@@ -39,27 +39,27 @@ discard block |
||
39 | 39 | |
40 | 40 | function user_log($msg) |
41 | 41 | { |
42 | - $log = $msg . PHP_EOL; |
|
43 | - file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("j.n.Y") . '.txt', $log, FILE_APPEND); |
|
42 | + $log = $msg . PHP_EOL; |
|
43 | + file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("j.n.Y") . '.txt', $log, FILE_APPEND); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | function isUserBot() |
47 | 47 | { |
48 | - preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
48 | + preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
49 | 49 | |
50 | - return (isset($matches[0])) ? true : false; |
|
50 | + return (isset($matches[0])) ? true : false; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | function configPropertyExists($config, $property) |
54 | 54 | { |
55 | - if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
56 | - { |
|
57 | - return FALSE; |
|
58 | - } |
|
59 | - else |
|
60 | - { |
|
61 | - return TRUE; |
|
62 | - } |
|
55 | + if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
56 | + { |
|
57 | + return FALSE; |
|
58 | + } |
|
59 | + else |
|
60 | + { |
|
61 | + return TRUE; |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | function isUserAdmin() { |
65 | 65 | global $config; |
@@ -75,17 +75,17 @@ discard block |
||
75 | 75 | |
76 | 76 | function isDeviceUidInDatabase($deviceUid) |
77 | 77 | { |
78 | - $db = new DatabaseConnect(); |
|
79 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
80 | - |
|
81 | - if ($result->num_rows > 0) |
|
82 | - { |
|
83 | - return TRUE; |
|
84 | - } |
|
85 | - else |
|
86 | - { |
|
87 | - return FALSE; |
|
88 | - } |
|
78 | + $db = new DatabaseConnect(); |
|
79 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
80 | + |
|
81 | + if ($result->num_rows > 0) |
|
82 | + { |
|
83 | + return TRUE; |
|
84 | + } |
|
85 | + else |
|
86 | + { |
|
87 | + return FALSE; |
|
88 | + } |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | //Check if it's a Spider or Google Bot |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if(configPropertyExists($config, 'karmaDeviceUid')) |
115 | - { |
|
116 | - $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
117 | - } |
|
118 | - else |
|
119 | - { |
|
120 | - error_log("No Karma deviceUid set in config file"); |
|
115 | + { |
|
116 | + $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
117 | + } |
|
118 | + else |
|
119 | + { |
|
120 | + error_log("No Karma deviceUid set in config file"); |
|
121 | 121 | $jodelAccountForKarma = new JodelAccount($deviceUid); |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | /* |
125 | 125 | * Cunstruct View |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | { |
230 | 230 | $jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']); |
231 | 231 | if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails'])) |
232 | - { |
|
233 | - header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
|
234 | - } |
|
235 | - else |
|
236 | - { |
|
237 | - header("Location: index.php#postId-" . htmlspecialchars($_GET['postId'])); |
|
238 | - } |
|
239 | - die(); |
|
232 | + { |
|
233 | + header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
|
234 | + } |
|
235 | + else |
|
236 | + { |
|
237 | + header("Location: index.php#postId-" . htmlspecialchars($_GET['postId'])); |
|
238 | + } |
|
239 | + die(); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | //SendJodel |