@@ -91,7 +91,7 @@ |
||
91 | 91 | * return the entire session superglobal. mainly for debugging purposes |
92 | 92 | * @return mixed |
93 | 93 | */ |
94 | - public function getAllSessionVars(){ |
|
94 | + public function getAllSessionVars() { |
|
95 | 95 | return $_SESSION; |
96 | 96 | } |
97 | 97 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * fetches the result from an executed query |
102 | 102 | * @return array |
103 | 103 | */ |
104 | - protected function fetchAll(){ |
|
104 | + protected function fetchAll() { |
|
105 | 105 | return $this->stmt->fetchAll(); |
106 | 106 | } |
107 | 107 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * returns a single line from the executed query |
110 | 110 | * @return mixed |
111 | 111 | */ |
112 | - protected function fetch(){ |
|
112 | + protected function fetch() { |
|
113 | 113 | return $this->stmt->fetch(); |
114 | 114 | } |
115 | 115 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $table = $reflect->getShortName(); //this is to only get the model name, otherwise we get the full namespace |
137 | 137 | //since our models all end with Model, we should remove it. |
138 | 138 | $table = $this->removeFromEnd($table, 'Model'); |
139 | - $table = $table . 's'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s |
|
139 | + $table = $table.'s'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s |
|
140 | 140 | $table = strtolower($table); //the database names are in lowercase |
141 | 141 | } |
142 | 142 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | //if we are here, then table doesn't exist, check for view |
158 | - $view = 'v_' . $table; |
|
158 | + $view = 'v_'.$table; |
|
159 | 159 | $stmt->bindValue(':table', $view, PDO::PARAM_STR); |
160 | 160 | $stmt->execute(); |
161 | 161 | $exists = $stmt->rowCount() > 0; //will return 1 if table exists or 0 if non existant |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | * @param $table string the table name |
177 | 177 | * @return string |
178 | 178 | */ |
179 | - protected function getTablePrefix($table){ |
|
180 | - if(Config::TABLE_PREFIX != '') |
|
179 | + protected function getTablePrefix($table) { |
|
180 | + if (Config::TABLE_PREFIX != '') |
|
181 | 181 | { |
182 | 182 | $table = Config::TABLE_PREFIX.'_'.$table; |
183 | 183 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | protected function getRowById($rowId, $table = null): array |
249 | 249 | { |
250 | 250 | $tableName = $this->getTable($table); |
251 | - $idName = 'id' . $tableName; |
|
251 | + $idName = 'id'.$tableName; |
|
252 | 252 | $sql = "SELECT * FROM $tableName WHERE $idName = :rowId"; |
253 | 253 | $this->query($sql); |
254 | 254 | $this->bind(':rowId', $rowId); |
@@ -22,5 +22,5 @@ |
||
22 | 22 | const FRONT_PAGE_POSTS = 3; |
23 | 23 | const POSTS_PER_PAGE = 10; |
24 | 24 | |
25 | - const EXCERPT_WORD_COUNT =20; |
|
25 | + const EXCERPT_WORD_COUNT = 20; |
|
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function index() |
10 | 10 | { |
11 | - if(!$this->auth->isUser()){ |
|
11 | + if (!$this->auth->isUser()) { |
|
12 | 12 | $this->alertBox->setAlert("You must be connected to acces the admin interface", 'warning'); |
13 | 13 | $this->container->getResponse()->redirect(); |
14 | 14 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | } |
37 | 37 | if ($success) { |
38 | 38 | $this->alertBox->setAlert('Configuration updates successfully'); |
39 | - } else { |
|
39 | + }else { |
|
40 | 40 | $this->alertBox->setAlert('error in configuration update', 'error'); |
41 | 41 | } |
42 | 42 | $this->container->getResponse()->redirect('admin/config'); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | if (!$configModel->updateConfig($update->name, $update->value)) { |
39 | 39 | $result['success'] = false; |
40 | 40 | $result['errorId'][] = $update->name; |
41 | - } else { |
|
41 | + }else { |
|
42 | 42 | $result['successId'][] = $update->name; |
43 | 43 | } |
44 | 44 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | $this->session->set('user_role_name', 'Admin'); |
26 | 26 | $this->session->set('user_role_level', 2); |
27 | - $this->session->set('user_id',1); |
|
27 | + $this->session->set('user_id', 1); |
|
28 | 28 | $this->alertBox->setAlert('Connected as admin'); |
29 | 29 | $this->container->getResponse()->redirect('/admin/'); |
30 | 30 | } |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | - $filetowrite = $folder . $tempFile['name']; |
|
49 | + $filetowrite = $folder.$tempFile['name']; |
|
50 | 50 | move_uploaded_file($tempFile['tmp_name'], $filetowrite); |
51 | 51 | |
52 | 52 | // Respond to the successful upload with JSON. |
53 | 53 | echo json_encode(array('location' => $filetowrite)); |
54 | - } else { |
|
54 | + }else { |
|
55 | 55 | // Notify editor that the upload failed |
56 | 56 | echo json_encode(array('error' => 'Upload failed')); |
57 | 57 | } |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - $filetowrite = $this->imageFolder . $tempFile['name']; |
|
82 | + $filetowrite = $this->imageFolder.$tempFile['name']; |
|
83 | 83 | move_uploaded_file($tempFile['tmp_name'], $filetowrite); |
84 | 84 | |
85 | 85 | // Respond to the successful upload with JSON. |
86 | 86 | echo json_encode(array('location' => $filetowrite)); |
87 | - } else { |
|
87 | + }else { |
|
88 | 88 | // Notify editor that the upload failed |
89 | 89 | header("HTTP/1.1 500 Server Error"); |
90 | 90 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | { |
82 | 82 | //if the post already has the tag, do nothing |
83 | 83 | if($this->postHasTag($postId, $tagId)){ |
84 | - return; |
|
84 | + return; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $sql = "INSERT INTO $this->tagAssoTbl (post_idposts, tag_idtags) VALUES (:postId, :tagId)"; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use Core\Container; |
5 | 5 | use Core\Model; |
6 | 6 | |
7 | -class TagsModel extends Model{ |
|
7 | +class TagsModel extends Model { |
|
8 | 8 | |
9 | 9 | private $tagAssoTbl; |
10 | 10 | private $tagTbl; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->bind(':tagName', $tagName); |
41 | 41 | $this->execute(); |
42 | 42 | //if no rows, return zero |
43 | - if(!$this->stmt->rowCount() > 0){ |
|
43 | + if (!$this->stmt->rowCount() > 0) { |
|
44 | 44 | return 0; |
45 | 45 | } |
46 | 46 | return $this->stmt->fetchColumn(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function addTagToPost(int $postId, int $tagId) |
81 | 81 | { |
82 | 82 | //if the post already has the tag, do nothing |
83 | - if($this->postHasTag($postId, $tagId)){ |
|
83 | + if ($this->postHasTag($postId, $tagId)) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | //check if tag doesn't already exist |
103 | 103 | $tagId = $this->getTagId($tag); |
104 | - if($tagId === 0){ |
|
104 | + if ($tagId === 0) { |
|
105 | 105 | $tagId = $this->createNewTag($tag); |
106 | 106 | } |
107 | 107 | $this->addTagToPost($postId, $tagId); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public function removeTagFromPost(int $postId, int $tagId) |
117 | 117 | { |
118 | 118 | //if the tag isn't present, do nothing |
119 | - if(!$this->postHasTag($postId, $tagId)){ |
|
119 | + if (!$this->postHasTag($postId, $tagId)) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 |