@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | if (is_file($mapFilePath = $publicFilePath . '.map')) { |
| 174 | 174 | $mapMetadata = json_decode(file_get_contents($mapFilePath), true); |
| 175 | 175 | // if the file version is changed delete it first |
| 176 | - if ( ! hash_equals($fileVersion, $mapMetadata[ 'version' ])) { |
|
| 176 | + if ( ! hash_equals($fileVersion, $mapMetadata['version'])) { |
|
| 177 | 177 | unlink($publicFilePath); |
| 178 | 178 | unlink($publicMinifyFilePath); |
| 179 | 179 | unlink($mapFilePath); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | if ( ! empty($content)) { |
| 267 | 267 | $sourcesContent[] = $content; |
| 268 | 268 | } else { |
| 269 | - unset($sources[ $key ]); |
|
| 269 | + unset($sources[$key]); |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | if (is_file($mapFilePath = $publicFilePath . '.map')) { |
| 288 | 288 | $mapMetadata = json_decode(file_get_contents($mapFilePath), true); |
| 289 | 289 | // if the file version is changed delete it first |
| 290 | - if ( ! hash_equals($fileVersion, $mapMetadata[ 'version' ])) { |
|
| 290 | + if ( ! hash_equals($fileVersion, $mapMetadata['version'])) { |
|
| 291 | 291 | unlink($publicFilePath); |
| 292 | 292 | unlink($publicMinifyFilePath); |
| 293 | 293 | unlink($mapFilePath); |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | foreach ($this->javascripts as $javascript) { |
| 112 | 112 | if (in_array(pathinfo($javascript, PATHINFO_FILENAME), $unbundledFilenames)) { |
| 113 | 113 | $fileVersion = $this->getVersion(filemtime($javascript)); |
| 114 | - $output[] = '<script type="text/javascript" id="js-'.pathinfo($javascript, PATHINFO_FILENAME).'" src="' . $this->getUrl($javascript) . '?v=' . $fileVersion . '"></script>'; |
|
| 114 | + $output[] = '<script type="text/javascript" id="js-' . pathinfo($javascript, PATHINFO_FILENAME) . '" src="' . $this->getUrl($javascript) . '?v=' . $fileVersion . '"></script>'; |
|
| 115 | 115 | } elseif (in_array(pathinfo($javascript, PATHINFO_FILENAME), ['module', 'module.min'])) { |
| 116 | 116 | $modulePublicFile = $this->publishFile($javascript); |
| 117 | 117 | |
| 118 | - if (is_file($modulePublicFile[ 'filePath' ])) { |
|
| 118 | + if (is_file($modulePublicFile['filePath'])) { |
|
| 119 | 119 | if (input()->env('DEBUG_STAGE') === 'PRODUCTION') { |
| 120 | - $output[] = '<script type="text/javascript" id="js-module" src="' . $modulePublicFile[ 'minify' ][ 'url' ] . '?v=' . $modulePublicFile[ 'version' ] . '"></script>'; |
|
| 120 | + $output[] = '<script type="text/javascript" id="js-module" src="' . $modulePublicFile['minify']['url'] . '?v=' . $modulePublicFile['version'] . '"></script>'; |
|
| 121 | 121 | } else { |
| 122 | - $output[] = '<script type="text/javascript" id="js-module" src="' . $modulePublicFile[ 'url' ] . '?v=' . $modulePublicFile[ 'version' ] . '"></script>'; |
|
| 122 | + $output[] = '<script type="text/javascript" id="js-module" src="' . $modulePublicFile['url'] . '?v=' . $modulePublicFile['version'] . '"></script>'; |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } else { |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | if (count($bundleJavascriptSources)) { |
| 131 | 131 | $bundleJavascriptPublicFile = $this->bundleFile($bundleFilename . '.js', $bundleJavascriptSources); |
| 132 | 132 | |
| 133 | - if (is_file($bundleJavascriptPublicFile[ 'filePath' ])) { |
|
| 133 | + if (is_file($bundleJavascriptPublicFile['filePath'])) { |
|
| 134 | 134 | if (input()->env('DEBUG_STAGE') === 'PRODUCTION') { |
| 135 | - $output[] = '<script type="text/javascript" id="js-bundle" src="' . $bundleJavascriptPublicFile[ 'minify' ][ 'url' ] . '?v=' . $bundleJavascriptPublicFile[ 'version' ] . '"></script>'; |
|
| 135 | + $output[] = '<script type="text/javascript" id="js-bundle" src="' . $bundleJavascriptPublicFile['minify']['url'] . '?v=' . $bundleJavascriptPublicFile['version'] . '"></script>'; |
|
| 136 | 136 | } else { |
| 137 | - $output[] = '<script type="text/javascript" id="js-bundle" src="' . $bundleJavascriptPublicFile[ 'url' ] . '?v=' . $bundleJavascriptPublicFile[ 'version' ] . '"></script>'; |
|
| 137 | + $output[] = '<script type="text/javascript" id="js-bundle" src="' . $bundleJavascriptPublicFile['url'] . '?v=' . $bundleJavascriptPublicFile['version'] . '"></script>'; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | $args = func_get_args(); |
| 68 | 68 | |
| 69 | 69 | if (count($args)) { |
| 70 | - if (isset($GLOBALS[ $args[ 0 ] ])) { |
|
| 71 | - return $GLOBALS[ $args[ 0 ] ]; |
|
| 70 | + if (isset($GLOBALS[$args[0]])) { |
|
| 71 | + return $GLOBALS[$args[0]]; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return null; |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | $args = func_get_args(); |
| 94 | 94 | |
| 95 | 95 | if (count($args)) { |
| 96 | - if (isset($_ENV[ $args[ 0 ] ])) { |
|
| 97 | - return $_ENV[ $args[ 0 ] ]; |
|
| 96 | + if (isset($_ENV[$args[0]])) { |
|
| 97 | + return $_ENV[$args[0]]; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | return null; |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | $args = func_get_args(); |
| 196 | 196 | |
| 197 | 197 | if (count($args) == 1) { |
| 198 | - return o2system()->models->autoload($args[ 0 ]); |
|
| 198 | + return o2system()->models->autoload($args[0]); |
|
| 199 | 199 | } else if (count($args) == 2) { |
| 200 | - return o2system()->models->autoload($args[ 0 ], $args[ 1 ]); |
|
| 200 | + return o2system()->models->autoload($args[0], $args[1]); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return o2system()->models; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $args = func_get_args(); |
| 220 | 220 | |
| 221 | 221 | if (count($args)) { |
| 222 | - return o2system()->modules->getModule($args[ 0 ]); |
|
| 222 | + return o2system()->modules->getModule($args[0]); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | return o2system()->modules; |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | $args = func_get_args(); |
| 262 | 262 | |
| 263 | 263 | if (count($args)) { |
| 264 | - if (isset($_SESSION[ $args[ 0 ] ])) { |
|
| 265 | - return $_SESSION[ $args[ 0 ] ]; |
|
| 264 | + if (isset($_SESSION[$args[0]])) { |
|
| 265 | + return $_SESSION[$args[0]]; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | return null; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | ]); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $update[ 'id' ] = $child->id; |
|
| 88 | + $update['id'] = $child->id; |
|
| 89 | 89 | |
| 90 | 90 | if ($this->hasChilds($child->id)) { |
| 91 | 91 | $right = $this->rebuildTree($child->id, $right, $depth + 1); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ->update($update = [ |
| 96 | 96 | 'record_right' => $right, |
| 97 | 97 | ]); |
| 98 | - $update[ 'id' ] = $child->id; |
|
| 98 | + $update['id'] = $child->id; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $i++; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function getNumOfParents($id) |
| 212 | 212 | { |
| 213 | - if($parents = $this->getParents($id)) { |
|
| 213 | + if ($parents = $this->getParents($id)) { |
|
| 214 | 214 | return $parents->count(); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | public function getNumOfChilds($idParent, $direct = true) |
| 278 | 278 | { |
| 279 | - if($childs = $this->getChilds($idParent)) { |
|
| 279 | + if ($childs = $this->getChilds($idParent)) { |
|
| 280 | 280 | return $childs->count(); |
| 281 | 281 | } |
| 282 | 282 | |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if (method_exists($this, 'getRecordOrdering')) { |
| 44 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
| 45 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
| 44 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
| 45 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | if (method_exists($this, 'insertRecordSets')) { |
| 94 | 94 | foreach ($sets as $set) { |
| 95 | 95 | $this->insertRecordSets($set); |
| 96 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
| 97 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
| 96 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
| 97 | + $set['record_ordering'] = $this->getRecordOrdering($this->table); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
| 155 | 155 | |
| 156 | 156 | if (empty($conditions)) { |
| 157 | - if (isset($sets[ $primaryKey ])) { |
|
| 158 | - $conditions = [$primaryKey => $sets[ $primaryKey ]]; |
|
| 157 | + if (isset($sets[$primaryKey])) { |
|
| 158 | + $conditions = [$primaryKey => $sets[$primaryKey]]; |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | if (method_exists($this, 'getRecordOrdering')) { |
| 171 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
| 172 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
| 171 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
| 172 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
| 203 | 203 | |
| 204 | 204 | if (empty($conditions)) { |
| 205 | - if (isset($sets[ $primaryKey ])) { |
|
| 206 | - $conditions = [$primaryKey => $sets[ $primaryKey ]]; |
|
| 205 | + if (isset($sets[$primaryKey])) { |
|
| 206 | + $conditions = [$primaryKey => $sets[$primaryKey]]; |
|
| 207 | 207 | } else { |
| 208 | 208 | $conditions = $sets; |
| 209 | 209 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | if (method_exists($this, 'updateRecordSets')) { |
| 237 | 237 | foreach ($sets as $key => $set) { |
| 238 | - $this->updateRecordSets($sets[ $key ]); |
|
| 238 | + $this->updateRecordSets($sets[$key]); |
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | private function updateRecordStatus($id, $recordStatus, $method) |
| 385 | 385 | { |
| 386 | - $sets[ 'record_status' ] = $recordStatus; |
|
| 386 | + $sets['record_status'] = $recordStatus; |
|
| 387 | 387 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
| 388 | 388 | |
| 389 | 389 | if (method_exists($this, 'updateRecordSets')) { |
@@ -417,13 +417,13 @@ discard block |
||
| 417 | 417 | private function updateRecordStatusMany(array $ids, $recordStatus, $method) |
| 418 | 418 | { |
| 419 | 419 | if (count($ids)) { |
| 420 | - $sets[ 'record_status' ] = $recordStatus; |
|
| 420 | + $sets['record_status'] = $recordStatus; |
|
| 421 | 421 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
| 422 | 422 | |
| 423 | 423 | $this->qb->whereIn($primaryKey, $ids); |
| 424 | 424 | |
| 425 | 425 | if (method_exists($this, 'updateRecordSets')) { |
| 426 | - $this->updateRecordSets($sets[ $key ]); |
|
| 426 | + $this->updateRecordSets($sets[$key]); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | if (method_exists($this, $beforeMethod = 'before' . ucfirst($method))) { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | private function updateRecordStatusBy(array $conditions = [], $recordStatus, $method) |
| 456 | 456 | { |
| 457 | 457 | if (count($conditions)) { |
| 458 | - $sets[ 'record_status' ] = $recordStatus; |
|
| 458 | + $sets['record_status'] = $recordStatus; |
|
| 459 | 459 | |
| 460 | 460 | if (method_exists($this, 'updateRecordSets')) { |
| 461 | 461 | $this->updateRecordSets($sets); |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | private function updateRecordStatusManyBy($conditions = [], $recordStatus, $method) |
| 491 | 491 | { |
| 492 | 492 | if (count($conditions)) { |
| 493 | - $sets[ 'record_status' ] = $recordStatus; |
|
| 493 | + $sets['record_status'] = $recordStatus; |
|
| 494 | 494 | |
| 495 | 495 | if (method_exists($this, 'updateRecordSets')) { |
| 496 | 496 | $this->updateRecordSets($sets); |
@@ -99,64 +99,64 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
| 101 | 101 | |
| 102 | - if(is_null($this->recordUser)) { |
|
| 103 | - if(globals()->offsetExists('account')) { |
|
| 102 | + if (is_null($this->recordUser)) { |
|
| 103 | + if (globals()->offsetExists('account')) { |
|
| 104 | 104 | $this->setRecordUser(globals()->account->id); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if ( ! isset($sets[ 'record_status' ])) { |
|
| 109 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
| 108 | + if ( ! isset($sets['record_status'])) { |
|
| 109 | + $sets['record_status'] = $this->recordStatus; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | if (empty($this->primaryKeys)) { |
| 113 | 113 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
| 114 | 114 | |
| 115 | - if (isset($sets[ $primaryKey ])) { |
|
| 116 | - if (empty($sets[ $primaryKey ])) { |
|
| 117 | - unset($sets[ $primaryKey ]); |
|
| 115 | + if (isset($sets[$primaryKey])) { |
|
| 116 | + if (empty($sets[$primaryKey])) { |
|
| 117 | + unset($sets[$primaryKey]); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if (empty($sets[ $primaryKey ])) { |
|
| 122 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
| 123 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
| 121 | + if (empty($sets[$primaryKey])) { |
|
| 122 | + if ( ! isset($sets['record_create_user'])) { |
|
| 123 | + $sets['record_create_user'] = $this->recordUser; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
| 127 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
| 126 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
| 127 | + $sets['record_create_timestamp'] = $timestamp; |
|
| 128 | 128 | } elseif ($this->unixTimestamp) { |
| 129 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
| 129 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } else { |
| 133 | 133 | foreach ($this->primaryKeys as $primaryKey) { |
| 134 | - if (empty($sets[ $primaryKey ])) { |
|
| 135 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
| 136 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
| 134 | + if (empty($sets[$primaryKey])) { |
|
| 135 | + if ( ! isset($sets['record_create_user'])) { |
|
| 136 | + $sets['record_create_user'] = $this->recordUser; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
| 140 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
| 139 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
| 140 | + $sets['record_create_timestamp'] = $timestamp; |
|
| 141 | 141 | } elseif ($this->unixTimestamp) { |
| 142 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
| 142 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( ! isset($sets[ 'record_update_user' ])) { |
|
| 149 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
| 148 | + if ( ! isset($sets['record_update_user'])) { |
|
| 149 | + $sets['record_update_user'] = $this->recordUser; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
| 153 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
| 152 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
| 153 | + $sets['record_update_timestamp'] = $timestamp; |
|
| 154 | 154 | } elseif ($this->unixTimestamp) { |
| 155 | - $sets[ 'record_update_timestamp' ] = strtotime($sets[ 'record_update_timestamp' ]); |
|
| 155 | + $sets['record_update_timestamp'] = strtotime($sets['record_update_timestamp']); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if ( ! isset($sets[ 'record_ordering' ]) && $this->recordOrdering === true) { |
|
| 159 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering(); |
|
| 158 | + if ( ! isset($sets['record_ordering']) && $this->recordOrdering === true) { |
|
| 159 | + $sets['record_ordering'] = $this->getRecordOrdering(); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
@@ -169,24 +169,24 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | protected function updateRecordSets(array &$sets) |
| 171 | 171 | { |
| 172 | - if(is_null($this->recordUser)) { |
|
| 173 | - if(globals()->offsetExists('account')) { |
|
| 172 | + if (is_null($this->recordUser)) { |
|
| 173 | + if (globals()->offsetExists('account')) { |
|
| 174 | 174 | $this->setRecordUser(globals()->account->id); |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if ( ! isset($sets[ 'record_status' ])) { |
|
| 179 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
| 178 | + if ( ! isset($sets['record_status'])) { |
|
| 179 | + $sets['record_status'] = $this->recordStatus; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if ( ! isset($sets[ 'record_update_user' ])) { |
|
| 183 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
| 182 | + if ( ! isset($sets['record_update_user'])) { |
|
| 183 | + $sets['record_update_user'] = $this->recordUser; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
| 187 | 187 | |
| 188 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
| 189 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
| 188 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
| 189 | + $sets['record_update_timestamp'] = $timestamp; |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function getRecordOrdering() |
| 201 | 201 | { |
| 202 | - if($this->recordOrdering === true) { |
|
| 202 | + if ($this->recordOrdering === true) { |
|
| 203 | 203 | return $this->qb->countAllResults($this->table) + 1; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | if (isset($account)) { |
| 78 | 78 | foreach ($account as $key => $value) { |
| 79 | 79 | if (strpos($key, 'record') !== false) { |
| 80 | - unset($account[ $key ]); |
|
| 80 | + unset($account[$key]); |
|
| 81 | 81 | } elseif (in_array($key, |
| 82 | 82 | ['password', 'pin', 'token', 'sso', 'id_sys_user', 'id_sys_module', 'id_sys_module_role'])) { |
| 83 | - unset($account[ $key ]); |
|
| 83 | + unset($account[$key]); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $column = 'id'; |
| 110 | 110 | } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) { |
| 111 | 111 | $column = 'email'; |
| 112 | - } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) { |
|
| 112 | + } elseif (preg_match($this->config['msisdnRegex'], $username)) { |
|
| 113 | 113 | $column = 'msisdn'; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | public function loggedIn() |
| 132 | 132 | { |
| 133 | 133 | if (parent::loggedIn()) { |
| 134 | - $account = new Account($_SESSION[ 'account' ]); |
|
| 134 | + $account = new Account($_SESSION['account']); |
|
| 135 | 135 | |
| 136 | 136 | if ($user = models('users')->findWhere(['username' => $account->username], 1)) { |
| 137 | 137 | // Store Account Profile |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $column = 'id'; |
| 181 | 181 | } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) { |
| 182 | 182 | $column = 'email'; |
| 183 | - } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) { |
|
| 183 | + } elseif (preg_match($this->config['msisdnRegex'], $username)) { |
|
| 184 | 184 | $column = 'msisdn'; |
| 185 | 185 | } elseif (strpos($username, 'token-') !== false) { |
| 186 | 186 | $username = str_replace('token-', '', $username); |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | foreach ($account as $key => $value) { |
| 197 | 197 | if (strpos($key, 'record') !== false) { |
| 198 | - unset($account[ $key ]); |
|
| 198 | + unset($account[$key]); |
|
| 199 | 199 | } elseif (in_array($key, ['password', 'pin', 'token', 'sso'])) { |
| 200 | - unset($account[ $key ]); |
|
| 200 | + unset($account[$key]); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | if ($column === 'token') { |
| 205 | 205 | models('users')->update([ |
| 206 | - 'id' => $account[ 'id' ], |
|
| 206 | + 'id' => $account['id'], |
|
| 207 | 207 | 'token' => null, |
| 208 | 208 | ]); |
| 209 | 209 | } |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function authorize(ServerRequest $request) |
| 229 | 229 | { |
| 230 | - if (isset($GLOBALS[ 'account' ][ 'role' ])) { |
|
| 230 | + if (isset($GLOBALS['account']['role'])) { |
|
| 231 | 231 | $uriSegments = $request->getUri()->getSegments()->getString(); |
| 232 | - $role = $GLOBALS[ 'account' ][ 'role' ]; |
|
| 232 | + $role = $GLOBALS['account']['role']; |
|
| 233 | 233 | if (in_array($role->code, ['DEVELOPER', 'ADMINISTRATOR'])) { |
| 234 | 234 | globals()->store('authority', new Authority([ |
| 235 | 235 | 'permission' => 'GRANTED', |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | public function getIframeCode() |
| 270 | 270 | { |
| 271 | 271 | if ($this->signedOn() && $this->loggedIn() === false) { |
| 272 | - return '<iframe id="sign-on-iframe" width="1" height="1" src="' . rtrim($this->config[ 'sso' ][ 'server' ], |
|
| 272 | + return '<iframe id="sign-on-iframe" width="1" height="1" src="' . rtrim($this->config['sso']['server'], |
|
| 273 | 273 | '/') . '" style="display: none; visibility: hidden;"></iframe>'; |
| 274 | 274 | } |
| 275 | 275 | |