@@ -13,7 +13,7 @@ |
||
| 13 | 13 | if (filter_var(trim($email), FILTER_VALIDATE_EMAIL)) { |
| 14 | 14 | $this->email = filter_var(trim($email), FILTER_SANITIZE_EMAIL); |
| 15 | 15 | } else { |
| 16 | - throw new InvalidArgumentException('Invalid email address: '.$email); |
|
| 16 | + throw new InvalidArgumentException('Invalid email address: ' . $email); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | // e.g: $app->add(new \Slim\Csrf\Guard); |
| 11 | 11 | |
| 12 | 12 | // 3) add route information to twig |
| 13 | -$app->add(function (Request $request, Response $response, callable $next) { |
|
| 13 | +$app->add(function(Request $request, Response $response, callable $next) { |
|
| 14 | 14 | $route = $request->getAttribute('route'); |
| 15 | 15 | |
| 16 | 16 | // return NotFound for non existent route |
@@ -42,12 +42,12 @@ |
||
| 42 | 42 | |
| 43 | 43 | $ret = ''; |
| 44 | 44 | |
| 45 | - $chars = 26 * 2 + 10; //26 (a-z) + 26 (A-Z) + 10 (0-9) |
|
| 45 | + $chars = 26 * 2 + 10; //26 (a-z) + 26 (A-Z) + 10 (0-9) |
|
| 46 | 46 | //a-z = 97-122 |
| 47 | 47 | //A-Z = 65-90 |
| 48 | 48 | //0-9 = 48-57 |
| 49 | 49 | |
| 50 | - srand(make_seed()); //Seed with microseconds |
|
| 50 | + srand(make_seed()); //Seed with microseconds |
|
| 51 | 51 | //if you don't need this, you can just use srand(time()); |
| 52 | 52 | |
| 53 | 53 | for ($i = 1; $i <= $length; $i++) { |
@@ -38,21 +38,21 @@ discard block |
||
| 38 | 38 | echo var_dump($accessToken); |
| 39 | 39 | } catch (Facebook\Exceptions\FacebookResponseException $e) { |
| 40 | 40 | // When Graph returns an error |
| 41 | - echo 'Graph returned an error: '.$e->getMessage(); |
|
| 41 | + echo 'Graph returned an error: ' . $e->getMessage(); |
|
| 42 | 42 | exit; |
| 43 | 43 | } catch (Facebook\Exceptions\FacebookSDKException $e) { |
| 44 | 44 | // When validation fails or other local issues |
| 45 | - echo 'Facebook SDK returned an error: '.$e->getMessage(); |
|
| 45 | + echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
|
| 46 | 46 | exit; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (!isset($accessToken)) { |
| 50 | 50 | if ($helper->getError()) { |
| 51 | 51 | header('HTTP/1.0 401 Unauthorized'); |
| 52 | - echo 'Error: '.$helper->getError()."\n"; |
|
| 53 | - echo 'Error Code: '.$helper->getErrorCode()."\n"; |
|
| 54 | - echo 'Error Reason: '.$helper->getErrorReason()."\n"; |
|
| 55 | - echo 'Error Description: '.$helper->getErrorDescription()."\n"; |
|
| 52 | + echo 'Error: ' . $helper->getError() . "\n"; |
|
| 53 | + echo 'Error Code: ' . $helper->getErrorCode() . "\n"; |
|
| 54 | + echo 'Error Reason: ' . $helper->getErrorReason() . "\n"; |
|
| 55 | + echo 'Error Description: ' . $helper->getErrorDescription() . "\n"; |
|
| 56 | 56 | } else { |
| 57 | 57 | header('HTTP/1.0 400 Bad Request'); |
| 58 | 58 | echo 'Bad request'; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | try { |
| 77 | 77 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
| 78 | 78 | } catch (Facebook\Exceptions\FacebookSDKException $e) { |
| 79 | - echo '<p>Error getting long-lived access token: '.$helper->getMessage()."</p>\n\n"; |
|
| 79 | + echo '<p>Error getting long-lived access token: ' . $helper->getMessage() . "</p>\n\n"; |
|
| 80 | 80 | exit; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | return false; |
| 122 | 122 | } |
| 123 | - $sendNotif = $fb->post('/'.$facebookUserId.'/notifications', ['href' => $url, 'template' => $message], $appAccessToken); |
|
| 123 | + $sendNotif = $fb->post('/' . $facebookUserId . '/notifications', ['href' => $url, 'template' => $message], $appAccessToken); |
|
| 124 | 124 | |
| 125 | 125 | if ($sendNotif->getHttpStatusCode() == 200) { |
| 126 | 126 | return true; |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $statusMessage = 'Sent successfully'; |
| 54 | 54 | } else { |
| 55 | 55 | foreach ($sent as $errorMessage) { |
| 56 | - $statusMessage .= '<p>'.$errorMessage.'</p>'; |
|
| 56 | + $statusMessage .= '<p>' . $errorMessage . '</p>'; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -29,11 +29,11 @@ |
||
| 29 | 29 | // parameter represents the DataTables column identifier. In this case simple |
| 30 | 30 | // indexes |
| 31 | 31 | $columns = [ |
| 32 | - ['db' => 'id', 'dt' => 0], |
|
| 33 | - ['db' => 'firstname', 'dt' => 1], |
|
| 34 | - ['db' => 'surname', 'dt' => 2], |
|
| 35 | - ['db' => 'zip', 'dt' => 3], |
|
| 36 | - ['db' => 'country', 'dt' => 4], |
|
| 32 | + ['db' => 'id', 'dt' => 0], |
|
| 33 | + ['db' => 'firstname', 'dt' => 1], |
|
| 34 | + ['db' => 'surname', 'dt' => 2], |
|
| 35 | + ['db' => 'zip', 'dt' => 3], |
|
| 36 | + ['db' => 'country', 'dt' => 4], |
|
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | 39 | // SQL server connection information |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } else { |
| 34 | 34 | $notificationId = getQueryStringForKey('id'); |
| 35 | 35 | $referer = getQueryStringForKey('click'); |
| 36 | - $_SESSION['redirectUrl'] = siteSettings()->getSiteUrl().'/notification.php?id='.$notificationId.'&click='.$referer; |
|
| 36 | + $_SESSION['redirectUrl'] = siteSettings()->getSiteUrl() . '/notification.php?id=' . $notificationId . '&click=' . $referer; |
|
| 37 | 37 | header('Location: login.php'); |
| 38 | 38 | exit; |
| 39 | 39 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // redir if notification has URL |
| 61 | 61 | $redir = notificationLink($notificationId); |
| 62 | 62 | if (!empty($redir)) { |
| 63 | - header('Location: '.$redir); |
|
| 63 | + header('Location: ' . $redir); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // find notification |
@@ -24,12 +24,12 @@ |
||
| 24 | 24 | public function createInDb(Database $db) |
| 25 | 25 | { |
| 26 | 26 | if (empty($this->name) || empty($this->datetime) || empty($this->series) || empty($this->type) || empty($this->sub_type) || empty($this->location)) { |
| 27 | - $message = 'Series name ('.$this->name.')'; |
|
| 28 | - $message .= ' or date ('.$this->datetime.')'; |
|
| 29 | - $message .= ' or series ('.$this->series.')'; |
|
| 30 | - $message .= ' or type ('.$this->type.')'; |
|
| 31 | - $message .= ' or sub_type ('.$this->sub_type.')'; |
|
| 32 | - $message .= ' or location ('.$this->location.')'; |
|
| 27 | + $message = 'Series name (' . $this->name . ')'; |
|
| 28 | + $message .= ' or date (' . $this->datetime . ')'; |
|
| 29 | + $message .= ' or series (' . $this->series . ')'; |
|
| 30 | + $message .= ' or type (' . $this->type . ')'; |
|
| 31 | + $message .= ' or sub_type (' . $this->sub_type . ')'; |
|
| 32 | + $message .= ' or location (' . $this->location . ')'; |
|
| 33 | 33 | $message .= ' cannot be empty.'; |
| 34 | 34 | |
| 35 | 35 | throw new Exception($message); |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | if ($first) { |
| 181 | 181 | $first = false; |
| 182 | 182 | $fields .= $item['field']; |
| 183 | - $valuesPlaceholder .= ':'.$item['field']; |
|
| 183 | + $valuesPlaceholder .= ':' . $item['field']; |
|
| 184 | 184 | } else { |
| 185 | - $fields .= ', '.$item['field']; |
|
| 186 | - $valuesPlaceholder .= ', :'.$item['field']; |
|
| 185 | + $fields .= ', ' . $item['field']; |
|
| 186 | + $valuesPlaceholder .= ', :' . $item['field']; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | if ($item['type'] == 's' || $item['type'] == 'string') { |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $statement = $this->db_connection->prepare('INSERT INTO '.$table.' ('.$fields.') VALUES ('.$valuesPlaceholder.')'); |
|
| 204 | + $statement = $this->db_connection->prepare('INSERT INTO ' . $table . ' (' . $fields . ') VALUES (' . $valuesPlaceholder . ')'); |
|
| 205 | 205 | foreach ($data as $item) { |
| 206 | - $statement->bindParam(':'.$item['field'], $item['value']); |
|
| 206 | + $statement->bindParam(':' . $item['field'], $item['value']); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if ($statement->execute()) { |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | private function addPrefix($table) |
| 250 | 250 | { |
| 251 | - $table = $this->db_prefix.$table; |
|
| 251 | + $table = $this->db_prefix . $table; |
|
| 252 | 252 | |
| 253 | 253 | return $table; |
| 254 | 254 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | public function count($table, $column, $where = null) |
| 273 | 273 | { |
| 274 | 274 | $columns = [ |
| 275 | - 'COUNT('.$column.') AS count', |
|
| 275 | + 'COUNT(' . $column . ') AS count', |
|
| 276 | 276 | ]; |
| 277 | 277 | $statement = $this->selectStatement($table, $columns, $where); |
| 278 | 278 | |