@@ -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 | } |
@@ -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 |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | class CRUDBooster |
16 | 16 | { |
17 | 17 | /** |
18 | - * Comma-delimited data output from the child table |
|
19 | - */ |
|
18 | + * Comma-delimited data output from the child table |
|
19 | + */ |
|
20 | 20 | public static function echoSelect2Mult($values, $table, $id, $name) { |
21 | 21 | $values = explode(",", $values); |
22 | 22 | return implode(", ", DB::table($table)->whereIn($id, $values)->pluck($name)->toArray()); |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | @$mime_type = $mime_type[1]; |
44 | 44 | if ($mime_type) { |
45 | 45 | $filePath = 'uploads/'.$userID.'/'.date('Y-m'); |
46 | - Storage::makeDirectory($filePath); |
|
47 | - $filename = md5(str_random(5)).'.'.$mime_type; |
|
48 | - if (Storage::put($filePath.'/'.$filename, $filedata)) { |
|
49 | - self::resizeImage($filePath.'/'.$filename); |
|
46 | + Storage::makeDirectory($filePath); |
|
47 | + $filename = md5(str_random(5)).'.'.$mime_type; |
|
48 | + if (Storage::put($filePath.'/'.$filename, $filedata)) { |
|
49 | + self::resizeImage($filePath.'/'.$filename); |
|
50 | 50 | |
51 | - return $filePath.'/'.$filename; |
|
52 | - } |
|
51 | + return $filePath.'/'.$filename; |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -374,17 +374,17 @@ discard block |
||
374 | 374 | |
375 | 375 | public static function getCurrentModule() |
376 | 376 | { |
377 | - $modulepath = self::getModulePath(); |
|
377 | + $modulepath = self::getModulePath(); |
|
378 | 378 | |
379 | - if (Cache::has('moduls_'.$modulepath)) { |
|
380 | - return Cache::get('moduls_'.$modulepath); |
|
381 | - } else { |
|
379 | + if (Cache::has('moduls_'.$modulepath)) { |
|
380 | + return Cache::get('moduls_'.$modulepath); |
|
381 | + } else { |
|
382 | 382 | |
383 | - $module = DB::table('cms_moduls')->where('path', self::getModulePath())->first(); |
|
383 | + $module = DB::table('cms_moduls')->where('path', self::getModulePath())->first(); |
|
384 | 384 | |
385 | - //supply modulpath instead of $module incase where user decides to create form and custom url that does not exist in cms_moduls table. |
|
386 | - return ($module)?:$modulepath; |
|
387 | - } |
|
385 | + //supply modulpath instead of $module incase where user decides to create form and custom url that does not exist in cms_moduls table. |
|
386 | + return ($module)?:$modulepath; |
|
387 | + } |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | public static function getCurrentDashboardId() |
@@ -526,22 +526,22 @@ discard block |
||
526 | 526 | |
527 | 527 | public static function getModulePath() |
528 | 528 | { |
529 | - // Check to position of admin_path |
|
530 | - if(config("crudbooster.ADMIN_PATH")) { |
|
531 | - $adminPathSegments = explode('/', Request::path()); |
|
532 | - $no = 1; |
|
533 | - foreach($adminPathSegments as $path) { |
|
534 | - if($path == config("crudbooster.ADMIN_PATH")) { |
|
535 | - $segment = $no+1; |
|
536 | - break; |
|
537 | - } |
|
538 | - $no++; |
|
539 | - } |
|
540 | - } else { |
|
541 | - $segment = 1; |
|
542 | - } |
|
543 | - |
|
544 | - return Request::segment($segment); |
|
529 | + // Check to position of admin_path |
|
530 | + if(config("crudbooster.ADMIN_PATH")) { |
|
531 | + $adminPathSegments = explode('/', Request::path()); |
|
532 | + $no = 1; |
|
533 | + foreach($adminPathSegments as $path) { |
|
534 | + if($path == config("crudbooster.ADMIN_PATH")) { |
|
535 | + $segment = $no+1; |
|
536 | + break; |
|
537 | + } |
|
538 | + $no++; |
|
539 | + } |
|
540 | + } else { |
|
541 | + $segment = 1; |
|
542 | + } |
|
543 | + |
|
544 | + return Request::segment($segment); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | public static function mainpath($path = null) |
@@ -937,19 +937,19 @@ discard block |
||
937 | 937 | // } |
938 | 938 | // } |
939 | 939 | |
940 | - public static function findPrimaryKey($table) |
|
941 | - { |
|
942 | - if(!$table) |
|
943 | - { |
|
944 | - return 'id'; |
|
945 | - } |
|
940 | + public static function findPrimaryKey($table) |
|
941 | + { |
|
942 | + if(!$table) |
|
943 | + { |
|
944 | + return 'id'; |
|
945 | + } |
|
946 | 946 | |
947 | - $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey(); |
|
948 | - if(!$pk) { |
|
949 | - return null; |
|
950 | - } |
|
951 | - return $pk->getColumns()[0]; |
|
952 | - } |
|
947 | + $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey(); |
|
948 | + if(!$pk) { |
|
949 | + return null; |
|
950 | + } |
|
951 | + return $pk->getColumns()[0]; |
|
952 | + } |
|
953 | 953 | |
954 | 954 | public static function newId($table) |
955 | 955 | { |