Passed
Push — Comments ( 0e09d9...73e073 )
by Stone
02:13
created
Core/Modules/Debug.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 use Core\Constant;
6 6
 use \Core\Container;
7 7
 
8
-class Debug extends Module{
8
+class Debug extends Module {
9 9
 
10 10
     /**
11 11
      * Var dump a var
Please login to merge, or discard this patch.
App/Controllers/Admin/Home.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
         $this->onlyUser();
97 97
         $this->onlyPost();
98 98
 
99
-        $user = (object)$this->request->getDataFull();
99
+        $user = (object) $this->request->getDataFull();
100 100
         $redirectUrl = "/admin";
101 101
 
102 102
         if ($user->userId !== $this->session->get("userId") || isset($user->userRoleSelector) || isset($user->locked_out)) {
103 103
             //an admin is trying to update a user or form tampered with
104 104
             $this->onlyAdmin();
105
-            $redirectUrl = "/admin/home/view-user/" . $user->userId;
106
-        } else {
105
+            $redirectUrl = "/admin/home/view-user/".$user->userId;
106
+        }else {
107 107
             //set the role to the original state for update
108 108
             $beforeUser = $this->userModel->getUserDetailsById($user->userId);
109 109
             $user->userRoleSelector = $beforeUser->roles_idroles;
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
         $error = false;
118 118
         $registerErrors = new \stdClass();
119 119
 
120
-        if($userId == 1 && $user->userLockedOut == 1)
120
+        if ($userId == 1 && $user->userLockedOut == 1)
121 121
         {
122 122
             $error = true;
123 123
             $this->alertBox->setAlert("Original admin may not be deactivated", "error");
124 124
         }
125 125
 
126
-        if($userId == 1 && $user->userRoleSelector != 2)
126
+        if ($userId == 1 && $user->userRoleSelector != 2)
127 127
         {
128 128
             $error = true;
129 129
             $this->alertBox->setAlert("Original admin must stay admin", "error");
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             throw new \Exception("Error in passed ID");
205 205
         }
206 206
 
207
-        if($userId === 1)
207
+        if ($userId === 1)
208 208
         {
209 209
             $this->alertBox->setAlert('Original Admin can not be deleted', "error");
210 210
             $this->response->redirect("/admin/home/list-users");
Please login to merge, or discard this patch.
App/Controllers/Ajax/User.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Core\JsonException;
9 9
 use Core\Traits\StringFunctions;
10 10
 
11
-class User  extends AjaxController{
11
+class User  extends AjaxController {
12 12
 
13 13
     use StringFunctions;
14 14
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         //the router needs a parameter with get functions else throsw a wobbly
26 26
         //we pass a get variable and call the /controller/function/get?bla
27 27
         //for better use and security, we must pass "get" as the parameter
28
-        if(!$this->startsWith(strtolower($get),"get"))
28
+        if (!$this->startsWith(strtolower($get), "get"))
29 29
         {
30 30
             throw new JsonException("invalid call");
31 31
         }
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $this->onlyAdmin();
48 48
         $this->onlyPost();
49
-        $state = (bool)($this->request->getData("state") === 'true');
50
-        $userId = (int)$this->request->getData("userId");
49
+        $state = (bool) ($this->request->getData("state") === 'true');
50
+        $userId = (int) $this->request->getData("userId");
51 51
 
52 52
         $result = array();
53 53
         $result["success"] = false;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $result["userId"] = $userId;
56 56
 
57 57
         // we can not update the Original Admin activation state
58
-        if($userId !== 1)
58
+        if ($userId !== 1)
59 59
         {
60 60
             $result["success"] = $this->userModel->activateUser(!$state, $userId);
61 61
             $result["state"] = !$state;
Please login to merge, or discard this patch.
App/Modules/SendMail.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         ;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             ->setBody($message, 'text/html')
52 52
         ;
53 53
 
54
-        if($from === null)
54
+        if ($from === null)
55 55
         {
56 56
             //if we haven't set a from, get the config value
57 57
             $from = $this->siteConfig["SMTP_from"];
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $message = "<h1>Message from <a href='".$this->container->getRequest()->getBaseUrl()."'>".$this->siteConfig["site_name"]."</a></h1>";
78 78
         $message .= "<p>You have asked to reset your password, please click <a href=\"".$url."\">Here</a> to define a new password</p>";
79 79
 
80
-        $this->send($to, "Define New Password", $message );
80
+        $this->send($to, "Define New Password", $message);
81 81
 
82 82
     }
83 83
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $message .= "<p>You have sucsessfuly created an account, now all you need to do is <a href=\"".$url."\">Create your new password</a></p>";
98 98
         $message .= "<p>Have fun</p>";
99 99
 
100
-        $this->send($to, "Define Password at ".$this->siteConfig["site_name"], $message );
100
+        $this->send($to, "Define Password at ".$this->siteConfig["site_name"], $message);
101 101
 
102 102
     }
103 103
 }
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
Core/Constant.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@
 block discarded – undo
24 24
     const LIST_PER_PAGE = 10;
25 25
     const COMMENTS_PER_PAGE = 10;
26 26
 
27
-    const EXCERPT_WORD_COUNT =50;
27
+    const EXCERPT_WORD_COUNT = 50;
28 28
 
29 29
     //login security
30 30
     const NUMBER_OF_BAD_PASSWORD_TRIES = 3;
31 31
     const LOCKOUT_MINUTES = 5;
32 32
 
33
-    const PASSWORD_RESET_DURATION = 240;//number of minutes the reset password link is valid
33
+    const PASSWORD_RESET_DURATION = 240; //number of minutes the reset password link is valid
34 34
 
35 35
     const HASH_KEY = "1337blogOcPass159758348ShaQpiss";
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
App/Models/CommentModel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use Core\Container;
7 7
 use Core\Constant;
8 8
 
9
-class CommentModel extends Model{
9
+class CommentModel extends Model {
10 10
 
11 11
     private $commentTbl;
12 12
     private $userTbl;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function addComment(int $postId, int $userId, string $message):int
105 105
     {
106
-        $sql="
106
+        $sql = "
107 107
             INSERT INTO $this->commentTbl (users_idusers, posts_idposts, comment, approved)
108 108
             VALUES (:userId, :postId, :comment, 0)
109 109
         ";
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $this->bind(':comment', $message);
114 114
 
115 115
         $this->execute();
116
-        return (int)$this->dbh->lastInsertId();
116
+        return (int) $this->dbh->lastInsertId();
117 117
     }
118 118
 
119 119
 }
120 120
\ No newline at end of file
Please login to merge, or discard this patch.