@@ -43,36 +43,36 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | function isUserBot() |
| 45 | 45 | { |
| 46 | - preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
| 46 | + preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
| 47 | 47 | |
| 48 | - return (isset($matches[0])) ? true : false; |
|
| 48 | + return (isset($matches[0])) ? true : false; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | function configPropertyExists($config, $property) |
| 52 | 52 | { |
| 53 | - if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
| 54 | - { |
|
| 55 | - return FALSE; |
|
| 56 | - } |
|
| 57 | - else |
|
| 58 | - { |
|
| 59 | - return TRUE; |
|
| 60 | - } |
|
| 53 | + if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
| 54 | + { |
|
| 55 | + return FALSE; |
|
| 56 | + } |
|
| 57 | + else |
|
| 58 | + { |
|
| 59 | + return TRUE; |
|
| 60 | + } |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | function isDeviceUidInDatabase($deviceUid) |
| 64 | 64 | { |
| 65 | - $db = new DatabaseConnect(); |
|
| 66 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 67 | - |
|
| 68 | - if ($result->num_rows > 0) |
|
| 69 | - { |
|
| 70 | - return TRUE; |
|
| 71 | - } |
|
| 72 | - else |
|
| 73 | - { |
|
| 74 | - return FALSE; |
|
| 75 | - } |
|
| 65 | + $db = new DatabaseConnect(); |
|
| 66 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 67 | + |
|
| 68 | + if ($result->num_rows > 0) |
|
| 69 | + { |
|
| 70 | + return TRUE; |
|
| 71 | + } |
|
| 72 | + else |
|
| 73 | + { |
|
| 74 | + return FALSE; |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | //Check if it's a Spider or Google Bot |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if(configPropertyExists($config, 'karmaDeviceUid')) |
| 102 | - { |
|
| 103 | - $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
| 104 | - } |
|
| 105 | - else |
|
| 106 | - { |
|
| 107 | - error_log("No Karma deviceUid set in config file"); |
|
| 102 | + { |
|
| 103 | + $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
| 104 | + } |
|
| 105 | + else |
|
| 106 | + { |
|
| 107 | + error_log("No Karma deviceUid set in config file"); |
|
| 108 | 108 | $jodelAccountForKarma = new JodelAccount($deviceUid); |
| 109 | - } |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | $newPositionStatus = $jodelAccountForView->location->getCityName(); |
| 112 | 112 | |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | $jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']); |
| 155 | 155 | if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails'])) |
| 156 | - { |
|
| 157 | - header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
|
| 158 | - } |
|
| 159 | - else |
|
| 160 | - { |
|
| 161 | - header("Location: index.php#postId-" . htmlspecialchars($_GET['postId'])); |
|
| 162 | - } |
|
| 163 | - die(); |
|
| 156 | + { |
|
| 157 | + header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
|
| 158 | + } |
|
| 159 | + else |
|
| 160 | + { |
|
| 161 | + header("Location: index.php#postId-" . htmlspecialchars($_GET['postId'])); |
|
| 162 | + } |
|
| 163 | + die(); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | //SendJodel |
@@ -205,32 +205,32 @@ discard block |
||
| 205 | 205 | if(!array_key_exists(0, $posts)) |
| 206 | 206 | { |
| 207 | 207 | $posts[0] = array( |
| 208 | - "post_id" => "0", |
|
| 209 | - "discovered_by" => 0, |
|
| 210 | - "message" => "Not found", |
|
| 211 | - "created_at" => "2017-02-11T16:44:50.385Z", |
|
| 212 | - "updated_at" => "2017-02-11T16:44:50.385Z", |
|
| 213 | - "pin_count" => 0, |
|
| 214 | - "color" => "FFBA00", |
|
| 215 | - "got_thanks" => FALSE, |
|
| 216 | - "post_own" => "friend", |
|
| 217 | - "discovered" => 0, |
|
| 218 | - "distance" => 9, |
|
| 219 | - "vote_count" => 0, |
|
| 220 | - "location" => |
|
| 221 | - array("name" => "Berlin", |
|
| 222 | - "loc_coordinates" => |
|
| 223 | - array( |
|
| 224 | - "lat" => 0, |
|
| 225 | - "lng" => 0 |
|
| 226 | - ), |
|
| 227 | - "loc_accuracy" => 0, |
|
| 228 | - "country" => "", |
|
| 229 | - "city" => "", |
|
| 230 | - ), |
|
| 231 | - "tags" => |
|
| 232 | - array(), |
|
| 233 | - "user_handle" => "0" |
|
| 208 | + "post_id" => "0", |
|
| 209 | + "discovered_by" => 0, |
|
| 210 | + "message" => "Not found", |
|
| 211 | + "created_at" => "2017-02-11T16:44:50.385Z", |
|
| 212 | + "updated_at" => "2017-02-11T16:44:50.385Z", |
|
| 213 | + "pin_count" => 0, |
|
| 214 | + "color" => "FFBA00", |
|
| 215 | + "got_thanks" => FALSE, |
|
| 216 | + "post_own" => "friend", |
|
| 217 | + "discovered" => 0, |
|
| 218 | + "distance" => 9, |
|
| 219 | + "vote_count" => 0, |
|
| 220 | + "location" => |
|
| 221 | + array("name" => "Berlin", |
|
| 222 | + "loc_coordinates" => |
|
| 223 | + array( |
|
| 224 | + "lat" => 0, |
|
| 225 | + "lng" => 0 |
|
| 226 | + ), |
|
| 227 | + "loc_accuracy" => 0, |
|
| 228 | + "country" => "", |
|
| 229 | + "city" => "", |
|
| 230 | + ), |
|
| 231 | + "tags" => |
|
| 232 | + array(), |
|
| 233 | + "user_handle" => "0" |
|
| 234 | 234 | ); |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -239,32 +239,32 @@ discard block |
||
| 239 | 239 | $posts = array(); |
| 240 | 240 | $posts[0] = |
| 241 | 241 | array( |
| 242 | - "post_id" => "0", |
|
| 243 | - "discovered_by" => 0, |
|
| 244 | - "message" => "Bad Request", |
|
| 245 | - "created_at" => "2017-02-11T16:44:50.385Z", |
|
| 246 | - "updated_at" => "2017-02-11T16:44:50.385Z", |
|
| 247 | - "pin_count" => 0, |
|
| 248 | - "color" => "FFBA00", |
|
| 249 | - "got_thanks" => FALSE, |
|
| 250 | - "post_own" => "friend", |
|
| 251 | - "discovered" => 0, |
|
| 252 | - "distance" => 9, |
|
| 253 | - "vote_count" => 0, |
|
| 254 | - "location" => |
|
| 255 | - array("name" => "Berlin", |
|
| 256 | - "loc_coordinates" => |
|
| 257 | - array( |
|
| 258 | - "lat" => 0, |
|
| 259 | - "lng" => 0 |
|
| 260 | - ), |
|
| 261 | - "loc_accuracy" => 0, |
|
| 262 | - "country" => "", |
|
| 263 | - "city" => "", |
|
| 264 | - ), |
|
| 265 | - "tags" => |
|
| 266 | - array(), |
|
| 267 | - "user_handle" => "0" |
|
| 242 | + "post_id" => "0", |
|
| 243 | + "discovered_by" => 0, |
|
| 244 | + "message" => "Bad Request", |
|
| 245 | + "created_at" => "2017-02-11T16:44:50.385Z", |
|
| 246 | + "updated_at" => "2017-02-11T16:44:50.385Z", |
|
| 247 | + "pin_count" => 0, |
|
| 248 | + "color" => "FFBA00", |
|
| 249 | + "got_thanks" => FALSE, |
|
| 250 | + "post_own" => "friend", |
|
| 251 | + "discovered" => 0, |
|
| 252 | + "distance" => 9, |
|
| 253 | + "vote_count" => 0, |
|
| 254 | + "location" => |
|
| 255 | + array("name" => "Berlin", |
|
| 256 | + "loc_coordinates" => |
|
| 257 | + array( |
|
| 258 | + "lat" => 0, |
|
| 259 | + "lng" => 0 |
|
| 260 | + ), |
|
| 261 | + "loc_accuracy" => 0, |
|
| 262 | + "country" => "", |
|
| 263 | + "city" => "", |
|
| 264 | + ), |
|
| 265 | + "tags" => |
|
| 266 | + array(), |
|
| 267 | + "user_handle" => "0" |
|
| 268 | 268 | ); |
| 269 | 269 | |
| 270 | 270 | |