@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->load_all_plugins= true; |
38 | 38 | $this->full_cache_file= $this->path."edit_area_full_with_plugins.js"; |
39 | 39 | $this->gzip_cache_file= $this->path."edit_area_full_with_plugins.gz"; |
40 | - }else{ |
|
40 | + } else{ |
|
41 | 41 | $this->load_all_plugins= false; |
42 | 42 | $this->full_cache_file= $this->path."edit_area_full.js"; |
43 | 43 | $this->gzip_cache_file= $this->path."edit_area_full.gz"; |
@@ -55,8 +55,9 @@ discard block |
||
55 | 55 | header("Content-type: text/javascript; charset: UTF-8"); |
56 | 56 | header("Vary: Accept-Encoding"); // Handle proxies |
57 | 57 | header(sprintf("Expires: %s GMT", gmdate("D, d M Y H:i:s", time() + $this->param['cache_duration'])) ); |
58 | - if($this->use_gzip) |
|
59 | - header("Content-Encoding: ".$this->gzip_enc_header); |
|
58 | + if($this->use_gzip) { |
|
59 | + header("Content-Encoding: ".$this->gzip_enc_header); |
|
60 | + } |
|
60 | 61 | } |
61 | 62 | |
62 | 63 | function check_gzip_use() |
@@ -64,14 +65,16 @@ discard block |
||
64 | 65 | $encodings = array(); |
65 | 66 | $desactivate_gzip=false; |
66 | 67 | |
67 | - if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) |
|
68 | - $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING']))); |
|
68 | + if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { |
|
69 | + $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING']))); |
|
70 | + } |
|
69 | 71 | |
70 | 72 | // desactivate gzip for IE version < 7 |
71 | 73 | if(preg_match("/(?:msie )([0-9.]+)/i", $_SERVER['HTTP_USER_AGENT'], $ie)) |
72 | 74 | { |
73 | - if($ie[1]<7) |
|
74 | - $desactivate_gzip=true; |
|
75 | + if($ie[1]<7) { |
|
76 | + $desactivate_gzip=true; |
|
77 | + } |
|
75 | 78 | } |
76 | 79 | |
77 | 80 | // Check for gzip header or northon internet securities |
@@ -79,7 +82,7 @@ discard block |
||
79 | 82 | $this->gzip_enc_header= in_array('x-gzip', $encodings) ? "x-gzip" : "gzip"; |
80 | 83 | $this->use_gzip=true; |
81 | 84 | $this->cache_file=$this->gzip_cache_file; |
82 | - }else{ |
|
85 | + } else{ |
|
83 | 86 | $this->use_gzip=false; |
84 | 87 | $this->cache_file=$this->full_cache_file; |
85 | 88 | } |
@@ -93,8 +96,9 @@ discard block |
||
93 | 96 | $cache_date=0; |
94 | 97 | if ($dir = opendir($this->path)) { |
95 | 98 | while (($file = readdir($dir)) !== false) { |
96 | - if(is_file($this->path.$file) && $file!="." && $file!="..") |
|
97 | - $cache_date= max($cache_date, filemtime($this->path.$file)); |
|
99 | + if(is_file($this->path.$file) && $file!="." && $file!="..") { |
|
100 | + $cache_date= max($cache_date, filemtime($this->path.$file)); |
|
101 | + } |
|
98 | 102 | } |
99 | 103 | closedir($dir); |
100 | 104 | } |
@@ -106,8 +110,9 @@ discard block |
||
106 | 110 | { |
107 | 111 | if ($file !== "." && $file !== "..") |
108 | 112 | { |
109 | - if(is_dir($plug_path.$file) && file_exists($plug_path.$file."/".$file.".js")) |
|
110 | - $cache_date= max($cache_date, filemtime("plugins/".$file."/".$file.".js")); |
|
113 | + if(is_dir($plug_path.$file) && file_exists($plug_path.$file."/".$file.".js")) { |
|
114 | + $cache_date= max($cache_date, filemtime("plugins/".$file."/".$file.".js")); |
|
115 | + } |
|
111 | 116 | } |
112 | 117 | } |
113 | 118 | closedir($dir); |
@@ -123,8 +128,7 @@ discard block |
||
123 | 128 | header("Last-modified: ".$last_modified); |
124 | 129 | header("Cache-Control: Public"); // Tells HTTP 1.1 clients to cache |
125 | 130 | header("Pragma:"); // Tells HTTP 1.0 clients to cache |
126 | - } |
|
127 | - else |
|
131 | + } else |
|
128 | 132 | { |
129 | 133 | header("Last-modified: ".$last_modified); |
130 | 134 | header("Cache-Control: Public"); // Tells HTTP 1.1 clients to cache |
@@ -207,8 +211,9 @@ discard block |
||
207 | 211 | { |
208 | 212 | if ($file !== "." && $file !== "..") |
209 | 213 | { |
210 | - if(is_dir($plug_path.$file) && file_exists($plug_path.$file."/".$file.".js")) |
|
211 | - $sub_scripts_list[]= "plugins/".$file."/".$file.".js"; |
|
214 | + if(is_dir($plug_path.$file) && file_exists($plug_path.$file."/".$file.".js")) { |
|
215 | + $sub_scripts_list[]= "plugins/".$file."/".$file.".js"; |
|
216 | + } |
|
212 | 217 | } |
213 | 218 | } |
214 | 219 | closedir($dir); |
@@ -247,22 +252,23 @@ discard block |
||
247 | 252 | 'Î' => '"', |
248 | 253 | 'Ï' => "\n", |
249 | 254 | 'À' => "\r"*/); |
250 | - } |
|
251 | - else |
|
255 | + } else |
|
252 | 256 | { |
253 | 257 | $last_comp = array(); |
254 | 258 | } |
255 | 259 | |
256 | 260 | $js_replace= ''; |
257 | - foreach( $last_comp as $key => $val ) |
|
258 | - $js_replace .= ".replace(/". $key ."/g,'". str_replace( array("\n", "\r"), array('\n','\r'), $val ) ."')"; |
|
261 | + foreach( $last_comp as $key => $val ) { |
|
262 | + $js_replace .= ".replace(/". $key ."/g,'". str_replace( array("\n", "\r"), array('\n','\r'), $val ) ."')"; |
|
263 | + } |
|
259 | 264 | |
260 | 265 | $this->datas.= sprintf("editAreaLoader.iframe_script= \"<script type='text/javascript'>%s</script>\"%s;\n", |
261 | 266 | str_replace( array_values($last_comp), array_keys($last_comp), $sub_scripts ), |
262 | 267 | $js_replace); |
263 | 268 | |
264 | - if($this->load_all_plugins) |
|
265 | - $this->datas.="editAreaLoader.all_plugins_loaded=true;\n"; |
|
269 | + if($this->load_all_plugins) { |
|
270 | + $this->datas.="editAreaLoader.all_plugins_loaded=true;\n"; |
|
271 | + } |
|
266 | 272 | |
267 | 273 | |
268 | 274 | // load the template |
@@ -283,7 +289,7 @@ discard block |
||
283 | 289 | $gzip_datas= gzencode($this->datas, 9, FORCE_GZIP); |
284 | 290 | $header.=sprintf("=> GZIP COMPRESSION => %s", strlen($gzip_datas)); |
285 | 291 | $ratio = round(100 - strlen($gzip_datas) / $this->file_loaded_size * 100.0); |
286 | - }else{ |
|
292 | + } else{ |
|
287 | 293 | $ratio = round(100 - strlen($this->datas) / $this->file_loaded_size * 100.0); |
288 | 294 | } |
289 | 295 | $header.=sprintf(", reduced by %s%%\n", $ratio); |
@@ -296,19 +302,22 @@ discard block |
||
296 | 302 | // generate gzip file and cahce it if using disk cache |
297 | 303 | if($this->use_gzip){ |
298 | 304 | $this->gzip_datas= gzencode($this->datas, 9, FORCE_GZIP); |
299 | - if($this->param['use_disk_cache']) |
|
300 | - $this->file_put_contents($this->gzip_cache_file, $this->gzip_datas, $mtime); |
|
305 | + if($this->param['use_disk_cache']) { |
|
306 | + $this->file_put_contents($this->gzip_cache_file, $this->gzip_datas, $mtime); |
|
307 | + } |
|
301 | 308 | } |
302 | 309 | |
303 | 310 | // generate full js file and cache it if using disk cache |
304 | - if($this->param['use_disk_cache']) |
|
305 | - $this->file_put_contents($this->full_cache_file, $this->datas, $mtime); |
|
311 | + if($this->param['use_disk_cache']) { |
|
312 | + $this->file_put_contents($this->full_cache_file, $this->datas, $mtime); |
|
313 | + } |
|
306 | 314 | |
307 | 315 | // generate output |
308 | - if($this->use_gzip) |
|
309 | - echo $this->gzip_datas; |
|
310 | - else |
|
311 | - echo $this->datas; |
|
316 | + if($this->use_gzip) { |
|
317 | + echo $this->gzip_datas; |
|
318 | + } else { |
|
319 | + echo $this->datas; |
|
320 | + } |
|
312 | 321 | |
313 | 322 | // die; |
314 | 323 | } |
@@ -325,7 +334,7 @@ discard block |
||
325 | 334 | fclose($fd); |
326 | 335 | return $content;*/ |
327 | 336 | return $this->file_get_contents($file); |
328 | - }else{ |
|
337 | + } else{ |
|
329 | 338 | $this->infos[]=sprintf("'%s' not loaded", $end_uri); |
330 | 339 | return ""; |
331 | 340 | } |
@@ -382,10 +391,11 @@ discard block |
||
382 | 391 | /*$pattern= array("/(\\\\)?\"/", '/\\\n/' , '/\\\r/' , "/(\r?\n)/"); |
383 | 392 | $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\\\n"$1+"');*/ |
384 | 393 | $pattern= array("/(\\\\)?\"/", '/\\\n/' , '/\\\r/' , "/(\r?\n)/"); |
385 | - if($this->param['compress']) |
|
386 | - $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\n'); |
|
387 | - else |
|
388 | - $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , "\\n\"\n+\""); |
|
394 | + if($this->param['compress']) { |
|
395 | + $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\n'); |
|
396 | + } else { |
|
397 | + $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , "\\n\"\n+\""); |
|
398 | + } |
|
389 | 399 | $str= preg_replace($pattern, $replace, $str); |
390 | 400 | } |
391 | 401 | |
@@ -407,8 +417,9 @@ discard block |
||
407 | 417 | |
408 | 418 | function file_put_contents($file, &$content, $mtime=-1) |
409 | 419 | { |
410 | - if($mtime==-1) |
|
411 | - $mtime=time(); |
|
420 | + if($mtime==-1) { |
|
421 | + $mtime=time(); |
|
422 | + } |
|
412 | 423 | $fp = @fopen($file, "wb"); |
413 | 424 | if ($fp) { |
414 | 425 | fwrite($fp, $content); |
@@ -30,7 +30,9 @@ |
||
30 | 30 | break; |
31 | 31 | } |
32 | 32 | } |
33 | - if (! $value) $value = []; |
|
33 | + if (! $value) { |
|
34 | + $value = []; |
|
35 | + } |
|
34 | 36 | } |
35 | 37 | } else { |
36 | 38 | $value = explode(";", $value); |
@@ -68,7 +68,9 @@ |
||
68 | 68 | |
69 | 69 | foreach ($selects_data as $d) { |
70 | 70 | $val = $d->{$select_field_alias}; |
71 | - if ($val == '' || ! $d->id) continue; |
|
71 | + if ($val == '' || ! $d->id) { |
|
72 | + continue; |
|
73 | + } |
|
72 | 74 | |
73 | 75 | $checked = ($value == $d->id) ? "checked" : ""; |
74 | 76 |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $columns_table[$index]['type_data'] = CRUDBooster::getFieldType($table, $field); |
364 | 364 | $columns_table[$index]['field'] = $table.'_'.$field; |
365 | 365 | $columns_table[$index]['field_raw'] = $table.'.'.$field; |
366 | - }else{ |
|
366 | + } else{ |
|
367 | 367 | $result->addselect($table.'.'.$field); |
368 | 368 | $columns_table[$index]['type_data'] = CRUDBooster::getFieldType($table, $field); |
369 | 369 | $columns_table[$index]['field'] = $field; |
@@ -1154,8 +1154,9 @@ discard block |
||
1154 | 1154 | $lastInsertId = $id = DB::table($this->table)->insertGetId($this->arr); |
1155 | 1155 | |
1156 | 1156 | //fix bug if primary key is uuid |
1157 | - if($this->arr[$this->primary_key]!=$id) |
|
1158 | - $id = $this->arr[$this->primary_key]; |
|
1157 | + if($this->arr[$this->primary_key]!=$id) { |
|
1158 | + $id = $this->arr[$this->primary_key]; |
|
1159 | + } |
|
1159 | 1160 | |
1160 | 1161 | //Looping Data Input Again After Insert |
1161 | 1162 | foreach ($this->data_inputan as $ro) { |
@@ -1350,7 +1351,9 @@ discard block |
||
1350 | 1351 | } |
1351 | 1352 | if ($ro['relationship_table'] && $ro["datatable_orig"] != "") { |
1352 | 1353 | $params = explode("|", $ro['datatable_orig']); |
1353 | - if(!isset($params[2])) $params[2] = "id"; |
|
1354 | + if(!isset($params[2])) { |
|
1355 | + $params[2] = "id"; |
|
1356 | + } |
|
1354 | 1357 | DB::table($params[0])->where($params[2], $id)->update([$params[1] => implode(",",$inputdata)]); |
1355 | 1358 | } |
1356 | 1359 | } |
@@ -502,22 +502,28 @@ |
||
502 | 502 | |
503 | 503 | </div> |
504 | 504 | |
505 | - <?php else:?> |
|
505 | + <?php else { |
|
506 | + :?> |
|
506 | 507 | |
507 | 508 | <div class="form-group"> |
508 | 509 | <label>{{$key}}</label> |
509 | 510 | <input type="text" name="option[{{$index}}][{{$key}}]" placeholder="{{$val->placeholder}}" value="{{$value}}" |
510 | 511 | class="form-control"> |
511 | 512 | </div> |
512 | - <?php endif;?> |
|
513 | - <?php else:?> |
|
513 | + <?php endif; |
|
514 | +} |
|
515 | +?> |
|
516 | + <?php else { |
|
517 | + :?> |
|
514 | 518 | |
515 | 519 | <div class="form-group"> |
516 | 520 | <label>{{$key}}</label> |
517 | 521 | <input type="text" name="option[{{$index}}][{{$key}}]" placeholder="{{$val}}" value="{{$value}}" class="form-control"> |
518 | 522 | </div> |
519 | 523 | |
520 | - <?php endif;?> |
|
524 | + <?php endif; |
|
525 | +} |
|
526 | +?> |
|
521 | 527 | <?php endforeach; endif;?> |
522 | 528 | |
523 | 529 |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | try{ |
592 | 592 | $id = DB::table($table)->insertGetId($row_assign); |
593 | 593 | DB::commit(); |
594 | - }catch (\Exception $e) |
|
594 | + } catch (\Exception $e) |
|
595 | 595 | { |
596 | 596 | DB::rollBack(); |
597 | 597 | throw new \Exception($e->getMessage()); |
@@ -658,11 +658,13 @@ discard block |
||
658 | 658 | } |
659 | 659 | |
660 | 660 | $this->hook_after($posts, $result); |
661 | - if($this->output) return response()->json($this->output); |
|
661 | + if($this->output) { |
|
662 | + return response()->json($this->output); |
|
663 | + } |
|
662 | 664 | |
663 | 665 | if($output == 'JSON') { |
664 | 666 | return response()->json($result, 200); |
665 | - }else{ |
|
667 | + } else{ |
|
666 | 668 | return $result; |
667 | 669 | } |
668 | 670 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | </script> |
62 | 62 | |
63 | 63 | <?php |
64 | - }else { |
|
64 | + } else { |
|
65 | 65 | echo $value; |
66 | 66 | } |
67 | 67 | ?> |
@@ -77,7 +77,7 @@ |
||
77 | 77 | </script> |
78 | 78 | @endif |
79 | 79 | <?php |
80 | - }else { |
|
80 | + } else { |
|
81 | 81 | echo $value; |
82 | 82 | } |
83 | 83 | ?> |
@@ -137,7 +137,9 @@ discard block |
||
137 | 137 | @foreach($table_columns as $k=>$column) |
138 | 138 | <?php |
139 | 139 | $help = ''; |
140 | - if ($column == 'id' || $column == 'created_at' || $column == 'updated_at' || $column == 'deleted_at') continue; |
|
140 | + if ($column == 'id' || $column == 'created_at' || $column == 'updated_at' || $column == 'deleted_at') { |
|
141 | + continue; |
|
142 | + } |
|
141 | 143 | if (substr($column, 0, 3) == 'id_') { |
142 | 144 | $relational_table = substr($column, 3); |
143 | 145 | $help = "<a href='#' title='This is foreign key, so the System will be inserting new data to table `$relational_table` if doesn`t exists'><strong>(?)</strong></a>"; |
@@ -151,7 +153,10 @@ discard block |
||
151 | 153 | |
152 | 154 | <tr> |
153 | 155 | @foreach($table_columns as $k=>$column) |
154 | - <?php if ($column == 'id' || $column == 'created_at' || $column == 'updated_at' || $column == 'deleted_at') continue;?> |
|
156 | + <?php if ($column == 'id' || $column == 'created_at' || $column == 'updated_at' || $column == 'deleted_at') { |
|
157 | + continue; |
|
158 | +} |
|
159 | +?> |
|
155 | 160 | <td data-no-column='{{$k}}'> |
156 | 161 | <select style='width:120px' class='form-control select_column' name='select_column[{{$k}}]'> |
157 | 162 | <option value=''>** Set Column for {{$column}}</option> |