@@ -23,13 +23,13 @@ |
||
| 23 | 23 | const POSTS_PER_PAGE = 4; |
| 24 | 24 | const LIST_PER_PAGE = 10; |
| 25 | 25 | |
| 26 | - const EXCERPT_WORD_COUNT =50; |
|
| 26 | + const EXCERPT_WORD_COUNT = 50; |
|
| 27 | 27 | |
| 28 | 28 | //login security |
| 29 | 29 | const NUMBER_OF_BAD_PASSWORD_TRIES = 3; |
| 30 | 30 | const LOCKOUT_MINUTES = 5; |
| 31 | 31 | |
| 32 | - const PASSWORD_RESET_DURATION = 240;//number of minutes the reset password link is valid |
|
| 32 | + const PASSWORD_RESET_DURATION = 240; //number of minutes the reset password link is valid |
|
| 33 | 33 | |
| 34 | 34 | const HASH_KEY = "1337blogOcPass159758348ShaQpiss"; |
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | $loadModuleObj = $this->getModuleNamespace($loadModule); |
| 110 | 110 | //Modules must be children of the Module template |
| 111 | 111 | if (!is_subclass_of($loadModuleObj, 'Core\Modules\Module')) { |
| 112 | - throw new \ErrorException('Module ' . $loadModuleName . ' must be a sub class of module'); |
|
| 112 | + throw new \ErrorException('Module '.$loadModuleName.' must be a sub class of module'); |
|
| 113 | 113 | } |
| 114 | 114 | $loadedModule = new $loadModuleObj($this->container); |
| 115 | 115 | //we are not allowed to create public modules, they must be a placeholder ready |
| 116 | 116 | if (!property_exists($this, $loadModuleName)) { |
| 117 | - throw new \ErrorException('the protected or private variable of ' . $loadModuleName . ' is not present'); |
|
| 117 | + throw new \ErrorException('the protected or private variable of '.$loadModuleName.' is not present'); |
|
| 118 | 118 | } |
| 119 | 119 | $this->$loadModuleName = $loadedModule; |
| 120 | 120 | } |
@@ -131,23 +131,23 @@ discard block |
||
| 131 | 131 | $childClass = new \ReflectionClass(get_class($this)); |
| 132 | 132 | $childClassNamespace = $childClass->getNamespaceName(); |
| 133 | 133 | //check in classNameSpace |
| 134 | - if (class_exists($childClassNamespace . '\\Modules\\' . $loadModule)) { |
|
| 135 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', $childClassNamespace . '\\' . $loadModule); |
|
| 136 | - return $childClassNamespace . '\\' . $loadModule; |
|
| 134 | + if (class_exists($childClassNamespace.'\\Modules\\'.$loadModule)) { |
|
| 135 | + $this->addToDevHelper('module '.$loadModule.' loaded', $childClassNamespace.'\\'.$loadModule); |
|
| 136 | + return $childClassNamespace.'\\'.$loadModule; |
|
| 137 | 137 | } |
| 138 | 138 | //check in app |
| 139 | - if (class_exists('App\\Modules\\' . $loadModule)) { |
|
| 140 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', 'App\\Modules\\' . $loadModule); |
|
| 141 | - return 'App\\Modules\\' . $loadModule; |
|
| 139 | + if (class_exists('App\\Modules\\'.$loadModule)) { |
|
| 140 | + $this->addToDevHelper('module '.$loadModule.' loaded', 'App\\Modules\\'.$loadModule); |
|
| 141 | + return 'App\\Modules\\'.$loadModule; |
|
| 142 | 142 | } |
| 143 | 143 | //check in core, send error popup if overcharged |
| 144 | - if (class_exists('Core\\Modules\\' . $loadModule)) { |
|
| 145 | - $this->addToDevHelper('module ' . $loadModule . ' loaded', 'Core\\Modules\\' . $loadModule); |
|
| 146 | - return 'Core\\Modules\\' . $loadModule; |
|
| 144 | + if (class_exists('Core\\Modules\\'.$loadModule)) { |
|
| 145 | + $this->addToDevHelper('module '.$loadModule.' loaded', 'Core\\Modules\\'.$loadModule); |
|
| 146 | + return 'Core\\Modules\\'.$loadModule; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | //if we are here then no module found |
| 150 | - throw new \ErrorException('module ' . $loadModule . ' does not exist or not loaded'); |
|
| 150 | + throw new \ErrorException('module '.$loadModule.' does not exist or not loaded'); |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | public function getView($template) |
| 173 | 173 | { |
| 174 | 174 | $twig = $this->container->getTemplate(); |
| 175 | - return $twig->render($template . '.twig', $this->data); |
|
| 175 | + return $twig->render($template.'.twig', $this->data); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | $twig = $this->container->getTemplate(); |
| 201 | - $twig->display($template . '.twig', $this->data); |
|
| 201 | + $twig->display($template.'.twig', $this->data); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $user = $this->fetch(); |
| 147 | 147 | $linkValidTime = strtotime($user->reset_password_hash_generation_datetime); |
| 148 | 148 | $currentTime = time(); |
| 149 | - if($currentTime-$linkValidTime > Constant::PASSWORD_RESET_DURATION*60) |
|
| 149 | + if ($currentTime - $linkValidTime > Constant::PASSWORD_RESET_DURATION * 60) |
|
| 150 | 150 | { |
| 151 | 151 | //token is no longer valid |
| 152 | 152 | return false; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | //check if email is valid for sanity |
| 167 | 167 | if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
| 168 | 168 | $email = htmlspecialchars($email); |
| 169 | - throw new BlogocException("invalid email " . $email); |
|
| 169 | + throw new BlogocException("invalid email ".$email); |
|
| 170 | 170 | } |
| 171 | 171 | $sql = $this->baseSqlSelect(); |
| 172 | 172 | $sql .= " |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $this->bind(':roles_idroles', 1); |
| 215 | 215 | $this->execute(); |
| 216 | 216 | |
| 217 | - return (int)$this->dbh->lastInsertId(); |
|
| 217 | + return (int) $this->dbh->lastInsertId(); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if ($this->isAccountPasswordBlocked($user)) { |
| 248 | - $response->message = "too many bad passwords, account is blocked for " . Constant::LOCKOUT_MINUTES . " minutes"; |
|
| 248 | + $response->message = "too many bad passwords, account is blocked for ".Constant::LOCKOUT_MINUTES." minutes"; |
|
| 249 | 249 | return $response; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function reset($get) |
| 46 | 46 | { |
| 47 | 47 | //only get messages here |
| 48 | - if(!$this->startsWith(strtolower($get),"get")) |
|
| 48 | + if (!$this->startsWith(strtolower($get), "get")) |
|
| 49 | 49 | { |
| 50 | 50 | throw new \Exception("invalid call"); |
| 51 | 51 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $token = $this->request->getData("token"); |
| 55 | 55 | |
| 56 | 56 | //verify if token is valid |
| 57 | - if(!$this->userModel->getUserDetailsByToken($token)) |
|
| 57 | + if (!$this->userModel->getUserDetailsByToken($token)) |
|
| 58 | 58 | { |
| 59 | 59 | $this->alertBox->setAlert('Invalid reset token, please request a new password', 'error'); |
| 60 | 60 | $this->response->redirect(); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $error = false; |
| 79 | 79 | $registerErrors = new \stdClass(); |
| 80 | - if($password !== $confirm) |
|
| 80 | + if ($password !== $confirm) |
|
| 81 | 81 | { |
| 82 | 82 | $error = true; |
| 83 | 83 | $registerErrors->forgotPassword = "password and confirmation do not match"; |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | use Swift_Message; |
| 9 | 9 | use Swift_SmtpTransport; |
| 10 | 10 | |
| 11 | -class SendMail extends Module{ |
|
| 11 | +class SendMail extends Module { |
|
| 12 | 12 | |
| 13 | 13 | private $siteConfig; |
| 14 | 14 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // Create the Transport for mail sending |
| 26 | 26 | //$config = $this->siteConfig->getSiteConfig(); |
| 27 | - $this->transport = (new Swift_SmtpTransport($this->siteConfig["SMTP_server"], (int)$this->siteConfig["SMTP_port"])) |
|
| 27 | + $this->transport = (new Swift_SmtpTransport($this->siteConfig["SMTP_server"], (int) $this->siteConfig["SMTP_port"])) |
|
| 28 | 28 | ->setUsername($this->siteConfig["SMTP_user"]) |
| 29 | 29 | ->setPassword($this->siteConfig["SMTP_pass"]) |
| 30 | 30 | ; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $message = "<a href=\"".$url."\">Define new password</a>"; |
| 68 | 68 | |
| 69 | - $this->send($to, "Define Password", $message ); |
|
| 69 | + $this->send($to, "Define Password", $message); |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |