@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!function_exists('add_dot')) { |
|
2 | +if (!function_exists('add_dot')) { |
|
3 | 3 | /** |
4 | 4 | * @param array $array |
5 | 5 | * @return array |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | { |
9 | 9 | $count = count($array); |
10 | 10 | for ($i = 0; $i < $count; $i++) { |
11 | - $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :) |
|
11 | + $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :) |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | return $array; |
15 | 15 | } |
16 | 16 | } |
17 | 17 | |
18 | -if(!function_exists('determineIcon')) { |
|
18 | +if (!function_exists('determineIcon')) { |
|
19 | 19 | /** |
20 | 20 | * @param string $file |
21 | 21 | * @param string $selFile |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default']; |
35 | 35 | } |
36 | 36 | |
37 | - return '<i class="' . $icon . ' FilesPage"></i>'; |
|
37 | + return '<i class="'.$icon.' FilesPage"></i>'; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | -if(!function_exists('markRow')) { |
|
41 | +if (!function_exists('markRow')) { |
|
42 | 42 | /** |
43 | 43 | * @param string $file |
44 | 44 | * @param string $selFile |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | if ($file == $selFile) { |
56 | 56 | $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default']; |
57 | 57 | |
58 | - return ' class="' . $class . '"'; |
|
58 | + return ' class="'.$class.'"'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | return ''; |
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | -if(!function_exists('ls')) { |
|
65 | +if (!function_exists('ls')) { |
|
66 | 66 | /** |
67 | 67 | * @param string $curpath |
68 | 68 | */ |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx; |
73 | 73 | $dircounter = 0; |
74 | 74 | $filecounter = 0; |
75 | - $curpath = str_replace('//', '/', $curpath . '/'); |
|
75 | + $curpath = str_replace('//', '/', $curpath.'/'); |
|
76 | 76 | |
77 | 77 | if (!is_dir($curpath)) { |
78 | 78 | echo 'Invalid path "', $curpath, '"<br />'; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | // first, get info |
85 | 85 | foreach ($dir as $file) { |
86 | - $newpath = $curpath . $file; |
|
86 | + $newpath = $curpath.$file; |
|
87 | 87 | if ($file === '..' || $file === '.') { |
88 | 88 | continue; |
89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if ($file === '..' || $file === '.') { |
94 | 94 | continue; |
95 | 95 | } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) { |
96 | - $dirs_array[$dircounter]['text'] = '<i class="' . $_style['files_folder'] . ' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path=' . urlencode($newpath) . '"><b>' . $file . '</b></a>'; |
|
96 | + $dirs_array[$dircounter]['text'] = '<i class="'.$_style['files_folder'].' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path='.urlencode($newpath).'"><b>'.$file.'</b></a>'; |
|
97 | 97 | |
98 | 98 | $dfiles = scandir($newpath); |
99 | 99 | foreach ($dfiles as $i => $infile) { |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | } |
107 | 107 | $file_exists = (0 < count($dfiles)) ? 'file_exists' : ''; |
108 | 108 | |
109 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\'' . urlencode($file) . '\',\'' . $file_exists . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></a>' : ''; |
|
109 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\''.urlencode($file).'\',\''.$file_exists.'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></a>' : ''; |
|
110 | 110 | } else { |
111 | - $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>'; |
|
112 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : ''; |
|
111 | + $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>'; |
|
112 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : ''; |
|
113 | 113 | } |
114 | 114 | |
115 | - $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : ''; |
|
115 | + $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : ''; |
|
116 | 116 | |
117 | 117 | // increment the counter |
118 | 118 | $dircounter++; |
@@ -121,24 +121,24 @@ discard block |
||
121 | 121 | $files_array[$filecounter]['file'] = $newpath; |
122 | 122 | $files_array[$filecounter]['stats'] = lstat($newpath); |
123 | 123 | $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], |
124 | - $_REQUEST['mode']) . ' ' . $file; |
|
124 | + $_REQUEST['mode']).' '.$file; |
|
125 | 125 | $files_array[$filecounter]['view'] = (in_array($type, |
126 | - $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath, |
|
126 | + $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath, |
|
127 | 127 | $len, |
128 | - strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type, |
|
129 | - $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode', |
|
128 | + strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type, |
|
129 | + $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode', |
|
130 | 130 | explode('/', substr($newpath, $len, |
131 | - strlen($newpath))))) . '" style="cursor:pointer;"><i class="' . $_style['files_download'] . '" title="' . $_lang['file_download_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></span>'); |
|
131 | + strlen($newpath))))).'" style="cursor:pointer;"><i class="'.$_style['files_download'].'" title="'.$_lang['file_download_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></span>'); |
|
132 | 132 | $files_array[$filecounter]['view'] = (in_array($type, |
133 | - $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path=' . urlencode($newpath) . '"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : $files_array[$filecounter]['view']; |
|
134 | - $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_unzip'] . '" title="' . $_lang['file_download_unzip'] . '"></i></a>' : ''; |
|
133 | + $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path='.urlencode($newpath).'"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : $files_array[$filecounter]['view']; |
|
134 | + $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\''.urlencode($file).'\');"><i class="'.$_style['files_unzip'].'" title="'.$_lang['file_download_unzip'].'"></i></a>' : ''; |
|
135 | 135 | $files_array[$filecounter]['edit'] = (in_array($type, |
136 | - $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path=' . urlencode($newpath) . '#file_editfile"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></span>'; |
|
136 | + $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path='.urlencode($newpath).'#file_editfile"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></span>'; |
|
137 | 137 | $files_array[$filecounter]['duplicate'] = (in_array($type, |
138 | - $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_duplicate'] . '" title="' . $_lang['duplicate'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_duplicate'] . '" align="absmiddle" title="' . $_lang['duplicate'] . '"></i></span>'; |
|
138 | + $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\''.urlencode($file).'\');"><i class="'.$_style['files_duplicate'].'" title="'.$_lang['duplicate'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_duplicate'].'" align="absmiddle" title="'.$_lang['duplicate'].'"></i></span>'; |
|
139 | 139 | $files_array[$filecounter]['rename'] = (in_array($type, |
140 | - $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></span>'; |
|
141 | - $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></span>'; |
|
140 | + $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></span>'; |
|
141 | + $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\''.urlencode($file).'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></span>'; |
|
142 | 142 | |
143 | 143 | // increment the counter |
144 | 144 | $filecounter++; |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | for ($i = 0; $i < $folders; $i++) { |
152 | 152 | $filesizes += $dirs_array[$i]['stats']['7']; |
153 | 153 | echo '<tr>'; |
154 | - echo '<td>' . $dirs_array[$i]['text'] . '</td>'; |
|
155 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>'; |
|
156 | - echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>'; |
|
154 | + echo '<td>'.$dirs_array[$i]['text'].'</td>'; |
|
155 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>'; |
|
156 | + echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>'; |
|
157 | 157 | echo '<td class="actions text-right">'; |
158 | 158 | echo $dirs_array[$i]['rename']; |
159 | 159 | echo $dirs_array[$i]['delete']; |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | sort($files_array); // sorting the array alphabetically (Thanks pxl8r!) |
167 | 167 | for ($i = 0; $i < $files; $i++) { |
168 | 168 | $filesizes += $files_array[$i]['stats']['7']; |
169 | - echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>'; |
|
170 | - echo '<td>' . $files_array[$i]['text'] . '</td>'; |
|
171 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>'; |
|
172 | - echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>'; |
|
169 | + echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>'; |
|
170 | + echo '<td>'.$files_array[$i]['text'].'</td>'; |
|
171 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>'; |
|
172 | + echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>'; |
|
173 | 173 | echo '<td class="actions text-right">'; |
174 | 174 | echo $files_array[$i]['unzip']; |
175 | 175 | echo $files_array[$i]['view']; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | -if(!function_exists('removeLastPath')) { |
|
188 | +if (!function_exists('removeLastPath')) { |
|
189 | 189 | /** |
190 | 190 | * @param string $string |
191 | 191 | * @return bool|string |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | -if(!function_exists('getExtension')) { |
|
206 | +if (!function_exists('getExtension')) { |
|
207 | 207 | /** |
208 | 208 | * @param string $string |
209 | 209 | * @return bool|string |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | -if(!function_exists('checkExtension')) { |
|
225 | +if (!function_exists('checkExtension')) { |
|
226 | 226 | /** |
227 | 227 | * @param string $path |
228 | 228 | * @return bool |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | -if(!function_exists('mkdirs')) { |
|
242 | +if (!function_exists('mkdirs')) { |
|
243 | 243 | /** |
244 | 244 | * recursive mkdir function |
245 | 245 | * |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | -if(!function_exists('logFileChange')) { |
|
264 | +if (!function_exists('logFileChange')) { |
|
265 | 265 | /** |
266 | 266 | * @param string $type |
267 | 267 | * @param string $filename |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | -if(!function_exists('unzip')) { |
|
300 | +if (!function_exists('unzip')) { |
|
301 | 301 | /** |
302 | 302 | * by patrick_allaert - php user notes |
303 | 303 | * |
@@ -321,17 +321,17 @@ discard block |
||
321 | 321 | $zip = zip_open($file); |
322 | 322 | if ($zip) { |
323 | 323 | $old_umask = umask(0); |
324 | - $path = rtrim($path, '/') . '/'; |
|
324 | + $path = rtrim($path, '/').'/'; |
|
325 | 325 | while ($zip_entry = zip_read($zip)) { |
326 | 326 | if (zip_entry_filesize($zip_entry) > 0) { |
327 | 327 | // str_replace must be used under windows to convert "/" into "\" |
328 | 328 | $zip_entry_name = zip_entry_name($zip_entry); |
329 | - $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name)); |
|
330 | - $complete_name = $path . str_replace('\\', '/', $zip_entry_name); |
|
329 | + $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name)); |
|
330 | + $complete_name = $path.str_replace('\\', '/', $zip_entry_name); |
|
331 | 331 | if (!file_exists($complete_path)) { |
332 | 332 | $tmp = ''; |
333 | 333 | foreach (explode('/', $complete_path) AS $k) { |
334 | - $tmp .= $k . '/'; |
|
334 | + $tmp .= $k.'/'; |
|
335 | 335 | if (!is_dir($tmp)) { |
336 | 336 | mkdir($tmp, 0777); |
337 | 337 | } |
@@ -352,14 +352,14 @@ discard block |
||
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | -if(!function_exists('rrmdir')) { |
|
355 | +if (!function_exists('rrmdir')) { |
|
356 | 356 | /** |
357 | 357 | * @param string $dir |
358 | 358 | * @return bool |
359 | 359 | */ |
360 | 360 | function rrmdir($dir) |
361 | 361 | { |
362 | - foreach (glob($dir . '/*') as $file) { |
|
362 | + foreach (glob($dir.'/*') as $file) { |
|
363 | 363 | if (is_dir($file)) { |
364 | 364 | rrmdir($file); |
365 | 365 | } else { |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | -if(!function_exists('fileupload')) { |
|
374 | +if (!function_exists('fileupload')) { |
|
375 | 375 | /** |
376 | 376 | * @return string |
377 | 377 | */ |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | $userfile['type'] = $_FILES['userfile']['type'][$i]; |
402 | 402 | |
403 | 403 | // this seems to be an upload action. |
404 | - $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
405 | - $path = rtrim($path, '/') . '/' . $userfile['name']; |
|
404 | + $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
405 | + $path = rtrim($path, '/').'/'.$userfile['name']; |
|
406 | 406 | $msg .= $path; |
407 | 407 | if ($userfile['error'] == 0) { |
408 | 408 | $img = (strpos($userfile['type'], |
409 | - 'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : ''; |
|
410 | - $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>'; |
|
409 | + 'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : ''; |
|
410 | + $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>'; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | $userfilename = $userfile['tmp_name']; |
@@ -415,15 +415,15 @@ discard block |
||
415 | 415 | if (is_uploaded_file($userfilename)) { |
416 | 416 | // file is uploaded file, process it! |
417 | 417 | if (!checkExtension($userfile['name'])) { |
418 | - $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>'; |
|
418 | + $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>'; |
|
419 | 419 | } else { |
420 | - if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) { |
|
420 | + if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) { |
|
421 | 421 | // Ryan: Repair broken permissions issue with file manager |
422 | 422 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
423 | - @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions); |
|
423 | + @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions); |
|
424 | 424 | } |
425 | 425 | // Ryan: End |
426 | - $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>'; |
|
426 | + $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>'; |
|
427 | 427 | |
428 | 428 | // invoke OnFileManagerUpload event |
429 | 429 | $modx->invokeEvent('OnFileManagerUpload', array( |
@@ -431,13 +431,13 @@ discard block |
||
431 | 431 | 'filename' => $userfile['name'] |
432 | 432 | )); |
433 | 433 | // Log the change |
434 | - logFileChange('upload', $_POST['path'] . '/' . $userfile['name']); |
|
434 | + logFileChange('upload', $_POST['path'].'/'.$userfile['name']); |
|
435 | 435 | } else { |
436 | - $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>'; |
|
436 | + $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>'; |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | } else { |
440 | - $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>'; |
|
440 | + $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>'; |
|
441 | 441 | switch ($userfile['error']) { |
442 | 442 | case 0: //no error; possible file attack! |
443 | 443 | $msg .= $_lang['files_upload_error0']; |
@@ -462,11 +462,11 @@ discard block |
||
462 | 462 | } |
463 | 463 | } |
464 | 464 | |
465 | - return $msg . '<br/>'; |
|
465 | + return $msg.'<br/>'; |
|
466 | 466 | } |
467 | 467 | } |
468 | 468 | |
469 | -if(!function_exists('textsave')) { |
|
469 | +if (!function_exists('textsave')) { |
|
470 | 470 | /** |
471 | 471 | * @return string |
472 | 472 | */ |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | |
481 | 481 | // Write $content to our opened file. |
482 | 482 | if (file_put_contents($filename, $content) === false) { |
483 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />'; |
|
483 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />'; |
|
484 | 484 | } else { |
485 | - $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />'; |
|
485 | + $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />'; |
|
486 | 486 | $_REQUEST['mode'] = 'edit'; |
487 | 487 | } |
488 | 488 | // Log the change |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | } |
493 | 493 | } |
494 | 494 | |
495 | -if(!function_exists('delete_file')) { |
|
495 | +if (!function_exists('delete_file')) { |
|
496 | 496 | /** |
497 | 497 | * @return string |
498 | 498 | */ |
@@ -504,9 +504,9 @@ discard block |
||
504 | 504 | |
505 | 505 | $file = $_REQUEST['path']; |
506 | 506 | if (!$token_check || !@unlink($file)) { |
507 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />'; |
|
507 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />'; |
|
508 | 508 | } else { |
509 | - $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />'; |
|
509 | + $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />'; |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | // Log the change |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
519 | -if(!function_exists('parsePlaceholder')) { |
|
519 | +if (!function_exists('parsePlaceholder')) { |
|
520 | 520 | /** |
521 | 521 | * @param string $tpl |
522 | 522 | * @param array $ph |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -if(!function_exists('checkToken')) { |
|
536 | +if (!function_exists('checkToken')) { |
|
537 | 537 | /** |
538 | 538 | * @return bool |
539 | 539 | */ |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | -if(!function_exists('makeToken')) { |
|
561 | +if (!function_exists('makeToken')) { |
|
562 | 562 | /** |
563 | 563 | * @return string |
564 | 564 | */ |
@@ -887,7 +887,7 @@ |
||
887 | 887 | $complete_name = $path . str_replace('\\', '/', $zip_entry_name); |
888 | 888 | if (!file_exists($complete_path)) { |
889 | 889 | $tmp = ''; |
890 | - foreach (explode('/', $complete_path) AS $k) { |
|
890 | + foreach (explode('/', $complete_path) as $k) { |
|
891 | 891 | $tmp .= $k . '/'; |
892 | 892 | if (!is_dir($tmp)) { |
893 | 893 | mkdir($tmp, 0777); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | if(!function_exists('removeLastPath')) { |
189 | 189 | /** |
190 | 190 | * @param string $string |
191 | - * @return bool|string |
|
191 | + * @return string|false |
|
192 | 192 | */ |
193 | 193 | function removeLastPath($string) |
194 | 194 | { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | if(!function_exists('getExtension')) { |
207 | 207 | /** |
208 | 208 | * @param string $string |
209 | - * @return bool|string |
|
209 | + * @return string|false |
|
210 | 210 | * |
211 | 211 | * @TODO: not work if $string contains folder name with dot |
212 | 212 | */ |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!function_exists('import_sql')) { |
|
2 | +if (!function_exists('import_sql')) { |
|
3 | 3 | /** |
4 | 4 | * @param string $source |
5 | 5 | * @param string $result_code |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -if(!function_exists('dumpSql')) { |
|
43 | +if (!function_exists('dumpSql')) { |
|
44 | 44 | /** |
45 | 45 | * @param string $dumpstring |
46 | 46 | * @return bool |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -if(!function_exists('snapshot')) { |
|
69 | +if (!function_exists('snapshot')) { |
|
70 | 70 | /** |
71 | 71 | * @param string $dumpstring |
72 | 72 | * @return bool |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -if(!function_exists('getSettings')) { |
|
83 | +if (!function_exists('getSettings')) { |
|
84 | 84 | /** |
85 | 85 | * @return array |
86 | 86 | */ |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -if(!function_exists('restoreSettings')) { |
|
110 | +if (!function_exists('restoreSettings')) { |
|
111 | 111 | /** |
112 | 112 | * @param array $settings |
113 | 113 | */ |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | -if(!function_exists('parsePlaceholder')) { |
|
125 | +if (!function_exists('parsePlaceholder')) { |
|
126 | 126 | /** |
127 | 127 | * @param string $tpl |
128 | 128 | * @param array $ph |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!function_exists('render_form')) { |
|
3 | +if (!function_exists('render_form')) { |
|
4 | 4 | /** |
5 | 5 | * @param string $name |
6 | 6 | * @param string $label |
@@ -403,10 +403,12 @@ |
||
403 | 403 | $failedlogins += 1; |
404 | 404 | |
405 | 405 | $fields = array('failedlogincount' => $failedlogins); |
406 | - if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
406 | + if ($failedlogins >= $failed_allowed) { |
|
407 | + //block user for too many fail attempts |
|
407 | 408 | { |
408 | 409 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
409 | 410 | } |
411 | + } |
|
410 | 412 | |
411 | 413 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
412 | 414 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if(!function_exists('duplicateDocument')) { |
|
39 | +if (!function_exists('duplicateDocument')) { |
|
40 | 40 | /** |
41 | 41 | * @param int $docid |
42 | 42 | * @param null|int $parent |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), |
91 | 91 | "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
92 | 92 | if ($count >= 1) { |
93 | - $count = ' ' . ($count + 1); |
|
93 | + $count = ' '.($count + 1); |
|
94 | 94 | } else { |
95 | 95 | $count = ''; |
96 | 96 | } |
97 | 97 | |
98 | - $content['pagetitle'] = $_lang['duplicated_el_suffix'] . $count . ' ' . $content['pagetitle']; |
|
98 | + $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
99 | 99 | $content['alias'] = null; |
100 | 100 | } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
101 | 101 | $content['alias'] = null; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | -if(!function_exists('duplicateTVs')) { |
|
156 | +if (!function_exists('duplicateTVs')) { |
|
157 | 157 | /** |
158 | 158 | * Duplicate Document TVs |
159 | 159 | * |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | |
167 | 167 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
168 | 168 | |
169 | - $newid = (int)$newid; |
|
170 | - $oldid = (int)$oldid; |
|
169 | + $newid = (int) $newid; |
|
170 | + $oldid = (int) $oldid; |
|
171 | 171 | |
172 | 172 | $modx->db->insert( |
173 | 173 | array('contentid' => '', 'tmplvarid' => '', 'value' => ''), $tbltvc, // Insert into |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | -if(!function_exists('duplicateAccess')) { |
|
179 | +if (!function_exists('duplicateAccess')) { |
|
180 | 180 | /** |
181 | 181 | * Duplicate Document Access Permissions |
182 | 182 | * |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | |
190 | 190 | $tbldg = $modx->getFullTableName('document_groups'); |
191 | 191 | |
192 | - $newid = (int)$newid; |
|
193 | - $oldid = (int)$oldid; |
|
192 | + $newid = (int) $newid; |
|
193 | + $oldid = (int) $oldid; |
|
194 | 194 | |
195 | 195 | $modx->db->insert( |
196 | 196 | array('document' => '', 'document_group' => ''), $tbldg, // Insert into |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | -if(!function_exists('evalModule')) { |
|
202 | +if (!function_exists('evalModule')) { |
|
203 | 203 | /** |
204 | 204 | * evalModule |
205 | 205 | * |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | } |
236 | 236 | if ($modx->config['error_reporting'] === '99' || 2 < $error_level) { |
237 | 237 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], |
238 | - $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
238 | + $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
239 | 239 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
240 | 240 | } |
241 | 241 | } |
242 | 242 | unset($modx->event->params); |
243 | 243 | |
244 | - return $mod . $msg; |
|
244 | + return $mod.$msg; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | -if(!function_exists('allChildren')) { |
|
248 | +if (!function_exists('allChildren')) { |
|
249 | 249 | /** |
250 | 250 | * @param int $currDocID |
251 | 251 | * @return array |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | -if(!function_exists('jsAlert')) { |
|
268 | +if (!function_exists('jsAlert')) { |
|
269 | 269 | /** |
270 | 270 | * show javascript alert |
271 | 271 | * |
@@ -275,14 +275,14 @@ discard block |
||
275 | 275 | { |
276 | 276 | $modx = evolutionCMS(); |
277 | 277 | if ($_POST['ajax'] != 1) { |
278 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
278 | + echo "<script>window.setTimeout(\"alert('".addslashes($modx->db->escape($msg))."')\",10);history.go(-1)</script>"; |
|
279 | 279 | } else { |
280 | - echo $msg . "\n"; |
|
280 | + echo $msg."\n"; |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
285 | -if(!function_exists('login')) { |
|
285 | +if (!function_exists('login')) { |
|
286 | 286 | /** |
287 | 287 | * @param string $username |
288 | 288 | * @param string $givenPassword |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | -if(!function_exists('loginV1')) { |
|
300 | +if (!function_exists('loginV1')) { |
|
301 | 301 | /** |
302 | 302 | * @param int $internalKey |
303 | 303 | * @param string $givenPassword |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
333 | -if(!function_exists('loginMD5')) { |
|
333 | +if (!function_exists('loginMD5')) { |
|
334 | 334 | /** |
335 | 335 | * @param int $internalKey |
336 | 336 | * @param string $givenPassword |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | -if(!function_exists('updateNewHash')) { |
|
354 | +if (!function_exists('updateNewHash')) { |
|
355 | 355 | /** |
356 | 356 | * @param string $username |
357 | 357 | * @param string $password |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
369 | -if(!function_exists('incrementFailedLoginCount')) { |
|
369 | +if (!function_exists('incrementFailedLoginCount')) { |
|
370 | 370 | /** |
371 | 371 | * @param int $internalKey |
372 | 372 | * @param int $failedlogins |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | if ($failedlogins < $failed_allowed) { |
391 | 391 | //sleep to help prevent brute force attacks |
392 | - $sleep = (int)$failedlogins / 2; |
|
392 | + $sleep = (int) $failedlogins / 2; |
|
393 | 393 | if ($sleep > 5) { |
394 | 394 | $sleep = 5; |
395 | 395 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
405 | -if(!function_exists('saveUserGroupAccessPermissons')) { |
|
405 | +if (!function_exists('saveUserGroupAccessPermissons')) { |
|
406 | 406 | /** |
407 | 407 | * saves module user group access |
408 | 408 | */ |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | } |
434 | 434 | } |
435 | 435 | |
436 | -if(!function_exists('saveEventListeners')) { |
|
436 | +if (!function_exists('saveEventListeners')) { |
|
437 | 437 | # Save Plugin Event Listeners |
438 | 438 | function saveEventListeners($id, $sysevents, $mode) |
439 | 439 | { |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | -if(!function_exists('getEventIdByName')) { |
|
489 | +if (!function_exists('getEventIdByName')) { |
|
490 | 490 | /** |
491 | 491 | * @param string $name |
492 | 492 | * @return string|int |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | -if(!function_exists('saveTemplateAccess')) { |
|
512 | +if (!function_exists('saveTemplateAccess')) { |
|
513 | 513 | /** |
514 | 514 | * @param int $id |
515 | 515 | */ |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | } |
549 | 549 | } |
550 | 550 | |
551 | -if(!function_exists('saveTemplateVarAccess')) { |
|
551 | +if (!function_exists('saveTemplateVarAccess')) { |
|
552 | 552 | /** |
553 | 553 | * @return void |
554 | 554 | */ |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | } |
588 | 588 | } |
589 | 589 | |
590 | -if(!function_exists('saveDocumentAccessPermissons')) { |
|
590 | +if (!function_exists('saveDocumentAccessPermissons')) { |
|
591 | 591 | function saveDocumentAccessPermissons() |
592 | 592 | { |
593 | 593 | global $id, $newid; |
@@ -756,10 +756,10 @@ discard block |
||
756 | 756 | } |
757 | 757 | |
758 | 758 | foreach ($defaults as $k) { |
759 | - if (isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
759 | + if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') { |
|
760 | 760 | unset($settings[$k]); |
761 | 761 | } |
762 | - unset($settings['default_' . $k]); |
|
762 | + unset($settings['default_'.$k]); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | $modx->db->delete($tbl_user_settings, "user='{$id}'"); |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | global $id, $modx; |
792 | 792 | $mode = $_POST['mode']; |
793 | 793 | $modx->manager->saveFormValues($mode); |
794 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode === $action ? "&id={$id}" : '')); |
|
794 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode === $action ? "&id={$id}" : '')); |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | global $deltime; |
808 | 808 | |
809 | 809 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), |
810 | - "parent='" . (int)$parent . "' AND deleted=1 AND deletedon='" . (int)$deltime . "'"); |
|
810 | + "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'"); |
|
811 | 811 | // the document has children documents, we'll need to delete those too |
812 | 812 | while ($row = $modx->db->getRow($rs)) { |
813 | 813 | $children[] = $row['id']; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!function_exists('createGUID')) { |
|
3 | +if (!function_exists('createGUID')) { |
|
4 | 4 | /** |
5 | 5 | * create globally unique identifiers (guid) |
6 | 6 | * |
@@ -8,22 +8,22 @@ discard block |
||
8 | 8 | */ |
9 | 9 | function createGUID() |
10 | 10 | { |
11 | - srand((double)microtime() * 1000000); |
|
11 | + srand((double) microtime() * 1000000); |
|
12 | 12 | $r = rand(); |
13 | - $u = uniqid(getmypid() . $r . (double)microtime() * 1000000, 1); |
|
13 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
14 | 14 | $m = md5($u); |
15 | 15 | |
16 | 16 | return $m; |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | -if(!function_exists('generate_password')) { |
|
20 | +if (!function_exists('generate_password')) { |
|
21 | 21 | // Generate password |
22 | 22 | function generate_password($length = 10) |
23 | 23 | { |
24 | 24 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
25 | 25 | $ps_len = strlen($allowable_characters); |
26 | - mt_srand((double)microtime() * 1000000); |
|
26 | + mt_srand((double) microtime() * 1000000); |
|
27 | 27 | $pass = ""; |
28 | 28 | for ($i = 0; $i < $length; $i++) { |
29 | 29 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once MODX_MANAGER_PATH . 'includes/functions/tv.php'; |
|
3 | +include_once MODX_MANAGER_PATH.'includes/functions/tv.php'; |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once MODX_MANAGER_PATH . 'includes/functions/tv.php'; |
|
3 | +include_once MODX_MANAGER_PATH.'includes/functions/tv.php'; |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once MODX_MANAGER_PATH . 'includes/functions/tv.php'; |
|
3 | +include_once MODX_MANAGER_PATH.'includes/functions/tv.php'; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | $msg = ''; |
39 | -$pth = dirname(dirname(__DIR__)) . '/install/'; |
|
39 | +$pth = dirname(dirname(__DIR__)).'/install/'; |
|
40 | 40 | $pth = str_replace('\\', '/', $pth); |
41 | 41 | |
42 | 42 | if (isset($_GET['rminstall'])) { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | if ($msg) { |
50 | - echo "<script>alert('" . addslashes($msg) . "');</script>"; |
|
50 | + echo "<script>alert('".addslashes($msg)."');</script>"; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | echo "<script>window.location='../index.php?a=2';</script>"; |