@@ -4,7 +4,7 @@ |
||
4 | 4 | interface CBHook { |
5 | 5 | |
6 | 6 | public function hookGetLogin(); |
7 | - public function hookPostLogin(); |
|
8 | - public function beforeBackendMiddleware($request); |
|
7 | + public function hookPostLogin(); |
|
8 | + public function beforeBackendMiddleware($request); |
|
9 | 9 | public function afterBackendMiddleware($request, $response); |
10 | 10 | } |
11 | 11 | \ No newline at end of file |
@@ -220,20 +220,20 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | if(!function_exists('extract_unit')) { |
223 | - /* |
|
223 | + /* |
|
224 | 224 | Credits: Bit Repository |
225 | 225 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
226 | 226 | */ |
227 | - function extract_unit($string, $start, $end) |
|
228 | - { |
|
229 | - $pos = stripos($string, $start); |
|
230 | - $str = substr($string, $pos); |
|
231 | - $str_two = substr($str, strlen($start)); |
|
232 | - $second_pos = stripos($str_two, $end); |
|
233 | - $str_three = substr($str_two, 0, $second_pos); |
|
234 | - $unit = trim($str_three); // remove whitespaces |
|
235 | - return $unit; |
|
236 | - } |
|
227 | + function extract_unit($string, $start, $end) |
|
228 | + { |
|
229 | + $pos = stripos($string, $start); |
|
230 | + $str = substr($string, $pos); |
|
231 | + $str_two = substr($str, strlen($start)); |
|
232 | + $second_pos = stripos($str_two, $end); |
|
233 | + $str_three = substr($str_two, 0, $second_pos); |
|
234 | + $unit = trim($str_three); // remove whitespaces |
|
235 | + return $unit; |
|
236 | + } |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /* |
@@ -407,22 +407,22 @@ discard block |
||
407 | 407 | } |
408 | 408 | |
409 | 409 | if(!function_exists('rrmdir')) { |
410 | - /* |
|
410 | + /* |
|
411 | 411 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
412 | 412 | */ |
413 | - function rrmdir($dir) { |
|
414 | - if (is_dir($dir)) { |
|
415 | - $objects = scandir($dir); |
|
416 | - foreach ($objects as $object) { |
|
417 | - if ($object != "." && $object != "..") { |
|
418 | - if (is_dir($dir."/".$object)) |
|
419 | - rrmdir($dir."/".$object); |
|
420 | - else |
|
421 | - unlink($dir."/".$object); |
|
422 | - } |
|
423 | - } |
|
424 | - rmdir($dir); |
|
425 | - } |
|
426 | - } |
|
413 | + function rrmdir($dir) { |
|
414 | + if (is_dir($dir)) { |
|
415 | + $objects = scandir($dir); |
|
416 | + foreach ($objects as $object) { |
|
417 | + if ($object != "." && $object != "..") { |
|
418 | + if (is_dir($dir."/".$object)) |
|
419 | + rrmdir($dir."/".$object); |
|
420 | + else |
|
421 | + unlink($dir."/".$object); |
|
422 | + } |
|
423 | + } |
|
424 | + rmdir($dir); |
|
425 | + } |
|
426 | + } |
|
427 | 427 | } |
428 | 428 |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | $parentPath = $this->getData("permalink"); |
203 | 203 | $parentTitle = $this->getData("page_title"); |
204 | 204 | $this->addActionButton($label,function($row) use ($label, $controllerName, $foreignKey, $additionalInfo, $parentPath, $parentTitle) { |
205 | - $actionParameters = [ |
|
206 | - "label"=>$label, |
|
207 | - "foreignKey"=>$foreignKey, |
|
208 | - "foreignValue"=>$row->primary_key, |
|
209 | - "parentPath"=>$parentPath, |
|
210 | - "parentTitle"=>$parentTitle |
|
211 | - ]; |
|
205 | + $actionParameters = [ |
|
206 | + "label"=>$label, |
|
207 | + "foreignKey"=>$foreignKey, |
|
208 | + "foreignValue"=>$row->primary_key, |
|
209 | + "parentPath"=>$parentPath, |
|
210 | + "parentTitle"=>$parentTitle |
|
211 | + ]; |
|
212 | 212 | |
213 | 213 | if(isset($additionalInfo) && is_callable($additionalInfo)) { |
214 | 214 | $additionalInfo = call_user_func($additionalInfo, $row); |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | - $actionHash = md5(serialize($actionParameters)); |
|
221 | - $actionHashToken = Cache::get("subModule".$actionHash); |
|
222 | - if(!$actionHashToken) { |
|
223 | - $actionHashToken = Str::random(5); |
|
224 | - Cache::forever("subModule".$actionHash, $actionHashToken); |
|
225 | - Cache::forever("subModule".$actionHashToken, $actionParameters); |
|
226 | - } |
|
220 | + $actionHash = md5(serialize($actionParameters)); |
|
221 | + $actionHashToken = Cache::get("subModule".$actionHash); |
|
222 | + if(!$actionHashToken) { |
|
223 | + $actionHashToken = Str::random(5); |
|
224 | + Cache::forever("subModule".$actionHash, $actionHashToken); |
|
225 | + Cache::forever("subModule".$actionHashToken, $actionParameters); |
|
226 | + } |
|
227 | 227 | |
228 | - return action(class_basename($controllerName)."@getSubModule",['subModuleKey'=>$actionHashToken])."?ref=".makeReferalUrl($parentTitle); |
|
228 | + return action(class_basename($controllerName)."@getSubModule",['subModuleKey'=>$actionHashToken])."?ref=".makeReferalUrl($parentTitle); |
|
229 | 229 | }, $condition, $font, $color); |
230 | 230 | |
231 | 231 | } |
@@ -37,8 +37,8 @@ |
||
37 | 37 | $this->menu = (!$this->menu)?cb()->find("cb_menus",["type"=>"path","path"=>request()->segment(2)]):$this->menu; |
38 | 38 | if($this->menu) { |
39 | 39 | $this->privilege = cb()->find("cb_role_privileges",[ |
40 | - "cb_menus_id"=>$this->menu->id, |
|
41 | - "cb_roles_id"=>cb()->session()->roleId() |
|
40 | + "cb_menus_id"=>$this->menu->id, |
|
41 | + "cb_roles_id"=>cb()->session()->roleId() |
|
42 | 42 | ]); |
43 | 43 | } |
44 | 44 | } |
@@ -132,9 +132,9 @@ |
||
132 | 132 | |
133 | 133 | // Update Login At |
134 | 134 | cb()->update("users", auth()->id(), [ |
135 | - "login_at"=>now()->format("Y-m-d H:i:s"), |
|
136 | - "ip_address"=>request()->ip(), |
|
137 | - "user_agent"=>request()->userAgent() |
|
135 | + "login_at"=>now()->format("Y-m-d H:i:s"), |
|
136 | + "ip_address"=>request()->ip(), |
|
137 | + "user_agent"=>request()->userAgent() |
|
138 | 138 | ]); |
139 | 139 | |
140 | 140 | // When login user success, clear suspend attempt |