@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if (!$modx->hasPermission('file_manager')) { |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | $newToken = makeToken(); |
| 10 | 10 | |
| 11 | 11 | // settings |
| 12 | -$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
|
| 12 | +$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/'; |
|
| 13 | 13 | $excludes = array( |
| 14 | 14 | '.', |
| 15 | 15 | '..', |
| 16 | 16 | '.svn' |
| 17 | 17 | ); |
| 18 | -$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : ''; |
|
| 19 | -$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json' . $alias_suffix); |
|
| 20 | -$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json' . $alias_suffix); |
|
| 18 | +$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : ''; |
|
| 19 | +$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json'.$alias_suffix); |
|
| 20 | +$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json'.$alias_suffix); |
|
| 21 | 21 | $viewablefiles = explode(',', 'jpg,gif,png,ico'); |
| 22 | 22 | |
| 23 | 23 | $editablefiles = add_dot($editablefiles); |
@@ -30,31 +30,31 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | */ |
| 32 | 32 | $protected_path[] = $modx->config['site_manager_path']; |
| 33 | -$protected_path[] = $modx->config['base_path'] . 'temp/backup'; |
|
| 34 | -$protected_path[] = $modx->config['base_path'] . 'assets/backup'; |
|
| 33 | +$protected_path[] = $modx->config['base_path'].'temp/backup'; |
|
| 34 | +$protected_path[] = $modx->config['base_path'].'assets/backup'; |
|
| 35 | 35 | |
| 36 | 36 | if (!$modx->hasPermission('save_plugin')) { |
| 37 | - $protected_path[] = $modx->config['base_path'] . 'assets/plugins'; |
|
| 37 | + $protected_path[] = $modx->config['base_path'].'assets/plugins'; |
|
| 38 | 38 | } |
| 39 | 39 | if (!$modx->hasPermission('save_snippet')) { |
| 40 | - $protected_path[] = $modx->config['base_path'] . 'assets/snippets'; |
|
| 40 | + $protected_path[] = $modx->config['base_path'].'assets/snippets'; |
|
| 41 | 41 | } |
| 42 | 42 | if (!$modx->hasPermission('save_template')) { |
| 43 | - $protected_path[] = $modx->config['base_path'] . 'assets/templates'; |
|
| 43 | + $protected_path[] = $modx->config['base_path'].'assets/templates'; |
|
| 44 | 44 | } |
| 45 | 45 | if (!$modx->hasPermission('save_module')) { |
| 46 | - $protected_path[] = $modx->config['base_path'] . 'assets/modules'; |
|
| 46 | + $protected_path[] = $modx->config['base_path'].'assets/modules'; |
|
| 47 | 47 | } |
| 48 | 48 | if (!$modx->hasPermission('empty_cache')) { |
| 49 | - $protected_path[] = $modx->config['base_path'] . 'assets/cache'; |
|
| 49 | + $protected_path[] = $modx->config['base_path'].'assets/cache'; |
|
| 50 | 50 | } |
| 51 | 51 | if (!$modx->hasPermission('import_static')) { |
| 52 | - $protected_path[] = $modx->config['base_path'] . 'temp/import'; |
|
| 53 | - $protected_path[] = $modx->config['base_path'] . 'assets/import'; |
|
| 52 | + $protected_path[] = $modx->config['base_path'].'temp/import'; |
|
| 53 | + $protected_path[] = $modx->config['base_path'].'assets/import'; |
|
| 54 | 54 | } |
| 55 | 55 | if (!$modx->hasPermission('export_static')) { |
| 56 | - $protected_path[] = $modx->config['base_path'] . 'temp/export'; |
|
| 57 | - $protected_path[] = $modx->config['base_path'] . 'assets/export'; |
|
| 56 | + $protected_path[] = $modx->config['base_path'].'temp/export'; |
|
| 57 | + $protected_path[] = $modx->config['base_path'].'assets/export'; |
|
| 58 | 58 | } |
| 59 | 59 | /* |
| 60 | 60 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $count = count($array); |
| 81 | 81 | for ($i = 0; $i < $count; $i++) { |
| 82 | - $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :) |
|
| 82 | + $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :) |
|
| 83 | 83 | } |
| 84 | 84 | return $array; |
| 85 | 85 | } |
@@ -104,15 +104,15 @@ discard block |
||
| 104 | 104 | $rw = realpath('../'); |
| 105 | 105 | $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf)); |
| 106 | 106 | if (substr($webstart_path, 0, 1) == '/') { |
| 107 | - $webstart_path = '..' . $webstart_path; |
|
| 107 | + $webstart_path = '..'.$webstart_path; |
|
| 108 | 108 | } else { |
| 109 | - $webstart_path = '../' . $webstart_path; |
|
| 109 | + $webstart_path = '../'.$webstart_path; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | ?> |
| 113 | 113 | <script type="text/javascript"> |
| 114 | 114 | |
| 115 | - var current_path = '<?= $startpath;?>'; |
|
| 115 | + var current_path = '<?= $startpath; ?>'; |
|
| 116 | 116 | |
| 117 | 117 | function viewfile (url) |
| 118 | 118 | { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | function unzipFile (file) |
| 149 | 149 | { |
| 150 | 150 | if (confirmUnzip()) { |
| 151 | - window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>"; |
|
| 151 | + window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>"; |
|
| 152 | 152 | return false; |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | function deleteFolder (folder, status) |
| 171 | 171 | { |
| 172 | 172 | if (confirmDeleteFolder(status)) { |
| 173 | - window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>"; |
|
| 173 | + window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>"; |
|
| 174 | 174 | return false; |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | function deleteFile (file) |
| 179 | 179 | { |
| 180 | 180 | if (confirmDelete()) { |
| 181 | - window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>"; |
|
| 181 | + window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>"; |
|
| 182 | 182 | return false; |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
| 189 | 189 | if (newFilename !== null && newFilename !== file) { |
| 190 | - window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
| 190 | + window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir); |
| 197 | 197 | if (newDirname !== null && newDirname !== dir) { |
| 198 | - window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>"; |
|
| 198 | + window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>"; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
| 205 | 205 | if (newFilename !== null && newFilename !== file) { |
| 206 | - window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
| 206 | + window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | <?php endif ?> |
| 223 | 223 | <?php |
| 224 | 224 | if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') { |
| 225 | - $href = 'a=31&path=' . urlencode($_REQUEST['path']); |
|
| 225 | + $href = 'a=31&path='.urlencode($_REQUEST['path']); |
|
| 226 | 226 | } else { |
| 227 | 227 | $href = 'a=2'; |
| 228 | 228 | } |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>'; |
| 233 | 233 | $ph['image'] = $_style['files_folder-open']; |
| 234 | 234 | $ph['subject'] = $_lang['add_folder']; |
| 235 | - $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name='; |
|
| 235 | + $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name='; |
|
| 236 | 236 | $_ = parsePlaceholder($tpl, $ph); |
| 237 | 237 | |
| 238 | - $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>'; |
|
| 238 | + $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>'; |
|
| 239 | 239 | $ph['image'] = $_style['files_page_html']; |
| 240 | - $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name='; |
|
| 240 | + $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name='; |
|
| 241 | 241 | $_ .= parsePlaceholder($tpl, $ph); |
| 242 | 242 | echo $_; |
| 243 | 243 | } |
@@ -267,12 +267,12 @@ discard block |
||
| 267 | 267 | $ph = array(); |
| 268 | 268 | $ph['style_path'] = $theme_image_path; |
| 269 | 269 | // To Top Level with folder icon to the left |
| 270 | - if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) { |
|
| 271 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
| 270 | + if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) { |
|
| 271 | + $ph['image'] = ''.$_style['files_top'].''; |
|
| 272 | 272 | $ph['subject'] = '<span>Top</span>'; |
| 273 | 273 | } else { |
| 274 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
| 275 | - $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/'; |
|
| 274 | + $ph['image'] = ''.$_style['files_top'].''; |
|
| 275 | + $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/'; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | echo parsePlaceholder($tpl, $ph); |
@@ -289,12 +289,12 @@ discard block |
||
| 289 | 289 | if (empty($v)) { |
| 290 | 290 | continue; |
| 291 | 291 | } |
| 292 | - $path .= rtrim($v, '/') . '/'; |
|
| 292 | + $path .= rtrim($v, '/').'/'; |
|
| 293 | 293 | if (1 < $count) { |
| 294 | - $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path); |
|
| 295 | - $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>'; |
|
| 294 | + $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path); |
|
| 295 | + $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>'; |
|
| 296 | 296 | } else { |
| 297 | - $pieces[$i] = '<span>' . trim($v, '/') . '</span>'; |
|
| 297 | + $pieces[$i] = '<span>'.trim($v, '/').'</span>'; |
|
| 298 | 298 | } |
| 299 | 299 | $count--; |
| 300 | 300 | } |
@@ -307,16 +307,16 @@ discard block |
||
| 307 | 307 | </div> |
| 308 | 308 | <?php |
| 309 | 309 | // check to see user isn't trying to move below the document_root |
| 310 | - if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) { |
|
| 310 | + if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) { |
|
| 311 | 311 | $modx->webAlertAndQuit($_lang["files_access_denied"]); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // Unzip .zip files - by Raymond |
| 315 | 315 | if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) { |
| 316 | - if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) { |
|
| 317 | - echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />'; |
|
| 316 | + if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) { |
|
| 317 | + echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />'; |
|
| 318 | 318 | } else { |
| 319 | - echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />'; |
|
| 319 | + echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />'; |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | // End Unzip - Raymond |
@@ -328,9 +328,9 @@ discard block |
||
| 328 | 328 | if ($_REQUEST['mode'] == 'deletefolder') { |
| 329 | 329 | $folder = $_REQUEST['folderpath']; |
| 330 | 330 | if (!$token_check || !@rrmdir($folder)) { |
| 331 | - echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />'; |
|
| 331 | + echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />'; |
|
| 332 | 332 | } else { |
| 333 | - echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />'; |
|
| 333 | + echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />'; |
|
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | if (!mkdirs("{$startpath}/{$foldername}", 0777)) { |
| 342 | 342 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
| 343 | 343 | } else { |
| 344 | - if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) { |
|
| 345 | - echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />'; |
|
| 344 | + if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) { |
|
| 345 | + echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />'; |
|
| 346 | 346 | } else { |
| 347 | - echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />'; |
|
| 347 | + echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />'; |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | umask($old_umask); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $filename = $modx->db->escape($filename); |
| 357 | 357 | |
| 358 | 358 | if (!checkExtension($filename)) { |
| 359 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
| 359 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
| 360 | 360 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) { |
| 361 | 361 | echo $_lang['files.dynamic.php3']; |
| 362 | 362 | } else { |
@@ -378,11 +378,11 @@ discard block |
||
| 378 | 378 | $newFilename = $modx->db->escape($newFilename); |
| 379 | 379 | |
| 380 | 380 | if (!checkExtension($newFilename)) { |
| 381 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
| 381 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
| 382 | 382 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
| 383 | 383 | echo $_lang['files.dynamic.php3']; |
| 384 | 384 | } else { |
| 385 | - if (!copy($filename, MODX_BASE_PATH . $newFilename)) { |
|
| 385 | + if (!copy($filename, MODX_BASE_PATH.$newFilename)) { |
|
| 386 | 386 | echo $_lang['files.dynamic.php5']; |
| 387 | 387 | } |
| 388 | 388 | umask($old_umask); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | // Rename folder here |
| 392 | 392 | if ($_REQUEST['mode'] == 'renameFolder') { |
| 393 | 393 | $old_umask = umask(0); |
| 394 | - $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname']; |
|
| 394 | + $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname']; |
|
| 395 | 395 | $dirname = $modx->db->escape($dirname); |
| 396 | 396 | $newDirname = str_replace(array( |
| 397 | 397 | '..\\', |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) { |
| 405 | 405 | echo $_lang['files.dynamic.php3']; |
| 406 | - } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) { |
|
| 406 | + } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) { |
|
| 407 | 407 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
| 408 | 408 | } |
| 409 | 409 | umask($old_umask); |
@@ -423,11 +423,11 @@ discard block |
||
| 423 | 423 | $newFilename = $modx->db->escape($newFilename); |
| 424 | 424 | |
| 425 | 425 | if (!checkExtension($newFilename)) { |
| 426 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
| 426 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
| 427 | 427 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
| 428 | 428 | echo $_lang['files.dynamic.php3']; |
| 429 | 429 | } else { |
| 430 | - if (!rename($filename, $path . '/' . $newFilename)) { |
|
| 430 | + if (!rename($filename, $path.'/'.$newFilename)) { |
|
| 431 | 431 | echo $_lang['files.dynamic.php5']; |
| 432 | 432 | } |
| 433 | 433 | umask($old_umask); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | ls($startpath); |
| 461 | 461 | echo "\n\n\n"; |
| 462 | 462 | if ($folders == 0 && $files == 0) { |
| 463 | - echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>'; |
|
| 463 | + echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>'; |
|
| 464 | 464 | } |
| 465 | 465 | ?> |
| 466 | 466 | </table> |
@@ -469,10 +469,10 @@ discard block |
||
| 469 | 469 | <div class="container"> |
| 470 | 470 | <p> |
| 471 | 471 | <?php |
| 472 | - echo $_lang['files_directories'] . ': <b>' . $folders . '</b> '; |
|
| 473 | - echo $_lang['files_files'] . ': <b>' . $files . '</b> '; |
|
| 474 | - echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> '; |
|
| 475 | - echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>' |
|
| 472 | + echo $_lang['files_directories'].': <b>'.$folders.'</b> '; |
|
| 473 | + echo $_lang['files_files'].': <b>'.$files.'</b> '; |
|
| 474 | + echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> '; |
|
| 475 | + echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>' |
|
| 476 | 476 | ?> |
| 477 | 477 | </p> |
| 478 | 478 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | </form> |
| 498 | 498 | <?php |
| 499 | 499 | } else { |
| 500 | - echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>"; |
|
| 500 | + echo "<p>".$_lang['files_upload_inhibited_msg']."</p>"; |
|
| 501 | 501 | } |
| 502 | 502 | ?> |
| 503 | 503 | <div id="imageviewer"></div> |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | if ($file == $selFile) { |
| 577 | 577 | $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default']; |
| 578 | 578 | } |
| 579 | - return '<i class="' . $icon . ' FilesPage"></i>'; |
|
| 579 | + return '<i class="'.$icon.' FilesPage"></i>'; |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | function markRow($file, $selFile, $mode) |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | ); |
| 589 | 589 | if ($file == $selFile) { |
| 590 | 590 | $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default']; |
| 591 | - return ' class="' . $class . '"'; |
|
| 591 | + return ' class="'.$class.'"'; |
|
| 592 | 592 | } |
| 593 | 593 | return ''; |
| 594 | 594 | } |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx; |
| 600 | 600 | $dircounter = 0; |
| 601 | 601 | $filecounter = 0; |
| 602 | - $curpath = str_replace('//', '/', $curpath . '/'); |
|
| 602 | + $curpath = str_replace('//', '/', $curpath.'/'); |
|
| 603 | 603 | |
| 604 | 604 | if (!is_dir($curpath)) { |
| 605 | 605 | echo 'Invalid path "', $curpath, '"<br />'; |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | |
| 610 | 610 | // first, get info |
| 611 | 611 | foreach ($dir as $file) { |
| 612 | - $newpath = $curpath . $file; |
|
| 612 | + $newpath = $curpath.$file; |
|
| 613 | 613 | if ($file === '..' || $file === '.') { |
| 614 | 614 | continue; |
| 615 | 615 | } |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | if ($file === '..' || $file === '.') { |
| 620 | 620 | continue; |
| 621 | 621 | } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) { |
| 622 | - $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>'; |
|
| 622 | + $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>'; |
|
| 623 | 623 | |
| 624 | 624 | $dfiles = scandir($newpath); |
| 625 | 625 | foreach ($dfiles as $i => $infile) { |
@@ -632,13 +632,13 @@ discard block |
||
| 632 | 632 | } |
| 633 | 633 | $file_exists = (0 < count($dfiles)) ? 'file_exists' : ''; |
| 634 | 634 | |
| 635 | - $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>' : ''; |
|
| 635 | + $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>' : ''; |
|
| 636 | 636 | } else { |
| 637 | - $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>'; |
|
| 638 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : ''; |
|
| 637 | + $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>'; |
|
| 638 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : ''; |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | - $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : ''; |
|
| 641 | + $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : ''; |
|
| 642 | 642 | |
| 643 | 643 | // increment the counter |
| 644 | 644 | $dircounter++; |
@@ -646,14 +646,14 @@ discard block |
||
| 646 | 646 | $type = getExtension($newpath); |
| 647 | 647 | $files_array[$filecounter]['file'] = $newpath; |
| 648 | 648 | $files_array[$filecounter]['stats'] = lstat($newpath); |
| 649 | - $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']) . ' ' . $file; |
|
| 650 | - $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath, $len, strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, 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>'); |
|
| 651 | - $files_array[$filecounter]['view'] = (in_array($type, $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']; |
|
| 652 | - $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>' : ''; |
|
| 653 | - $files_array[$filecounter]['edit'] = (in_array($type, $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>'; |
|
| 654 | - $files_array[$filecounter]['duplicate'] = (in_array($type, $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>'; |
|
| 655 | - $files_array[$filecounter]['rename'] = (in_array($type, $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>'; |
|
| 656 | - $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>'; |
|
| 649 | + $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']).' '.$file; |
|
| 650 | + $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath, $len, strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, 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>'); |
|
| 651 | + $files_array[$filecounter]['view'] = (in_array($type, $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']; |
|
| 652 | + $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>' : ''; |
|
| 653 | + $files_array[$filecounter]['edit'] = (in_array($type, $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>'; |
|
| 654 | + $files_array[$filecounter]['duplicate'] = (in_array($type, $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>'; |
|
| 655 | + $files_array[$filecounter]['rename'] = (in_array($type, $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>'; |
|
| 656 | + $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>'; |
|
| 657 | 657 | |
| 658 | 658 | // increment the counter |
| 659 | 659 | $filecounter++; |
@@ -666,9 +666,9 @@ discard block |
||
| 666 | 666 | for ($i = 0; $i < $folders; $i++) { |
| 667 | 667 | $filesizes += $dirs_array[$i]['stats']['7']; |
| 668 | 668 | echo '<tr>'; |
| 669 | - echo '<td>' . $dirs_array[$i]['text'] . '</td>'; |
|
| 670 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>'; |
|
| 671 | - echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>'; |
|
| 669 | + echo '<td>'.$dirs_array[$i]['text'].'</td>'; |
|
| 670 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>'; |
|
| 671 | + echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>'; |
|
| 672 | 672 | echo '<td class="actions text-right">'; |
| 673 | 673 | echo $dirs_array[$i]['rename']; |
| 674 | 674 | echo $dirs_array[$i]['delete']; |
@@ -681,10 +681,10 @@ discard block |
||
| 681 | 681 | sort($files_array); // sorting the array alphabetically (Thanks pxl8r!) |
| 682 | 682 | for ($i = 0; $i < $files; $i++) { |
| 683 | 683 | $filesizes += $files_array[$i]['stats']['7']; |
| 684 | - echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>'; |
|
| 685 | - echo '<td>' . $files_array[$i]['text'] . '</td>'; |
|
| 686 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>'; |
|
| 687 | - echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>'; |
|
| 684 | + echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>'; |
|
| 685 | + echo '<td>'.$files_array[$i]['text'].'</td>'; |
|
| 686 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>'; |
|
| 687 | + echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>'; |
|
| 688 | 688 | echo '<td class="actions text-right">'; |
| 689 | 689 | echo $files_array[$i]['unzip']; |
| 690 | 690 | echo $files_array[$i]['view']; |
@@ -792,17 +792,17 @@ discard block |
||
| 792 | 792 | $zip = zip_open($file); |
| 793 | 793 | if ($zip) { |
| 794 | 794 | $old_umask = umask(0); |
| 795 | - $path = rtrim($path, '/') . '/'; |
|
| 795 | + $path = rtrim($path, '/').'/'; |
|
| 796 | 796 | while ($zip_entry = zip_read($zip)) { |
| 797 | 797 | if (zip_entry_filesize($zip_entry) > 0) { |
| 798 | 798 | // str_replace must be used under windows to convert "/" into "\" |
| 799 | 799 | $zip_entry_name = zip_entry_name($zip_entry); |
| 800 | - $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name)); |
|
| 801 | - $complete_name = $path . str_replace('\\', '/', $zip_entry_name); |
|
| 800 | + $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name)); |
|
| 801 | + $complete_name = $path.str_replace('\\', '/', $zip_entry_name); |
|
| 802 | 802 | if (!file_exists($complete_path)) { |
| 803 | 803 | $tmp = ''; |
| 804 | 804 | foreach (explode('/', $complete_path) AS $k) { |
| 805 | - $tmp .= $k . '/'; |
|
| 805 | + $tmp .= $k.'/'; |
|
| 806 | 806 | if (!is_dir($tmp)) { |
| 807 | 807 | mkdir($tmp, 0777); |
| 808 | 808 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | |
| 824 | 824 | function rrmdir($dir) |
| 825 | 825 | { |
| 826 | - foreach (glob($dir . '/*') as $file) { |
|
| 826 | + foreach (glob($dir.'/*') as $file) { |
|
| 827 | 827 | if (is_dir($file)) { |
| 828 | 828 | rrmdir($file); |
| 829 | 829 | } else { |
@@ -855,12 +855,12 @@ discard block |
||
| 855 | 855 | $userfile['type'] = $_FILES['userfile']['type'][$i]; |
| 856 | 856 | |
| 857 | 857 | // this seems to be an upload action. |
| 858 | - $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
| 859 | - $path = rtrim($path, '/') . '/' . $userfile['name']; |
|
| 858 | + $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
| 859 | + $path = rtrim($path, '/').'/'.$userfile['name']; |
|
| 860 | 860 | $msg .= $path; |
| 861 | 861 | if ($userfile['error'] == 0) { |
| 862 | - $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : ''; |
|
| 863 | - $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>'; |
|
| 862 | + $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : ''; |
|
| 863 | + $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>'; |
|
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | $userfilename = $userfile['tmp_name']; |
@@ -868,15 +868,15 @@ discard block |
||
| 868 | 868 | if (is_uploaded_file($userfilename)) { |
| 869 | 869 | // file is uploaded file, process it! |
| 870 | 870 | if (!checkExtension($userfile['name'])) { |
| 871 | - $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>'; |
|
| 871 | + $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>'; |
|
| 872 | 872 | } else { |
| 873 | - if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) { |
|
| 873 | + if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) { |
|
| 874 | 874 | // Ryan: Repair broken permissions issue with file manager |
| 875 | 875 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
| 876 | - @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions); |
|
| 876 | + @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions); |
|
| 877 | 877 | } |
| 878 | 878 | // Ryan: End |
| 879 | - $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>'; |
|
| 879 | + $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>'; |
|
| 880 | 880 | |
| 881 | 881 | // invoke OnFileManagerUpload event |
| 882 | 882 | $modx->invokeEvent('OnFileManagerUpload', array( |
@@ -884,13 +884,13 @@ discard block |
||
| 884 | 884 | 'filename' => $userfile['name'] |
| 885 | 885 | )); |
| 886 | 886 | // Log the change |
| 887 | - logFileChange('upload', $_POST['path'] . '/' . $userfile['name']); |
|
| 887 | + logFileChange('upload', $_POST['path'].'/'.$userfile['name']); |
|
| 888 | 888 | } else { |
| 889 | - $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>'; |
|
| 889 | + $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>'; |
|
| 890 | 890 | } |
| 891 | 891 | } |
| 892 | 892 | } else { |
| 893 | - $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>'; |
|
| 893 | + $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>'; |
|
| 894 | 894 | switch ($userfile['error']) { |
| 895 | 895 | case 0: //no error; possible file attack! |
| 896 | 896 | $msg .= $_lang['files_upload_error0']; |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | } |
| 916 | 916 | } |
| 917 | 917 | } |
| 918 | - return $msg . '<br/>'; |
|
| 918 | + return $msg.'<br/>'; |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | function textsave() |
@@ -928,9 +928,9 @@ discard block |
||
| 928 | 928 | |
| 929 | 929 | // Write $content to our opened file. |
| 930 | 930 | if (file_put_contents($filename, $content) === false) { |
| 931 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />'; |
|
| 931 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />'; |
|
| 932 | 932 | } else { |
| 933 | - $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />'; |
|
| 933 | + $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />'; |
|
| 934 | 934 | $_REQUEST['mode'] = 'edit'; |
| 935 | 935 | } |
| 936 | 936 | // Log the change |
@@ -946,9 +946,9 @@ discard block |
||
| 946 | 946 | |
| 947 | 947 | $file = $_REQUEST['path']; |
| 948 | 948 | if (!$token_check || !@unlink($file)) { |
| 949 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />'; |
|
| 949 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />'; |
|
| 950 | 950 | } else { |
| 951 | - $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />'; |
|
| 951 | + $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />'; |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | // Log the change |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -switch($modx->manager->action) {
|
|
| 6 | +switch ($modx->manager->action) {
|
|
| 7 | 7 | case 12: |
| 8 | - if(!$modx->hasPermission('edit_user')) {
|
|
| 8 | + if (!$modx->hasPermission('edit_user')) {
|
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | 10 | } |
| 11 | 11 | break; |
| 12 | 12 | case 11: |
| 13 | - if(!$modx->hasPermission('new_user')) {
|
|
| 13 | + if (!$modx->hasPermission('new_user')) {
|
|
| 14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 15 | 15 | } |
| 16 | 16 | break; |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | $user = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| 22 | 22 | |
| 23 | 23 | // check to see the snippet editor isn't locked |
| 24 | -$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
|
| 25 | -if($username = $modx->db->getValue($rs)) {
|
|
| 24 | +$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
|
|
| 25 | +if ($username = $modx->db->getValue($rs)) {
|
|
| 26 | 26 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
| 27 | 27 | } |
| 28 | 28 | // end check for lock |
| 29 | 29 | |
| 30 | -if($modx->manager->action == '12') {
|
|
| 30 | +if ($modx->manager->action == '12') {
|
|
| 31 | 31 | // get user attribute |
| 32 | 32 | $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
|
| 33 | 33 | $userdata = $modx->db->getRow($rs); |
| 34 | - if(!$userdata) {
|
|
| 34 | + if (!$userdata) {
|
|
| 35 | 35 | $modx->webAlertAndQuit("No user returned!");
|
| 36 | 36 | } |
| 37 | 37 | |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | // get user settings |
| 40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
|
| 41 | 41 | $usersettings = array(); |
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 42 | + while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | 43 | // manually extract so that user display settings are not overwritten |
| 44 | - foreach($usersettings as $k => $v) {
|
|
| 45 | - if($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 44 | + foreach ($usersettings as $k => $v) {
|
|
| 45 | + if ($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 46 | 46 | ${$k} = $v;
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | // get user name |
| 51 | 51 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
|
| 52 | 52 | $usernamedata = $modx->db->getRow($rs); |
| 53 | - if(!$usernamedata) {
|
|
| 53 | + if (!$usernamedata) {
|
|
| 54 | 54 | $modx->webAlertAndQuit("No user returned while getting username!");
|
| 55 | 55 | } |
| 56 | 56 | $_SESSION['itemname'] = $usernamedata['username']; |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 65 | -foreach($userdata as $key => $val) {
|
|
| 65 | +foreach ($userdata as $key => $val) {
|
|
| 66 | 66 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
| 67 | 67 | }; |
| 68 | 68 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 69 | 69 | |
| 70 | 70 | // restore saved form |
| 71 | 71 | $formRestored = false; |
| 72 | -if($modx->manager->hasFormValues()) {
|
|
| 72 | +if ($modx->manager->hasFormValues()) {
|
|
| 73 | 73 | $modx->manager->loadFormValues(); |
| 74 | 74 | // restore post values |
| 75 | 75 | $userdata = array_merge($userdata, $_POST); |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | // include the country list language file |
| 85 | 85 | $_country_lang = array(); |
| 86 | 86 | include_once "lang/country/english_country.inc.php"; |
| 87 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
|
| 88 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 87 | +if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
|
|
| 88 | + include_once "lang/country/".$manager_language."_country.inc.php"; |
|
| 89 | 89 | } |
| 90 | 90 | asort($_country_lang); |
| 91 | 91 | |
| 92 | 92 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
| 93 | -if($which_browser == 'default') {
|
|
| 93 | +if ($which_browser == 'default') {
|
|
| 94 | 94 | $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
| 95 | 95 | } |
| 96 | 96 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | document.userform.save.click(); |
| 183 | 183 | }, |
| 184 | 184 | delete: function() {
|
| 185 | - <?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
|
|
| 185 | + <?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
|
|
| 186 | 186 | alert("<?php echo $_lang['alert_delete_self']; ?>");
|
| 187 | 187 | <?php } else { ?>
|
| 188 | 188 | if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) {
|
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
|
| 206 | 206 | "id" => $user |
| 207 | 207 | )); |
| 208 | - if(is_array($evtOut)) {
|
|
| 208 | + if (is_array($evtOut)) {
|
|
| 209 | 209 | echo implode("", $evtOut);
|
| 210 | 210 | } |
| 211 | 211 | ?> |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
| 215 | 215 | |
| 216 | 216 | <h1> |
| 217 | - <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?>
|
|
| 217 | + <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?>
|
|
| 218 | 218 | </h1> |
| 219 | 219 | |
| 220 | 220 | <?php echo $_style['actionbuttons']['dynamic']['user'] ?> |
@@ -232,13 +232,13 @@ discard block |
||
| 232 | 232 | <table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser"> |
| 233 | 233 | <tr> |
| 234 | 234 | <td colspan="3"><span id="blocked" class="warning"> |
| 235 | - <?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
|
|
| 235 | + <?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
|
|
| 236 | 236 | <?php echo $_lang['user_is_blocked']; ?> |
| 237 | 237 | <?php } ?> |
| 238 | 238 | </span> |
| 239 | 239 | <br /></td> |
| 240 | 240 | </tr> |
| 241 | - <?php if(!empty($userdata['id'])) { ?>
|
|
| 241 | + <?php if (!empty($userdata['id'])) { ?>
|
|
| 242 | 242 | <tr id="showname" style="display: <?php echo ($modx->manager->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> "> |
| 243 | 243 | <td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i> <b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span> |
| 244 | 244 | <input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" /> |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | <td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td> |
| 252 | 252 | </tr> |
| 253 | 253 | <tr> |
| 254 | - <th><?php echo $modx->manager->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th> |
|
| 254 | + <th><?php echo $modx->manager->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th> |
|
| 255 | 255 | <td> </td> |
| 256 | 256 | <td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "11" ? " checked disabled" : ""; ?>> |
| 257 | 257 | <input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" /> |
@@ -305,8 +305,8 @@ discard block |
||
| 305 | 305 | ?> |
| 306 | 306 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
| 307 | 307 | <?php |
| 308 | - while($row = $modx->db->getRow($rs)) {
|
|
| 309 | - if($modx->manager->action == '11') {
|
|
| 308 | + while ($row = $modx->db->getRow($rs)) {
|
|
| 309 | + if ($modx->manager->action == '11') {
|
|
| 310 | 310 | $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
| 311 | 311 | } else {
|
| 312 | 312 | $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 361 | 361 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 362 | 362 | <?php |
| 363 | - foreach($_country_lang as $key => $country) {
|
|
| 364 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 363 | + foreach ($_country_lang as $key => $country) {
|
|
| 364 | + echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>"; |
|
| 365 | 365 | } |
| 366 | 366 | ?> |
| 367 | 367 | </select></td> |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | <td> </td> |
| 388 | 388 | <td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars($userdata['comment']); ?></textarea></td> |
| 389 | 389 | </tr> |
| 390 | - <?php if($modx->manager->action == '12') { ?>
|
|
| 390 | + <?php if ($modx->manager->action == '12') { ?>
|
|
| 391 | 391 | <tr> |
| 392 | 392 | <th><?php echo $_lang['user_logincount']; ?>:</th> |
| 393 | 393 | <td> </td> |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | </tr> |
| 425 | 425 | <?php } ?> |
| 426 | 426 | </table> |
| 427 | - <?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
|
|
| 427 | + <?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
|
|
| 428 | 428 | <p><?php echo $_lang['user_edit_self_msg']; ?></p> |
| 429 | 429 | <?php } ?> |
| 430 | 430 | </div> |
@@ -441,8 +441,8 @@ discard block |
||
| 441 | 441 | <?php |
| 442 | 442 | $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
| 443 | 443 | $dir = dir("includes/lang");
|
| 444 | - while($file = $dir->read()) {
|
|
| 445 | - if(strpos($file, ".inc.php") > 0) {
|
|
| 444 | + while ($file = $dir->read()) {
|
|
| 445 | + if (strpos($file, ".inc.php") > 0) {
|
|
| 446 | 446 | $endpos = strpos($file, "."); |
| 447 | 447 | $languagename = substr($file, 0, $endpos); |
| 448 | 448 | $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
@@ -529,17 +529,17 @@ discard block |
||
| 529 | 529 | <option value=""></option> |
| 530 | 530 | <?php |
| 531 | 531 | $dir = dir("media/style/");
|
| 532 | - while($file = $dir->read()) {
|
|
| 533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 532 | + while ($file = $dir->read()) {
|
|
| 533 | + if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 534 | 534 | $themename = $file; |
| 535 | - if($themename === 'common') {
|
|
| 535 | + if ($themename === 'common') {
|
|
| 536 | 536 | continue; |
| 537 | 537 | } |
| 538 | - $attr = 'value="' . $themename . '" '; |
|
| 539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 538 | + $attr = 'value="'.$themename.'" '; |
|
| 539 | + if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 540 | 540 | $attr .= 'selected="selected" '; |
| 541 | 541 | } |
| 542 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
|
|
| 542 | + echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n";
|
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | $dir->close(); |
@@ -556,12 +556,12 @@ discard block |
||
| 556 | 556 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
| 557 | 557 | <?php |
| 558 | 558 | $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
| 559 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
| 560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 559 | + echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n"; |
|
| 560 | + foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 561 | 561 | $dir = str_replace('\\', '/', $dir);
|
| 562 | 562 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
| 563 | 563 | $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
| 564 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
|
|
| 564 | + echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n";
|
|
| 565 | 565 | } |
| 566 | 566 | ?> |
| 567 | 567 | </select></td> |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | </tr> |
| 589 | 589 | <tr> |
| 590 | 590 | <td> </td> |
| 591 | - <td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td> |
|
| 591 | + <td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td> |
|
| 592 | 592 | </tr> |
| 593 | 593 | <tr> |
| 594 | 594 | <th><?php echo $_lang["uploadable_media_title"] ?></th> |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | </tr> |
| 601 | 601 | <tr> |
| 602 | 602 | <td> </td> |
| 603 | - <td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td> |
|
| 603 | + <td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td> |
|
| 604 | 604 | </tr> |
| 605 | 605 | <tr> |
| 606 | 606 | <th><?php echo $_lang["uploadable_flash_title"] ?></th> |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | </tr> |
| 613 | 613 | <tr> |
| 614 | 614 | <td> </td> |
| 615 | - <td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td> |
|
| 615 | + <td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td> |
|
| 616 | 616 | </tr> |
| 617 | 617 | <tr> |
| 618 | 618 | <th><?php echo $_lang["uploadable_files_title"] ?></th> |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | </tr> |
| 625 | 625 | <tr> |
| 626 | 626 | <td> </td> |
| 627 | - <td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td> |
|
| 627 | + <td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td> |
|
| 628 | 628 | </tr> |
| 629 | 629 | <tr class='row2'> |
| 630 | 630 | <th><?php echo $_lang["upload_maxsize_title"] ?></th> |
@@ -643,11 +643,11 @@ discard block |
||
| 643 | 643 | $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
| 644 | 644 | // invoke OnRichTextEditorRegister event |
| 645 | 645 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
|
| 646 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
| 647 | - if(is_array($evtOut)) {
|
|
| 648 | - for($i = 0; $i < count($evtOut); $i++) {
|
|
| 646 | + echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n"; |
|
| 647 | + if (is_array($evtOut)) {
|
|
| 648 | + for ($i = 0; $i < count($evtOut); $i++) {
|
|
| 649 | 649 | $editor = $evtOut[$i]; |
| 650 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
| 650 | + echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n"; |
|
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | 653 | ?> |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | <?php |
| 686 | 686 | // invoke OnInterfaceSettingsRender event |
| 687 | 687 | $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
|
| 688 | - if(is_array($evtOut)) {
|
|
| 688 | + if (is_array($evtOut)) {
|
|
| 689 | 689 | echo implode("", $evtOut);
|
| 690 | 690 | } |
| 691 | 691 | ?> |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | function BrowseServer() {
|
| 713 | 713 | var w = screen.width * 0.7; |
| 714 | 714 | var h = screen.height * 0.7; |
| 715 | - OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
|
|
| 715 | + OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
|
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | function SetUrl(url, width, height, alt) {
|
@@ -735,17 +735,17 @@ discard block |
||
| 735 | 735 | </tr> |
| 736 | 736 | </table> |
| 737 | 737 | </div> |
| 738 | - <?php if($use_udperms == 1) {
|
|
| 738 | + <?php if ($use_udperms == 1) {
|
|
| 739 | 739 | |
| 740 | 740 | $groupsarray = array(); |
| 741 | 741 | |
| 742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 742 | + if ($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 743 | 743 | $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
|
| 744 | 744 | $groupsarray = $modx->db->getColumn('user_group', $rs);
|
| 745 | 745 | } |
| 746 | 746 | // retain selected doc groups between post |
| 747 | - if(is_array($_POST['user_groups'])) {
|
|
| 748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 747 | + if (is_array($_POST['user_groups'])) {
|
|
| 748 | + foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 749 | 749 | } |
| 750 | 750 | ?> |
| 751 | 751 | <div class="tab-page" id="tabAccess"> |
@@ -754,8 +754,8 @@ discard block |
||
| 754 | 754 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 755 | 755 | <?php |
| 756 | 756 | $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
|
| 757 | - while($row = $modx->db->getRow($rs)) {
|
|
| 758 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
| 757 | + while ($row = $modx->db->getRow($rs)) {
|
|
| 758 | + echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />"; |
|
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | ?> |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | $evtOut = $modx->invokeEvent("OnUserFormRender", array(
|
| 769 | 769 | "id" => $user |
| 770 | 770 | )); |
| 771 | - if(is_array($evtOut)) {
|
|
| 771 | + if (is_array($evtOut)) {
|
|
| 772 | 772 | echo implode("", $evtOut);
|
| 773 | 773 | } |
| 774 | 774 | ?> |
@@ -2,16 +2,16 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * Ajax Requests |
| 4 | 4 | */ |
| 5 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 5 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) |
|
| 9 | +if (isset($_REQUEST[$cm->get('request_key')]['ajax'])) |
|
| 10 | 10 | { |
| 11 | 11 | $_data = $_REQUEST[$cm->get('request_key')]; |
| 12 | 12 | $output = ''; |
| 13 | 13 | $task = $_data['task']; |
| 14 | - switch( $task ) |
|
| 14 | + switch ($task) |
|
| 15 | 15 | { |
| 16 | 16 | /** |
| 17 | 17 | * get categories |
@@ -19,19 +19,19 @@ discard block |
||
| 19 | 19 | case 'categorize_load_elements': |
| 20 | 20 | $elements = $_data['elements']; |
| 21 | 21 | |
| 22 | - if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
|
| 22 | + if ($uncategorized_elements = $cm->getAssignedElements(0, $_data['elements'])) |
|
| 23 | 23 | { |
| 24 | 24 | $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - foreach( $cm->getCategories() as $category ) |
|
| 27 | + foreach ($cm->getCategories() as $category) |
|
| 28 | 28 | { |
| 29 | - $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] ); |
|
| 29 | + $category['elements'] = $cm->getAssignedElements($category['id'], $_data['elements']); |
|
| 30 | 30 | $output .= $cm->renderView('chunks/categorize/category', $category); |
| 31 | 31 | } |
| 32 | 32 | break; |
| 33 | 33 | } |
| 34 | - exit( $output ); |
|
| 34 | + exit($output); |
|
| 35 | 35 | } |
| 36 | 36 | /** |
| 37 | 37 | * Categorize elements |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 |
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | -if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) |
|
| 44 | +if (isset($_POST[$cm->get('request_key')]['categorize']['submit'])) |
|
| 45 | 45 | { |
| 46 | 46 | $_data = $_POST[$cm->get('request_key')]['categorize']; |
| 47 | 47 | $_changes = 0; |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | 'categorize' |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | - if( !isset( $_data['elements'] ) ) |
|
| 57 | + if (!isset($_data['elements'])) |
|
| 58 | 58 | { |
| 59 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' ); |
|
| 59 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'categorize'); |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - foreach( $_data['elements'] as $element_id => $data ) |
|
| 63 | + foreach ($_data['elements'] as $element_id => $data) |
|
| 64 | 64 | { |
| 65 | - if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) |
|
| 65 | + if ($cm->updateElement($_data['elementsgroup'], $element_id, $data['category_id'])) |
|
| 66 | 66 | { |
| 67 | 67 | $cm->addMessage( |
| 68 | 68 | sprintf( |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if( $_changes === 0 ) |
|
| 81 | + if ($_changes === 0) |
|
| 82 | 82 | { |
| 83 | - $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' ); |
|
| 83 | + $cm->addMessage($cm->txt('cm_no_categorization'), 'categorize'); |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | else |
@@ -98,29 +98,29 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * Add a new category |
| 100 | 100 | */ |
| 101 | -if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) |
|
| 101 | +if (isset($_POST[$cm->get('request_key')]['add']['submit'])) |
|
| 102 | 102 | { |
| 103 | 103 | $_data = $_POST[$cm->get('request_key')]['add']['data']; |
| 104 | - $category = trim( html_entity_decode($_data['name']) ); |
|
| 104 | + $category = trim(html_entity_decode($_data['name'])); |
|
| 105 | 105 | $rank = (int) $_data['rank']; |
| 106 | 106 | |
| 107 | - if( empty( $category ) ) |
|
| 107 | + if (empty($category)) |
|
| 108 | 108 | { |
| 109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
| 109 | + $cm->addMessage($cm->txt('cm_enter_name_for_category'), 'add'); |
|
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if( $cm->isCategoryExists( $category ) ) |
|
| 113 | + if ($cm->isCategoryExists($category)) |
|
| 114 | 114 | { |
| 115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
| 115 | + $cm->addMessage(sprintf($cm->txt('cm_category_x_exists'), $category), 'add'); |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if( $cm->addCategory( $category, $rank ) !== 0 ) |
|
| 119 | + if ($cm->addCategory($category, $rank) !== 0) |
|
| 120 | 120 | { |
| 121 | 121 | $cm->addMessage( |
| 122 | 122 | sprintf( |
| 123 | - $cm->txt( 'cm_category_x_saved_at_position_y' ), |
|
| 123 | + $cm->txt('cm_category_x_saved_at_position_y'), |
|
| 124 | 124 | $category, |
| 125 | 125 | $rank |
| 126 | 126 | ), |
@@ -129,26 +129,26 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | else |
| 131 | 131 | { |
| 132 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' ); |
|
| 132 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'add'); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Sort categories |
| 138 | 138 | */ |
| 139 | -if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) |
|
| 139 | +if (isset($_POST[$cm->get('request_key')]['sort']['submit'])) |
|
| 140 | 140 | { |
| 141 | 141 | $categories = $_POST[$cm->get('request_key')]['sort']['data']; |
| 142 | 142 | $_changes = 0; |
| 143 | 143 | |
| 144 | - foreach( $categories as $category_id => $_data ) |
|
| 144 | + foreach ($categories as $category_id => $_data) |
|
| 145 | 145 | { |
| 146 | 146 | $data = array( |
| 147 | - 'category' => urldecode( $_data['category'] ), |
|
| 147 | + 'category' => urldecode($_data['category']), |
|
| 148 | 148 | 'rank' => $_data['rank'] |
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
| 151 | + if ($cm->updateCategory($category_id, $data)) |
|
| 152 | 152 | { |
| 153 | 153 | $cm->addMessage( |
| 154 | 154 | sprintf( |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if( $_changes === 0 ) |
|
| 165 | + if ($_changes === 0) |
|
| 166 | 166 | { |
| 167 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort'); |
|
| 167 | + $cm->addMessage($cm->txt('cm_no_changes'), 'sort'); |
|
| 168 | 168 | } |
| 169 | 169 | else |
| 170 | 170 | { |
@@ -181,21 +181,21 @@ discard block |
||
| 181 | 181 | /** |
| 182 | 182 | * Edit categories |
| 183 | 183 | */ |
| 184 | -if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) |
|
| 184 | +if (isset($_POST[$cm->get('request_key')]['edit']['submit'])) |
|
| 185 | 185 | { |
| 186 | 186 | $categories = $_POST[$cm->get('request_key')]['edit']['data']; |
| 187 | 187 | $_changes = 0; |
| 188 | 188 | |
| 189 | - foreach( $categories as $category_id => $_data ) |
|
| 189 | + foreach ($categories as $category_id => $_data) |
|
| 190 | 190 | { |
| 191 | - if( isset( $_data['delete'] ) ) |
|
| 191 | + if (isset($_data['delete'])) |
|
| 192 | 192 | { |
| 193 | - if( $cm->deleteCategory( $category_id ) ) |
|
| 193 | + if ($cm->deleteCategory($category_id)) |
|
| 194 | 194 | { |
| 195 | 195 | $cm->addMessage( |
| 196 | 196 | sprintf( |
| 197 | 197 | $cm->txt('cm_category_x_deleted'), |
| 198 | - urldecode( $_data['origin'] ) |
|
| 198 | + urldecode($_data['origin']) |
|
| 199 | 199 | ), |
| 200 | 200 | 'edit' |
| 201 | 201 | ); |
@@ -205,16 +205,16 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | $data = array( |
| 208 | - 'category' => trim( html_entity_decode( $_data['category'] ) ), |
|
| 208 | + 'category' => trim(html_entity_decode($_data['category'])), |
|
| 209 | 209 | 'rank' => $_data['rank'] |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
| 212 | + if ($cm->updateCategory($category_id, $data)) |
|
| 213 | 213 | { |
| 214 | 214 | $cm->addMessage( |
| 215 | 215 | sprintf( |
| 216 | 216 | $cm->txt('cm_category_x_renamed_to_y'), |
| 217 | - urldecode( $_data['origin'] ), |
|
| 217 | + urldecode($_data['origin']), |
|
| 218 | 218 | $data['category'] |
| 219 | 219 | ), |
| 220 | 220 | 'edit' |
@@ -223,26 +223,26 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if( $_changes === 0 ) |
|
| 226 | + if ($_changes === 0) |
|
| 227 | 227 | { |
| 228 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit'); |
|
| 228 | + $cm->addMessage($cm->txt('cm_no_changes'), 'edit'); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * Delete singel category by $_GET |
| 234 | 234 | */ |
| 235 | -if( isset( $_GET[$cm->get('request_key')]['delete'] ) |
|
| 236 | - && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) |
|
| 235 | +if (isset($_GET[$cm->get('request_key')]['delete']) |
|
| 236 | + && !empty($_GET[$cm->get('request_key')]['delete'])) |
|
| 237 | 237 | { |
| 238 | - $category_id = (int)$_GET[$cm->get('request_key')]['delete']; |
|
| 238 | + $category_id = (int) $_GET[$cm->get('request_key')]['delete']; |
|
| 239 | 239 | |
| 240 | - if( $cm->deleteCategory( $category_id ) ) |
|
| 240 | + if ($cm->deleteCategory($category_id)) |
|
| 241 | 241 | { |
| 242 | 242 | $cm->addMessage( |
| 243 | 243 | sprintf( |
| 244 | 244 | $cm->txt('cm_category_x_deleted'), |
| 245 | - urldecode( $_GET[$cm->get('request_key')]['category'] ) |
|
| 245 | + urldecode($_GET[$cm->get('request_key')]['category']) |
|
| 246 | 246 | ), |
| 247 | 247 | 'edit' |
| 248 | 248 | ); |
@@ -251,15 +251,15 @@ discard block |
||
| 251 | 251 | /** |
| 252 | 252 | * Translate phrases |
| 253 | 253 | */ |
| 254 | -if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) |
|
| 254 | +if (isset($_POST[$cm->get('request_key')]['translate']['submit'])) |
|
| 255 | 255 | { |
| 256 | 256 | $translations = $_POST[$cm->get('request_key')]['translate']['data']; |
| 257 | 257 | |
| 258 | - foreach( $translations as $native_phrase => $translation ) |
|
| 258 | + foreach ($translations as $native_phrase => $translation) |
|
| 259 | 259 | { |
| 260 | - $native_phrase = urldecode( $native_phrase ); |
|
| 260 | + $native_phrase = urldecode($native_phrase); |
|
| 261 | 261 | |
| 262 | - if( empty( $translation ) ) |
|
| 262 | + if (empty($translation)) |
|
| 263 | 263 | { |
| 264 | 264 | $translation = $native_phrase; |
| 265 | 265 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | ); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $cm->c('Translator')->addTranslation( $native_phrase, $translation, 'phrase' ); |
|
| 275 | + $cm->c('Translator')->addTranslation($native_phrase, $translation, 'phrase'); |
|
| 276 | 276 | |
| 277 | 277 | $cm->addMessage( |
| 278 | 278 | sprintf( |
@@ -2,13 +2,13 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * Class for MODx Categories Manager |
| 4 | 4 | */ |
| 5 | -if( !is_object( $modx ) |
|
| 6 | - || $modx->isBackend() === false ) |
|
| 5 | +if (!is_object($modx) |
|
| 6 | + || $modx->isBackend() === false) |
|
| 7 | 7 | { |
| 8 | 8 | die('Please use the MODx Backend.'); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -require_once realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'Categories.php'; |
|
| 11 | +require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php'; |
|
| 12 | 12 | |
| 13 | 13 | class Module_Categories_Manager extends Categories |
| 14 | 14 | { |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | * @return mixed return the parameter value if exists, otherwise false |
| 38 | 38 | * @param string $key Paramter-key |
| 39 | 39 | */ |
| 40 | - public function get( $key ) |
|
| 40 | + public function get($key) |
|
| 41 | 41 | { |
| 42 | 42 | global $modx; |
| 43 | 43 | |
| 44 | - if( isset( $this->params[$key] ) ) |
|
| 44 | + if (isset($this->params[$key])) |
|
| 45 | 45 | { |
| 46 | 46 | return $this->params[$key]; |
| 47 | 47 | } |
| 48 | - elseif( isset( $modx->config[$key] ) ) |
|
| 48 | + elseif (isset($modx->config[$key])) |
|
| 49 | 49 | { |
| 50 | 50 | return $modx->config[$key]; |
| 51 | 51 | } |
| 52 | - elseif( isset( $modx->event->params[$key] ) ) |
|
| 52 | + elseif (isset($modx->event->params[$key])) |
|
| 53 | 53 | { |
| 54 | 54 | return $modx->event->params[$key]; |
| 55 | 55 | } |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - public function addMessage( $message, $namespace = 'default' ) |
|
| 60 | + public function addMessage($message, $namespace = 'default') |
|
| 61 | 61 | { |
| 62 | 62 | $this->params['messages'][$namespace][] = $message; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
| 66 | - public function getMessages( $namespace = 'default' ) |
|
| 66 | + public function getMessages($namespace = 'default') |
|
| 67 | 67 | { |
| 68 | - if( isset( $this->params['messages'][$namespace] ) ) |
|
| 68 | + if (isset($this->params['messages'][$namespace])) |
|
| 69 | 69 | { |
| 70 | 70 | return $this->params['messages'][$namespace]; |
| 71 | 71 | } |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | - public function renderView( $view_name, $data = array() ) |
|
| 76 | + public function renderView($view_name, $data = array()) |
|
| 77 | 77 | { |
| 78 | 78 | global $_lang, $_style; |
| 79 | 79 | |
| 80 | - $filename = trim( $view_name ) . '.tpl.phtml'; |
|
| 81 | - $file = self::get('views_dir') . $filename; |
|
| 80 | + $filename = trim($view_name).'.tpl.phtml'; |
|
| 81 | + $file = self::get('views_dir').$filename; |
|
| 82 | 82 | $view = & $this; |
| 83 | 83 | |
| 84 | - if( is_file( $file ) |
|
| 85 | - && is_readable( $file ) ) |
|
| 84 | + if (is_file($file) |
|
| 85 | + && is_readable($file)) |
|
| 86 | 86 | { |
| 87 | 87 | include $file; |
| 88 | 88 | } |
@@ -96,28 +96,28 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function updateElement( $element, $element_id, $category_id ) |
|
| 99 | + public function updateElement($element, $element_id, $category_id) |
|
| 100 | 100 | { |
| 101 | 101 | |
| 102 | 102 | $_update = array( |
| 103 | - 'id' => (int)$element_id, |
|
| 104 | - 'category' => (int)$category_id |
|
| 103 | + 'id' => (int) $element_id, |
|
| 104 | + 'category' => (int) $category_id |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | $this->db->update( |
| 108 | 108 | $_update, |
| 109 | 109 | $this->db_tbl[$element], |
| 110 | - "`id` = '" . (int)$element_id . "'" |
|
| 110 | + "`id` = '".(int) $element_id."'" |
|
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | return $this->db->getAffectedRows() === 1; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | - public function txt( $txt ) |
|
| 117 | + public function txt($txt) |
|
| 118 | 118 | { |
| 119 | 119 | global $_lang; |
| 120 | - if(isset($_lang[$txt])) return $_lang[$txt]; |
|
| 120 | + if (isset($_lang[$txt])) return $_lang[$txt]; |
|
| 121 | 121 | return $txt; |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | { |
| 7 | 7 | public $db = ''; |
| 8 | 8 | public $db_tbl = array(); |
| 9 | - public $elements = array( 'templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules' ); |
|
| 9 | + public $elements = array('templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules'); |
|
| 10 | 10 | |
| 11 | 11 | public function __construct() |
| 12 | 12 | { |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | $this->db = & $modx->db; |
| 16 | 16 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
| 17 | 17 | |
| 18 | - foreach( $this->elements as $element ) |
|
| 18 | + foreach ($this->elements as $element) |
|
| 19 | 19 | { |
| 20 | - $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element ); |
|
| 20 | + $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element); |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
@@ -37,54 +37,54 @@ discard block |
||
| 37 | 37 | ) |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - if( !empty( $categories ) ) |
|
| 40 | + if (!empty($categories)) |
|
| 41 | 41 | { |
| 42 | 42 | return $categories; |
| 43 | 43 | } |
| 44 | 44 | return false; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function getCategory( $search, $where = 'category' ) |
|
| 47 | + public function getCategory($search, $where = 'category') |
|
| 48 | 48 | { |
| 49 | 49 | $category = $this->db->getRow( |
| 50 | 50 | $this->db->select( |
| 51 | 51 | '*', |
| 52 | 52 | $this->db_tbl['categories'], |
| 53 | - "`" . $where . "` = '" . $search . "'" |
|
| 53 | + "`".$where."` = '".$search."'" |
|
| 54 | 54 | ) |
| 55 | 55 | ); |
| 56 | 56 | return $category; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function getCategoryValue( $value, $search, $where = 'category' ) |
|
| 59 | + public function getCategoryValue($value, $search, $where = 'category') |
|
| 60 | 60 | { |
| 61 | 61 | $_value = $this->db->getValue( |
| 62 | 62 | $this->db->select( |
| 63 | - '`' . $value . '`', |
|
| 63 | + '`'.$value.'`', |
|
| 64 | 64 | $this->db_tbl['categories'], |
| 65 | - "`" . $where . "` = '" . $search . "'" |
|
| 65 | + "`".$where."` = '".$search."'" |
|
| 66 | 66 | ) |
| 67 | 67 | ); |
| 68 | 68 | return $_value; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function getAssignedElements( $category_id, $element ) |
|
| 71 | + public function getAssignedElements($category_id, $element) |
|
| 72 | 72 | { |
| 73 | - if( in_array( $element, $this->elements, true ) ) |
|
| 73 | + if (in_array($element, $this->elements, true)) |
|
| 74 | 74 | { |
| 75 | 75 | $elements = $this->db->makeArray( |
| 76 | 76 | $this->db->select( |
| 77 | 77 | '*', |
| 78 | 78 | $this->db_tbl[$element], |
| 79 | - "`category` = '" . $category_id . "'" |
|
| 79 | + "`category` = '".$category_id."'" |
|
| 80 | 80 | ) |
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | 83 | // correct the name of templates |
| 84 | - if( $element === 'templates' ) |
|
| 84 | + if ($element === 'templates') |
|
| 85 | 85 | { |
| 86 | 86 | $_elements_count = count($elements); |
| 87 | - for( $i=0; $i < $_elements_count; $i++ ) |
|
| 87 | + for ($i = 0; $i < $_elements_count; $i++) |
|
| 88 | 88 | { |
| 89 | 89 | $elements[$i]['name'] = $elements[$i]['templatename']; |
| 90 | 90 | } |
@@ -94,56 +94,56 @@ discard block |
||
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function getAllAssignedElements( $category_id ) |
|
| 97 | + public function getAllAssignedElements($category_id) |
|
| 98 | 98 | { |
| 99 | 99 | $elements = array(); |
| 100 | - foreach( $this->elements as $element ) |
|
| 100 | + foreach ($this->elements as $element) |
|
| 101 | 101 | { |
| 102 | - $elements[$element] = $this->getAssignedElements( $category_id, $element ); |
|
| 102 | + $elements[$element] = $this->getAssignedElements($category_id, $element); |
|
| 103 | 103 | } |
| 104 | 104 | return $elements; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function deleteCategory( $category_id ) |
|
| 107 | + public function deleteCategory($category_id) |
|
| 108 | 108 | { |
| 109 | 109 | $_update = array('category' => 0); |
| 110 | - foreach( $this->elements as $element ) |
|
| 110 | + foreach ($this->elements as $element) |
|
| 111 | 111 | { |
| 112 | 112 | $this->db->update( |
| 113 | 113 | $_update, |
| 114 | 114 | $this->db_tbl[$element], |
| 115 | - "`category` = '" . $category_id . "'" |
|
| 115 | + "`category` = '".$category_id."'" |
|
| 116 | 116 | ); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $this->db->delete( |
| 120 | 120 | $this->db_tbl['categories'], |
| 121 | - "`id` = '" . $category_id . "'" |
|
| 121 | + "`id` = '".$category_id."'" |
|
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | 124 | return $this->db->getAffectedRows() === 1; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - public function updateCategory( $category_id, $data = array() ) |
|
| 127 | + public function updateCategory($category_id, $data = array()) |
|
| 128 | 128 | { |
| 129 | - if( empty( $data ) |
|
| 130 | - || empty( $category_id ) ) |
|
| 129 | + if (empty($data) |
|
| 130 | + || empty($category_id)) |
|
| 131 | 131 | { |
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $_update = array( |
| 136 | - 'category' => $this->db->escape( $data['category'] ), |
|
| 137 | - 'rank' => (int)$data['rank'] |
|
| 136 | + 'category' => $this->db->escape($data['category']), |
|
| 137 | + 'rank' => (int) $data['rank'] |
|
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | $this->db->update( |
| 141 | 141 | $_update, |
| 142 | 142 | $this->db_tbl['categories'], |
| 143 | - "`id` = '" . (int)$category_id . "'" |
|
| 143 | + "`id` = '".(int) $category_id."'" |
|
| 144 | 144 | ); |
| 145 | 145 | |
| 146 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 146 | + if ($this->db->getAffectedRows() === 1) |
|
| 147 | 147 | { |
| 148 | 148 | return true; |
| 149 | 149 | } |
@@ -151,16 +151,16 @@ discard block |
||
| 151 | 151 | return false; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function addCategory( $category_name, $category_rank ) |
|
| 154 | + public function addCategory($category_name, $category_rank) |
|
| 155 | 155 | { |
| 156 | - if( $this->isCategoryExists( $category_name ) ) |
|
| 156 | + if ($this->isCategoryExists($category_name)) |
|
| 157 | 157 | { |
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $_insert = array( |
| 162 | - 'category' => $this->db->escape( $category_name ), |
|
| 163 | - 'rank' => (int)$category_rank |
|
| 162 | + 'category' => $this->db->escape($category_name), |
|
| 163 | + 'rank' => (int) $category_rank |
|
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | 166 | $this->db->insert( |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $this->db_tbl['categories'] |
| 169 | 169 | ); |
| 170 | 170 | |
| 171 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 171 | + if ($this->db->getAffectedRows() === 1) |
|
| 172 | 172 | { |
| 173 | 173 | return $this->db->getInsertId(); |
| 174 | 174 | } |
@@ -176,19 +176,19 @@ discard block |
||
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public function isCategoryExists( $category_name ) |
|
| 179 | + public function isCategoryExists($category_name) |
|
| 180 | 180 | { |
| 181 | - $category = $this->db->escape( $category_name ); |
|
| 181 | + $category = $this->db->escape($category_name); |
|
| 182 | 182 | |
| 183 | 183 | $category_id = $this->db->getValue( |
| 184 | 184 | $this->db->select( |
| 185 | 185 | '`id`', |
| 186 | 186 | $this->db_tbl['categories'], |
| 187 | - "`category` = '" . $category . "'" |
|
| 187 | + "`category` = '".$category."'" |
|
| 188 | 188 | ) |
| 189 | 189 | ); |
| 190 | 190 | |
| 191 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 191 | + if ($this->db->getAffectedRows() === 1) |
|
| 192 | 192 | { |
| 193 | 193 | return $category_id; |
| 194 | 194 | } |
@@ -1,17 +1,17 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('view_eventlog')) { |
|
| 5 | +if (!$modx->hasPermission('view_eventlog')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // get id |
| 10 | 10 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| 11 | 11 | |
| 12 | -$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log") . " el |
|
| 13 | - LEFT JOIN " . $modx->getFullTableName("manager_users") . " mu ON mu.id=el.user AND el.usertype=0 |
|
| 14 | - LEFT JOIN " . $modx->getFullTableName("web_users") . " wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'"); |
|
| 12 | +$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log")." el |
|
| 13 | + LEFT JOIN " . $modx->getFullTableName("manager_users")." mu ON mu.id=el.user AND el.usertype=0 |
|
| 14 | + LEFT JOIN " . $modx->getFullTableName("web_users")." wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'"); |
|
| 15 | 15 | $content = $modx->db->getRow($ds); |
| 16 | 16 | |
| 17 | 17 | ?> |
@@ -42,18 +42,18 @@ discard block |
||
| 42 | 42 | <div class="container container-body"> |
| 43 | 43 | <?php |
| 44 | 44 | $date = $modx->toDateFormat($content["createdon"]); |
| 45 | - if($content["type"] == 1) { |
|
| 46 | - $icon = $_style['actions_info'] . ' text-info'; |
|
| 45 | + if ($content["type"] == 1) { |
|
| 46 | + $icon = $_style['actions_info'].' text-info'; |
|
| 47 | 47 | $msgtype = $_lang["information"]; |
| 48 | - } else if($content["type"] == 2) { |
|
| 49 | - $icon = $_style['actions_triangle'] . ' text-warning'; |
|
| 48 | + } else if ($content["type"] == 2) { |
|
| 49 | + $icon = $_style['actions_triangle'].' text-warning'; |
|
| 50 | 50 | $msgtype = $_lang["warning"]; |
| 51 | - } else if($content["type"] == 3) { |
|
| 52 | - $icon = $_style['actions_error'] . ' text-danger'; |
|
| 51 | + } else if ($content["type"] == 3) { |
|
| 52 | + $icon = $_style['actions_error'].' text-danger'; |
|
| 53 | 53 | $msgtype = $_lang["error"]; |
| 54 | 54 | } |
| 55 | 55 | ?> |
| 56 | - <p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p> |
|
| 56 | + <p><b><?= $content['source']." - ".$_lang['eventlog_viewer'] ?></b></p> |
|
| 57 | 57 | <p> |
| 58 | 58 | <i class="<?= $icon ?>"></i> <?= $msgtype ?> |
| 59 | 59 | </p> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | '999' => 'Viewing test page', |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | -function getAction($actionId, $itemid='') { |
|
| 137 | +function getAction($actionId, $itemid = ''){ |
|
| 138 | 138 | global $action_list; |
| 139 | 139 | |
| 140 | 140 | $ret = sprintf($action_list[$actionId], $itemid); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if(( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE!="true") { |
|
| 2 | +if ((!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE != "true") { |
|
| 3 | 3 | die("<b>INCLUDE ACCESS ERROR</b><br /><br />Direct access to this file prohibited."); |
| 4 | 4 | } |
| 5 | 5 | $tmpArray = array(); |
@@ -1,43 +1,43 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | $this->old = new OldFunctions(); |
| 3 | -class OldFunctions { |
|
| 3 | +class OldFunctions{ |
|
| 4 | 4 | |
| 5 | - function dbConnect() {global $modx; $modx->db->connect();$modx->rs = $modx->db->conn;} |
|
| 6 | - function dbQuery($sql) {global $modx;return $modx->db->query($sql);} |
|
| 7 | - function recordCount($rs) {global $modx;return $modx->db->getRecordCount($rs);} |
|
| 8 | - function fetchRow($rs,$mode='assoc') {global $modx;return $modx->db->getRow($rs, $mode);} |
|
| 9 | - function affectedRows($rs) {global $modx;return $modx->db->getAffectedRows($rs);} |
|
| 10 | - function insertId($rs) {global $modx;return $modx->db->getInsertId($rs);} |
|
| 11 | - function dbClose() {global $modx; $modx->db->disconnect();} |
|
| 5 | + function dbConnect(){global $modx; $modx->db->connect(); $modx->rs = $modx->db->conn; } |
|
| 6 | + function dbQuery($sql){global $modx; return $modx->db->query($sql); } |
|
| 7 | + function recordCount($rs){global $modx; return $modx->db->getRecordCount($rs); } |
|
| 8 | + function fetchRow($rs, $mode = 'assoc'){global $modx; return $modx->db->getRow($rs, $mode); } |
|
| 9 | + function affectedRows($rs){global $modx; return $modx->db->getAffectedRows($rs); } |
|
| 10 | + function insertId($rs){global $modx; return $modx->db->getInsertId($rs); } |
|
| 11 | + function dbClose(){global $modx; $modx->db->disconnect(); } |
|
| 12 | 12 | |
| 13 | - function makeList($array, $ulroot= 'root', $ulprefix= 'sub_', $type= '', $ordered= false, $tablevel= 0) { |
|
| 13 | + function makeList($array, $ulroot = 'root', $ulprefix = 'sub_', $type = '', $ordered = false, $tablevel = 0){ |
|
| 14 | 14 | // first find out whether the value passed is an array |
| 15 | 15 | if (!is_array($array)) { |
| 16 | 16 | return "<ul><li>Bad list</li></ul>"; |
| 17 | 17 | } |
| 18 | 18 | if (!empty ($type)) { |
| 19 | - $typestr= " style='list-style-type: $type'"; |
|
| 19 | + $typestr = " style='list-style-type: $type'"; |
|
| 20 | 20 | } else { |
| 21 | - $typestr= ""; |
|
| 21 | + $typestr = ""; |
|
| 22 | 22 | } |
| 23 | - $tabs= ""; |
|
| 24 | - for ($i= 0; $i < $tablevel; $i++) { |
|
| 23 | + $tabs = ""; |
|
| 24 | + for ($i = 0; $i < $tablevel; $i++) { |
|
| 25 | 25 | $tabs .= "\t"; |
| 26 | 26 | } |
| 27 | - $listhtml= $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n"; |
|
| 27 | + $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n"; |
|
| 28 | 28 | foreach ($array as $key => $value) { |
| 29 | 29 | if (is_array($value)) { |
| 30 | - $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix, $type, $ordered, $tablevel +2) . $tabs . "\t</li>\n"; |
|
| 30 | + $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix, $type, $ordered, $tablevel + 2).$tabs."\t</li>\n"; |
|
| 31 | 31 | } else { |
| 32 | - $listhtml .= $tabs . "\t<li>" . $value . "</li>\n"; |
|
| 32 | + $listhtml .= $tabs."\t<li>".$value."</li>\n"; |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | - $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n"; |
|
| 35 | + $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n"; |
|
| 36 | 36 | return $listhtml; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | - function getUserData() { |
|
| 40 | + function getUserData(){ |
|
| 41 | 41 | $client['ip'] = $_SERVER['REMOTE_ADDR']; |
| 42 | 42 | $client['ua'] = $_SERVER['HTTP_USER_AGENT']; |
| 43 | 43 | return $client; |
@@ -45,80 +45,80 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | # Returns true, install or interact when inside manager |
| 47 | 47 | // deprecated |
| 48 | - function insideManager() { |
|
| 49 | - $m= false; |
|
| 50 | - if( defined('IN_MANAGER_MODE') && IN_MANAGER_MODE === true) { |
|
| 51 | - $m= true; |
|
| 48 | + function insideManager(){ |
|
| 49 | + $m = false; |
|
| 50 | + if (defined('IN_MANAGER_MODE') && IN_MANAGER_MODE === true) { |
|
| 51 | + $m = true; |
|
| 52 | 52 | if (defined('SNIPPET_INTERACTIVE_MODE') && SNIPPET_INTERACTIVE_MODE == 'true') |
| 53 | - $m= "interact"; |
|
| 53 | + $m = "interact"; |
|
| 54 | 54 | else |
| 55 | 55 | if (defined('SNIPPET_INSTALL_MODE') && SNIPPET_INSTALL_MODE == 'true') |
| 56 | - $m= "install"; |
|
| 56 | + $m = "install"; |
|
| 57 | 57 | } |
| 58 | 58 | return $m; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // deprecated |
| 62 | - function putChunk($chunkName) { // alias name >.< |
|
| 62 | + function putChunk($chunkName){ // alias name >.< |
|
| 63 | 63 | global $modx; |
| 64 | 64 | return $modx->getChunk($chunkName); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - function getDocGroups() { |
|
| 67 | + function getDocGroups(){ |
|
| 68 | 68 | global $modx; |
| 69 | 69 | return $modx->getUserDocGroups(); |
| 70 | 70 | } // deprecated |
| 71 | 71 | |
| 72 | - function changePassword($o, $n) { |
|
| 72 | + function changePassword($o, $n){ |
|
| 73 | 73 | return changeWebUserPassword($o, $n); |
| 74 | 74 | } // deprecated |
| 75 | 75 | |
| 76 | - function userLoggedIn() { |
|
| 76 | + function userLoggedIn(){ |
|
| 77 | 77 | global $modx; |
| 78 | - $userdetails= array (); |
|
| 78 | + $userdetails = array(); |
|
| 79 | 79 | if ($modx->isFrontend() && isset ($_SESSION['webValidated'])) { |
| 80 | 80 | // web user |
| 81 | - $userdetails['loggedIn']= true; |
|
| 82 | - $userdetails['id']= $_SESSION['webInternalKey']; |
|
| 83 | - $userdetails['username']= $_SESSION['webShortname']; |
|
| 84 | - $userdetails['usertype']= 'web'; // added by Raymond |
|
| 81 | + $userdetails['loggedIn'] = true; |
|
| 82 | + $userdetails['id'] = $_SESSION['webInternalKey']; |
|
| 83 | + $userdetails['username'] = $_SESSION['webShortname']; |
|
| 84 | + $userdetails['usertype'] = 'web'; // added by Raymond |
|
| 85 | 85 | return $userdetails; |
| 86 | 86 | } else |
| 87 | 87 | if ($modx->isBackend() && isset ($_SESSION['mgrValidated'])) { |
| 88 | 88 | // manager user |
| 89 | - $userdetails['loggedIn']= true; |
|
| 90 | - $userdetails['id']= $_SESSION['mgrInternalKey']; |
|
| 91 | - $userdetails['username']= $_SESSION['mgrShortname']; |
|
| 92 | - $userdetails['usertype']= 'manager'; // added by Raymond |
|
| 89 | + $userdetails['loggedIn'] = true; |
|
| 90 | + $userdetails['id'] = $_SESSION['mgrInternalKey']; |
|
| 91 | + $userdetails['username'] = $_SESSION['mgrShortname']; |
|
| 92 | + $userdetails['usertype'] = 'manager'; // added by Raymond |
|
| 93 | 93 | return $userdetails; |
| 94 | 94 | } else { |
| 95 | 95 | return false; |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD) { |
|
| 99 | + function getFormVars($method = "", $prefix = "", $trim = "", $REQUEST_METHOD){ |
|
| 100 | 100 | // function to retrieve form results into an associative array |
| 101 | 101 | global $modx; |
| 102 | - $results= array (); |
|
| 103 | - $method= strtoupper($method); |
|
| 102 | + $results = array(); |
|
| 103 | + $method = strtoupper($method); |
|
| 104 | 104 | if ($method == "") |
| 105 | - $method= $REQUEST_METHOD; |
|
| 105 | + $method = $REQUEST_METHOD; |
|
| 106 | 106 | if ($method == "POST") |
| 107 | - $method= & $_POST; |
|
| 108 | - elseif ($method == "GET") $method= & $_GET; |
|
| 107 | + $method = & $_POST; |
|
| 108 | + elseif ($method == "GET") $method = & $_GET; |
|
| 109 | 109 | else |
| 110 | 110 | return false; |
| 111 | 111 | reset($method); |
| 112 | 112 | foreach ($method as $key => $value) { |
| 113 | 113 | if (($prefix != "") && (substr($key, 0, strlen($prefix)) == $prefix)) { |
| 114 | 114 | if ($trim) { |
| 115 | - $pieces= explode($prefix, $key, 2); |
|
| 116 | - $key= $pieces[1]; |
|
| 117 | - $results[$key]= $value; |
|
| 115 | + $pieces = explode($prefix, $key, 2); |
|
| 116 | + $key = $pieces[1]; |
|
| 117 | + $results[$key] = $value; |
|
| 118 | 118 | } else |
| 119 | - $results[$key]= $value; |
|
| 119 | + $results[$key] = $value; |
|
| 120 | 120 | } |
| 121 | - elseif ($prefix == "") $results[$key]= $value; |
|
| 121 | + elseif ($prefix == "") $results[$key] = $value; |
|
| 122 | 122 | } |
| 123 | 123 | return $results; |
| 124 | 124 | } |
@@ -129,16 +129,16 @@ discard block |
||
| 129 | 129 | * @param string $msg Message to show |
| 130 | 130 | * @param string $url URL to redirect to |
| 131 | 131 | */ |
| 132 | - function webAlert($msg, $url= "") { |
|
| 132 | + function webAlert($msg, $url = ""){ |
|
| 133 | 133 | global $modx; |
| 134 | - $msg= addslashes($modx->db->escape($msg)); |
|
| 134 | + $msg = addslashes($modx->db->escape($msg)); |
|
| 135 | 135 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
| 136 | - $act= "__WebAlert();"; |
|
| 137 | - $fnc= "function __WebAlert(){" . substr($url, 11) . "};"; |
|
| 136 | + $act = "__WebAlert();"; |
|
| 137 | + $fnc = "function __WebAlert(){".substr($url, 11)."};"; |
|
| 138 | 138 | } else { |
| 139 | - $act= ($url ? "window.location.href='" . addslashes($url) . "';" : ""); |
|
| 139 | + $act = ($url ? "window.location.href='".addslashes($url)."';" : ""); |
|
| 140 | 140 | } |
| 141 | - $html= "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
|
| 141 | + $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
|
| 142 | 142 | if ($modx->isFrontend()) |
| 143 | 143 | $modx->regClientScript($html); |
| 144 | 144 | else { |