@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class GetCaptcha extends AbstractRequest |
| 3 | 3 | { |
| 4 | - function getApiEndPoint() |
|
| 5 | - { |
|
| 6 | - return '/v3/user/verification/imageCaptcha/'; |
|
| 7 | - } |
|
| 8 | - function getPayload() |
|
| 9 | - { |
|
| 10 | - return array( |
|
| 11 | - ); |
|
| 12 | - } |
|
| 13 | - function getMethod() |
|
| 14 | - { |
|
| 15 | - return 'GET'; |
|
| 16 | - } |
|
| 4 | + function getApiEndPoint() |
|
| 5 | + { |
|
| 6 | + return '/v3/user/verification/imageCaptcha/'; |
|
| 7 | + } |
|
| 8 | + function getPayload() |
|
| 9 | + { |
|
| 10 | + return array( |
|
| 11 | + ); |
|
| 12 | + } |
|
| 13 | + function getMethod() |
|
| 14 | + { |
|
| 15 | + return 'GET'; |
|
| 16 | + } |
|
| 17 | 17 | } |
| 18 | 18 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class GetCaptcha extends AbstractRequest |
| 3 | -{ |
|
| 3 | +{ |
|
| 4 | 4 | function getApiEndPoint() |
| 5 | 5 | { |
| 6 | 6 | return '/v3/user/verification/imageCaptcha/'; |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | class Jodel |
| 4 | 4 | { |
| 5 | - public $jodel; |
|
| 5 | + public $jodel; |
|
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | } |
| 9 | 9 | \ No newline at end of file |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | { |
| 44 | 44 | preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
| 45 | 45 | |
| 46 | - return (isset($matches[0])) ? true : false; |
|
| 46 | + return (isset($matches[0])) ? TRUE : FALSE; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function configPropertyExists($config, $property) |
@@ -37,6 +37,9 @@ discard block |
||
| 37 | 37 | die(); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | +/** |
|
| 41 | + * @param string $msg |
|
| 42 | + */ |
|
| 40 | 43 | function user_log($msg) |
| 41 | 44 | { |
| 42 | 45 | $log = $msg . PHP_EOL; |
@@ -51,6 +54,9 @@ discard block |
||
| 51 | 54 | return (isset($matches[0])) ? true : false; |
| 52 | 55 | } |
| 53 | 56 | |
| 57 | +/** |
|
| 58 | + * @param string $property |
|
| 59 | + */ |
|
| 54 | 60 | function configPropertyExists($config, $property) |
| 55 | 61 | { |
| 56 | 62 | if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | function isUserVoter() |
| 76 | 76 | { |
| 77 | 77 | if(isset($_COOKIE['JodelVoterPassword'])) |
| 78 | - { |
|
| 78 | + { |
|
| 79 | 79 | $db = new DatabaseConnect(); |
| 80 | 80 | $result = $db->query("SELECT id FROM users WHERE user_token = '" . $_COOKIE['JodelVoterPassword'] . "'"); |
| 81 | 81 | if($result->num_rows == 0) |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if(configPropertyExists($config, 'karmaDeviceUid')) |
| 150 | - { |
|
| 150 | + { |
|
| 151 | 151 | $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
| 152 | 152 | } |
| 153 | 153 | else |
@@ -220,7 +220,8 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | if(isset($_GET['view'])) |
| 222 | 222 | { |
| 223 | - switch ($_GET['view']) { |
|
| 223 | + switch ($_GET['view']) |
|
| 224 | + { |
|
| 224 | 225 | case 'discussed': |
| 225 | 226 | $view = 'discussed'; |
| 226 | 227 | break; |
@@ -49,27 +49,27 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | function user_log($msg) |
| 51 | 51 | { |
| 52 | - $log = $msg . PHP_EOL; |
|
| 53 | - file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("Y.n.j") . '.txt', $log, FILE_APPEND); |
|
| 52 | + $log = $msg . PHP_EOL; |
|
| 53 | + file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("Y.n.j") . '.txt', $log, FILE_APPEND); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | function isUserBot() |
| 57 | 57 | { |
| 58 | - preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
| 58 | + preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
|
| 59 | 59 | |
| 60 | - return (isset($matches[0])) ? true : false; |
|
| 60 | + return (isset($matches[0])) ? true : false; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | function configPropertyExists($config, $property) |
| 64 | 64 | { |
| 65 | - if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
| 66 | - { |
|
| 67 | - return FALSE; |
|
| 68 | - } |
|
| 69 | - else |
|
| 70 | - { |
|
| 71 | - return TRUE; |
|
| 72 | - } |
|
| 65 | + if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
| 66 | + { |
|
| 67 | + return FALSE; |
|
| 68 | + } |
|
| 69 | + else |
|
| 70 | + { |
|
| 71 | + return TRUE; |
|
| 72 | + } |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | function isUserVoter() |
@@ -110,19 +110,19 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | function isDeviceUidInDatabase($deviceUid) |
| 112 | 112 | { |
| 113 | - $db = new DatabaseConnect(); |
|
| 114 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 113 | + $db = new DatabaseConnect(); |
|
| 114 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 115 | 115 | |
| 116 | - if ($result->num_rows > 0) |
|
| 117 | - { |
|
| 118 | - $db->close(); |
|
| 119 | - return TRUE; |
|
| 120 | - } |
|
| 121 | - else |
|
| 122 | - { |
|
| 123 | - $db->close(); |
|
| 124 | - return FALSE; |
|
| 125 | - } |
|
| 116 | + if ($result->num_rows > 0) |
|
| 117 | + { |
|
| 118 | + $db->close(); |
|
| 119 | + return TRUE; |
|
| 120 | + } |
|
| 121 | + else |
|
| 122 | + { |
|
| 123 | + $db->close(); |
|
| 124 | + return FALSE; |
|
| 125 | + } |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | //Check if it's a Spider or Google Bot |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if(configPropertyExists($config, 'karmaDeviceUid')) |
| 152 | - { |
|
| 153 | - $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
| 154 | - } |
|
| 155 | - else |
|
| 156 | - { |
|
| 157 | - error_log("No Karma deviceUid set in config file"); |
|
| 152 | + { |
|
| 153 | + $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
|
| 154 | + } |
|
| 155 | + else |
|
| 156 | + { |
|
| 157 | + error_log("No Karma deviceUid set in config file"); |
|
| 158 | 158 | $jodelAccountForKarma = new JodelAccount($deviceUid); |
| 159 | - } |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | 161 | /* |
| 162 | 162 | * Cunstruct View |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | function user_log($msg) |
| 51 | 51 | { |
| 52 | - $log = $msg . PHP_EOL; |
|
| 52 | + $log = $msg . PHP_EOL; |
|
| 53 | 53 | file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("Y.n.j") . '.txt', $log, FILE_APPEND); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches); |
| 59 | 59 | |
| 60 | - return (isset($matches[0])) ? true : false; |
|
| 60 | + return (isset($matches[0]))?true : false; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | function configPropertyExists($config, $property) |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | function isUserAdmin() |
| 99 | 99 | { |
| 100 | 100 | global $config; |
| 101 | - if (isset($_COOKIE['JodelAdminPassword']) && configPropertyExists($config, 'pw') && $config['pw'] == $_COOKIE['JodelAdminPassword']) |
|
| 101 | + if(isset($_COOKIE['JodelAdminPassword']) && configPropertyExists($config, 'pw') && $config['pw'] == $_COOKIE['JodelAdminPassword']) |
|
| 102 | 102 | { |
| 103 | 103 | return TRUE; |
| 104 | 104 | } |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | function isDeviceUidInDatabase($deviceUid) |
| 112 | 112 | { |
| 113 | 113 | $db = new DatabaseConnect(); |
| 114 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 114 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'"); |
|
| 115 | 115 | |
| 116 | - if ($result->num_rows > 0) |
|
| 116 | + if($result->num_rows > 0) |
|
| 117 | 117 | { |
| 118 | 118 | $db->close(); |
| 119 | 119 | return TRUE; |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | if(!isset($_COOKIE['JodelDeviceId']) || !isDeviceUidInDatabase($_COOKIE['JodelDeviceId'])) |
| 138 | 138 | { |
| 139 | 139 | $jodelAccountForView = new JodelAccount(); |
| 140 | - setcookie('JodelDeviceId', $jodelAccountForView->deviceUid, time()+60*60*24*365*10); |
|
| 141 | - user_log('Created account with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
| 140 | + setcookie('JodelDeviceId', $jodelAccountForView->deviceUid, time() + 60 * 60 * 24 * 365 * 10); |
|
| 141 | + user_log('Created account with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
|
| 142 | 142 | |
| 143 | 143 | } |
| 144 | 144 | else |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if(isset($_GET['search'])) |
| 168 | 168 | { |
| 169 | 169 | |
| 170 | - user_log('User with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] searched for ' . $_GET['search']); |
|
| 170 | + user_log('User with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] searched for ' . $_GET['search']); |
|
| 171 | 171 | |
| 172 | 172 | if(substr($_GET['search'], 0, 1) === "#") |
| 173 | 173 | { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | if(isset($_GET['view'])) |
| 224 | 224 | { |
| 225 | - switch ($_GET['view']) { |
|
| 225 | + switch($_GET['view']) { |
|
| 226 | 226 | case 'discussed': |
| 227 | 227 | $view = 'discussed'; |
| 228 | 228 | break; |
@@ -385,6 +385,9 @@ |
||
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | + /** |
|
| 389 | + * @param Location $location |
|
| 390 | + */ |
|
| 388 | 391 | function registerAccount($location) { |
| 389 | 392 | $accountCreator = new CreateUser(); |
| 390 | 393 | $accountCreator->setLocation($location); |
@@ -2,47 +2,47 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class JodelAccount |
| 4 | 4 | { |
| 5 | - public $accessToken; |
|
| 6 | - public $expirationDate; |
|
| 7 | - public $refreshToken; |
|
| 8 | - public $distinctId; |
|
| 9 | - public $deviceUid; |
|
| 10 | - |
|
| 11 | - //is the Account a Bot or Spider? |
|
| 12 | - public $isBot; |
|
| 5 | + public $accessToken; |
|
| 6 | + public $expirationDate; |
|
| 7 | + public $refreshToken; |
|
| 8 | + public $distinctId; |
|
| 9 | + public $deviceUid; |
|
| 10 | + |
|
| 11 | + //is the Account a Bot or Spider? |
|
| 12 | + public $isBot; |
|
| 13 | 13 | |
| 14 | - // array of voted Jodels |
|
| 15 | - public $votes; |
|
| 14 | + // array of voted Jodels |
|
| 15 | + public $votes; |
|
| 16 | 16 | |
| 17 | - //Location of the Account |
|
| 18 | - public $location; |
|
| 17 | + //Location of the Account |
|
| 18 | + public $location; |
|
| 19 | 19 | |
| 20 | - function __construct($deviceUid = NULL, $isBot = FALSE) |
|
| 21 | - { |
|
| 22 | - if($deviceUid == NULL) |
|
| 23 | - { |
|
| 24 | - $this->deviceUid = $this->createAccount(); |
|
| 25 | - } |
|
| 26 | - else |
|
| 27 | - { |
|
| 28 | - $this->deviceUid = $deviceUid; |
|
| 29 | - } |
|
| 20 | + function __construct($deviceUid = NULL, $isBot = FALSE) |
|
| 21 | + { |
|
| 22 | + if($deviceUid == NULL) |
|
| 23 | + { |
|
| 24 | + $this->deviceUid = $this->createAccount(); |
|
| 25 | + } |
|
| 26 | + else |
|
| 27 | + { |
|
| 28 | + $this->deviceUid = $deviceUid; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $this->isBot = $isBot; |
|
| 32 | - $this->location = $this->getLocation(); |
|
| 31 | + $this->isBot = $isBot; |
|
| 32 | + $this->location = $this->getLocation(); |
|
| 33 | 33 | |
| 34 | - if(!$this->isTokenFresh()) |
|
| 35 | - { |
|
| 36 | - $this->refreshToken(); |
|
| 37 | - } |
|
| 38 | - $this->accessToken = $this->getAccessToken(); |
|
| 34 | + if(!$this->isTokenFresh()) |
|
| 35 | + { |
|
| 36 | + $this->refreshToken(); |
|
| 37 | + } |
|
| 38 | + $this->accessToken = $this->getAccessToken(); |
|
| 39 | 39 | |
| 40 | - /* if($this->isAccountVerified() != 1) |
|
| 40 | + /* if($this->isAccountVerified() != 1) |
|
| 41 | 41 | { |
| 42 | 42 | $this->showCaptcha(); |
| 43 | 43 | //$this->verifyCaptcha(); |
| 44 | 44 | }*/ |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | /* |
| 48 | 48 | function showCaptcha() |
@@ -71,513 +71,513 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | */ |
| 73 | 73 | |
| 74 | - function getCaptcha() |
|
| 75 | - { |
|
| 76 | - $accountCreator = new GetCaptcha(); |
|
| 77 | - $accountCreator->setAccessToken($this->accessToken); |
|
| 78 | - $captcha = $accountCreator->execute(); |
|
| 79 | - |
|
| 80 | - return array("image_url" => $captcha['image_url'], "key" => $captcha['key']); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - function isAccountVerified() |
|
| 84 | - { |
|
| 85 | - $accountCreator = new GetUserConfig(); |
|
| 86 | - $accountCreator->setAccessToken($this->accessToken); |
|
| 87 | - $data = $accountCreator->execute(); |
|
| 88 | - |
|
| 89 | - //error_log(print_r($data, true)); |
|
| 90 | - |
|
| 91 | - return $data['verified']; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - function getGeocodingToken() |
|
| 95 | - { |
|
| 96 | - $config = parse_ini_file('config/config.ini.php'); |
|
| 97 | - if(!isset($config['geocodingToken']) || |
|
| 98 | - $config['geocodingToken'] == NULL || |
|
| 99 | - $config['geocodingToken'] == '' || |
|
| 100 | - $config['geocodingToken'] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
| 101 | - { |
|
| 102 | - error_log("Please set a Google Maps Geocoding Token!"); |
|
| 103 | - } |
|
| 104 | - else |
|
| 105 | - { |
|
| 106 | - return $config['geocodingToken']; |
|
| 107 | - } |
|
| 108 | - } |
|
| 74 | + function getCaptcha() |
|
| 75 | + { |
|
| 76 | + $accountCreator = new GetCaptcha(); |
|
| 77 | + $accountCreator->setAccessToken($this->accessToken); |
|
| 78 | + $captcha = $accountCreator->execute(); |
|
| 79 | + |
|
| 80 | + return array("image_url" => $captcha['image_url'], "key" => $captcha['key']); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + function isAccountVerified() |
|
| 84 | + { |
|
| 85 | + $accountCreator = new GetUserConfig(); |
|
| 86 | + $accountCreator->setAccessToken($this->accessToken); |
|
| 87 | + $data = $accountCreator->execute(); |
|
| 88 | + |
|
| 89 | + //error_log(print_r($data, true)); |
|
| 90 | + |
|
| 91 | + return $data['verified']; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + function getGeocodingToken() |
|
| 95 | + { |
|
| 96 | + $config = parse_ini_file('config/config.ini.php'); |
|
| 97 | + if(!isset($config['geocodingToken']) || |
|
| 98 | + $config['geocodingToken'] == NULL || |
|
| 99 | + $config['geocodingToken'] == '' || |
|
| 100 | + $config['geocodingToken'] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') |
|
| 101 | + { |
|
| 102 | + error_log("Please set a Google Maps Geocoding Token!"); |
|
| 103 | + } |
|
| 104 | + else |
|
| 105 | + { |
|
| 106 | + return $config['geocodingToken']; |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - function locationEquals($city) |
|
| 111 | - { |
|
| 112 | - $db = new DatabaseConnect(); |
|
| 113 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 110 | + function locationEquals($city) |
|
| 111 | + { |
|
| 112 | + $db = new DatabaseConnect(); |
|
| 113 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 114 | 114 | |
| 115 | - $location = new Location(); |
|
| 115 | + $location = new Location(); |
|
| 116 | 116 | |
| 117 | - if ($result->num_rows > 0) |
|
| 118 | - { |
|
| 119 | - // output data of each row |
|
| 120 | - while($row = $result->fetch_assoc()) |
|
| 121 | - { |
|
| 122 | - $location->setLat($row['lat']); |
|
| 123 | - $location->setLng($row['lng']); |
|
| 124 | - $location->setCityName($row['name']); |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - else |
|
| 128 | - { |
|
| 129 | - error_log("Error no Location found - getLocation"); |
|
| 130 | - } |
|
| 117 | + if ($result->num_rows > 0) |
|
| 118 | + { |
|
| 119 | + // output data of each row |
|
| 120 | + while($row = $result->fetch_assoc()) |
|
| 121 | + { |
|
| 122 | + $location->setLat($row['lat']); |
|
| 123 | + $location->setLng($row['lng']); |
|
| 124 | + $location->setCityName($row['name']); |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + else |
|
| 128 | + { |
|
| 129 | + error_log("Error no Location found - getLocation"); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - if($location->getCityName() == $city) |
|
| 133 | - { |
|
| 134 | - return TRUE; |
|
| 135 | - } |
|
| 136 | - else |
|
| 137 | - { |
|
| 138 | - return FALSE; |
|
| 139 | - } |
|
| 140 | - } |
|
| 132 | + if($location->getCityName() == $city) |
|
| 133 | + { |
|
| 134 | + return TRUE; |
|
| 135 | + } |
|
| 136 | + else |
|
| 137 | + { |
|
| 138 | + return FALSE; |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - function setLocation() |
|
| 143 | - { |
|
| 144 | - //Is Channel or City |
|
| 145 | - if(substr($_GET['city'], 0, 1) === '#') |
|
| 146 | - { |
|
| 147 | - return htmlspecialchars($_GET['city']) . " " . $this->location->cityName; |
|
| 148 | - } |
|
| 149 | - else |
|
| 150 | - { |
|
| 151 | - $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=' . $this->getGeocodingToken(); |
|
| 152 | - $result = Requests::post($url); |
|
| 153 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
| 154 | - { |
|
| 155 | - return "0 results"; |
|
| 156 | - } |
|
| 157 | - else |
|
| 158 | - { |
|
| 159 | - $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
| 160 | - $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
| 161 | - $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
| 162 | - |
|
| 163 | - $location = new Location(); |
|
| 164 | - $location->setLat($lat); |
|
| 165 | - $location->setLng($lng); |
|
| 166 | - $location->setCityName($name); |
|
| 167 | - $accountCreator = new UpdateLocation(); |
|
| 168 | - $accountCreator->setLocation($location); |
|
| 169 | - $accountCreator->setAccessToken($this->accessToken); |
|
| 170 | - $data = $accountCreator->execute(); |
|
| 171 | - |
|
| 172 | - //safe location to db |
|
| 173 | - $db = new DatabaseConnect(); |
|
| 174 | - |
|
| 175 | - if($data == 'Success') |
|
| 176 | - { |
|
| 177 | - $result = $db->query("UPDATE accounts |
|
| 142 | + function setLocation() |
|
| 143 | + { |
|
| 144 | + //Is Channel or City |
|
| 145 | + if(substr($_GET['city'], 0, 1) === '#') |
|
| 146 | + { |
|
| 147 | + return htmlspecialchars($_GET['city']) . " " . $this->location->cityName; |
|
| 148 | + } |
|
| 149 | + else |
|
| 150 | + { |
|
| 151 | + $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=' . $this->getGeocodingToken(); |
|
| 152 | + $result = Requests::post($url); |
|
| 153 | + if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
| 154 | + { |
|
| 155 | + return "0 results"; |
|
| 156 | + } |
|
| 157 | + else |
|
| 158 | + { |
|
| 159 | + $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
| 160 | + $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
| 161 | + $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
| 162 | + |
|
| 163 | + $location = new Location(); |
|
| 164 | + $location->setLat($lat); |
|
| 165 | + $location->setLng($lng); |
|
| 166 | + $location->setCityName($name); |
|
| 167 | + $accountCreator = new UpdateLocation(); |
|
| 168 | + $accountCreator->setLocation($location); |
|
| 169 | + $accountCreator->setAccessToken($this->accessToken); |
|
| 170 | + $data = $accountCreator->execute(); |
|
| 171 | + |
|
| 172 | + //safe location to db |
|
| 173 | + $db = new DatabaseConnect(); |
|
| 174 | + |
|
| 175 | + if($data == 'Success') |
|
| 176 | + { |
|
| 177 | + $result = $db->query("UPDATE accounts |
|
| 178 | 178 | SET name='" . $name . "', |
| 179 | 179 | lat='" . $lat . "', |
| 180 | 180 | lng='" . $lng . "' |
| 181 | 181 | WHERE access_token='" . $this->accessToken . "'"); |
| 182 | 182 | |
| 183 | - if($result === false) |
|
| 184 | - { |
|
| 185 | - echo "Updating location failed: (" . $db->errno . ") " . $db->error; |
|
| 186 | - } |
|
| 187 | - else |
|
| 188 | - { |
|
| 189 | - user_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - return $name; |
|
| 194 | - } |
|
| 195 | - } |
|
| 196 | - } |
|
| 183 | + if($result === false) |
|
| 184 | + { |
|
| 185 | + echo "Updating location failed: (" . $db->errno . ") " . $db->error; |
|
| 186 | + } |
|
| 187 | + else |
|
| 188 | + { |
|
| 189 | + user_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + return $name; |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - function getLocation() |
|
| 199 | - { |
|
| 200 | - $db = new DatabaseConnect(); |
|
| 201 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 198 | + function getLocation() |
|
| 199 | + { |
|
| 200 | + $db = new DatabaseConnect(); |
|
| 201 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 202 | 202 | |
| 203 | - $location = new Location(); |
|
| 203 | + $location = new Location(); |
|
| 204 | 204 | |
| 205 | - if ($result->num_rows > 0) |
|
| 206 | - { |
|
| 207 | - // output data of each row |
|
| 208 | - while($row = $result->fetch_assoc()) |
|
| 209 | - { |
|
| 210 | - $location->setLat($row['lat']); |
|
| 211 | - $location->setLng($row['lng']); |
|
| 212 | - $location->setCityName($row['name']); |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - else |
|
| 216 | - { |
|
| 217 | - echo "Error: 0 results"; |
|
| 218 | - error_log("Error no Location found - getLocation"); |
|
| 219 | - } |
|
| 205 | + if ($result->num_rows > 0) |
|
| 206 | + { |
|
| 207 | + // output data of each row |
|
| 208 | + while($row = $result->fetch_assoc()) |
|
| 209 | + { |
|
| 210 | + $location->setLat($row['lat']); |
|
| 211 | + $location->setLng($row['lng']); |
|
| 212 | + $location->setCityName($row['name']); |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + else |
|
| 216 | + { |
|
| 217 | + echo "Error: 0 results"; |
|
| 218 | + error_log("Error no Location found - getLocation"); |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - return $location; |
|
| 222 | - } |
|
| 221 | + return $location; |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - function verifyCaptcha() |
|
| 225 | - { |
|
| 226 | - if(isset($_GET['deviceUid'])) |
|
| 227 | - { |
|
| 228 | - $deviceUid = $_GET['deviceUid']; |
|
| 229 | - $jodelAccountForVerify = new JodelAccount($deviceUid); |
|
| 230 | - } |
|
| 231 | - else if(isset($_POST['deviceUid'])) |
|
| 232 | - { |
|
| 233 | - $deviceUid = $_POST['deviceUid']; |
|
| 234 | - $jodelAccountForVerify = new JodelAccount($deviceUid); |
|
| 235 | - } |
|
| 236 | - else |
|
| 237 | - { |
|
| 238 | - $deviceUid = $this->deviceUid; |
|
| 239 | - $jodelAccountForVerify = $this; |
|
| 240 | - } |
|
| 224 | + function verifyCaptcha() |
|
| 225 | + { |
|
| 226 | + if(isset($_GET['deviceUid'])) |
|
| 227 | + { |
|
| 228 | + $deviceUid = $_GET['deviceUid']; |
|
| 229 | + $jodelAccountForVerify = new JodelAccount($deviceUid); |
|
| 230 | + } |
|
| 231 | + else if(isset($_POST['deviceUid'])) |
|
| 232 | + { |
|
| 233 | + $deviceUid = $_POST['deviceUid']; |
|
| 234 | + $jodelAccountForVerify = new JodelAccount($deviceUid); |
|
| 235 | + } |
|
| 236 | + else |
|
| 237 | + { |
|
| 238 | + $deviceUid = $this->deviceUid; |
|
| 239 | + $jodelAccountForVerify = $this; |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - $solution = $_GET['solution']; |
|
| 243 | - $solution = array_map('intval', explode('-', $solution)); |
|
| 242 | + $solution = $_GET['solution']; |
|
| 243 | + $solution = array_map('intval', explode('-', $solution)); |
|
| 244 | 244 | |
| 245 | - $accountCreator = new PostCaptcha(); |
|
| 246 | - $accountCreator->setAccessToken($jodelAccountForVerify->accessToken); |
|
| 247 | - $accountCreator->captchaKey = $_GET['key']; |
|
| 248 | - $accountCreator->captchaSolution = $solution; |
|
| 249 | - $verified = $accountCreator->execute(); |
|
| 245 | + $accountCreator = new PostCaptcha(); |
|
| 246 | + $accountCreator->setAccessToken($jodelAccountForVerify->accessToken); |
|
| 247 | + $accountCreator->captchaKey = $_GET['key']; |
|
| 248 | + $accountCreator->captchaSolution = $solution; |
|
| 249 | + $verified = $accountCreator->execute(); |
|
| 250 | 250 | |
| 251 | - if(isset($verified->status_code)) |
|
| 252 | - { |
|
| 253 | - return $verified->status_code; |
|
| 254 | - } |
|
| 255 | - return $verified['verified']; |
|
| 256 | - } |
|
| 251 | + if(isset($verified->status_code)) |
|
| 252 | + { |
|
| 253 | + return $verified->status_code; |
|
| 254 | + } |
|
| 255 | + return $verified['verified']; |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - //ToDo Spider Check |
|
| 259 | - function votePostId($postId, $vote) |
|
| 260 | - { |
|
| 261 | - if(!$this->isBot) |
|
| 262 | - { |
|
| 263 | - if(!$this->isAccountVerified()) |
|
| 264 | - { |
|
| 265 | - error_log('Account is not Verified! jodelAccount.php Line 279'); |
|
| 266 | - return FALSE; |
|
| 267 | - } |
|
| 268 | - else |
|
| 269 | - { |
|
| 258 | + //ToDo Spider Check |
|
| 259 | + function votePostId($postId, $vote) |
|
| 260 | + { |
|
| 261 | + if(!$this->isBot) |
|
| 262 | + { |
|
| 263 | + if(!$this->isAccountVerified()) |
|
| 264 | + { |
|
| 265 | + error_log('Account is not Verified! jodelAccount.php Line 279'); |
|
| 266 | + return FALSE; |
|
| 267 | + } |
|
| 268 | + else |
|
| 269 | + { |
|
| 270 | 270 | |
| 271 | - } |
|
| 272 | - |
|
| 273 | - if(!$this->hasVoted($postId)) |
|
| 274 | - { |
|
| 275 | - if($vote == "up") |
|
| 276 | - { |
|
| 277 | - $accountCreator = new Upvote(); |
|
| 278 | - } |
|
| 279 | - else if($vote == "down") |
|
| 280 | - { |
|
| 281 | - $accountCreator = new Downvote(); |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - $accountCreator->setAccessToken($this->accessToken); |
|
| 285 | - $accountCreator->postId = htmlspecialchars($postId); |
|
| 286 | - $data = $accountCreator->execute(); |
|
| 287 | - |
|
| 288 | - user_log('User voted: ' . print_r($data, true)); |
|
| 289 | - |
|
| 290 | - if(array_key_exists('post', $data)) |
|
| 291 | - { |
|
| 292 | - $this->addVoteWithPostIdAndType($postId, $vote); |
|
| 293 | - return TRUE; |
|
| 294 | - } |
|
| 295 | - else if(array_key_exists('error', $data)) |
|
| 296 | - { |
|
| 297 | - error_log('Could not vote - Error: ' . $data['error']); |
|
| 298 | - return FALSE; |
|
| 299 | - } |
|
| 300 | - else |
|
| 301 | - { |
|
| 302 | - error_log('Could not vote: ' . print_r($data, true)); |
|
| 303 | - return FALSE; |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - else |
|
| 307 | - { |
|
| 308 | - return FALSE; |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - else |
|
| 312 | - { |
|
| 313 | - return FALSE; |
|
| 314 | - } |
|
| 315 | - } |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + if(!$this->hasVoted($postId)) |
|
| 274 | + { |
|
| 275 | + if($vote == "up") |
|
| 276 | + { |
|
| 277 | + $accountCreator = new Upvote(); |
|
| 278 | + } |
|
| 279 | + else if($vote == "down") |
|
| 280 | + { |
|
| 281 | + $accountCreator = new Downvote(); |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + $accountCreator->setAccessToken($this->accessToken); |
|
| 285 | + $accountCreator->postId = htmlspecialchars($postId); |
|
| 286 | + $data = $accountCreator->execute(); |
|
| 287 | + |
|
| 288 | + user_log('User voted: ' . print_r($data, true)); |
|
| 289 | + |
|
| 290 | + if(array_key_exists('post', $data)) |
|
| 291 | + { |
|
| 292 | + $this->addVoteWithPostIdAndType($postId, $vote); |
|
| 293 | + return TRUE; |
|
| 294 | + } |
|
| 295 | + else if(array_key_exists('error', $data)) |
|
| 296 | + { |
|
| 297 | + error_log('Could not vote - Error: ' . $data['error']); |
|
| 298 | + return FALSE; |
|
| 299 | + } |
|
| 300 | + else |
|
| 301 | + { |
|
| 302 | + error_log('Could not vote: ' . print_r($data, true)); |
|
| 303 | + return FALSE; |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + else |
|
| 307 | + { |
|
| 308 | + return FALSE; |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + else |
|
| 312 | + { |
|
| 313 | + return FALSE; |
|
| 314 | + } |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | - //ToDo Spider Check |
|
| 318 | - function sendJodel($location, $view) |
|
| 319 | - { |
|
| 320 | - if($this->isAccountVerified() != 1) |
|
| 321 | - { |
|
| 322 | - $this->showCaptcha(); |
|
| 323 | - //$this->verifyCaptcha(); |
|
| 324 | - } |
|
| 317 | + //ToDo Spider Check |
|
| 318 | + function sendJodel($location, $view) |
|
| 319 | + { |
|
| 320 | + if($this->isAccountVerified() != 1) |
|
| 321 | + { |
|
| 322 | + $this->showCaptcha(); |
|
| 323 | + //$this->verifyCaptcha(); |
|
| 324 | + } |
|
| 325 | 325 | |
| 326 | - $accountCreator = new SendJodel(); |
|
| 326 | + $accountCreator = new SendJodel(); |
|
| 327 | 327 | |
| 328 | - if(isset($_POST['ancestor'])) |
|
| 329 | - { |
|
| 330 | - $ancestor = $_POST['ancestor']; |
|
| 331 | - $accountCreator->ancestor = $ancestor; |
|
| 332 | - } |
|
| 333 | - if(isset($_POST['color'])) |
|
| 334 | - { |
|
| 335 | - $color = $_POST['color']; |
|
| 336 | - switch ($color) { |
|
| 337 | - case '8ABDB0': |
|
| 338 | - $color = '8ABDB0'; |
|
| 339 | - break; |
|
| 340 | - case '9EC41C': |
|
| 341 | - $color = '9EC41C'; |
|
| 342 | - break; |
|
| 343 | - case '06A3CB': |
|
| 344 | - $color = '06A3CB'; |
|
| 345 | - break; |
|
| 346 | - case 'FFBA00': |
|
| 347 | - $color = 'FFBA00'; |
|
| 348 | - break; |
|
| 349 | - case 'DD5F5F': |
|
| 350 | - $color = 'DD5F5F'; |
|
| 351 | - break; |
|
| 352 | - case 'FF9908': |
|
| 353 | - $color = 'FF9908'; |
|
| 354 | - break; |
|
| 355 | - default: |
|
| 356 | - $color = '8ABDB0'; |
|
| 357 | - break; |
|
| 358 | - } |
|
| 359 | - $accountCreator->color = $color; |
|
| 360 | - } |
|
| 361 | - |
|
| 362 | - $accountCreatorLocation = new UpdateLocation(); |
|
| 363 | - $accountCreatorLocation->setLocation($location); |
|
| 364 | - $accountCreatorLocation->setAccessToken($this->accessToken); |
|
| 365 | - $data = $accountCreatorLocation->execute(); |
|
| 328 | + if(isset($_POST['ancestor'])) |
|
| 329 | + { |
|
| 330 | + $ancestor = $_POST['ancestor']; |
|
| 331 | + $accountCreator->ancestor = $ancestor; |
|
| 332 | + } |
|
| 333 | + if(isset($_POST['color'])) |
|
| 334 | + { |
|
| 335 | + $color = $_POST['color']; |
|
| 336 | + switch ($color) { |
|
| 337 | + case '8ABDB0': |
|
| 338 | + $color = '8ABDB0'; |
|
| 339 | + break; |
|
| 340 | + case '9EC41C': |
|
| 341 | + $color = '9EC41C'; |
|
| 342 | + break; |
|
| 343 | + case '06A3CB': |
|
| 344 | + $color = '06A3CB'; |
|
| 345 | + break; |
|
| 346 | + case 'FFBA00': |
|
| 347 | + $color = 'FFBA00'; |
|
| 348 | + break; |
|
| 349 | + case 'DD5F5F': |
|
| 350 | + $color = 'DD5F5F'; |
|
| 351 | + break; |
|
| 352 | + case 'FF9908': |
|
| 353 | + $color = 'FF9908'; |
|
| 354 | + break; |
|
| 355 | + default: |
|
| 356 | + $color = '8ABDB0'; |
|
| 357 | + break; |
|
| 358 | + } |
|
| 359 | + $accountCreator->color = $color; |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + $accountCreatorLocation = new UpdateLocation(); |
|
| 363 | + $accountCreatorLocation->setLocation($location); |
|
| 364 | + $accountCreatorLocation->setAccessToken($this->accessToken); |
|
| 365 | + $data = $accountCreatorLocation->execute(); |
|
| 366 | 366 | |
| 367 | 367 | if($data != 'Success') |
| 368 | 368 | { |
| 369 | 369 | error_log('Could not set location befor Post: ' . print_r($data, true)); |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - $accountCreator->location = $this->location; |
|
| 372 | + $accountCreator->location = $this->location; |
|
| 373 | 373 | |
| 374 | - $image = ''; |
|
| 375 | - if(isset($_FILES['image']) && $_FILES['image']['size'] > 0) |
|
| 376 | - { |
|
| 377 | - $image = file_get_contents($_FILES['image']['tmp_name']); |
|
| 378 | - } |
|
| 374 | + $image = ''; |
|
| 375 | + if(isset($_FILES['image']) && $_FILES['image']['size'] > 0) |
|
| 376 | + { |
|
| 377 | + $image = file_get_contents($_FILES['image']['tmp_name']); |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | - $accountCreator->image = $image; |
|
| 380 | + $accountCreator->image = $image; |
|
| 381 | 381 | |
| 382 | - $accountCreator->setAccessToken($this->accessToken); |
|
| 383 | - $data = $accountCreator->execute(); |
|
| 382 | + $accountCreator->setAccessToken($this->accessToken); |
|
| 383 | + $data = $accountCreator->execute(); |
|
| 384 | 384 | |
| 385 | - if(isset($data['error']) && $data['error'] == 'length') |
|
| 386 | - { |
|
| 387 | - $errorMsg = 'Error: The input was to long'; |
|
| 388 | - return $errorMsg; |
|
| 389 | - } |
|
| 385 | + if(isset($data['error']) && $data['error'] == 'length') |
|
| 386 | + { |
|
| 387 | + $errorMsg = 'Error: The input was to long'; |
|
| 388 | + return $errorMsg; |
|
| 389 | + } |
|
| 390 | 390 | |
| 391 | - user_log('User posted: ' . print_r($data, true)); |
|
| 391 | + user_log('User posted: ' . print_r($data, true)); |
|
| 392 | 392 | |
| 393 | - if(isset($_POST['ancestor'])) |
|
| 394 | - { |
|
| 395 | - header('Location: ' . $view->toUrl()); |
|
| 396 | - exit; |
|
| 397 | - } |
|
| 398 | - else |
|
| 399 | - { |
|
| 400 | - header('Location: ' . $view->baseUrl); |
|
| 401 | - exit; |
|
| 402 | - } |
|
| 403 | - } |
|
| 393 | + if(isset($_POST['ancestor'])) |
|
| 394 | + { |
|
| 395 | + header('Location: ' . $view->toUrl()); |
|
| 396 | + exit; |
|
| 397 | + } |
|
| 398 | + else |
|
| 399 | + { |
|
| 400 | + header('Location: ' . $view->baseUrl); |
|
| 401 | + exit; |
|
| 402 | + } |
|
| 403 | + } |
|
| 404 | 404 | |
| 405 | - function isTokenFresh() |
|
| 406 | - { |
|
| 407 | - $db = new DatabaseConnect(); |
|
| 408 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 405 | + function isTokenFresh() |
|
| 406 | + { |
|
| 407 | + $db = new DatabaseConnect(); |
|
| 408 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 409 | 409 | |
| 410 | - if ($result->num_rows > 0) |
|
| 411 | - { |
|
| 412 | - // output data of each row |
|
| 413 | - while($row = $result->fetch_assoc()) |
|
| 414 | - { |
|
| 415 | - $expiration_date = $row["expiration_date"]; |
|
| 416 | - } |
|
| 417 | - } |
|
| 418 | - else |
|
| 419 | - { |
|
| 420 | - error_log('0 results'); |
|
| 421 | - } |
|
| 410 | + if ($result->num_rows > 0) |
|
| 411 | + { |
|
| 412 | + // output data of each row |
|
| 413 | + while($row = $result->fetch_assoc()) |
|
| 414 | + { |
|
| 415 | + $expiration_date = $row["expiration_date"]; |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | + else |
|
| 419 | + { |
|
| 420 | + error_log('0 results'); |
|
| 421 | + } |
|
| 422 | 422 | |
| 423 | - if($expiration_date <= time()) |
|
| 424 | - { |
|
| 425 | - return FALSE; |
|
| 426 | - } |
|
| 423 | + if($expiration_date <= time()) |
|
| 424 | + { |
|
| 425 | + return FALSE; |
|
| 426 | + } |
|
| 427 | 427 | |
| 428 | - return TRUE; |
|
| 429 | - } |
|
| 430 | - |
|
| 431 | - function refreshToken() |
|
| 432 | - { |
|
| 433 | - $accountCreator = new CreateUser(); |
|
| 434 | - $accountCreator->setAccessToken($this->accessToken); |
|
| 435 | - $accountCreator->setDeviceUid($this->deviceUid); |
|
| 436 | - $accountCreator->setLocation($this->location); |
|
| 437 | - $data = $accountCreator->execute(); |
|
| 438 | - |
|
| 439 | - $access_token = (string)$data[0]['access_token']; |
|
| 440 | - $expiration_date = $data[0]['expiration_date']; |
|
| 441 | - $device_uid = (string)$data[1]; |
|
| 428 | + return TRUE; |
|
| 429 | + } |
|
| 430 | + |
|
| 431 | + function refreshToken() |
|
| 432 | + { |
|
| 433 | + $accountCreator = new CreateUser(); |
|
| 434 | + $accountCreator->setAccessToken($this->accessToken); |
|
| 435 | + $accountCreator->setDeviceUid($this->deviceUid); |
|
| 436 | + $accountCreator->setLocation($this->location); |
|
| 437 | + $data = $accountCreator->execute(); |
|
| 438 | + |
|
| 439 | + $access_token = (string)$data[0]['access_token']; |
|
| 440 | + $expiration_date = $data[0]['expiration_date']; |
|
| 441 | + $device_uid = (string)$data[1]; |
|
| 442 | 442 | |
| 443 | - $db = new DatabaseConnect(); |
|
| 444 | - $result = $db->query("UPDATE accounts |
|
| 443 | + $db = new DatabaseConnect(); |
|
| 444 | + $result = $db->query("UPDATE accounts |
|
| 445 | 445 | SET access_token='" . $access_token . "', |
| 446 | 446 | expiration_date='" . $expiration_date . "' |
| 447 | 447 | WHERE device_uid='" . $device_uid . "'"); |
| 448 | 448 | |
| 449 | - if($result === false){ |
|
| 450 | - error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
|
| 451 | - } |
|
| 452 | - } |
|
| 449 | + if($result === false){ |
|
| 450 | + error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
|
| 451 | + } |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | 454 | |
| 455 | 455 | |
| 456 | - function getAccessToken() |
|
| 457 | - { |
|
| 458 | - $db = new DatabaseConnect(); |
|
| 459 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 456 | + function getAccessToken() |
|
| 457 | + { |
|
| 458 | + $db = new DatabaseConnect(); |
|
| 459 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 460 | 460 | |
| 461 | - $accessToken; |
|
| 461 | + $accessToken; |
|
| 462 | 462 | |
| 463 | - if ($result->num_rows > 0) |
|
| 464 | - { |
|
| 465 | - // output data of each row |
|
| 466 | - while($row = $result->fetch_assoc()) |
|
| 467 | - { |
|
| 468 | - $accessToken = $row['access_token']; |
|
| 469 | - } |
|
| 470 | - } |
|
| 471 | - else |
|
| 472 | - { |
|
| 473 | - error_log('Error: 0 results'); |
|
| 474 | - } |
|
| 463 | + if ($result->num_rows > 0) |
|
| 464 | + { |
|
| 465 | + // output data of each row |
|
| 466 | + while($row = $result->fetch_assoc()) |
|
| 467 | + { |
|
| 468 | + $accessToken = $row['access_token']; |
|
| 469 | + } |
|
| 470 | + } |
|
| 471 | + else |
|
| 472 | + { |
|
| 473 | + error_log('Error: 0 results'); |
|
| 474 | + } |
|
| 475 | 475 | |
| 476 | - return $accessToken; |
|
| 477 | - } |
|
| 476 | + return $accessToken; |
|
| 477 | + } |
|
| 478 | 478 | |
| 479 | 479 | |
| 480 | - function getKarma() |
|
| 481 | - { |
|
| 482 | - $accountCreator = new GetKarma(); |
|
| 483 | - $accountCreator->setAccessToken($this->accessToken); |
|
| 484 | - $data = $accountCreator->execute(); |
|
| 480 | + function getKarma() |
|
| 481 | + { |
|
| 482 | + $accountCreator = new GetKarma(); |
|
| 483 | + $accountCreator->setAccessToken($this->accessToken); |
|
| 484 | + $data = $accountCreator->execute(); |
|
| 485 | 485 | |
| 486 | - return $data['karma']; |
|
| 487 | - } |
|
| 486 | + return $data['karma']; |
|
| 487 | + } |
|
| 488 | 488 | |
| 489 | - function hasVoted($postId) |
|
| 490 | - { |
|
| 491 | - $db = new DatabaseConnect(); |
|
| 489 | + function hasVoted($postId) |
|
| 490 | + { |
|
| 491 | + $db = new DatabaseConnect(); |
|
| 492 | 492 | |
| 493 | - $postId = $db->real_escape_string($postId); |
|
| 493 | + $postId = $db->real_escape_string($postId); |
|
| 494 | 494 | |
| 495 | - $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')"); |
|
| 495 | + $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')"); |
|
| 496 | 496 | |
| 497 | - if($result === false) |
|
| 498 | - { |
|
| 499 | - $error = db_error(); |
|
| 500 | - echo $error; |
|
| 501 | - error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error); |
|
| 502 | - } |
|
| 497 | + if($result === false) |
|
| 498 | + { |
|
| 499 | + $error = db_error(); |
|
| 500 | + echo $error; |
|
| 501 | + error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error); |
|
| 502 | + } |
|
| 503 | 503 | |
| 504 | - if($result->num_rows == 0) |
|
| 505 | - { |
|
| 506 | - return FALSE; |
|
| 507 | - } |
|
| 508 | - else |
|
| 509 | - { |
|
| 510 | - return TRUE; |
|
| 511 | - } |
|
| 512 | - } |
|
| 504 | + if($result->num_rows == 0) |
|
| 505 | + { |
|
| 506 | + return FALSE; |
|
| 507 | + } |
|
| 508 | + else |
|
| 509 | + { |
|
| 510 | + return TRUE; |
|
| 511 | + } |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | - function addVoteWithPostIdAndType($postId, $voteType) |
|
| 515 | - { |
|
| 516 | - $db = new DatabaseConnect(); |
|
| 514 | + function addVoteWithPostIdAndType($postId, $voteType) |
|
| 515 | + { |
|
| 516 | + $db = new DatabaseConnect(); |
|
| 517 | 517 | |
| 518 | - $postId = $db->real_escape_string($postId); |
|
| 519 | - $voteType = $db->real_escape_string($voteType); |
|
| 518 | + $postId = $db->real_escape_string($postId); |
|
| 519 | + $voteType = $db->real_escape_string($voteType); |
|
| 520 | 520 | |
| 521 | - if($this->hasVoted($postId)) |
|
| 522 | - { |
|
| 523 | - return "Already voted"; |
|
| 524 | - } |
|
| 521 | + if($this->hasVoted($postId)) |
|
| 522 | + { |
|
| 523 | + return "Already voted"; |
|
| 524 | + } |
|
| 525 | 525 | |
| 526 | - $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
|
| 526 | + $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
|
| 527 | 527 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 528 | 528 | |
| 529 | - if($result === false){ |
|
| 530 | - $error = db_error(); |
|
| 531 | - echo $error; |
|
| 532 | - echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
|
| 533 | - } |
|
| 534 | - } |
|
| 535 | - |
|
| 536 | - function registerAccount($location) { |
|
| 537 | - $accountCreator = new CreateUser(); |
|
| 538 | - $accountCreator->setLocation($location); |
|
| 539 | - $data = $accountCreator->execute(); |
|
| 529 | + if($result === false){ |
|
| 530 | + $error = db_error(); |
|
| 531 | + echo $error; |
|
| 532 | + echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
|
| 533 | + } |
|
| 534 | + } |
|
| 535 | + |
|
| 536 | + function registerAccount($location) { |
|
| 537 | + $accountCreator = new CreateUser(); |
|
| 538 | + $accountCreator->setLocation($location); |
|
| 539 | + $data = $accountCreator->execute(); |
|
| 540 | 540 | |
| 541 | - $access_token = (string)$data[0]['access_token']; |
|
| 542 | - $refresh_token = (string)$data[0]['refresh_token']; |
|
| 543 | - $token_type = (string)$data[0]['token_type']; |
|
| 544 | - $expires_in = $data[0]['expires_in']; |
|
| 545 | - $expiration_date = $data[0]['expiration_date']; |
|
| 546 | - $distinct_id = (string)$data[0]['distinct_id']; |
|
| 547 | - $device_uid = (string)$data[1]; |
|
| 548 | - |
|
| 549 | - $name = $location->cityName; |
|
| 550 | - $lat = $location->lat; |
|
| 551 | - $lng = $location->lng; |
|
| 541 | + $access_token = (string)$data[0]['access_token']; |
|
| 542 | + $refresh_token = (string)$data[0]['refresh_token']; |
|
| 543 | + $token_type = (string)$data[0]['token_type']; |
|
| 544 | + $expires_in = $data[0]['expires_in']; |
|
| 545 | + $expiration_date = $data[0]['expiration_date']; |
|
| 546 | + $distinct_id = (string)$data[0]['distinct_id']; |
|
| 547 | + $device_uid = (string)$data[1]; |
|
| 548 | + |
|
| 549 | + $name = $location->cityName; |
|
| 550 | + $lat = $location->lat; |
|
| 551 | + $lng = $location->lng; |
|
| 552 | 552 | |
| 553 | - $db = new DatabaseConnect(); |
|
| 554 | - $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
|
| 553 | + $db = new DatabaseConnect(); |
|
| 554 | + $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
|
| 555 | 555 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
| 556 | 556 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
| 557 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 558 | - "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
|
| 559 | - |
|
| 560 | - $success = TRUE; |
|
| 561 | - if($result === false){ |
|
| 562 | - $error = $db->error(); |
|
| 563 | - echo $error; |
|
| 564 | - echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
|
| 565 | - $success = FALSE; |
|
| 566 | - } |
|
| 557 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 558 | + "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
|
| 559 | + |
|
| 560 | + $success = TRUE; |
|
| 561 | + if($result === false){ |
|
| 562 | + $error = $db->error(); |
|
| 563 | + echo $error; |
|
| 564 | + echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
|
| 565 | + $success = FALSE; |
|
| 566 | + } |
|
| 567 | 567 | |
| 568 | - return $device_uid; |
|
| 569 | - } |
|
| 568 | + return $device_uid; |
|
| 569 | + } |
|
| 570 | 570 | |
| 571 | - function createAccount() |
|
| 572 | - { |
|
| 573 | - $config = parse_ini_file('config/config.ini.php'); |
|
| 574 | - $location = new Location(); |
|
| 575 | - $location->setLat($config['default_lat']); |
|
| 576 | - $location->setLng($config['default_lng']); |
|
| 577 | - $location->setCityName($config['default_location']); |
|
| 571 | + function createAccount() |
|
| 572 | + { |
|
| 573 | + $config = parse_ini_file('config/config.ini.php'); |
|
| 574 | + $location = new Location(); |
|
| 575 | + $location->setLat($config['default_lat']); |
|
| 576 | + $location->setLng($config['default_lng']); |
|
| 577 | + $location->setCityName($config['default_location']); |
|
| 578 | 578 | |
| 579 | - $deviceUid = $this->registerAccount($location); |
|
| 579 | + $deviceUid = $this->registerAccount($location); |
|
| 580 | 580 | |
| 581 | - return $deviceUid; |
|
| 582 | - } |
|
| 581 | + return $deviceUid; |
|
| 582 | + } |
|
| 583 | 583 | } |
| 584 | 584 | \ No newline at end of file |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $this->refreshToken(); |
| 37 | 37 | } |
| 38 | - $this->accessToken = $this->getAccessToken(); |
|
| 38 | + $this->accessToken = $this->getAccessToken(); |
|
| 39 | 39 | |
| 40 | 40 | /* if($this->isAccountVerified() != 1) |
| 41 | 41 | { |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | function locationEquals($city) |
| 111 | 111 | { |
| 112 | 112 | $db = new DatabaseConnect(); |
| 113 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 113 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 114 | 114 | |
| 115 | 115 | $location = new Location(); |
| 116 | 116 | |
| 117 | - if ($result->num_rows > 0) |
|
| 117 | + if($result->num_rows > 0) |
|
| 118 | 118 | { |
| 119 | 119 | // output data of each row |
| 120 | 120 | while($row = $result->fetch_assoc()) |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | else |
| 188 | 188 | { |
| 189 | - user_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 189 | + user_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | function getLocation() |
| 199 | 199 | { |
| 200 | 200 | $db = new DatabaseConnect(); |
| 201 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 201 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 202 | 202 | |
| 203 | 203 | $location = new Location(); |
| 204 | 204 | |
| 205 | - if ($result->num_rows > 0) |
|
| 205 | + if($result->num_rows > 0) |
|
| 206 | 206 | { |
| 207 | 207 | // output data of each row |
| 208 | 208 | while($row = $result->fetch_assoc()) |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | if(isset($_POST['color'])) |
| 334 | 334 | { |
| 335 | 335 | $color = $_POST['color']; |
| 336 | - switch ($color) { |
|
| 336 | + switch($color) { |
|
| 337 | 337 | case '8ABDB0': |
| 338 | 338 | $color = '8ABDB0'; |
| 339 | 339 | break; |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $db = new DatabaseConnect(); |
| 408 | 408 | $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
| 409 | 409 | |
| 410 | - if ($result->num_rows > 0) |
|
| 410 | + if($result->num_rows > 0) |
|
| 411 | 411 | { |
| 412 | 412 | // output data of each row |
| 413 | 413 | while($row = $result->fetch_assoc()) |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | expiration_date='" . $expiration_date . "' |
| 447 | 447 | WHERE device_uid='" . $device_uid . "'"); |
| 448 | 448 | |
| 449 | - if($result === false){ |
|
| 449 | + if($result === false) { |
|
| 450 | 450 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -456,11 +456,11 @@ discard block |
||
| 456 | 456 | function getAccessToken() |
| 457 | 457 | { |
| 458 | 458 | $db = new DatabaseConnect(); |
| 459 | - $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 459 | + $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'"); |
|
| 460 | 460 | |
| 461 | 461 | $accessToken; |
| 462 | 462 | |
| 463 | - if ($result->num_rows > 0) |
|
| 463 | + if($result->num_rows > 0) |
|
| 464 | 464 | { |
| 465 | 465 | // output data of each row |
| 466 | 466 | while($row = $result->fetch_assoc()) |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 527 | 527 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 528 | 528 | |
| 529 | - if($result === false){ |
|
| 529 | + if($result === false) { |
|
| 530 | 530 | $error = db_error(); |
| 531 | 531 | echo $error; |
| 532 | 532 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -554,11 +554,11 @@ discard block |
||
| 554 | 554 | $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type, |
| 555 | 555 | expires_in, expiration_date, distinct_id, device_uid, name, lat, lng) |
| 556 | 556 | VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type . |
| 557 | - "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 557 | + "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id . |
|
| 558 | 558 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 559 | 559 | |
| 560 | 560 | $success = TRUE; |
| 561 | - if($result === false){ |
|
| 561 | + if($result === false) { |
|
| 562 | 562 | $error = $db->error(); |
| 563 | 563 | echo $error; |
| 564 | 564 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | if($location->getCityName() == $city) |
| 133 | 133 | { |
| 134 | 134 | return TRUE; |
| 135 | - } |
|
| 135 | + } |
|
| 136 | 136 | else |
| 137 | 137 | { |
| 138 | 138 | return FALSE; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | if(substr($_GET['city'], 0, 1) === '#') |
| 146 | 146 | { |
| 147 | 147 | return htmlspecialchars($_GET['city']) . " " . $this->location->cityName; |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | else |
| 150 | 150 | { |
| 151 | 151 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=' . $this->getGeocodingToken(); |
@@ -333,7 +333,8 @@ discard block |
||
| 333 | 333 | if(isset($_POST['color'])) |
| 334 | 334 | { |
| 335 | 335 | $color = $_POST['color']; |
| 336 | - switch ($color) { |
|
| 336 | + switch ($color) |
|
| 337 | + { |
|
| 337 | 338 | case '8ABDB0': |
| 338 | 339 | $color = '8ABDB0'; |
| 339 | 340 | break; |
@@ -446,7 +447,8 @@ discard block |
||
| 446 | 447 | expiration_date='" . $expiration_date . "' |
| 447 | 448 | WHERE device_uid='" . $device_uid . "'"); |
| 448 | 449 | |
| 449 | - if($result === false){ |
|
| 450 | + if($result === false) |
|
| 451 | + { |
|
| 450 | 452 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
| 451 | 453 | } |
| 452 | 454 | } |
@@ -526,14 +528,16 @@ discard block |
||
| 526 | 528 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 527 | 529 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 528 | 530 | |
| 529 | - if($result === false){ |
|
| 531 | + if($result === false) |
|
| 532 | + { |
|
| 530 | 533 | $error = db_error(); |
| 531 | 534 | echo $error; |
| 532 | 535 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
| 533 | 536 | } |
| 534 | 537 | } |
| 535 | 538 | |
| 536 | - function registerAccount($location) { |
|
| 539 | + function registerAccount($location) |
|
| 540 | + { |
|
| 537 | 541 | $accountCreator = new CreateUser(); |
| 538 | 542 | $accountCreator->setLocation($location); |
| 539 | 543 | $data = $accountCreator->execute(); |
@@ -558,7 +562,8 @@ discard block |
||
| 558 | 562 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 559 | 563 | |
| 560 | 564 | $success = TRUE; |
| 561 | - if($result === false){ |
|
| 565 | + if($result === false) |
|
| 566 | + { |
|
| 562 | 567 | $error = $db->error(); |
| 563 | 568 | echo $error; |
| 564 | 569 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=' . $this->getGeocodingToken(); |
| 152 | 152 | $result = Requests::post($url); |
| 153 | - if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST') |
|
| 153 | + if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST') |
|
| 154 | 154 | { |
| 155 | 155 | return "0 results"; |
| 156 | 156 | } |
| 157 | 157 | else |
| 158 | 158 | { |
| 159 | - $name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name']; |
|
| 160 | - $lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat']; |
|
| 161 | - $lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng']; |
|
| 159 | + $name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name']; |
|
| 160 | + $lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat']; |
|
| 161 | + $lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng']; |
|
| 162 | 162 | |
| 163 | 163 | $location = new Location(); |
| 164 | 164 | $location->setLat($lat); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | lng='" . $lng . "' |
| 181 | 181 | WHERE access_token='" . $this->accessToken . "'"); |
| 182 | 182 | |
| 183 | - if($result === false) |
|
| 183 | + if($result === FALSE) |
|
| 184 | 184 | { |
| 185 | 185 | echo "Updating location failed: (" . $db->errno . ") " . $db->error; |
| 186 | 186 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $accountCreator->postId = htmlspecialchars($postId); |
| 286 | 286 | $data = $accountCreator->execute(); |
| 287 | 287 | |
| 288 | - user_log('User voted: ' . print_r($data, true)); |
|
| 288 | + user_log('User voted: ' . print_r($data, TRUE)); |
|
| 289 | 289 | |
| 290 | 290 | if(array_key_exists('post', $data)) |
| 291 | 291 | { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | else |
| 301 | 301 | { |
| 302 | - error_log('Could not vote: ' . print_r($data, true)); |
|
| 302 | + error_log('Could not vote: ' . print_r($data, TRUE)); |
|
| 303 | 303 | return FALSE; |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | if($data != 'Success') |
| 368 | 368 | { |
| 369 | - error_log('Could not set location befor Post: ' . print_r($data, true)); |
|
| 369 | + error_log('Could not set location befor Post: ' . print_r($data, TRUE)); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | $accountCreator->location = $this->location; |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | return $errorMsg; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - user_log('User posted: ' . print_r($data, true)); |
|
| 391 | + user_log('User posted: ' . print_r($data, TRUE)); |
|
| 392 | 392 | |
| 393 | 393 | if(isset($_POST['ancestor'])) |
| 394 | 394 | { |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | expiration_date='" . $expiration_date . "' |
| 447 | 447 | WHERE device_uid='" . $device_uid . "'"); |
| 448 | 448 | |
| 449 | - if($result === false){ |
|
| 449 | + if($result === FALSE){ |
|
| 450 | 450 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | |
| 495 | 495 | $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')"); |
| 496 | 496 | |
| 497 | - if($result === false) |
|
| 497 | + if($result === FALSE) |
|
| 498 | 498 | { |
| 499 | 499 | $error = db_error(); |
| 500 | 500 | echo $error; |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
| 527 | 527 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
| 528 | 528 | |
| 529 | - if($result === false){ |
|
| 529 | + if($result === FALSE){ |
|
| 530 | 530 | $error = db_error(); |
| 531 | 531 | echo $error; |
| 532 | 532 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
| 559 | 559 | |
| 560 | 560 | $success = TRUE; |
| 561 | - if($result === false){ |
|
| 561 | + if($result === FALSE){ |
|
| 562 | 562 | $error = $db->error(); |
| 563 | 563 | echo $error; |
| 564 | 564 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -2,41 +2,41 @@ |
||
| 2 | 2 | |
| 3 | 3 | class GetChannel extends AbstractRequest |
| 4 | 4 | { |
| 5 | - /** |
|
| 6 | - * @var Location |
|
| 7 | - */ |
|
| 8 | - public $location; |
|
| 9 | - public $channel; |
|
| 10 | - public $hasPayload = FALSE; |
|
| 11 | - public $lastPostId = ''; |
|
| 12 | - public $view = 'combo'; |
|
| 5 | + /** |
|
| 6 | + * @var Location |
|
| 7 | + */ |
|
| 8 | + public $location; |
|
| 9 | + public $channel; |
|
| 10 | + public $hasPayload = FALSE; |
|
| 11 | + public $lastPostId = ''; |
|
| 12 | + public $view = 'combo'; |
|
| 13 | 13 | |
| 14 | - function getApiEndPoint() |
|
| 15 | - { |
|
| 16 | - if($this->lastPostId == '') |
|
| 17 | - { |
|
| 18 | - $apiEndPoint = '/v3/posts/hashtag/' . $this->view . '?hashtag=' . $this->channel; |
|
| 19 | - } |
|
| 20 | - else |
|
| 21 | - { |
|
| 22 | - if($this->view == 'combo') |
|
| 23 | - { |
|
| 24 | - $apiEndPoint = '/v3/posts/hashtag?hashtag=' . $this->channel . '&after=' . $this->lastPostId; |
|
| 25 | - } |
|
| 26 | - else |
|
| 27 | - { |
|
| 28 | - $apiEndPoint = '/v3/posts/hashtag/' . $this->view . '?hashtag=' . $this->channel . '&after=' . $this->lastPostId; |
|
| 29 | - } |
|
| 30 | - } |
|
| 31 | - return $apiEndPoint; |
|
| 32 | - } |
|
| 33 | - function getPayload() |
|
| 34 | - { |
|
| 35 | - return array( |
|
| 36 | - ); |
|
| 37 | - } |
|
| 38 | - function getMethod() |
|
| 39 | - { |
|
| 40 | - return 'GET'; |
|
| 41 | - } |
|
| 14 | + function getApiEndPoint() |
|
| 15 | + { |
|
| 16 | + if($this->lastPostId == '') |
|
| 17 | + { |
|
| 18 | + $apiEndPoint = '/v3/posts/hashtag/' . $this->view . '?hashtag=' . $this->channel; |
|
| 19 | + } |
|
| 20 | + else |
|
| 21 | + { |
|
| 22 | + if($this->view == 'combo') |
|
| 23 | + { |
|
| 24 | + $apiEndPoint = '/v3/posts/hashtag?hashtag=' . $this->channel . '&after=' . $this->lastPostId; |
|
| 25 | + } |
|
| 26 | + else |
|
| 27 | + { |
|
| 28 | + $apiEndPoint = '/v3/posts/hashtag/' . $this->view . '?hashtag=' . $this->channel . '&after=' . $this->lastPostId; |
|
| 29 | + } |
|
| 30 | + } |
|
| 31 | + return $apiEndPoint; |
|
| 32 | + } |
|
| 33 | + function getPayload() |
|
| 34 | + { |
|
| 35 | + return array( |
|
| 36 | + ); |
|
| 37 | + } |
|
| 38 | + function getMethod() |
|
| 39 | + { |
|
| 40 | + return 'GET'; |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -1,12 +1,24 @@ |
||
| 1 | 1 | <div id="sortJodelBy" class="row"> |
| 2 | 2 | <div class="col-3"> |
| 3 | - <a <?php if($view->view == 'combo')echo 'class="active"';?> href="<?php echo $view->changeView('combo')->back()->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 3 | + <a <?php if($view->view == 'combo') |
|
| 4 | +{ |
|
| 5 | + echo 'class="active"'; |
|
| 6 | +} |
|
| 7 | +?> href="<?php echo $view->changeView('combo')->back()->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 4 | 8 | </div> |
| 5 | 9 | <div class="col-3"> |
| 6 | - <a <?php if($view->view == 'discussed') echo 'class="active"';?> href="<?php echo $view->changeView('discussed')->back()->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 10 | + <a <?php if($view->view == 'discussed') |
|
| 11 | +{ |
|
| 12 | + echo 'class="active"'; |
|
| 13 | +} |
|
| 14 | +?> href="<?php echo $view->changeView('discussed')->back()->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 7 | 15 | </div> |
| 8 | 16 | <div class="col-3"> |
| 9 | - <a <?php if($view->view == 'popular') echo 'class="active"';?> href="<?php echo $view->changeView('popular')->back()->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 17 | + <a <?php if($view->view == 'popular') |
|
| 18 | +{ |
|
| 19 | + echo 'class="active"'; |
|
| 20 | +} |
|
| 21 | +?> href="<?php echo $view->changeView('popular')->back()->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 10 | 22 | </div> |
| 11 | 23 | <div class="col-3"> |
| 12 | 24 | <nav> |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <div id="sortJodelBy" class="row"> |
| 2 | 2 | <div class="col-3"> |
| 3 | - <a <?php if($view->view == 'combo')echo 'class="active"';?> href="<?php echo $view->changeView('combo')->back()->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 3 | + <a <?php if($view->view == 'combo')echo 'class="active"'; ?> href="<?php echo $view->changeView('combo')->back()->toUrl(); ?>"><i class="fa fa-clock-o fa-3x"></i></a> |
|
| 4 | 4 | </div> |
| 5 | 5 | <div class="col-3"> |
| 6 | - <a <?php if($view->view == 'discussed') echo 'class="active"';?> href="<?php echo $view->changeView('discussed')->back()->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 6 | + <a <?php if($view->view == 'discussed') echo 'class="active"'; ?> href="<?php echo $view->changeView('discussed')->back()->toUrl(); ?>"><i class="fa fa-commenting-o fa-3x"></i></a> |
|
| 7 | 7 | </div> |
| 8 | 8 | <div class="col-3"> |
| 9 | - <a <?php if($view->view == 'popular') echo 'class="active"';?> href="<?php echo $view->changeView('popular')->back()->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 9 | + <a <?php if($view->view == 'popular') echo 'class="active"'; ?> href="<?php echo $view->changeView('popular')->back()->toUrl(); ?>"><i class="fa fa-angle-up fa-3x"></i></a> |
|
| 10 | 10 | </div> |
| 11 | 11 | <div class="col-3"> |
| 12 | 12 | <nav> |
| 13 | - <a href="<?php echo $baseUrl;?>about-us.php">about</a> |
|
| 13 | + <a href="<?php echo $baseUrl; ?>about-us.php">about</a> |
|
| 14 | 14 | </nav> |
| 15 | 15 | </div> |
| 16 | 16 | </div> |
@@ -74,7 +74,11 @@ |
||
| 74 | 74 | |
| 75 | 75 | <div id="location_mobile" class="hidden-sm-up"> |
| 76 | 76 | <form method="get"> |
| 77 | - <input type="text" id="city_mobile" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
| 77 | + <input type="text" id="city_mobile" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
| 78 | +{ |
|
| 79 | + echo $newPositionStatus; |
|
| 80 | +} |
|
| 81 | +?>" required> |
|
| 78 | 82 | |
| 79 | 83 | <input type="submit" id="submit_mobile" class="fa" value="" /> |
| 80 | 84 | </form> |
@@ -1,53 +1,53 @@ |
||
| 1 | 1 | <!DOCTYPE html> |
| 2 | 2 | <html lang="en"> |
| 3 | 3 | <head> |
| 4 | - <title><?php echo $title;?></title> |
|
| 4 | + <title><?php echo $title; ?></title> |
|
| 5 | 5 | |
| 6 | 6 | <meta charset="utf-8"> |
| 7 | 7 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
| 8 | 8 | <meta http-equiv="x-ua-compatible" content="ie=edge"> |
| 9 | 9 | |
| 10 | - <meta name="description" content="<?php echo $description;?>"> |
|
| 10 | + <meta name="description" content="<?php echo $description; ?>"> |
|
| 11 | 11 | <meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client, web-app, browser, app"> |
| 12 | 12 | |
| 13 | 13 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"> |
| 14 | 14 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.1.1/ekko-lightbox.min.css" integrity="sha256-8aNQFtmxcOMVoOhLD4mrHqaKC2Ui++LmlQsoKTqxwIE=" crossorigin="anonymous" /> |
| 15 | - <link rel="stylesheet" href="<?php echo $baseUrl;?>css/font-awesome.min.css"> |
|
| 16 | - <link rel="stylesheet" href="<?php echo $baseUrl;?>style.css" type="text/css"> |
|
| 15 | + <link rel="stylesheet" href="<?php echo $baseUrl; ?>css/font-awesome.min.css"> |
|
| 16 | + <link rel="stylesheet" href="<?php echo $baseUrl; ?>style.css" type="text/css"> |
|
| 17 | 17 | |
| 18 | - <link rel="shortcut icon" type="image/x-icon" href="<?php echo $baseUrl;?>img/favicon/favicon.ico"> |
|
| 19 | - <link rel="icon" type="image/x-icon" href="<?php echo $baseUrl;?>img/favicon/favicon.ico"> |
|
| 20 | - <link rel="icon" type="image/gif" href="<?php echo $baseUrl;?>img/favicon/favicon.gif"> |
|
| 21 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon.png"> |
|
| 22 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon.png"> |
|
| 23 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-57x57.png" sizes="57x57"> |
|
| 24 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-60x60.png" sizes="60x60"> |
|
| 25 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-72x72.png" sizes="72x72"> |
|
| 26 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-76x76.png" sizes="76x76"> |
|
| 27 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-114x114.png" sizes="114x114"> |
|
| 28 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-120x120.png" sizes="120x120"> |
|
| 29 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-128x128.png" sizes="128x128"> |
|
| 30 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-144x144.png" sizes="144x144"> |
|
| 31 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-152x152.png" sizes="152x152"> |
|
| 32 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-180x180.png" sizes="180x180"> |
|
| 33 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-precomposed.png"> |
|
| 34 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-16x16.png" sizes="16x16"> |
|
| 35 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-32x32.png" sizes="32x32"> |
|
| 36 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-96x96.png" sizes="96x96"> |
|
| 37 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-160x160.png" sizes="160x160"> |
|
| 38 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-192x192.png" sizes="192x192"> |
|
| 39 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-196x196.png" sizes="196x196"> |
|
| 40 | - <meta name="msapplication-TileImage" content="<?php echo $baseUrl;?>img/favicon/win8-tile-144x144.png"> |
|
| 18 | + <link rel="shortcut icon" type="image/x-icon" href="<?php echo $baseUrl; ?>img/favicon/favicon.ico"> |
|
| 19 | + <link rel="icon" type="image/x-icon" href="<?php echo $baseUrl; ?>img/favicon/favicon.ico"> |
|
| 20 | + <link rel="icon" type="image/gif" href="<?php echo $baseUrl; ?>img/favicon/favicon.gif"> |
|
| 21 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon.png"> |
|
| 22 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon.png"> |
|
| 23 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-57x57.png" sizes="57x57"> |
|
| 24 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-60x60.png" sizes="60x60"> |
|
| 25 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-72x72.png" sizes="72x72"> |
|
| 26 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-76x76.png" sizes="76x76"> |
|
| 27 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-114x114.png" sizes="114x114"> |
|
| 28 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-120x120.png" sizes="120x120"> |
|
| 29 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-128x128.png" sizes="128x128"> |
|
| 30 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-144x144.png" sizes="144x144"> |
|
| 31 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-152x152.png" sizes="152x152"> |
|
| 32 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-180x180.png" sizes="180x180"> |
|
| 33 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-precomposed.png"> |
|
| 34 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-16x16.png" sizes="16x16"> |
|
| 35 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-32x32.png" sizes="32x32"> |
|
| 36 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-96x96.png" sizes="96x96"> |
|
| 37 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-160x160.png" sizes="160x160"> |
|
| 38 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-192x192.png" sizes="192x192"> |
|
| 39 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-196x196.png" sizes="196x196"> |
|
| 40 | + <meta name="msapplication-TileImage" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-144x144.png"> |
|
| 41 | 41 | <meta name="msapplication-TileColor" content="#5682a3"> |
| 42 | 42 | <meta name="msapplication-navbutton-color" content="#5682a3"> |
| 43 | 43 | <meta name="application-name" content="JodelBlue"/> |
| 44 | 44 | <meta name="msapplication-tooltip" content="JodelBlue"/> |
| 45 | 45 | <meta name="apple-mobile-web-app-title" content="JodelBlue"/> |
| 46 | - <meta name="msapplication-square70x70logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-70x70.png"> |
|
| 47 | - <meta name="msapplication-square144x144logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-144x144.png"> |
|
| 48 | - <meta name="msapplication-square150x150logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-150x150.png"> |
|
| 49 | - <meta name="msapplication-wide310x150logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-310x150.png"> |
|
| 50 | - <meta name="msapplication-square310x310logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-310x310.png"> |
|
| 46 | + <meta name="msapplication-square70x70logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-70x70.png"> |
|
| 47 | + <meta name="msapplication-square144x144logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-144x144.png"> |
|
| 48 | + <meta name="msapplication-square150x150logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-150x150.png"> |
|
| 49 | + <meta name="msapplication-wide310x150logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-310x150.png"> |
|
| 50 | + <meta name="msapplication-square310x310logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-310x310.png"> |
|
| 51 | 51 | </head> |
| 52 | 52 | |
| 53 | 53 | <body> |
@@ -47,6 +47,6 @@ |
||
| 47 | 47 | </content> |
| 48 | 48 | </article> |
| 49 | 49 | </div> |
| 50 | - <?php include 'templates/nav-bottom.php';?> |
|
| 50 | + <?php include 'templates/nav-bottom.php'; ?> |
|
| 51 | 51 | </div> |
| 52 | -<?php include 'templates/footer.php';?> |
|
| 53 | 52 | \ No newline at end of file |
| 53 | +<?php include 'templates/footer.php'; ?> |
|
| 54 | 54 | \ No newline at end of file |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | <?php |
| 130 | 130 | if(is_file(realpath(__DIR__ . '/..') . '/piwik-script.html')) |
| 131 | 131 | { |
| 132 | - include(realpath(__DIR__ . '/..') . '/piwik-script.html'); |
|
| 132 | + include(realpath(__DIR__ . '/..') . '/piwik-script.html'); |
|
| 133 | 133 | } |
| 134 | 134 | ?> |
| 135 | 135 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | crossorigin="anonymous"></script> |
| 6 | 6 | <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script> |
| 7 | 7 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script> |
| 8 | - <script src="<?php echo $baseUrl;?>js/jQueryEmoji.js"></script> |
|
| 8 | + <script src="<?php echo $baseUrl; ?>js/jQueryEmoji.js"></script> |
|
| 9 | 9 | <script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.1.1/ekko-lightbox.min.js" integrity="sha256-1odJPEl+KoMUaA1T7QNMGSSU/r5LCKCRC6SL8P0r2gY=" crossorigin="anonymous"></script> |
| 10 | 10 | |
| 11 | 11 | <script> |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | console.log(solution); |
| 38 | 38 | $.ajax({ |
| 39 | 39 | type: "POST", |
| 40 | - url: "<?php echo $baseUrl;?>vote-ajax.php?solution=" + solution + "&key="+key, |
|
| 40 | + url: "<?php echo $baseUrl; ?>vote-ajax.php?solution=" + solution + "&key="+key, |
|
| 41 | 41 | data: {"deviceUid" : deviceUid}, |
| 42 | 42 | success: function(result){ |
| 43 | 43 | var response = JSON.parse(result); |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | window.history.back(); |
| 63 | 63 | } |
| 64 | - <?php if(isset($includeEmojiAndAjax)){ ?> |
|
| 64 | + <?php if(isset($includeEmojiAndAjax)) { ?> |
|
| 65 | 65 | |
| 66 | 66 | function vote(postId, vote, obj) |
| 67 | 67 | { |
| 68 | 68 | $.ajax({ |
| 69 | - url: '<?php echo $baseUrl;?>vote-ajax.php?postId=' + postId + '&vote=' + vote, |
|
| 69 | + url: '<?php echo $baseUrl; ?>vote-ajax.php?postId=' + postId + '&vote=' + vote, |
|
| 70 | 70 | dataType: 'json', |
| 71 | 71 | async: true, |
| 72 | 72 | success: function(json) |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | <?php if(isset($errorMsg)) { ?> |
| 95 | 95 | //Error Msg |
| 96 | - if('<?php echo $errorMsg;?>' != '') |
|
| 96 | + if('<?php echo $errorMsg; ?>' != '') |
|
| 97 | 97 | { |
| 98 | - alert('<?php echo $errorMsg;?>'); |
|
| 98 | + alert('<?php echo $errorMsg; ?>'); |
|
| 99 | 99 | } |
| 100 | 100 | <?php } ?> |
| 101 | 101 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | function getMorePosts(lastPostId, view, hashtag, old_lastPostId) |
| 129 | 129 | { |
| 130 | 130 | $.ajax({ |
| 131 | - url: '<?php echo $baseUrl;?>get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view + '&hashtag=' + encodeURIComponent(hashtag), |
|
| 131 | + url: '<?php echo $baseUrl; ?>get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view + '&hashtag=' + encodeURIComponent(hashtag), |
|
| 132 | 132 | dataType: 'html', |
| 133 | 133 | async: false, |
| 134 | 134 | success: function(html) { |
@@ -61,7 +61,9 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | window.history.back(); |
| 63 | 63 | } |
| 64 | - <?php if(isset($includeEmojiAndAjax)){ ?> |
|
| 64 | + <?php if(isset($includeEmojiAndAjax)) |
|
| 65 | +{ |
|
| 66 | +?> |
|
| 65 | 67 | |
| 66 | 68 | function vote(postId, vote, obj) |
| 67 | 69 | { |
@@ -91,7 +93,9 @@ discard block |
||
| 91 | 93 | |
| 92 | 94 | $(document).ready(function() |
| 93 | 95 | { |
| 94 | - <?php if(isset($errorMsg)) { ?> |
|
| 96 | + <?php if(isset($errorMsg)) |
|
| 97 | +{ |
|
| 98 | +?> |
|
| 95 | 99 | //Error Msg |
| 96 | 100 | if('<?php echo $errorMsg;?>' != '') |
| 97 | 101 | { |
@@ -155,7 +159,9 @@ discard block |
||
| 155 | 159 | return {"lastPostId":lastPostId, "old_lastPostId":old_lastPostId}; |
| 156 | 160 | } |
| 157 | 161 | |
| 158 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
| 162 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
| 163 | +{ |
|
| 164 | +?> |
|
| 159 | 165 | |
| 160 | 166 | if(window.location.hash) |
| 161 | 167 | { |