@@ -32,6 +32,9 @@ |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | +/** |
|
| 36 | + * @param string $src |
|
| 37 | + */ |
|
| 35 | 38 | function parse($src,$ph,$left='[+',$right='+]') |
| 36 | 39 | { |
| 37 | 40 | foreach($ph as $k=>$v) |
@@ -4,9 +4,9 @@ discard block |
||
| 4 | 4 | global $_lang; |
| 5 | 5 | |
| 6 | 6 | // session loop-back tester |
| 7 | - if(!isset($_GET['action']) || $_GET['action']!=='mode') |
|
| 7 | + if (!isset($_GET['action']) || $_GET['action'] !== 'mode') |
|
| 8 | 8 | { |
| 9 | - if(!isset($_SESSION['test']) || $_SESSION['test']!=1) |
|
| 9 | + if (!isset($_SESSION['test']) || $_SESSION['test'] != 1) |
|
| 10 | 10 | { |
| 11 | 11 | echo ' |
| 12 | 12 | <html> |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | </head> |
| 23 | 23 | <body> |
| 24 | 24 | <div class="install"> |
| 25 | - <p>' . $_lang["session_problem"] . '</p> |
|
| 26 | - <p><a href="./">' .$_lang["session_problem_try_again"] . '</a></p> |
|
| 25 | + <p>' . $_lang["session_problem"].'</p> |
|
| 26 | + <p><a href="./">' .$_lang["session_problem_try_again"].'</a></p> |
|
| 27 | 27 | </div> |
| 28 | 28 | </body> |
| 29 | 29 | </html>'; |
@@ -32,28 +32,28 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -function parse($src,$ph,$left='[+',$right='+]') |
|
| 35 | +function parse($src, $ph, $left = '[+', $right = '+]') |
|
| 36 | 36 | { |
| 37 | - foreach($ph as $k=>$v) |
|
| 37 | + foreach ($ph as $k=>$v) |
|
| 38 | 38 | { |
| 39 | - $k = $left . $k . $right; |
|
| 40 | - $src = str_replace($k,$v,$src); |
|
| 39 | + $k = $left.$k.$right; |
|
| 40 | + $src = str_replace($k, $v, $src); |
|
| 41 | 41 | } |
| 42 | 42 | return $src; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | function ph() |
| 46 | 46 | { |
| 47 | - global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date; |
|
| 47 | + global $_lang, $moduleName, $moduleVersion, $modx_textdir, $modx_release_date; |
|
| 48 | 48 | |
| 49 | - if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode']; |
|
| 49 | + if (isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode']; |
|
| 50 | 50 | else $installmode = get_installmode(); |
| 51 | 51 | |
| 52 | 52 | $ph['pagetitle'] = $_lang['modx_install']; |
| 53 | - $ph['textdir'] = $modx_textdir ? ' id="rtl"':''; |
|
| 53 | + $ph['textdir'] = $modx_textdir ? ' id="rtl"' : ''; |
|
| 54 | 54 | $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd']; |
| 55 | 55 | $ph['version'] = $moduleVersion; |
| 56 | - $ph['release_date'] = ($modx_textdir ? '‏':'') . $modx_release_date; |
|
| 56 | + $ph['release_date'] = ($modx_textdir ? '‏' : '').$modx_release_date; |
|
| 57 | 57 | $ph['footer1'] = $_lang['modx_footer1']; |
| 58 | 58 | $ph['footer2'] = $_lang['modx_footer2']; |
| 59 | 59 | $ph['current_year'] = date('Y'); |
@@ -62,20 +62,20 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | function get_installmode() |
| 64 | 64 | { |
| 65 | - global $base_path,$database_server, $database_user, $database_password, $dbase, $table_prefix; |
|
| 65 | + global $base_path, $database_server, $database_user, $database_password, $dbase, $table_prefix; |
|
| 66 | 66 | |
| 67 | 67 | $conf_path = "{$base_path}manager/includes/config.inc.php"; |
| 68 | 68 | if (!is_file($conf_path)) $installmode = 0; |
| 69 | - elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
| 69 | + elseif (isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
| 70 | 70 | else |
| 71 | 71 | { |
| 72 | 72 | include_once("{$base_path}manager/includes/config.inc.php"); |
| 73 | 73 | |
| 74 | - if(!isset($dbase) || empty($dbase)) $installmode = 0; |
|
| 74 | + if (!isset($dbase) || empty($dbase)) $installmode = 0; |
|
| 75 | 75 | else |
| 76 | 76 | { |
| 77 | 77 | $conn = mysqli_connect($database_server, $database_user, $database_password); |
| 78 | - if($conn) |
|
| 78 | + if ($conn) |
|
| 79 | 79 | { |
| 80 | 80 | $_SESSION['database_server'] = $database_server; |
| 81 | 81 | $_SESSION['database_user'] = $database_user; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | else $rs = false; |
| 88 | 88 | |
| 89 | - if($rs) |
|
| 89 | + if ($rs) |
|
| 90 | 90 | { |
| 91 | 91 | $_SESSION['dbase'] = $dbase; |
| 92 | 92 | $_SESSION['table_prefix'] = $table_prefix; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`"; |
| 97 | 97 | $rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'"); |
| 98 | - if($rs) |
|
| 98 | + if ($rs) |
|
| 99 | 99 | { |
| 100 | 100 | $row = mysqli_fetch_assoc($rs); |
| 101 | 101 | $settings_version = $row['setting_value']; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $langs = array(); |
| 123 | - if ($handle = opendir("../" . MGR_DIR . "/includes/lang")) { |
|
| 123 | + if ($handle = opendir("../".MGR_DIR."/includes/lang")) { |
|
| 124 | 124 | while (false !== ($file = readdir($handle))) { |
| 125 | 125 | if (strpos($file, '.inc.') !== false) { |
| 126 | 126 | $langs[] = $file; |
@@ -565,6 +565,9 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | +/** |
|
| 569 | + * @param string $file |
|
| 570 | + */ |
|
| 568 | 571 | function determineIcon($file, $selFile, $mode) |
| 569 | 572 | { |
| 570 | 573 | $icons = array( |
@@ -709,6 +712,9 @@ discard block |
||
| 709 | 712 | return $path; |
| 710 | 713 | } |
| 711 | 714 | |
| 715 | +/** |
|
| 716 | + * @param string $string |
|
| 717 | + */ |
|
| 712 | 718 | function getExtension($string) |
| 713 | 719 | { |
| 714 | 720 | $pos = strrpos($string, '.'); |
@@ -744,6 +750,9 @@ discard block |
||
| 744 | 750 | return @mkdir($strPath); |
| 745 | 751 | } |
| 746 | 752 | |
| 753 | +/** |
|
| 754 | + * @param string $type |
|
| 755 | + */ |
|
| 747 | 756 | function logFileChange($type, $filename) |
| 748 | 757 | { |
| 749 | 758 | //global $_lang; |
@@ -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 |
@@ -160,6 +160,11 @@ discard block |
||
| 160 | 160 | return $output; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | +/** |
|
| 164 | + * @param integer $parent |
|
| 165 | + * @param string $filedir |
|
| 166 | + * @param string $mode |
|
| 167 | + */ |
|
| 163 | 168 | function importFiles($parent, $filedir, $files, $mode) { |
| 164 | 169 | global $modx; |
| 165 | 170 | global $_lang, $allowedfiles; |
@@ -302,6 +307,9 @@ discard block |
||
| 302 | 307 | } |
| 303 | 308 | } |
| 304 | 309 | |
| 310 | +/** |
|
| 311 | + * @param string $directory |
|
| 312 | + */ |
|
| 305 | 313 | function getFiles($directory, $listing = array(), $count = 0) { |
| 306 | 314 | global $_lang; |
| 307 | 315 | global $filesfound; |
@@ -326,6 +334,9 @@ discard block |
||
| 326 | 334 | return ($listing); |
| 327 | 335 | } |
| 328 | 336 | |
| 337 | +/** |
|
| 338 | + * @param string $filepath |
|
| 339 | + */ |
|
| 329 | 340 | function getFileContent($filepath) { |
| 330 | 341 | global $_lang; |
| 331 | 342 | // get the file |
@@ -353,6 +364,9 @@ discard block |
||
| 353 | 364 | return $new_array; |
| 354 | 365 | } |
| 355 | 366 | |
| 367 | +/** |
|
| 368 | + * @param null|string $src |
|
| 369 | + */ |
|
| 356 | 370 | function treatContent($src, $filename, $alias) { |
| 357 | 371 | global $modx; |
| 358 | 372 | |
@@ -1,8 +1,8 @@ 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('import_static')) { |
|
| 5 | +if (!$modx->hasPermission('import_static')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | <div class="tab-page"> |
| 44 | 44 | <div class="container container-body"> |
| 45 | 45 | <?php |
| 46 | - if(!isset($_POST['import'])) { |
|
| 47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
| 46 | + if (!isset($_POST['import'])) { |
|
| 47 | + echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>"; |
|
| 48 | 48 | ?> |
| 49 | 49 | <form action="index.php" method="post" name="importFrm"> |
| 50 | 50 | <input type="hidden" name="import" value="import" /> |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | </div> |
| 102 | 102 | |
| 103 | 103 | <?php |
| 104 | -function run() { |
|
| 104 | +function run(){ |
|
| 105 | 105 | global $modx; |
| 106 | 106 | |
| 107 | 107 | $tbl_site_content = $modx->getFullTableName('site_content'); |
| 108 | 108 | $output = ''; |
| 109 | 109 | $maxtime = $_POST['maxtime']; |
| 110 | 110 | |
| 111 | - if(!is_numeric($maxtime)) { |
|
| 111 | + if (!is_numeric($maxtime)) { |
|
| 112 | 112 | $maxtime = 30; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -119,17 +119,17 @@ discard block |
||
| 119 | 119 | $mtime = $mtime[1] + $mtime[0]; |
| 120 | 120 | $importstart = $mtime; |
| 121 | 121 | |
| 122 | - if($_POST['reset'] == 'on') { |
|
| 122 | + if ($_POST['reset'] == 'on') { |
|
| 123 | 123 | $modx->db->truncate($tbl_site_content); |
| 124 | 124 | $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $parent = intval($_POST['parent']); |
| 128 | 128 | |
| 129 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 130 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 131 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 132 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 129 | + if (is_dir(MODX_BASE_PATH.'temp/import')) { |
|
| 130 | + $filedir = MODX_BASE_PATH.'temp/import/'; |
|
| 131 | + } elseif (is_dir(MODX_BASE_PATH.'assets/import')) { |
|
| 132 | + $filedir = MODX_BASE_PATH.'assets/import/'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $filesfound = 0; |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | $files = pop_index($files); |
| 139 | 139 | |
| 140 | 140 | // no. of files to import |
| 141 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 141 | + $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound); |
|
| 142 | 142 | |
| 143 | 143 | // import files |
| 144 | - if(0 < count($files)) { |
|
| 144 | + if (0 < count($files)) { |
|
| 145 | 145 | $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
| 146 | 146 | importFiles($parent, $filedir, $files, 'root'); |
| 147 | 147 | } |
@@ -151,16 +151,16 @@ discard block |
||
| 151 | 151 | $mtime = $mtime[1] + $mtime[0]; |
| 152 | 152 | $importend = $mtime; |
| 153 | 153 | $totaltime = ($importend - $importstart); |
| 154 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 154 | + $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3)); |
|
| 155 | 155 | |
| 156 | - if($_POST['convert_link'] == 'on') { |
|
| 156 | + if ($_POST['convert_link'] == 'on') { |
|
| 157 | 157 | convertLink(); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | return $output; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | -function importFiles($parent, $filedir, $files, $mode) { |
|
| 163 | +function importFiles($parent, $filedir, $files, $mode){ |
|
| 164 | 164 | global $modx; |
| 165 | 165 | global $_lang, $allowedfiles; |
| 166 | 166 | global $search_default, $cache_default, $publish_default; |
@@ -169,21 +169,21 @@ discard block |
||
| 169 | 169 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
| 170 | 170 | |
| 171 | 171 | $createdby = $modx->getLoginUserID(); |
| 172 | - if(!is_array($files)) { |
|
| 172 | + if (!is_array($files)) { |
|
| 173 | 173 | return; |
| 174 | 174 | } |
| 175 | - if($_POST['object'] == 'all') { |
|
| 175 | + if ($_POST['object'] == 'all') { |
|
| 176 | 176 | $modx->config['default_template'] = '0'; |
| 177 | 177 | $richtext = '0'; |
| 178 | 178 | } else { |
| 179 | 179 | $richtext = '1'; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - foreach($files as $id => $value) { |
|
| 183 | - if(is_array($value)) { |
|
| 182 | + foreach ($files as $id => $value) { |
|
| 183 | + if (is_array($value)) { |
|
| 184 | 184 | // create folder |
| 185 | 185 | $alias = $id; |
| 186 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 186 | + printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias); |
|
| 187 | 187 | $field = array(); |
| 188 | 188 | $field['type'] = 'document'; |
| 189 | 189 | $field['contentType'] = 'text/html'; |
@@ -198,12 +198,12 @@ discard block |
||
| 198 | 198 | $field['isfolder'] = 1; |
| 199 | 199 | $field['menuindex'] = 1; |
| 200 | 200 | $find = false; |
| 201 | - foreach(array( |
|
| 201 | + foreach (array( |
|
| 202 | 202 | 'index.html', |
| 203 | 203 | 'index.htm' |
| 204 | 204 | ) as $filename) { |
| 205 | - $filepath = $filedir . $alias . '/' . $filename; |
|
| 206 | - if($find === false && file_exists($filepath)) { |
|
| 205 | + $filepath = $filedir.$alias.'/'.$filename; |
|
| 206 | + if ($find === false && file_exists($filepath)) { |
|
| 207 | 207 | $file = getFileContent($filepath); |
| 208 | 208 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
| 209 | 209 | |
@@ -215,17 +215,17 @@ discard block |
||
| 215 | 215 | $field['createdon'] = $date; |
| 216 | 216 | $field['editedon'] = $date; |
| 217 | 217 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 218 | - if($newid) { |
|
| 218 | + if ($newid) { |
|
| 219 | 219 | $find = true; |
| 220 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 221 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 220 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 221 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
| 222 | 222 | } else { |
| 223 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 223 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 224 | 224 | exit; |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | - if($find === false) { |
|
| 228 | + if ($find === false) { |
|
| 229 | 229 | $date = time(); |
| 230 | 230 | $field['pagetitle'] = '---'; |
| 231 | 231 | $field['content'] = ''; |
@@ -233,30 +233,30 @@ discard block |
||
| 233 | 233 | $field['editedon'] = $date; |
| 234 | 234 | $field['hidemenu'] = '1'; |
| 235 | 235 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 236 | - if($newid) { |
|
| 236 | + if ($newid) { |
|
| 237 | 237 | $find = true; |
| 238 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 239 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 238 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 239 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
| 240 | 240 | } else { |
| 241 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 241 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 242 | 242 | exit; |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | } else { |
| 246 | 246 | // create document |
| 247 | - if($mode == 'sub' && $value == 'index.html') { |
|
| 247 | + if ($mode == 'sub' && $value == 'index.html') { |
|
| 248 | 248 | continue; |
| 249 | 249 | } |
| 250 | 250 | $filename = $value; |
| 251 | 251 | $fparts = explode('.', $value); |
| 252 | 252 | $alias = $fparts[0]; |
| 253 | 253 | $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
| 254 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 254 | + printf("<span>".$_lang['import_site_importing_document']."</span>", $filename); |
|
| 255 | 255 | |
| 256 | - if(!in_array($ext, $allowedfiles)) { |
|
| 257 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 256 | + if (!in_array($ext, $allowedfiles)) { |
|
| 257 | + echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n"; |
|
| 258 | 258 | } else { |
| 259 | - $filepath = $filedir . $filename; |
|
| 259 | + $filepath = $filedir.$filename; |
|
| 260 | 260 | $file = getFileContent($filepath); |
| 261 | 261 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
| 262 | 262 | |
@@ -281,18 +281,18 @@ discard block |
||
| 281 | 281 | $field['isfolder'] = 0; |
| 282 | 282 | $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
| 283 | 283 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 284 | - if($newid) { |
|
| 285 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 284 | + if ($newid) { |
|
| 285 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 286 | 286 | } else { |
| 287 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 287 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 288 | 288 | exit; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | $is_site_start = false; |
| 292 | - if($filename == 'index.html') { |
|
| 292 | + if ($filename == 'index.html') { |
|
| 293 | 293 | $is_site_start = true; |
| 294 | 294 | } |
| 295 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 295 | + if ($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 296 | 296 | $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
| 297 | 297 | $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
| 298 | 298 | } |
@@ -301,85 +301,85 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
| 304 | +function getFiles($directory, $listing = array(), $count = 0){ |
|
| 305 | 305 | global $_lang; |
| 306 | 306 | global $filesfound; |
| 307 | 307 | $dummy = $count; |
| 308 | - if($files = scandir($directory)) { |
|
| 309 | - foreach($files as $file) { |
|
| 310 | - if($file == '.' || $file == '..') { |
|
| 308 | + if ($files = scandir($directory)) { |
|
| 309 | + foreach ($files as $file) { |
|
| 310 | + if ($file == '.' || $file == '..') { |
|
| 311 | 311 | continue; |
| 312 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
| 312 | + } elseif ($h = @opendir($directory.$file."/")) { |
|
| 313 | 313 | closedir($h); |
| 314 | 314 | $count = -1; |
| 315 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 316 | - } elseif(strpos($file, '.htm') !== false) { |
|
| 315 | + $listing[$file] = getFiles($directory.$file."/", array(), $count + 1); |
|
| 316 | + } elseif (strpos($file, '.htm') !== false) { |
|
| 317 | 317 | $listing[$dummy] = $file; |
| 318 | 318 | $dummy = $dummy + 1; |
| 319 | 319 | $filesfound++; |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | } else { |
| 323 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 323 | + echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>"; |
|
| 324 | 324 | } |
| 325 | 325 | return ($listing); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | -function getFileContent($filepath) { |
|
| 328 | +function getFileContent($filepath){ |
|
| 329 | 329 | global $_lang; |
| 330 | 330 | // get the file |
| 331 | - if(!$buffer = file_get_contents($filepath)) { |
|
| 332 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 331 | + if (!$buffer = file_get_contents($filepath)) { |
|
| 332 | + echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>"; |
|
| 333 | 333 | } else { |
| 334 | 334 | return $buffer; |
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | -function pop_index($array) { |
|
| 338 | +function pop_index($array){ |
|
| 339 | 339 | $new_array = array(); |
| 340 | - foreach($array as $k => $v) { |
|
| 341 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
| 340 | + foreach ($array as $k => $v) { |
|
| 341 | + if ($v !== 'index.html' && $v !== 'index.htm') { |
|
| 342 | 342 | $new_array[$k] = $v; |
| 343 | 343 | } else { |
| 344 | 344 | array_unshift($new_array, $v); |
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | - foreach($array as $k => $v) { |
|
| 348 | - if(is_array($v)) { |
|
| 347 | + foreach ($array as $k => $v) { |
|
| 348 | + if (is_array($v)) { |
|
| 349 | 349 | $new_array[$k] = $v; |
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | return $new_array; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | -function treatContent($src, $filename, $alias) { |
|
| 355 | +function treatContent($src, $filename, $alias){ |
|
| 356 | 356 | global $modx; |
| 357 | 357 | |
| 358 | 358 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
| 359 | 359 | |
| 360 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 360 | + if (preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 361 | 361 | $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
| 362 | 362 | $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
| 363 | 363 | } else { |
| 364 | 364 | $pagetitle = $alias; |
| 365 | 365 | } |
| 366 | - if(!$pagetitle) { |
|
| 366 | + if (!$pagetitle) { |
|
| 367 | 367 | $pagetitle = $alias; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 370 | + if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 371 | 371 | $description = ($matches[1] !== '') ? $matches[1] : $filename; |
| 372 | 372 | $description = str_replace('[*description*]', '', $description); |
| 373 | 373 | } else { |
| 374 | 374 | $description = ''; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 377 | + if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 378 | 378 | $content = $matches[1]; |
| 379 | 379 | } else { |
| 380 | 380 | $content = $src; |
| 381 | 381 | $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
| 382 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 382 | + $r = '$1'.$modx->config['modx_charset'].'$2'; |
|
| 383 | 383 | $content = preg_replace($s, $r, $content); |
| 384 | 384 | $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
| 385 | 385 | } |
@@ -393,38 +393,38 @@ discard block |
||
| 393 | 393 | ); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | -function convertLink() { |
|
| 396 | +function convertLink(){ |
|
| 397 | 397 | global $modx; |
| 398 | 398 | $tbl_site_content = $modx->getFullTableName('site_content'); |
| 399 | 399 | |
| 400 | 400 | $rs = $modx->db->select('id,content', $tbl_site_content); |
| 401 | - while($row = $modx->db->getRow($rs)) { |
|
| 401 | + while ($row = $modx->db->getRow($rs)) { |
|
| 402 | 402 | $id = $row['id']; |
| 403 | 403 | $array = explode('<a href=', $row['content']); |
| 404 | 404 | $c = 0; |
| 405 | - foreach($array as $v) { |
|
| 406 | - if($v[0] === '"') { |
|
| 405 | + foreach ($array as $v) { |
|
| 406 | + if ($v[0] === '"') { |
|
| 407 | 407 | $v = substr($v, 1); |
| 408 | 408 | list($href, $v) = explode('"', $v, 2); |
| 409 | 409 | $_ = $href; |
| 410 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
| 411 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 410 | + if (strpos($_, $modx->config['site_url']) !== false) { |
|
| 411 | + $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_); |
|
| 412 | 412 | } |
| 413 | - if($_[0] === '/') { |
|
| 413 | + if ($_[0] === '/') { |
|
| 414 | 414 | $_ = substr($_, 1); |
| 415 | 415 | } |
| 416 | 416 | $_ = str_replace('/index.html', '.html', $_); |
| 417 | 417 | $level = substr_count($_, '../'); |
| 418 | - if(1 < $level) { |
|
| 419 | - if(!isset($p[$id])) { |
|
| 418 | + if (1 < $level) { |
|
| 419 | + if (!isset($p[$id])) { |
|
| 420 | 420 | $p[$id] = $modx->getParentIds($id); |
| 421 | 421 | } |
| 422 | 422 | $k = array_keys($p[$id]); |
| 423 | - while(0 < $level) { |
|
| 423 | + while (0 < $level) { |
|
| 424 | 424 | $dir = array_shift($k); |
| 425 | 425 | $level--; |
| 426 | 426 | } |
| 427 | - if($dir != '') { |
|
| 427 | + if ($dir != '') { |
|
| 428 | 428 | $dir .= '/'; |
| 429 | 429 | } |
| 430 | 430 | } else { |
@@ -432,18 +432,18 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | $_ = trim($_, './'); |
| 435 | - if(strpos($_, '/') !== false) { |
|
| 435 | + if (strpos($_, '/') !== false) { |
|
| 436 | 436 | $_ = substr($_, strrpos($_, '/')); |
| 437 | 437 | } |
| 438 | - $_ = $dir . str_replace('.html', '', $_); |
|
| 439 | - if(!isset($target[$_])) { |
|
| 438 | + $_ = $dir.str_replace('.html', '', $_); |
|
| 439 | + if (!isset($target[$_])) { |
|
| 440 | 440 | $target[$_] = $modx->getIdFromAlias($_); |
| 441 | 441 | } |
| 442 | 442 | $target[$_] = trim($target[$_]); |
| 443 | - if(!empty($target[$_])) { |
|
| 444 | - $href = '[~' . $target[$_] . '~]'; |
|
| 443 | + if (!empty($target[$_])) { |
|
| 444 | + $href = '[~'.$target[$_].'~]'; |
|
| 445 | 445 | } |
| 446 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 446 | + $array[$c] = '<a href="'.$href.'"'.$v; |
|
| 447 | 447 | } |
| 448 | 448 | $c++; |
| 449 | 449 | } |
@@ -16,6 +16,7 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * get_langs_by_key |
| 18 | 18 | * |
| 19 | + * @param string $key |
|
| 19 | 20 | * @return array of languages that define the key in their file |
| 20 | 21 | */ |
| 21 | 22 | function get_langs_by_key($key) {
|
@@ -36,7 +37,7 @@ discard block |
||
| 36 | 37 | * |
| 37 | 38 | * @param string $key specify language key to return options of langauges that override it, default return all languages |
| 38 | 39 | * @param string $selected_lang specify language to select in option list, default none |
| 39 | - * @return html option list |
|
| 40 | + * @return string option list |
|
| 40 | 41 | */ |
| 41 | 42 | function get_lang_options($key=null, $selected_lang=null) {
|
| 42 | 43 | global $lang_keys, $_lang; |
@@ -4,9 +4,9 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | * @return array of keys from a language file |
| 6 | 6 | */ |
| 7 | -function get_lang_keys($filename) {
|
|
| 8 | - $file = MODX_MANAGER_PATH.'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
|
| 9 | - if(is_file($file) && is_readable($file)) {
|
|
| 7 | +function get_lang_keys($filename){
|
|
| 8 | + $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename; |
|
| 9 | + if (is_file($file) && is_readable($file)) {
|
|
| 10 | 10 | include($file); |
| 11 | 11 | return array_keys($_lang); |
| 12 | 12 | } else {
|
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return array of languages that define the key in their file |
| 20 | 20 | */ |
| 21 | -function get_langs_by_key($key) {
|
|
| 21 | +function get_langs_by_key($key){
|
|
| 22 | 22 | global $lang_keys; |
| 23 | 23 | $lang_return = array(); |
| 24 | - foreach($lang_keys as $lang=>$keys) {
|
|
| 25 | - if(in_array($key, $keys)) {
|
|
| 24 | + foreach ($lang_keys as $lang=>$keys) {
|
|
| 25 | + if (in_array($key, $keys)) {
|
|
| 26 | 26 | $lang_return[] = $lang; |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | * @param string $selected_lang specify language to select in option list, default none |
| 39 | 39 | * @return html option list |
| 40 | 40 | */ |
| 41 | -function get_lang_options($key=null, $selected_lang=null) {
|
|
| 41 | +function get_lang_options($key = null, $selected_lang = null){
|
|
| 42 | 42 | global $lang_keys, $_lang; |
| 43 | 43 | $lang_options = ''; |
| 44 | - if($key) {
|
|
| 44 | + if ($key) {
|
|
| 45 | 45 | $languages = get_langs_by_key($key); |
| 46 | 46 | sort($languages); |
| 47 | 47 | $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
| 48 | 48 | |
| 49 | - foreach($languages as $language_name) {
|
|
| 49 | + foreach ($languages as $language_name) {
|
|
| 50 | 50 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
|
| 51 | 51 | $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
| 52 | 52 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } else {
|
| 55 | 55 | $languages = array_keys($lang_keys); |
| 56 | 56 | sort($languages); |
| 57 | - foreach($languages as $language_name) {
|
|
| 57 | + foreach ($languages as $language_name) {
|
|
| 58 | 58 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
|
| 59 | 59 | $sel = $language_name == $selected_lang ? ' selected="selected"' : ''; |
| 60 | 60 | $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
@@ -63,23 +63,23 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -function form_radio($name,$value,$add='',$disabled=false) {
|
|
| 66 | +function form_radio($name, $value, $add = '', $disabled = false){
|
|
| 67 | 67 | global ${$name};
|
| 68 | 68 | $var = ${$name};
|
| 69 | - $checked = ($var==$value) ? ' checked="checked"' : ''; |
|
| 70 | - if($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
| 71 | - if($add) $add = ' ' . $add; |
|
| 69 | + $checked = ($var == $value) ? ' checked="checked"' : ''; |
|
| 70 | + if ($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
| 71 | + if ($add) $add = ' '.$add; |
|
| 72 | 72 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add);
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -function wrap_label($str='',$object) {
|
|
| 75 | +function wrap_label($str = '', $object){
|
|
| 76 | 76 | return "<label>{$object}\n{$str}</label>";
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -function parseText($tpl='', $ph=array()) {
|
|
| 80 | - if(empty($ph) || empty($tpl)) return $tpl; |
|
| 79 | +function parseText($tpl = '', $ph = array()){
|
|
| 80 | + if (empty($ph) || empty($tpl)) return $tpl; |
|
| 81 | 81 | |
| 82 | - foreach($ph as $k=>$v) |
|
| 82 | + foreach ($ph as $k=>$v) |
|
| 83 | 83 | {
|
| 84 | 84 | $k = "[+{$k}+]";
|
| 85 | 85 | $tpl = str_replace($k, $v, $tpl); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | return $tpl; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | -function showHide($cond=true) {
|
|
| 90 | +function showHide($cond = true){
|
|
| 91 | 91 | global $displayStyle; |
| 92 | 92 | $showHide = $cond ? $displayStyle : 'none'; |
| 93 | 93 | return sprintf('style="display:%s"', $showHide);
|
@@ -504,6 +504,9 @@ |
||
| 504 | 504 | return $iconsPrivate; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | +/** |
|
| 508 | + * @return string |
|
| 509 | + */ |
|
| 507 | 510 | function getNodeTitle($nodeNameSource, $row) { |
| 508 | 511 | global $modx; |
| 509 | 512 | |
@@ -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 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @param $theme |
| 11 | 11 | * @param string $hereid |
| 12 | 12 | */ |
| 13 | -function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') { |
|
| 13 | +function makeHTML($indent, $parent, $expandAll, $theme, $hereid = ''){ |
|
| 14 | 14 | global $modx; |
| 15 | 15 | global $icons, $iconsPrivate, $_style; |
| 16 | 16 | global $_lang, $opened, $opened2, $closed2; //added global vars |
@@ -21,35 +21,35 @@ discard block |
||
| 21 | 21 | // setup spacer |
| 22 | 22 | $level = 0; |
| 23 | 23 | $spacer = '<span class="indent">'; |
| 24 | - for($i = 2; $i <= $indent; $i++) { |
|
| 24 | + for ($i = 2; $i <= $indent; $i++) { |
|
| 25 | 25 | $spacer .= '<i></i>'; |
| 26 | 26 | $level++; |
| 27 | 27 | } |
| 28 | 28 | $spacer .= '</span>'; |
| 29 | 29 | |
| 30 | 30 | // manage order-by |
| 31 | - if(!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
|
| 31 | + if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
|
| 32 | 32 | // This is the first startup, set default sort order |
| 33 | 33 | $_SESSION['tree_sortby'] = 'menuindex'; |
| 34 | 34 | $_SESSION['tree_sortdir'] = 'ASC'; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - switch($_SESSION['tree_sortby']) { |
|
| 37 | + switch ($_SESSION['tree_sortby']) { |
|
| 38 | 38 | case 'createdon': |
| 39 | 39 | case 'editedon': |
| 40 | 40 | case 'publishedon': |
| 41 | 41 | case 'pub_date': |
| 42 | 42 | case 'unpub_date': |
| 43 | - $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']); |
|
| 43 | + $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], 'sc.'.$_SESSION['tree_sortby']); |
|
| 44 | 44 | break; |
| 45 | 45 | default: |
| 46 | - $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
| 46 | + $sortby = 'sc.'.$_SESSION['tree_sortby']; |
|
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | - $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
| 49 | + $orderby = $modx->db->escape($sortby.' '.$_SESSION['tree_sortdir']); |
|
| 50 | 50 | |
| 51 | 51 | // Folder sorting gets special setup ;) Add menuindex and pagetitle |
| 52 | - if($_SESSION['tree_sortby'] == 'isfolder') { |
|
| 52 | + if ($_SESSION['tree_sortby'] == 'isfolder') { |
|
| 53 | 53 | $orderby .= ', menuindex ASC, pagetitle'; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | // get document groups for current user |
| 60 | 60 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
| 61 | 61 | $showProtected = false; |
| 62 | - if(isset ($modx->config['tree_show_protected'])) { |
|
| 62 | + if (isset ($modx->config['tree_show_protected'])) { |
|
| 63 | 63 | $showProtected = (boolean) $modx->config['tree_show_protected']; |
| 64 | 64 | } |
| 65 | 65 | $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
| 66 | - if($showProtected == false) { |
|
| 67 | - $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
| 66 | + if ($showProtected == false) { |
|
| 67 | + $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
| 68 | 68 | } else { |
| 69 | 69 | $access = ''; |
| 70 | 70 | } |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | $from = "{$tblsc} AS sc LEFT JOIN {$tbldg} dg on dg.document = sc.id LEFT JOIN {$tblst} st on st.id = sc.template"; |
| 75 | 75 | $where = "(parent={$parent}) {$access} GROUP BY sc.id"; |
| 76 | 76 | $result = $modx->db->select($field, $from, $where, $orderby); |
| 77 | - if($modx->db->getRecordCount($result) == 0) { |
|
| 77 | + if ($modx->db->getRecordCount($result) == 0) { |
|
| 78 | 78 | $output .= sprintf('<div><a class="empty">%s%s <span class="empty">%s</span></a></div>', $spacer, $_style['tree_deletedpage'], $_lang['empty_folder']); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $nodeNameSource = $_SESSION['tree_nodename'] == 'default' ? $modx->config['resource_tree_node_name'] : $_SESSION['tree_nodename']; |
| 82 | 82 | |
| 83 | - while($row = $modx->db->getRow($result)) { |
|
| 83 | + while ($row = $modx->db->getRow($result)) { |
|
| 84 | 84 | $node = ''; |
| 85 | 85 | |
| 86 | 86 | $nodetitle = getNodeTitle($nodeNameSource, $row); |
@@ -89,46 +89,46 @@ discard block |
||
| 89 | 89 | $treeNodeClass = 'node'; |
| 90 | 90 | $treeNodeClass .= $row['hasAccess'] == 0 ? ' protected' : ''; |
| 91 | 91 | |
| 92 | - if($row['deleted'] == 1) { |
|
| 92 | + if ($row['deleted'] == 1) { |
|
| 93 | 93 | $treeNodeClass .= ' deleted'; |
| 94 | 94 | //$nodetitleDisplay = sprintf('<span class="deletedNode">%s</span>', $nodetitle); |
| 95 | - } elseif($row['published'] == 0) { |
|
| 95 | + } elseif ($row['published'] == 0) { |
|
| 96 | 96 | $treeNodeClass .= ' unpublished'; |
| 97 | 97 | //$nodetitleDisplay = sprintf('<span class="unpublishedNode">%s</span>', $nodetitle); |
| 98 | - } elseif($row['hidemenu'] == 1) { |
|
| 98 | + } elseif ($row['hidemenu'] == 1) { |
|
| 99 | 99 | $treeNodeClass .= ' hidemenu'; |
| 100 | 100 | //$nodetitleDisplay = sprintf('<span class="notInMenuNode%s">%s</span>', $protectedClass, $nodetitle); |
| 101 | 101 | } else { |
| 102 | 102 | //$nodetitleDisplay = sprintf('<span class="publishedNode%s">%s</span>', $protectedClass, $nodetitle); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if($row['id'] == $hereid) { |
|
| 105 | + if ($row['id'] == $hereid) { |
|
| 106 | 106 | $treeNodeClass .= ' current'; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
| 110 | - $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
| 110 | + $pageIdDisplay = '<small>('.($modx_textdir ? '‏' : '').$row['id'].')</small>'; |
|
| 111 | 111 | |
| 112 | 112 | // Prepare displaying user-locks |
| 113 | 113 | $lockedByUser = ''; |
| 114 | 114 | $rowLock = $modx->elementIsLocked(7, $row['id'], true); |
| 115 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
| 116 | - if($rowLock['sid'] == $modx->sid) { |
|
| 115 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
| 116 | + if ($rowLock['sid'] == $modx->sid) { |
|
| 117 | 117 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
| 118 | 118 | 'element_type' => $_lang["lock_element_type_7"], |
| 119 | 119 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 120 | 120 | )); |
| 121 | - $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
| 121 | + $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>'; |
|
| 122 | 122 | } else { |
| 123 | 123 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
| 124 | 124 | 'element_type' => $_lang["lock_element_type_7"], |
| 125 | 125 | 'username' => $rowLock['username'], |
| 126 | 126 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 127 | 127 | )); |
| 128 | - if($modx->hasPermission('remove_locks')) { |
|
| 129 | - $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
| 128 | + if ($modx->hasPermission('remove_locks')) { |
|
| 129 | + $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
| 130 | 130 | } else { |
| 131 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
| 131 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -136,23 +136,23 @@ discard block |
||
| 136 | 136 | $url = $modx->makeUrl($row['id']); |
| 137 | 137 | |
| 138 | 138 | $title = ''; |
| 139 | - if(isDateNode($nodeNameSource)) { |
|
| 140 | - $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
| 139 | + if (isDateNode($nodeNameSource)) { |
|
| 140 | + $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]'; |
|
| 141 | 141 | } |
| 142 | - $title .= $_lang['id'] . ': ' . $row['id']; |
|
| 143 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
| 144 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
| 145 | - $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
| 146 | - $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
| 147 | - $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
| 148 | - $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
| 149 | - $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
| 150 | - $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
| 151 | - $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
| 152 | - $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
| 153 | - $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
| 142 | + $title .= $_lang['id'].': '.$row['id']; |
|
| 143 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle']; |
|
| 144 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex']; |
|
| 145 | + $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-'); |
|
| 146 | + $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename']; |
|
| 147 | + $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']); |
|
| 148 | + $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']); |
|
| 149 | + $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
| 150 | + $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
| 151 | + $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
| 152 | + $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
| 153 | + $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
| 154 | 154 | $title = $modx->htmlspecialchars($title); |
| 155 | - $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
| 155 | + $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
| 156 | 156 | |
| 157 | 157 | $data = array( |
| 158 | 158 | 'id' => $row['id'], |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | $ph['expandAll'] = $expandAll; |
| 202 | 202 | $ph['isPrivate'] = ($row['privateweb'] || $row['privatemgr']) ? 1 : 0; |
| 203 | 203 | |
| 204 | - if(!$row['isfolder']) { |
|
| 204 | + if (!$row['isfolder']) { |
|
| 205 | 205 | $tpl = getTplSingleNode(); |
| 206 | - switch($row['id']) { |
|
| 206 | + switch ($row['id']) { |
|
| 207 | 207 | case $modx->config['site_start'] : |
| 208 | 208 | $icon = $_style['tree_page_home']; |
| 209 | 209 | break; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $icon = $_style['tree_page_info']; |
| 218 | 218 | break; |
| 219 | 219 | default: |
| 220 | - if(isset($icons[$row['contentType']])) { |
|
| 220 | + if (isset($icons[$row['contentType']])) { |
|
| 221 | 221 | $icon = $icons[$row['contentType']]; |
| 222 | 222 | } else { |
| 223 | 223 | $icon = $_style['tree_page']; |
@@ -227,20 +227,20 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | // invoke OnManagerNodePrerender event |
| 229 | 229 | $prenode = $modx->invokeEvent("OnManagerNodePrerender", array('ph' => $ph)); |
| 230 | - if(is_array($prenode)) { |
|
| 230 | + if (is_array($prenode)) { |
|
| 231 | 231 | $phnew = array(); |
| 232 | - foreach($prenode as $pnode) { |
|
| 232 | + foreach ($prenode as $pnode) { |
|
| 233 | 233 | $phnew = array_merge($phnew, unserialize($pnode)); |
| 234 | 234 | } |
| 235 | 235 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if($ph['contextmenu']) { |
|
| 239 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
| 238 | + if ($ph['contextmenu']) { |
|
| 239 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if($_SESSION['tree_show_only_folders']) { |
|
| 243 | - if($row['parent'] == 0) { |
|
| 242 | + if ($_SESSION['tree_show_only_folders']) { |
|
| 243 | + if ($row['parent'] == 0) { |
|
| 244 | 244 | $node .= $modx->parseText($tpl, $ph); |
| 245 | 245 | } else { |
| 246 | 246 | $node .= ''; |
@@ -253,15 +253,15 @@ discard block |
||
| 253 | 253 | $ph['icon_folder_open'] = $_style['tree_folderopen_new']; |
| 254 | 254 | $ph['icon_folder_close'] = $_style['tree_folder_new']; |
| 255 | 255 | |
| 256 | - if($_SESSION['tree_show_only_folders']) { |
|
| 256 | + if ($_SESSION['tree_show_only_folders']) { |
|
| 257 | 257 | $tpl = getTplFolderNodeNotChildren(); |
| 258 | 258 | $checkFolders = checkIsFolder($row['id'], 1) ? 1 : 0; // folders |
| 259 | 259 | $checkDocs = checkIsFolder($row['id'], 0) ? 1 : 0; // no folders |
| 260 | 260 | $ph['tree_page_click'] = 3; |
| 261 | 261 | |
| 262 | 262 | // expandAll: two type for partial expansion |
| 263 | - if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
| 264 | - if($expandAll == 1) { |
|
| 263 | + if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
| 264 | + if ($expandAll == 1) { |
|
| 265 | 265 | $opened2[] = $row['id']; |
| 266 | 266 | } |
| 267 | 267 | $ph['icon'] = $ph['icon_folder_open']; |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | $ph['node_toggle'] = 1; |
| 270 | 270 | $ph['subMenuState'] = ' open'; |
| 271 | 271 | |
| 272 | - if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
| 272 | + if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
| 273 | 273 | $ph['showChildren'] = 1; |
| 274 | 274 | $ph['icon_node_toggle'] = ''; |
| 275 | 275 | $ph['icon'] = $ph['icon_folder_close']; |
| 276 | - } elseif(!$checkDocs && $checkFolders) { |
|
| 276 | + } elseif (!$checkDocs && $checkFolders) { |
|
| 277 | 277 | $ph['showChildren'] = 0; |
| 278 | 278 | $ph['openFolder'] = 2; |
| 279 | 279 | } else { |
@@ -285,20 +285,20 @@ discard block |
||
| 285 | 285 | 'ph' => $ph, |
| 286 | 286 | 'opened' => '1' |
| 287 | 287 | )); |
| 288 | - if(is_array($prenode)) { |
|
| 288 | + if (is_array($prenode)) { |
|
| 289 | 289 | $phnew = array(); |
| 290 | - foreach($prenode as $pnode) { |
|
| 290 | + foreach ($prenode as $pnode) { |
|
| 291 | 291 | $phnew = array_merge($phnew, unserialize($pnode)); |
| 292 | 292 | } |
| 293 | 293 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - if($ph['contextmenu']) { |
|
| 297 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
| 296 | + if ($ph['contextmenu']) { |
|
| 297 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | $node .= $modx->parseText($tpl, $ph); |
| 301 | - if($checkFolders) { |
|
| 301 | + if ($checkFolders) { |
|
| 302 | 302 | $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
| 303 | 303 | } |
| 304 | 304 | $node .= '</div></div>'; |
@@ -308,10 +308,10 @@ discard block |
||
| 308 | 308 | $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
| 309 | 309 | $ph['node_toggle'] = 0; |
| 310 | 310 | |
| 311 | - if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
| 311 | + if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
| 312 | 312 | $ph['showChildren'] = 1; |
| 313 | 313 | $ph['icon_node_toggle'] = ''; |
| 314 | - } elseif(!$checkDocs && $checkFolders) { |
|
| 314 | + } elseif (!$checkDocs && $checkFolders) { |
|
| 315 | 315 | $ph['showChildren'] = 0; |
| 316 | 316 | $ph['openFolder'] = 2; |
| 317 | 317 | } else { |
@@ -323,16 +323,16 @@ discard block |
||
| 323 | 323 | 'ph' => $ph, |
| 324 | 324 | 'opened' => '0' |
| 325 | 325 | )); |
| 326 | - if(is_array($prenode)) { |
|
| 326 | + if (is_array($prenode)) { |
|
| 327 | 327 | $phnew = array(); |
| 328 | - foreach($prenode as $pnode) { |
|
| 328 | + foreach ($prenode as $pnode) { |
|
| 329 | 329 | $phnew = array_merge($phnew, unserialize($pnode)); |
| 330 | 330 | } |
| 331 | 331 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if($ph['contextmenu']) { |
|
| 335 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
| 334 | + if ($ph['contextmenu']) { |
|
| 335 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | $node .= $modx->parseText($tpl, $ph); |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | } else { |
| 342 | 342 | $tpl = getTplFolderNode(); |
| 343 | 343 | // expandAll: two type for partial expansion |
| 344 | - if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
| 345 | - if($expandAll == 1) { |
|
| 344 | + if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
| 345 | + if ($expandAll == 1) { |
|
| 346 | 346 | $opened2[] = $row['id']; |
| 347 | 347 | } |
| 348 | 348 | $ph['icon'] = $ph['icon_folder_open']; |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | $ph['node_toggle'] = 1; |
| 351 | 351 | $ph['subMenuState'] = ' open'; |
| 352 | 352 | |
| 353 | - if($ph['donthit'] == 1) { |
|
| 353 | + if ($ph['donthit'] == 1) { |
|
| 354 | 354 | $ph['tree_page_click'] = 3; |
| 355 | 355 | $ph['icon_node_toggle'] = ''; |
| 356 | 356 | $ph['icon'] = $ph['icon_folder_close']; |
@@ -362,32 +362,32 @@ discard block |
||
| 362 | 362 | 'ph' => $ph, |
| 363 | 363 | 'opened' => '1' |
| 364 | 364 | )); |
| 365 | - if(is_array($prenode)) { |
|
| 365 | + if (is_array($prenode)) { |
|
| 366 | 366 | $phnew = array(); |
| 367 | - foreach($prenode as $pnode) { |
|
| 367 | + foreach ($prenode as $pnode) { |
|
| 368 | 368 | $phnew = array_merge($phnew, unserialize($pnode)); |
| 369 | 369 | } |
| 370 | 370 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
| 371 | - if($ph['showChildren'] == 0) { |
|
| 371 | + if ($ph['showChildren'] == 0) { |
|
| 372 | 372 | unset($opened2[$row['id']]); |
| 373 | 373 | $ph['node_toggle'] = 0; |
| 374 | 374 | $ph['subMenuState'] = ''; |
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - if($ph['showChildren'] == 0) { |
|
| 378 | + if ($ph['showChildren'] == 0) { |
|
| 379 | 379 | $ph['icon_node_toggle'] = ''; |
| 380 | 380 | $ph['donthit'] = 1; |
| 381 | 381 | $ph['icon'] = $ph['icon_folder_close']; |
| 382 | 382 | $tpl = getTplFolderNodeNotChildren(); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - if($ph['contextmenu']) { |
|
| 386 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
| 385 | + if ($ph['contextmenu']) { |
|
| 386 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | $node .= $modx->parseText($tpl, $ph); |
| 390 | - if($ph['donthit'] == 0) { |
|
| 390 | + if ($ph['donthit'] == 0) { |
|
| 391 | 391 | $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
| 392 | 392 | } |
| 393 | 393 | $node .= '</div></div>'; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
| 398 | 398 | $ph['node_toggle'] = 0; |
| 399 | 399 | |
| 400 | - if($ph['donthit'] == 1) { |
|
| 400 | + if ($ph['donthit'] == 1) { |
|
| 401 | 401 | $ph['tree_page_click'] = 3; |
| 402 | 402 | $ph['icon_node_toggle'] = ''; |
| 403 | 403 | $ph['icon'] = $ph['icon_folder_close']; |
@@ -409,23 +409,23 @@ discard block |
||
| 409 | 409 | 'ph' => $ph, |
| 410 | 410 | 'opened' => '0' |
| 411 | 411 | )); |
| 412 | - if(is_array($prenode)) { |
|
| 412 | + if (is_array($prenode)) { |
|
| 413 | 413 | $phnew = array(); |
| 414 | - foreach($prenode as $pnode) { |
|
| 414 | + foreach ($prenode as $pnode) { |
|
| 415 | 415 | $phnew = array_merge($phnew, unserialize($pnode)); |
| 416 | 416 | } |
| 417 | 417 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - if($ph['showChildren'] == 0) { |
|
| 420 | + if ($ph['showChildren'] == 0) { |
|
| 421 | 421 | $ph['icon_node_toggle'] = ''; |
| 422 | 422 | $ph['donthit'] = 1; |
| 423 | 423 | $ph['icon'] = $ph['icon_folder_close']; |
| 424 | 424 | $tpl = getTplFolderNodeNotChildren(); |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - if($ph['contextmenu']) { |
|
| 428 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
| 427 | + if ($ph['contextmenu']) { |
|
| 428 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | $node .= $modx->parseText($tpl, $ph); |
@@ -437,10 +437,10 @@ discard block |
||
| 437 | 437 | // invoke OnManagerNodeRender event |
| 438 | 438 | $data['node'] = $node; |
| 439 | 439 | $evtOut = $modx->invokeEvent('OnManagerNodeRender', $data); |
| 440 | - if(is_array($evtOut)) { |
|
| 440 | + if (is_array($evtOut)) { |
|
| 441 | 441 | $evtOut = implode("\n", $evtOut); |
| 442 | 442 | } |
| 443 | - if($evtOut != '') { |
|
| 443 | + if ($evtOut != '') { |
|
| 444 | 444 | $node = trim($evtOut); |
| 445 | 445 | } |
| 446 | 446 | |
@@ -450,14 +450,14 @@ discard block |
||
| 450 | 450 | return $output; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | -function getIconInfo($_style) { |
|
| 454 | - if(!isset($_style['tree_page_gif'])) { |
|
| 453 | +function getIconInfo($_style){ |
|
| 454 | + if (!isset($_style['tree_page_gif'])) { |
|
| 455 | 455 | $_style['tree_page_gif'] = $_style['tree_page']; |
| 456 | 456 | } |
| 457 | - if(!isset($_style['tree_page_jpg'])) { |
|
| 457 | + if (!isset($_style['tree_page_jpg'])) { |
|
| 458 | 458 | $_style['tree_page_jpg'] = $_style['tree_page']; |
| 459 | 459 | } |
| 460 | - if(!isset($_style['tree_page_png'])) { |
|
| 460 | + if (!isset($_style['tree_page_png'])) { |
|
| 461 | 461 | $_style['tree_page_png'] = $_style['tree_page']; |
| 462 | 462 | } |
| 463 | 463 | $icons = array( |
@@ -477,14 +477,14 @@ discard block |
||
| 477 | 477 | return $icons; |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | -function getPrivateIconInfo($_style) { |
|
| 481 | - if(!isset($_style['tree_page_gif_secure'])) { |
|
| 480 | +function getPrivateIconInfo($_style){ |
|
| 481 | + if (!isset($_style['tree_page_gif_secure'])) { |
|
| 482 | 482 | $_style['tree_page_gif_secure'] = $_style['tree_page_secure']; |
| 483 | 483 | } |
| 484 | - if(!isset($_style['tree_page_jpg_secure'])) { |
|
| 484 | + if (!isset($_style['tree_page_jpg_secure'])) { |
|
| 485 | 485 | $_style['tree_page_jpg_secure'] = $_style['tree_page_secure']; |
| 486 | 486 | } |
| 487 | - if(!isset($_style['tree_page_png_secure'])) { |
|
| 487 | + if (!isset($_style['tree_page_png_secure'])) { |
|
| 488 | 488 | $_style['tree_page_png_secure'] = $_style['tree_page_secure']; |
| 489 | 489 | } |
| 490 | 490 | $iconsPrivate = array( |
@@ -504,21 +504,21 @@ discard block |
||
| 504 | 504 | return $iconsPrivate; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | -function getNodeTitle($nodeNameSource, $row) { |
|
| 507 | +function getNodeTitle($nodeNameSource, $row){ |
|
| 508 | 508 | global $modx; |
| 509 | 509 | |
| 510 | - switch($nodeNameSource) { |
|
| 510 | + switch ($nodeNameSource) { |
|
| 511 | 511 | case 'menutitle': |
| 512 | 512 | $nodetitle = $row['menutitle'] ? $row['menutitle'] : $row['pagetitle']; |
| 513 | 513 | break; |
| 514 | 514 | case 'alias': |
| 515 | 515 | $nodetitle = $row['alias'] ? $row['alias'] : $row['id']; |
| 516 | - if(strpos($row['alias'], '.') === false) { |
|
| 517 | - if($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) { |
|
| 516 | + if (strpos($row['alias'], '.') === false) { |
|
| 517 | + if ($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) { |
|
| 518 | 518 | $nodetitle .= $modx->config['friendly_url_suffix']; |
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | - $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle; |
|
| 521 | + $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle; |
|
| 522 | 522 | break; |
| 523 | 523 | case 'pagetitle': |
| 524 | 524 | $nodetitle = $row['pagetitle']; |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | case 'unpub_date': |
| 534 | 534 | $doc = $modx->getDocumentObject('id', $row['id']); |
| 535 | 535 | $date = $doc[$nodeNameSource]; |
| 536 | - if(!empty($date)) { |
|
| 536 | + if (!empty($date)) { |
|
| 537 | 537 | $nodetitle = $modx->toDateFormat($date); |
| 538 | 538 | } else { |
| 539 | 539 | $nodetitle = '- - -'; |
@@ -550,8 +550,8 @@ discard block |
||
| 550 | 550 | return $nodetitle; |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | -function isDateNode($nodeNameSource) { |
|
| 554 | - switch($nodeNameSource) { |
|
| 553 | +function isDateNode($nodeNameSource){ |
|
| 554 | + switch ($nodeNameSource) { |
|
| 555 | 555 | case 'createdon': |
| 556 | 556 | case 'editedon': |
| 557 | 557 | case 'publishedon': |
@@ -563,13 +563,13 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | -function checkIsFolder($parent = 0, $isfolder = 1) { |
|
| 566 | +function checkIsFolder($parent = 0, $isfolder = 1){ |
|
| 567 | 567 | global $modx; |
| 568 | 568 | |
| 569 | - return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
| 569 | + return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' ')); |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | -function _htmlentities($array) { |
|
| 572 | +function _htmlentities($array){ |
|
| 573 | 573 | global $modx; |
| 574 | 574 | |
| 575 | 575 | $array = json_encode($array, JSON_UNESCAPED_UNICODE); |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | return $array; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | -function getTplSingleNode() { |
|
| 581 | +function getTplSingleNode(){ |
|
| 582 | 582 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
| 583 | 583 | onclick="modx.tree.treeAction(event,[+id+]);" |
| 584 | 584 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a></div>'; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | -function getTplFolderNode() { |
|
| 605 | +function getTplFolderNode(){ |
|
| 606 | 606 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
| 607 | 607 | onclick="modx.tree.treeAction(event,[+id+]);" |
| 608 | 608 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>'; |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | -function getTplFolderNodeNotChildren() { |
|
| 641 | +function getTplFolderNodeNotChildren(){ |
|
| 642 | 642 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
| 643 | 643 | onclick="modx.tree.treeAction(event,[+id+]);" |
| 644 | 644 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -670,11 +670,11 @@ discard block |
||
| 670 | 670 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>'; |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | -function dbug($str, $flag = false) { |
|
| 673 | +function dbug($str, $flag = false){ |
|
| 674 | 674 | print('<pre>'); |
| 675 | 675 | print_r($str); |
| 676 | 676 | print('</pre>'); |
| 677 | - if($flag) { |
|
| 677 | + if ($flag) { |
|
| 678 | 678 | exit; |
| 679 | 679 | } |
| 680 | 680 | } |
@@ -3,6 +3,9 @@ |
||
| 3 | 3 | //Kyle Jaebker - 08/07/06 |
| 4 | 4 | |
| 5 | 5 | //Create a new category |
| 6 | +/** |
|
| 7 | + * @param string $newCat |
|
| 8 | + */ |
|
| 6 | 9 | function newCategory($newCat) { |
| 7 | 10 | global $modx; |
| 8 | 11 | $useTable = $modx->getFullTableName('categories'); |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | //Kyle Jaebker - 08/07/06 |
| 4 | 4 | |
| 5 | 5 | //Create a new category |
| 6 | -function newCategory($newCat) { |
|
| 6 | +function newCategory($newCat){ |
|
| 7 | 7 | global $modx; |
| 8 | 8 | $useTable = $modx->getFullTableName('categories'); |
| 9 | 9 | $categoryId = $modx->db->insert( |
@@ -14,36 +14,36 @@ discard block |
||
| 14 | 14 | return $categoryId; |
| 15 | 15 | } |
| 16 | 16 | //check if new category already exists |
| 17 | -function checkCategory($newCat = '') { |
|
| 17 | +function checkCategory($newCat = ''){ |
|
| 18 | 18 | global $modx; |
| 19 | 19 | $useTable = $modx->getFullTableName('categories'); |
| 20 | 20 | $newCat = $modx->db->escape($newCat); |
| 21 | 21 | $cats = $modx->db->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'"); |
| 22 | - if($cat = $modx->db->getValue($cats)) { |
|
| 22 | + if ($cat = $modx->db->getValue($cats)) { |
|
| 23 | 23 | return $cat; |
| 24 | 24 | } |
| 25 | 25 | return 0; |
| 26 | 26 | } |
| 27 | 27 | //Check for category, create new if not exists |
| 28 | -function getCategory($category='') { |
|
| 28 | +function getCategory($category = ''){ |
|
| 29 | 29 | $categoryId = checkCategory($category); |
| 30 | - if(!$categoryId) $categoryId = newCategory($category); |
|
| 30 | + if (!$categoryId) $categoryId = newCategory($category); |
|
| 31 | 31 | return $categoryId; |
| 32 | 32 | } |
| 33 | 33 | //Get all categories |
| 34 | -function getCategories() { |
|
| 34 | +function getCategories(){ |
|
| 35 | 35 | global $modx; |
| 36 | 36 | $useTable = $modx->getFullTableName('categories'); |
| 37 | 37 | $cats = $modx->db->select('id, category', $modx->getFullTableName('categories'), '', 'category'); |
| 38 | 38 | $resourceArray = array(); |
| 39 | - while($row = $modx->db->getRow($cats)) { |
|
| 39 | + while ($row = $modx->db->getRow($cats)) { |
|
| 40 | 40 | $row['category'] = stripslashes($row['category']); |
| 41 | 41 | $resourceArray[] = $row; |
| 42 | 42 | } |
| 43 | 43 | return $resourceArray; |
| 44 | 44 | } |
| 45 | 45 | //Delete category & associations |
| 46 | -function deleteCategory($catId=0) { |
|
| 46 | +function deleteCategory($catId = 0){ |
|
| 47 | 47 | global $modx; |
| 48 | 48 | if ($catId) { |
| 49 | 49 | $resetTables = array('site_plugins', 'site_snippets', 'site_htmlsnippets', 'site_templates', 'site_tmplvars', 'site_modules'); |
@@ -52,6 +52,9 @@ discard block |
||
| 52 | 52 | var $selPageClass; |
| 53 | 53 | var $noRecordMsg = "No records found."; |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @param string $id |
|
| 57 | + */ |
|
| 55 | 58 | function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
| 56 | 59 | global $__DataGridCnt; |
| 57 | 60 | |
@@ -187,6 +190,9 @@ discard block |
||
| 187 | 190 | |
| 188 | 191 | // format column values |
| 189 | 192 | |
| 193 | + /** |
|
| 194 | + * @param integer $n |
|
| 195 | + */ |
|
| 190 | 196 | function RenderRowFnc($n, $row) { |
| 191 | 197 | if($this->_alt == 0) { |
| 192 | 198 | $Style = $this->_itemStyle; |
@@ -10,14 +10,14 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataGridCnt = 0; |
| 12 | 12 | |
| 13 | -class DataGrid { |
|
| 13 | +class DataGrid{ |
|
| 14 | 14 | |
| 15 | 15 | var $ds; // datasource |
| 16 | 16 | var $id; |
| 17 | - var $pageSize; // pager settings |
|
| 17 | + var $pageSize; // pager settings |
|
| 18 | 18 | var $pageNumber; |
| 19 | 19 | var $pager; |
| 20 | - var $pagerLocation; // top-right, top-left, bottom-left, bottom-right, both-left, both-right |
|
| 20 | + var $pagerLocation; // top-right, top-left, bottom-left, bottom-right, both-left, both-right |
|
| 21 | 21 | |
| 22 | 22 | var $cssStyle; |
| 23 | 23 | var $cssClass; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | var $colAligns; |
| 36 | 36 | var $colWraps; |
| 37 | 37 | var $colColors; |
| 38 | - var $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
|
| 38 | + var $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
|
| 39 | 39 | // data type: integer,float,currency,date |
| 40 | 40 | |
| 41 | 41 | var $header; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | var $cellPadding; |
| 44 | 44 | var $cellSpacing; |
| 45 | 45 | |
| 46 | - var $rowAlign; // vertical alignment: top, middle, bottom |
|
| 46 | + var $rowAlign; // vertical alignment: top, middle, bottom |
|
| 47 | 47 | var $rowIdField; |
| 48 | 48 | |
| 49 | 49 | var $pagerStyle; |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | var $selPageClass; |
| 53 | 53 | var $noRecordMsg = "No records found."; |
| 54 | 54 | |
| 55 | - function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
|
| 55 | + function __construct($id, $ds, $pageSize = 20, $pageNumber = -1){ |
|
| 56 | 56 | global $__DataGridCnt; |
| 57 | 57 | |
| 58 | 58 | // set id |
| 59 | 59 | $__DataGridCnt++; |
| 60 | - $this->id = $this->id ? $id : "dg" . $__DataGridCnt; |
|
| 60 | + $this->id = $this->id ? $id : "dg".$__DataGridCnt; |
|
| 61 | 61 | |
| 62 | 62 | // set datasource |
| 63 | 63 | $this->ds = $ds; |
@@ -68,50 +68,50 @@ discard block |
||
| 68 | 68 | $this->pagerLocation = 'top-right'; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - function setDataSource($ds) { |
|
| 71 | + function setDataSource($ds){ |
|
| 72 | 72 | $this->ds = $ds; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - function render() { |
|
| 75 | + function render(){ |
|
| 76 | 76 | global $modx; |
| 77 | - $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
|
| 78 | - $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
|
| 79 | - $cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : ''; |
|
| 80 | - $cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : ''; |
|
| 77 | + $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='".$this->columnHeaderStyle."'" : ''; |
|
| 78 | + $columnHeaderClass = ($this->columnHeaderClass) ? "class='".$this->columnHeaderClass."'" : ""; |
|
| 79 | + $cssStyle = ($this->cssStyle) ? "style='".$this->cssStyle."'" : ''; |
|
| 80 | + $cssClass = ($this->cssClass) ? "class='".$this->cssClass."'" : ''; |
|
| 81 | 81 | |
| 82 | - $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : ''; |
|
| 83 | - $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'"; |
|
| 82 | + $pagerClass = ($this->pagerClass) ? "class='".$this->pagerClass."'" : ''; |
|
| 83 | + $pagerStyle = ($this->pagerStyle) ? "style='".$this->pagerStyle."'" : "style='background-color:#ffffff;'"; |
|
| 84 | 84 | |
| 85 | - $this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : ''; |
|
| 86 | - $this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : ''; |
|
| 87 | - $this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : ''; |
|
| 88 | - $this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : ''; |
|
| 85 | + $this->_itemStyle = ($this->itemStyle) ? "style='".$this->itemStyle."'" : ''; |
|
| 86 | + $this->_itemClass = ($this->itemClass) ? "class='".$this->itemClass."'" : ''; |
|
| 87 | + $this->_altItemStyle = ($this->altItemStyle) ? "style='".$this->altItemStyle."'" : ''; |
|
| 88 | + $this->_altItemClass = ($this->altItemClass) ? "class='".$this->altItemClass."'" : ''; |
|
| 89 | 89 | |
| 90 | 90 | $this->_alt = 0; |
| 91 | 91 | $this->_total = 0; |
| 92 | 92 | |
| 93 | 93 | $this->_isDataset = $modx->db->isResult($this->ds); // if not dataset then treat as array |
| 94 | 94 | |
| 95 | - if(!$cssStyle && !$cssClass) { |
|
| 95 | + if (!$cssStyle && !$cssClass) { |
|
| 96 | 96 | $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'"; |
| 97 | 97 | } |
| 98 | - if(!$columnHeaderStyle && !$columnHeaderClass) { |
|
| 98 | + if (!$columnHeaderStyle && !$columnHeaderClass) { |
|
| 99 | 99 | $columnHeaderStyle = "style='color:black;background-color:silver'"; |
| 100 | 100 | } |
| 101 | - if(!$this->_itemStyle && !$this->_itemClass) { |
|
| 101 | + if (!$this->_itemStyle && !$this->_itemClass) { |
|
| 102 | 102 | $this->_itemStyle = "style='color:black;'"; |
| 103 | 103 | } |
| 104 | - if(!$this->_altItemStyle && !$this->_altItemClass) { |
|
| 104 | + if (!$this->_altItemStyle && !$this->_altItemClass) { |
|
| 105 | 105 | $this->_altItemStyle = "style='color:black;background-color:#eeeeee'"; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if($this->_isDataset && !$this->columns) { |
|
| 108 | + if ($this->_isDataset && !$this->columns) { |
|
| 109 | 109 | $cols = $modx->db->numFields($this->ds); |
| 110 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 110 | + for ($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "").$modx->db->fieldName($this->ds, $i); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // start grid |
| 114 | - $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>"; |
|
| 114 | + $tblStart = "<table $cssClass $cssStyle cellpadding='".(isset($this->cellPadding) ? (int) $this->cellPadding : 1)."' cellspacing='".(isset($this->cellSpacing) ? (int) $this->cellSpacing : 1)."'>"; |
|
| 115 | 115 | $tblEnd = "</table>"; |
| 116 | 116 | |
| 117 | 117 | // build column header |
@@ -122,33 +122,33 @@ discard block |
||
| 122 | 122 | $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors); |
| 123 | 123 | $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes); |
| 124 | 124 | $this->_colcount = count($this->_colnames); |
| 125 | - if(!$this->_isDataset) { |
|
| 125 | + if (!$this->_isDataset) { |
|
| 126 | 126 | $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds); |
| 127 | 127 | $this->ds = array_chunk($this->ds, $this->_colcount); |
| 128 | 128 | } |
| 129 | 129 | $tblColHdr = "<thead><tr>"; |
| 130 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
| 130 | + for ($c = 0; $c < $this->_colcount; $c++) { |
|
| 131 | 131 | $name = $this->_colnames[$c]; |
| 132 | 132 | $width = $this->_colwidths[$c]; |
| 133 | - $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>"; |
|
| 133 | + $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass".($width ? " width='$width'" : "").">$name</td>"; |
|
| 134 | 134 | } |
| 135 | 135 | $tblColHdr .= "</tr></thead>\n"; |
| 136 | 136 | |
| 137 | 137 | // build rows |
| 138 | 138 | $rowcount = $this->_isDataset ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
| 139 | 139 | $this->_fieldnames = explode(",", $this->fields); |
| 140 | - if($rowcount == 0) { |
|
| 141 | - $tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n"; |
|
| 140 | + if ($rowcount == 0) { |
|
| 141 | + $tblRows .= "<tr><td ".$this->_itemStyle." ".$this->_itemClass." colspan='".$this->_colcount."'>".$this->noRecordMsg."</td></tr>\n"; |
|
| 142 | 142 | } else { |
| 143 | 143 | // render grid items |
| 144 | - if($this->pageSize <= 0) { |
|
| 145 | - for($r = 0; $r < $rowcount; $r++) { |
|
| 144 | + if ($this->pageSize <= 0) { |
|
| 145 | + for ($r = 0; $r < $rowcount; $r++) { |
|
| 146 | 146 | $row = $this->_isDataset ? $modx->db->getRow($this->ds) : $this->ds[$r]; |
| 147 | 147 | $tblRows .= $this->RenderRowFnc($r + 1, $row); |
| 148 | 148 | } |
| 149 | 149 | } else { |
| 150 | - if(!$this->pager) { |
|
| 151 | - include_once dirname(__FILE__) . "/datasetpager.class.php"; |
|
| 150 | + if (!$this->pager) { |
|
| 151 | + include_once dirname(__FILE__)."/datasetpager.class.php"; |
|
| 152 | 152 | $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber); |
| 153 | 153 | $this->pager->setRenderRowFnc($this); // pass this object |
| 154 | 154 | $this->pager->cssStyle = $pagerStyle; |
@@ -168,18 +168,18 @@ discard block |
||
| 168 | 168 | $o = $tblStart; |
| 169 | 169 | $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both"); |
| 170 | 170 | $pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both"); |
| 171 | - if($this->header) { |
|
| 172 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>"; |
|
| 171 | + if ($this->header) { |
|
| 172 | + $o .= "<tr><td bgcolor='#ffffff' colspan='".$this->_colcount."'>".$this->header."</td></tr>"; |
|
| 173 | 173 | } |
| 174 | - if($tblPager && $ptop) { |
|
| 175 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
| 174 | + if ($tblPager && $ptop) { |
|
| 175 | + $o .= "<tr><td align='".(substr($this->pagerLocation, -4) == "left" ? "left" : "right")."' $pagerClass $pagerStyle colspan='".$this->_colcount."'>".$tblPager." </td></tr>"; |
|
| 176 | 176 | } |
| 177 | - $o .= $tblColHdr . $tblRows; |
|
| 178 | - if($tblPager && $pbot) { |
|
| 179 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
| 177 | + $o .= $tblColHdr.$tblRows; |
|
| 178 | + if ($tblPager && $pbot) { |
|
| 179 | + $o .= "<tr><td align='".(substr($this->pagerLocation, -4) == "left" ? "left" : "right")."' $pagerClass $pagerStyle colspan='".$this->_colcount."'>".$tblPager." </td></tr>"; |
|
| 180 | 180 | } |
| 181 | - if($this->footer) { |
|
| 182 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>"; |
|
| 181 | + if ($this->footer) { |
|
| 182 | + $o .= "<tr><td bgcolor='#ffffff' colspan='".$this->_colcount."'>".$this->footer."</td></tr>"; |
|
| 183 | 183 | } |
| 184 | 184 | $o .= $tblEnd; |
| 185 | 185 | return $o; |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | // format column values |
| 189 | 189 | |
| 190 | - function RenderRowFnc($n, $row) { |
|
| 191 | - if($this->_alt == 0) { |
|
| 190 | + function RenderRowFnc($n, $row){ |
|
| 191 | + if ($this->_alt == 0) { |
|
| 192 | 192 | $Style = $this->_itemStyle; |
| 193 | 193 | $Class = $this->_itemClass; |
| 194 | 194 | $this->_alt = 1; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $this->_alt = 0; |
| 199 | 199 | } |
| 200 | 200 | $o = "<tr>"; |
| 201 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
| 201 | + for ($c = 0; $c < $this->_colcount; $c++) { |
|
| 202 | 202 | $colStyle = $Style; |
| 203 | 203 | $fld = trim($this->_fieldnames[$c]); |
| 204 | 204 | $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null; |
@@ -207,67 +207,67 @@ discard block |
||
| 207 | 207 | $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null; |
| 208 | 208 | $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null; |
| 209 | 209 | $value = $row[($this->_isDataset && $fld ? $fld : $c)]; |
| 210 | - if($color && $Style) { |
|
| 211 | - $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'"; |
|
| 210 | + if ($color && $Style) { |
|
| 211 | + $colStyle = substr($colStyle, 0, -1).";background-color:$color;'"; |
|
| 212 | 212 | } |
| 213 | 213 | $value = $this->formatColumnValue($row, $value, $type, $align); |
| 214 | - $o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>"; |
|
| 214 | + $o .= "<td $colStyle $Class".($align ? " align='$align'" : "").($color ? " bgcolor='$color'" : "").($nowrap ? " nowrap='$nowrap'" : "").($width ? " width='$width'" : "").">$value</td>"; |
|
| 215 | 215 | } |
| 216 | 216 | $o .= "</tr>\n"; |
| 217 | 217 | return $o; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - function formatColumnValue($row, $value, $type, &$align) { |
|
| 221 | - if(strpos($type, ":") !== false) { |
|
| 220 | + function formatColumnValue($row, $value, $type, &$align){ |
|
| 221 | + if (strpos($type, ":") !== false) { |
|
| 222 | 222 | list($type, $type_format) = explode(":", $type, 2); |
| 223 | 223 | } |
| 224 | - switch(strtolower($type)) { |
|
| 224 | + switch (strtolower($type)) { |
|
| 225 | 225 | case "integer": |
| 226 | - if($align == "") { |
|
| 226 | + if ($align == "") { |
|
| 227 | 227 | $align = "right"; |
| 228 | 228 | } |
| 229 | 229 | $value = number_format($value); |
| 230 | 230 | break; |
| 231 | 231 | |
| 232 | 232 | case "float": |
| 233 | - if($align == "") { |
|
| 233 | + if ($align == "") { |
|
| 234 | 234 | $align = "right"; |
| 235 | 235 | } |
| 236 | - if(!$type_format) { |
|
| 236 | + if (!$type_format) { |
|
| 237 | 237 | $type_format = 2; |
| 238 | 238 | } |
| 239 | 239 | $value = number_format($value, $type_format); |
| 240 | 240 | break; |
| 241 | 241 | |
| 242 | 242 | case "currency": |
| 243 | - if($align == "") { |
|
| 243 | + if ($align == "") { |
|
| 244 | 244 | $align = "right"; |
| 245 | 245 | } |
| 246 | - if(!$type_format) { |
|
| 246 | + if (!$type_format) { |
|
| 247 | 247 | $type_format = 2; |
| 248 | 248 | } |
| 249 | - $value = "$" . number_format($value, $type_format); |
|
| 249 | + $value = "$".number_format($value, $type_format); |
|
| 250 | 250 | break; |
| 251 | 251 | |
| 252 | 252 | case "date": |
| 253 | - if($align == "") { |
|
| 253 | + if ($align == "") { |
|
| 254 | 254 | $align = "right"; |
| 255 | 255 | } |
| 256 | - if(!is_numeric($value)) { |
|
| 256 | + if (!is_numeric($value)) { |
|
| 257 | 257 | $value = strtotime($value); |
| 258 | 258 | } |
| 259 | - if(!$type_format) { |
|
| 259 | + if (!$type_format) { |
|
| 260 | 260 | $type_format = "%A %d, %B %Y"; |
| 261 | 261 | } |
| 262 | 262 | $value = strftime($type_format, $value); |
| 263 | 263 | break; |
| 264 | 264 | |
| 265 | 265 | case "boolean": |
| 266 | - if($align == '') { |
|
| 266 | + if ($align == '') { |
|
| 267 | 267 | $align = "center"; |
| 268 | 268 | } |
| 269 | 269 | $value = number_format($value); |
| 270 | - if($value) { |
|
| 270 | + if ($value) { |
|
| 271 | 271 | $value = '•'; |
| 272 | 272 | } else { |
| 273 | 273 | $value = ' '; |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | // replace [+value+] first |
| 279 | 279 | $value = str_replace("[+value+]", $value, $type_format); |
| 280 | 280 | // replace other [+fields+] |
| 281 | - if(strpos($value, "[+") !== false) { |
|
| 282 | - foreach($row as $k => $v) { |
|
| 281 | + if (strpos($value, "[+") !== false) { |
|
| 282 | + foreach ($row as $k => $v) { |
|
| 283 | 283 | $value = str_replace("[+$k+]", $v, $value); |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -73,6 +73,9 @@ |
||
| 73 | 73 | $this->pageSize = $ps; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + /** |
|
| 77 | + * @param DataGrid $fncName |
|
| 78 | + */ |
|
| 76 | 79 | function setRenderRowFnc($fncName, $args = "") { |
| 77 | 80 | $this->renderRowFnc = &$fncName; |
| 78 | 81 | $this->renderRowFncArgs = $args; // extra agruments |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataSetPagerCnt = 0; |
| 12 | 12 | |
| 13 | -class DataSetPager { |
|
| 13 | +class DataSetPager{ |
|
| 14 | 14 | |
| 15 | 15 | var $ds; // datasource |
| 16 | 16 | var $pageSize; |
@@ -27,26 +27,26 @@ discard block |
||
| 27 | 27 | var $selPageStyle; |
| 28 | 28 | var $selPageClass; |
| 29 | 29 | |
| 30 | - function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
| 30 | + function __construct($id, $ds, $pageSize = 10, $pageNumber = -1){ |
|
| 31 | 31 | global $_PAGE; // use view state object |
| 32 | 32 | |
| 33 | 33 | global $__DataSetPagerCnt; |
| 34 | 34 | |
| 35 | 35 | // set id |
| 36 | 36 | $__DataSetPagerCnt++; |
| 37 | - $this->id = !empty($id) ? $id : "dsp" . $__DataSetPagerCnt; |
|
| 37 | + $this->id = !empty($id) ? $id : "dsp".$__DataSetPagerCnt; |
|
| 38 | 38 | |
| 39 | 39 | // get pagenumber |
| 40 | 40 | // by setting pager to -1 cause pager to load it's last page number |
| 41 | - if($pageNumber == -1) { |
|
| 41 | + if ($pageNumber == -1) { |
|
| 42 | 42 | $pageNumber = 1; |
| 43 | - if(isset($_GET["dpgn" . $this->id])) { |
|
| 44 | - $pageNumber = $_GET["dpgn" . $this->id]; |
|
| 45 | - } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) { |
|
| 46 | - $pageNumber = $_PAGE['vs'][$id . '_dpgn']; |
|
| 43 | + if (isset($_GET["dpgn".$this->id])) { |
|
| 44 | + $pageNumber = $_GET["dpgn".$this->id]; |
|
| 45 | + } elseif (isset($_PAGE['vs'][$id.'_dpgn'])) { |
|
| 46 | + $pageNumber = $_PAGE['vs'][$id.'_dpgn']; |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | - if(!is_numeric($pageNumber)) { |
|
| 49 | + if (!is_numeric($pageNumber)) { |
|
| 50 | 50 | $pageNumber = 1; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -57,40 +57,40 @@ discard block |
||
| 57 | 57 | $this->pager = ''; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - function getRenderedPager() { |
|
| 60 | + function getRenderedPager(){ |
|
| 61 | 61 | return $this->pager; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - function getRenderedRows() { |
|
| 64 | + function getRenderedRows(){ |
|
| 65 | 65 | return $this->rows; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - function setDataSource($ds) { |
|
| 68 | + function setDataSource($ds){ |
|
| 69 | 69 | $this->ds = $ds; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - function setPageSize($ps) { |
|
| 72 | + function setPageSize($ps){ |
|
| 73 | 73 | $this->pageSize = $ps; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - function setRenderRowFnc($fncName, $args = "") { |
|
| 76 | + function setRenderRowFnc($fncName, $args = ""){ |
|
| 77 | 77 | $this->renderRowFnc = &$fncName; |
| 78 | - $this->renderRowFncArgs = $args; // extra agruments |
|
| 78 | + $this->renderRowFncArgs = $args; // extra agruments |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - function setRenderPagerFnc($fncName, $args = "") { |
|
| 83 | + function setRenderPagerFnc($fncName, $args = ""){ |
|
| 84 | 84 | $this->renderPagerFnc = $fncName; |
| 85 | - $this->renderPagerFncArgs = $args; // extra agruments |
|
| 85 | + $this->renderPagerFncArgs = $args; // extra agruments |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - function render() { |
|
| 88 | + function render(){ |
|
| 89 | 89 | global $modx, $_PAGE; |
| 90 | 90 | |
| 91 | 91 | $isDataset = $modx->db->isResult($this->ds); |
| 92 | 92 | |
| 93 | - if(!$this->selPageStyle) { |
|
| 93 | + if (!$this->selPageStyle) { |
|
| 94 | 94 | $this->selPageStyle = "font-weight:bold"; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | $tnr = ($isDataset) ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
| 99 | 99 | |
| 100 | 100 | // render: no records found |
| 101 | - if($tnr <= 0) { |
|
| 101 | + if ($tnr <= 0) { |
|
| 102 | 102 | $fnc = $this->renderRowFnc; |
| 103 | 103 | $args = $this->renderRowFncArgs; |
| 104 | - if(isset($fnc)) { |
|
| 105 | - if($args != "") { |
|
| 104 | + if (isset($fnc)) { |
|
| 105 | + if ($args != "") { |
|
| 106 | 106 | $this->rows .= $fnc(0, null, $args); |
| 107 | 107 | } // if agrs was specified then we will pass three params |
| 108 | 108 | else { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | // get total pages |
| 116 | 116 | $tp = ceil($tnr / $this->pageSize); |
| 117 | - if($this->pageNumber > $tp) { |
|
| 117 | + if ($this->pageNumber > $tp) { |
|
| 118 | 118 | $this->pageNumber = 1; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -122,38 +122,38 @@ discard block |
||
| 122 | 122 | $p = $this->pageNumber; |
| 123 | 123 | |
| 124 | 124 | // save page number to view state if available |
| 125 | - if(isset($_PAGE['vs'])) { |
|
| 126 | - $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
| 125 | + if (isset($_PAGE['vs'])) { |
|
| 126 | + $_PAGE['vs'][$this->id.'_dpgn'] = $p; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
| 130 | - if($tp > 1) { |
|
| 130 | + if ($tp > 1) { |
|
| 131 | 131 | $fnc = $this->renderPagerFnc; |
| 132 | 132 | $args = $this->renderPagerFncArgs; |
| 133 | - if(!isset($fnc)) { |
|
| 134 | - if($modx->isFrontend()) { |
|
| 135 | - $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
| 133 | + if (!isset($fnc)) { |
|
| 134 | + if ($modx->isFrontend()) { |
|
| 135 | + $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full').'?'; |
|
| 136 | 136 | } else { |
| 137 | - $url = $_SERVER['PHP_SELF'] . '?'; |
|
| 137 | + $url = $_SERVER['PHP_SELF'].'?'; |
|
| 138 | 138 | } |
| 139 | 139 | $i = 0; |
| 140 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 140 | + foreach ($_GET as $n => $v) if ($n != 'dpgn'.$this->id) { |
|
| 141 | 141 | $i++; |
| 142 | - $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
| 142 | + $url .= (($i > 1) ? "&" : "")."$n=$v"; |
|
| 143 | 143 | } |
| 144 | - if($i >= 1) { |
|
| 144 | + if ($i >= 1) { |
|
| 145 | 145 | $url .= "&"; |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | - for($i = 1; $i <= $tp; $i++) { |
|
| 149 | - if(isset($fnc)) { |
|
| 150 | - if($args != "") { |
|
| 148 | + for ($i = 1; $i <= $tp; $i++) { |
|
| 149 | + if (isset($fnc)) { |
|
| 150 | + if ($args != "") { |
|
| 151 | 151 | $this->pager .= $fnc($p, $i, $args); |
| 152 | 152 | } else { |
| 153 | 153 | $this->pager .= $fnc($p, $i); |
| 154 | 154 | } |
| 155 | 155 | } else { |
| 156 | - $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> "; |
|
| 156 | + $this->pager .= ($p == $i) ? " <span class='".$this->selPageClass."' style='".$this->selPageStyle."'>$i</span> " : " <a href='".$url."dpgn".$this->id."=$i' class='".$this->pageClass."' style='".$this->pageStyle."'>$i</a> "; |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -162,21 +162,21 @@ discard block |
||
| 162 | 162 | $fnc = $this->renderRowFnc; |
| 163 | 163 | $args = $this->renderRowFncArgs; |
| 164 | 164 | |
| 165 | - if(isset($fnc)) { |
|
| 165 | + if (isset($fnc)) { |
|
| 166 | 166 | $i = 1; |
| 167 | 167 | $fncObject = is_object($fnc); |
| 168 | 168 | $minitems = (($p - 1) * $this->pageSize) + 1; |
| 169 | 169 | $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
| 170 | - while($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) { |
|
| 171 | - if($i >= $minitems && $i <= $maxitems) { |
|
| 172 | - if($fncObject) { |
|
| 173 | - if($args != "") { |
|
| 170 | + while ($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) { |
|
| 171 | + if ($i >= $minitems && $i <= $maxitems) { |
|
| 172 | + if ($fncObject) { |
|
| 173 | + if ($args != "") { |
|
| 174 | 174 | $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
| 175 | 175 | } else { |
| 176 | 176 | $this->rows .= $fnc->RenderRowFnc($i, $row); |
| 177 | 177 | } |
| 178 | 178 | } else { |
| 179 | - if($args != "") { |
|
| 179 | + if ($args != "") { |
|
| 180 | 180 | $this->rows .= $fnc($i, $row, $args); |
| 181 | 181 | } // if agrs was specified then we wil pass three params |
| 182 | 182 | else { |
@@ -3968,7 +3968,7 @@ |
||
| 3968 | 3968 | * @param int|string $options Either a PATHINFO_* constant, |
| 3969 | 3969 | * or a string name to return only the specified piece |
| 3970 | 3970 | * |
| 3971 | - * @return string|array |
|
| 3971 | + * @return string |
|
| 3972 | 3972 | */ |
| 3973 | 3973 | public static function mb_pathinfo($path, $options = null) |
| 3974 | 3974 | { |
@@ -1076,10 +1076,10 @@ discard block |
||
| 1076 | 1076 | $list = imap_rfc822_parse_adrlist($addrstr, ''); |
| 1077 | 1077 | foreach ($list as $address) { |
| 1078 | 1078 | if ('.SYNTAX-ERROR.' != $address->host) { |
| 1079 | - if (static::validateAddress($address->mailbox . '@' . $address->host)) { |
|
| 1079 | + if (static::validateAddress($address->mailbox.'@'.$address->host)) { |
|
| 1080 | 1080 | $addresses[] = [ |
| 1081 | 1081 | 'name' => (property_exists($address, 'personal') ? $address->personal : ''), |
| 1082 | - 'address' => $address->mailbox . '@' . $address->host, |
|
| 1082 | + 'address' => $address->mailbox.'@'.$address->host, |
|
| 1083 | 1083 | ]; |
| 1084 | 1084 | } |
| 1085 | 1085 | } |
@@ -1225,14 +1225,14 @@ discard block |
||
| 1225 | 1225 | * Feel free to use and redistribute this code. But please keep this copyright notice. |
| 1226 | 1226 | */ |
| 1227 | 1227 | return (bool) preg_match( |
| 1228 | - '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . |
|
| 1229 | - '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . |
|
| 1230 | - '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . |
|
| 1231 | - '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . |
|
| 1232 | - '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . |
|
| 1233 | - '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . |
|
| 1234 | - '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . |
|
| 1235 | - '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
|
| 1228 | + '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)'. |
|
| 1229 | + '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)'. |
|
| 1230 | + '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)'. |
|
| 1231 | + '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*'. |
|
| 1232 | + '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)'. |
|
| 1233 | + '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}'. |
|
| 1234 | + '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:'. |
|
| 1235 | + '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}'. |
|
| 1236 | 1236 | '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', |
| 1237 | 1237 | $address |
| 1238 | 1238 | ); |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | * @see http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) |
| 1244 | 1244 | */ |
| 1245 | 1245 | return (bool) preg_match( |
| 1246 | - '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . |
|
| 1246 | + '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}'. |
|
| 1247 | 1247 | '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', |
| 1248 | 1248 | $address |
| 1249 | 1249 | ); |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | $errorcode = 0; |
| 1295 | 1295 | $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_UTS46); |
| 1296 | 1296 | if (false !== $punycode) { |
| 1297 | - return substr($address, 0, $pos) . $punycode; |
|
| 1297 | + return substr($address, 0, $pos).$punycode; |
|
| 1298 | 1298 | } |
| 1299 | 1299 | } |
| 1300 | 1300 | } |
@@ -1358,8 +1358,8 @@ discard block |
||
| 1358 | 1358 | and version_compare(PHP_VERSION, '7.1.3', '<'))) |
| 1359 | 1359 | ) { |
| 1360 | 1360 | trigger_error( |
| 1361 | - 'Your version of PHP is affected by a bug that may result in corrupted messages.' . |
|
| 1362 | - ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' . |
|
| 1361 | + 'Your version of PHP is affected by a bug that may result in corrupted messages.'. |
|
| 1362 | + ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in'. |
|
| 1363 | 1363 | ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.', |
| 1364 | 1364 | E_USER_WARNING |
| 1365 | 1365 | ); |
@@ -1443,12 +1443,12 @@ discard block |
||
| 1443 | 1443 | ) |
| 1444 | 1444 | ) { |
| 1445 | 1445 | $header_dkim = $this->DKIM_Add( |
| 1446 | - $this->MIMEHeader . $this->mailHeader, |
|
| 1446 | + $this->MIMEHeader.$this->mailHeader, |
|
| 1447 | 1447 | $this->encodeHeader($this->secureHeader($this->Subject)), |
| 1448 | 1448 | $this->MIMEBody |
| 1449 | 1449 | ); |
| 1450 | - $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . static::$LE . |
|
| 1451 | - static::normalizeBreaks($header_dkim) . static::$LE; |
|
| 1450 | + $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ").static::$LE. |
|
| 1451 | + static::normalizeBreaks($header_dkim).static::$LE; |
|
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | 1454 | return true; |
@@ -1482,7 +1482,7 @@ discard block |
||
| 1482 | 1482 | case 'mail': |
| 1483 | 1483 | return $this->mailSend($this->MIMEHeader, $this->MIMEBody); |
| 1484 | 1484 | default: |
| 1485 | - $sendMethod = $this->Mailer . 'Send'; |
|
| 1485 | + $sendMethod = $this->Mailer.'Send'; |
|
| 1486 | 1486 | if (method_exists($this, $sendMethod)) { |
| 1487 | 1487 | return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); |
| 1488 | 1488 | } |
@@ -1535,9 +1535,9 @@ discard block |
||
| 1535 | 1535 | foreach ($this->SingleToArray as $toAddr) { |
| 1536 | 1536 | $mail = @popen($sendmail, 'w'); |
| 1537 | 1537 | if (!$mail) { |
| 1538 | - throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); |
|
| 1538 | + throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL); |
|
| 1539 | 1539 | } |
| 1540 | - fwrite($mail, 'To: ' . $toAddr . "\n"); |
|
| 1540 | + fwrite($mail, 'To: '.$toAddr."\n"); |
|
| 1541 | 1541 | fwrite($mail, $header); |
| 1542 | 1542 | fwrite($mail, $body); |
| 1543 | 1543 | $result = pclose($mail); |
@@ -1552,13 +1552,13 @@ discard block |
||
| 1552 | 1552 | [] |
| 1553 | 1553 | ); |
| 1554 | 1554 | if (0 !== $result) { |
| 1555 | - throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); |
|
| 1555 | + throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL); |
|
| 1556 | 1556 | } |
| 1557 | 1557 | } |
| 1558 | 1558 | } else { |
| 1559 | 1559 | $mail = @popen($sendmail, 'w'); |
| 1560 | 1560 | if (!$mail) { |
| 1561 | - throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); |
|
| 1561 | + throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL); |
|
| 1562 | 1562 | } |
| 1563 | 1563 | fwrite($mail, $header); |
| 1564 | 1564 | fwrite($mail, $body); |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | [] |
| 1575 | 1575 | ); |
| 1576 | 1576 | if (0 !== $result) { |
| 1577 | - throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); |
|
| 1577 | + throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL); |
|
| 1578 | 1578 | } |
| 1579 | 1579 | } |
| 1580 | 1580 | |
@@ -1732,7 +1732,7 @@ discard block |
||
| 1732 | 1732 | $smtp_from = $this->Sender; |
| 1733 | 1733 | } |
| 1734 | 1734 | if (!$this->smtp->mail($smtp_from)) { |
| 1735 | - $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); |
|
| 1735 | + $this->setError($this->lang('from_failed').$smtp_from.' : '.implode(',', $this->smtp->getError())); |
|
| 1736 | 1736 | throw new Exception($this->ErrorInfo, self::STOP_CRITICAL); |
| 1737 | 1737 | } |
| 1738 | 1738 | |
@@ -1753,7 +1753,7 @@ discard block |
||
| 1753 | 1753 | } |
| 1754 | 1754 | |
| 1755 | 1755 | // Only send the DATA command if we have viable recipients |
| 1756 | - if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) { |
|
| 1756 | + if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header.$body)) { |
|
| 1757 | 1757 | throw new Exception($this->lang('data_not_accepted'), self::STOP_CRITICAL); |
| 1758 | 1758 | } |
| 1759 | 1759 | |
@@ -1783,10 +1783,10 @@ discard block |
||
| 1783 | 1783 | if (count($bad_rcpt) > 0) { |
| 1784 | 1784 | $errstr = ''; |
| 1785 | 1785 | foreach ($bad_rcpt as $bad) { |
| 1786 | - $errstr .= $bad['to'] . ': ' . $bad['error']; |
|
| 1786 | + $errstr .= $bad['to'].': '.$bad['error']; |
|
| 1787 | 1787 | } |
| 1788 | 1788 | throw new Exception( |
| 1789 | - $this->lang('recipients_failed') . $errstr, |
|
| 1789 | + $this->lang('recipients_failed').$errstr, |
|
| 1790 | 1790 | self::STOP_CONTINUE |
| 1791 | 1791 | ); |
| 1792 | 1792 | } |
@@ -1836,7 +1836,7 @@ discard block |
||
| 1836 | 1836 | trim($hostentry), |
| 1837 | 1837 | $hostinfo |
| 1838 | 1838 | )) { |
| 1839 | - static::edebug($this->lang('connect_host') . ' ' . $hostentry); |
|
| 1839 | + static::edebug($this->lang('connect_host').' '.$hostentry); |
|
| 1840 | 1840 | // Not a valid host entry |
| 1841 | 1841 | continue; |
| 1842 | 1842 | } |
@@ -1848,7 +1848,7 @@ discard block |
||
| 1848 | 1848 | |
| 1849 | 1849 | //Check the host name is a valid name or IP address before trying to use it |
| 1850 | 1850 | if (!static::isValidHost($hostinfo[3])) { |
| 1851 | - static::edebug($this->lang('connect_host') . ' ' . $hostentry); |
|
| 1851 | + static::edebug($this->lang('connect_host').' '.$hostentry); |
|
| 1852 | 1852 | continue; |
| 1853 | 1853 | } |
| 1854 | 1854 | $prefix = ''; |
@@ -1868,7 +1868,7 @@ discard block |
||
| 1868 | 1868 | if ('tls' === $secure or 'ssl' === $secure) { |
| 1869 | 1869 | //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled |
| 1870 | 1870 | if (!$sslext) { |
| 1871 | - throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL); |
|
| 1871 | + throw new Exception($this->lang('extension_missing').'openssl', self::STOP_CRITICAL); |
|
| 1872 | 1872 | } |
| 1873 | 1873 | } |
| 1874 | 1874 | $host = $hostinfo[3]; |
@@ -1877,7 +1877,7 @@ discard block |
||
| 1877 | 1877 | if ($tport > 0 and $tport < 65536) { |
| 1878 | 1878 | $port = $tport; |
| 1879 | 1879 | } |
| 1880 | - if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { |
|
| 1880 | + if ($this->smtp->connect($prefix.$host, $port, $this->Timeout, $options)) { |
|
| 1881 | 1881 | try { |
| 1882 | 1882 | if ($this->Helo) { |
| 1883 | 1883 | $hello = $this->Helo; |
@@ -1994,14 +1994,14 @@ discard block |
||
| 1994 | 1994 | ]; |
| 1995 | 1995 | if (empty($lang_path)) { |
| 1996 | 1996 | // Calculate an absolute path so it can work if CWD is not here |
| 1997 | - $lang_path = __DIR__ . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR; |
|
| 1997 | + $lang_path = __DIR__.DIRECTORY_SEPARATOR.'language'.DIRECTORY_SEPARATOR; |
|
| 1998 | 1998 | } |
| 1999 | 1999 | //Validate $langcode |
| 2000 | 2000 | if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) { |
| 2001 | 2001 | $langcode = 'en'; |
| 2002 | 2002 | } |
| 2003 | 2003 | $foundlang = true; |
| 2004 | - $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php'; |
|
| 2004 | + $lang_file = $lang_path.'phpmailer.lang-'.$langcode.'.php'; |
|
| 2005 | 2005 | // There is no English translation file |
| 2006 | 2006 | if ('en' != $langcode) { |
| 2007 | 2007 | // Make sure language file path is readable |
@@ -2046,7 +2046,7 @@ discard block |
||
| 2046 | 2046 | $addresses[] = $this->addrFormat($address); |
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | - return $type . ': ' . implode(', ', $addresses) . static::$LE; |
|
| 2049 | + return $type.': '.implode(', ', $addresses).static::$LE; |
|
| 2050 | 2050 | } |
| 2051 | 2051 | |
| 2052 | 2052 | /** |
@@ -2063,9 +2063,9 @@ discard block |
||
| 2063 | 2063 | return $this->secureHeader($addr[0]); |
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | - return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader( |
|
| 2066 | + return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase').' <'.$this->secureHeader( |
|
| 2067 | 2067 | $addr[0] |
| 2068 | - ) . '>'; |
|
| 2068 | + ).'>'; |
|
| 2069 | 2069 | } |
| 2070 | 2070 | |
| 2071 | 2071 | /** |
@@ -2122,10 +2122,10 @@ discard block |
||
| 2122 | 2122 | } |
| 2123 | 2123 | $part = substr($word, 0, $len); |
| 2124 | 2124 | $word = substr($word, $len); |
| 2125 | - $buf .= ' ' . $part; |
|
| 2126 | - $message .= $buf . sprintf('=%s', static::$LE); |
|
| 2125 | + $buf .= ' '.$part; |
|
| 2126 | + $message .= $buf.sprintf('=%s', static::$LE); |
|
| 2127 | 2127 | } else { |
| 2128 | - $message .= $buf . $soft_break; |
|
| 2128 | + $message .= $buf.$soft_break; |
|
| 2129 | 2129 | } |
| 2130 | 2130 | $buf = ''; |
| 2131 | 2131 | } |
@@ -2145,7 +2145,7 @@ discard block |
||
| 2145 | 2145 | $word = substr($word, $len); |
| 2146 | 2146 | |
| 2147 | 2147 | if (strlen($word) > 0) { |
| 2148 | - $message .= $part . sprintf('=%s', static::$LE); |
|
| 2148 | + $message .= $part.sprintf('=%s', static::$LE); |
|
| 2149 | 2149 | } else { |
| 2150 | 2150 | $buf = $part; |
| 2151 | 2151 | } |
@@ -2158,13 +2158,13 @@ discard block |
||
| 2158 | 2158 | $buf .= $word; |
| 2159 | 2159 | |
| 2160 | 2160 | if (strlen($buf) > $length and '' != $buf_o) { |
| 2161 | - $message .= $buf_o . $soft_break; |
|
| 2161 | + $message .= $buf_o.$soft_break; |
|
| 2162 | 2162 | $buf = $word; |
| 2163 | 2163 | } |
| 2164 | 2164 | } |
| 2165 | 2165 | $firstword = false; |
| 2166 | 2166 | } |
| 2167 | - $message .= $buf . static::$LE; |
|
| 2167 | + $message .= $buf.static::$LE; |
|
| 2168 | 2168 | } |
| 2169 | 2169 | |
| 2170 | 2170 | return $message; |
@@ -2310,7 +2310,7 @@ discard block |
||
| 2310 | 2310 | if ('' == $this->XMailer) { |
| 2311 | 2311 | $result .= $this->headerLine( |
| 2312 | 2312 | 'X-Mailer', |
| 2313 | - 'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)' |
|
| 2313 | + 'PHPMailer '.self::VERSION.' (https://github.com/PHPMailer/PHPMailer)' |
|
| 2314 | 2314 | ); |
| 2315 | 2315 | } else { |
| 2316 | 2316 | $myXmailer = trim($this->XMailer); |
@@ -2320,7 +2320,7 @@ discard block |
||
| 2320 | 2320 | } |
| 2321 | 2321 | |
| 2322 | 2322 | if ('' != $this->ConfirmReadingTo) { |
| 2323 | - $result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>'); |
|
| 2323 | + $result .= $this->headerLine('Disposition-Notification-To', '<'.$this->ConfirmReadingTo.'>'); |
|
| 2324 | 2324 | } |
| 2325 | 2325 | |
| 2326 | 2326 | // Add custom headers |
@@ -2350,23 +2350,23 @@ discard block |
||
| 2350 | 2350 | switch ($this->message_type) { |
| 2351 | 2351 | case 'inline': |
| 2352 | 2352 | $result .= $this->headerLine('Content-Type', 'multipart/related;'); |
| 2353 | - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
| 2353 | + $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"'); |
|
| 2354 | 2354 | break; |
| 2355 | 2355 | case 'attach': |
| 2356 | 2356 | case 'inline_attach': |
| 2357 | 2357 | case 'alt_attach': |
| 2358 | 2358 | case 'alt_inline_attach': |
| 2359 | 2359 | $result .= $this->headerLine('Content-Type', 'multipart/mixed;'); |
| 2360 | - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
| 2360 | + $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"'); |
|
| 2361 | 2361 | break; |
| 2362 | 2362 | case 'alt': |
| 2363 | 2363 | case 'alt_inline': |
| 2364 | 2364 | $result .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
| 2365 | - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); |
|
| 2365 | + $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"'); |
|
| 2366 | 2366 | break; |
| 2367 | 2367 | default: |
| 2368 | 2368 | // Catches case 'plain': and case '': |
| 2369 | - $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet); |
|
| 2369 | + $result .= $this->textLine('Content-Type: '.$this->ContentType.'; charset='.$this->CharSet); |
|
| 2370 | 2370 | $ismultipart = false; |
| 2371 | 2371 | break; |
| 2372 | 2372 | } |
@@ -2401,7 +2401,7 @@ discard block |
||
| 2401 | 2401 | */ |
| 2402 | 2402 | public function getSentMIMEMessage() |
| 2403 | 2403 | { |
| 2404 | - return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . static::$LE . static::$LE . $this->MIMEBody; |
|
| 2404 | + return rtrim($this->MIMEHeader.$this->mailHeader, "\n\r").static::$LE.static::$LE.$this->MIMEBody; |
|
| 2405 | 2405 | } |
| 2406 | 2406 | |
| 2407 | 2407 | /** |
@@ -2438,12 +2438,12 @@ discard block |
||
| 2438 | 2438 | $body = ''; |
| 2439 | 2439 | //Create unique IDs and preset boundaries |
| 2440 | 2440 | $this->uniqueid = $this->generateId(); |
| 2441 | - $this->boundary[1] = 'b1_' . $this->uniqueid; |
|
| 2442 | - $this->boundary[2] = 'b2_' . $this->uniqueid; |
|
| 2443 | - $this->boundary[3] = 'b3_' . $this->uniqueid; |
|
| 2441 | + $this->boundary[1] = 'b1_'.$this->uniqueid; |
|
| 2442 | + $this->boundary[2] = 'b2_'.$this->uniqueid; |
|
| 2443 | + $this->boundary[3] = 'b3_'.$this->uniqueid; |
|
| 2444 | 2444 | |
| 2445 | 2445 | if ($this->sign_key_file) { |
| 2446 | - $body .= $this->getMailMIME() . static::$LE; |
|
| 2446 | + $body .= $this->getMailMIME().static::$LE; |
|
| 2447 | 2447 | } |
| 2448 | 2448 | |
| 2449 | 2449 | $this->setWordWrap(); |
@@ -2476,7 +2476,7 @@ discard block |
||
| 2476 | 2476 | $altBodyEncoding = 'quoted-printable'; |
| 2477 | 2477 | } |
| 2478 | 2478 | //Use this as a preamble in all multipart message types |
| 2479 | - $mimepre = 'This is a multi-part message in MIME format.' . static::$LE; |
|
| 2479 | + $mimepre = 'This is a multi-part message in MIME format.'.static::$LE; |
|
| 2480 | 2480 | switch ($this->message_type) { |
| 2481 | 2481 | case 'inline': |
| 2482 | 2482 | $body .= $mimepre; |
@@ -2494,9 +2494,9 @@ discard block |
||
| 2494 | 2494 | break; |
| 2495 | 2495 | case 'inline_attach': |
| 2496 | 2496 | $body .= $mimepre; |
| 2497 | - $body .= $this->textLine('--' . $this->boundary[1]); |
|
| 2497 | + $body .= $this->textLine('--'.$this->boundary[1]); |
|
| 2498 | 2498 | $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
| 2499 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
| 2499 | + $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"'); |
|
| 2500 | 2500 | $body .= static::$LE; |
| 2501 | 2501 | $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding); |
| 2502 | 2502 | $body .= $this->encodeString($this->Body, $bodyEncoding); |
@@ -2525,9 +2525,9 @@ discard block |
||
| 2525 | 2525 | $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
| 2526 | 2526 | $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
| 2527 | 2527 | $body .= static::$LE; |
| 2528 | - $body .= $this->textLine('--' . $this->boundary[1]); |
|
| 2528 | + $body .= $this->textLine('--'.$this->boundary[1]); |
|
| 2529 | 2529 | $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
| 2530 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
| 2530 | + $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"'); |
|
| 2531 | 2531 | $body .= static::$LE; |
| 2532 | 2532 | $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); |
| 2533 | 2533 | $body .= $this->encodeString($this->Body, $bodyEncoding); |
@@ -2538,9 +2538,9 @@ discard block |
||
| 2538 | 2538 | break; |
| 2539 | 2539 | case 'alt_attach': |
| 2540 | 2540 | $body .= $mimepre; |
| 2541 | - $body .= $this->textLine('--' . $this->boundary[1]); |
|
| 2541 | + $body .= $this->textLine('--'.$this->boundary[1]); |
|
| 2542 | 2542 | $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
| 2543 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
| 2543 | + $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"'); |
|
| 2544 | 2544 | $body .= static::$LE; |
| 2545 | 2545 | $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
| 2546 | 2546 | $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
@@ -2558,16 +2558,16 @@ discard block |
||
| 2558 | 2558 | break; |
| 2559 | 2559 | case 'alt_inline_attach': |
| 2560 | 2560 | $body .= $mimepre; |
| 2561 | - $body .= $this->textLine('--' . $this->boundary[1]); |
|
| 2561 | + $body .= $this->textLine('--'.$this->boundary[1]); |
|
| 2562 | 2562 | $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); |
| 2563 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); |
|
| 2563 | + $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"'); |
|
| 2564 | 2564 | $body .= static::$LE; |
| 2565 | 2565 | $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); |
| 2566 | 2566 | $body .= $this->encodeString($this->AltBody, $altBodyEncoding); |
| 2567 | 2567 | $body .= static::$LE; |
| 2568 | - $body .= $this->textLine('--' . $this->boundary[2]); |
|
| 2568 | + $body .= $this->textLine('--'.$this->boundary[2]); |
|
| 2569 | 2569 | $body .= $this->headerLine('Content-Type', 'multipart/related;'); |
| 2570 | - $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"'); |
|
| 2570 | + $body .= $this->textLine("\tboundary=\"".$this->boundary[3].'"'); |
|
| 2571 | 2571 | $body .= static::$LE; |
| 2572 | 2572 | $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding); |
| 2573 | 2573 | $body .= $this->encodeString($this->Body, $bodyEncoding); |
@@ -2594,12 +2594,12 @@ discard block |
||
| 2594 | 2594 | } elseif ($this->sign_key_file) { |
| 2595 | 2595 | try { |
| 2596 | 2596 | if (!defined('PKCS7_TEXT')) { |
| 2597 | - throw new Exception($this->lang('extension_missing') . 'openssl'); |
|
| 2597 | + throw new Exception($this->lang('extension_missing').'openssl'); |
|
| 2598 | 2598 | } |
| 2599 | 2599 | // @TODO would be nice to use php://temp streams here |
| 2600 | 2600 | $file = tempnam(sys_get_temp_dir(), 'mail'); |
| 2601 | 2601 | if (false === file_put_contents($file, $body)) { |
| 2602 | - throw new Exception($this->lang('signing') . ' Could not write temp file'); |
|
| 2602 | + throw new Exception($this->lang('signing').' Could not write temp file'); |
|
| 2603 | 2603 | } |
| 2604 | 2604 | $signed = tempnam(sys_get_temp_dir(), 'signed'); |
| 2605 | 2605 | //Workaround for PHP bug https://bugs.php.net/bug.php?id=69197 |
@@ -2607,16 +2607,16 @@ discard block |
||
| 2607 | 2607 | $sign = @openssl_pkcs7_sign( |
| 2608 | 2608 | $file, |
| 2609 | 2609 | $signed, |
| 2610 | - 'file://' . realpath($this->sign_cert_file), |
|
| 2611 | - ['file://' . realpath($this->sign_key_file), $this->sign_key_pass], |
|
| 2610 | + 'file://'.realpath($this->sign_cert_file), |
|
| 2611 | + ['file://'.realpath($this->sign_key_file), $this->sign_key_pass], |
|
| 2612 | 2612 | [] |
| 2613 | 2613 | ); |
| 2614 | 2614 | } else { |
| 2615 | 2615 | $sign = @openssl_pkcs7_sign( |
| 2616 | 2616 | $file, |
| 2617 | 2617 | $signed, |
| 2618 | - 'file://' . realpath($this->sign_cert_file), |
|
| 2619 | - ['file://' . realpath($this->sign_key_file), $this->sign_key_pass], |
|
| 2618 | + 'file://'.realpath($this->sign_cert_file), |
|
| 2619 | + ['file://'.realpath($this->sign_key_file), $this->sign_key_pass], |
|
| 2620 | 2620 | [], |
| 2621 | 2621 | PKCS7_DETACHED, |
| 2622 | 2622 | $this->sign_extracerts_file |
@@ -2628,11 +2628,11 @@ discard block |
||
| 2628 | 2628 | @unlink($signed); |
| 2629 | 2629 | //The message returned by openssl contains both headers and body, so need to split them up |
| 2630 | 2630 | $parts = explode("\n\n", $body, 2); |
| 2631 | - $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE; |
|
| 2631 | + $this->MIMEHeader .= $parts[0].static::$LE.static::$LE; |
|
| 2632 | 2632 | $body = $parts[1]; |
| 2633 | 2633 | } else { |
| 2634 | 2634 | @unlink($signed); |
| 2635 | - throw new Exception($this->lang('signing') . openssl_error_string()); |
|
| 2635 | + throw new Exception($this->lang('signing').openssl_error_string()); |
|
| 2636 | 2636 | } |
| 2637 | 2637 | } catch (Exception $exc) { |
| 2638 | 2638 | $body = ''; |
@@ -2667,7 +2667,7 @@ discard block |
||
| 2667 | 2667 | if ('' == $encoding) { |
| 2668 | 2668 | $encoding = $this->Encoding; |
| 2669 | 2669 | } |
| 2670 | - $result .= $this->textLine('--' . $boundary); |
|
| 2670 | + $result .= $this->textLine('--'.$boundary); |
|
| 2671 | 2671 | $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet); |
| 2672 | 2672 | $result .= static::$LE; |
| 2673 | 2673 | // RFC1341 part 5 says 7bit is assumed if not specified |
@@ -2688,7 +2688,7 @@ discard block |
||
| 2688 | 2688 | */ |
| 2689 | 2689 | protected function endBoundary($boundary) |
| 2690 | 2690 | { |
| 2691 | - return static::$LE . '--' . $boundary . '--' . static::$LE; |
|
| 2691 | + return static::$LE.'--'.$boundary.'--'.static::$LE; |
|
| 2692 | 2692 | } |
| 2693 | 2693 | |
| 2694 | 2694 | /** |
@@ -2724,7 +2724,7 @@ discard block |
||
| 2724 | 2724 | */ |
| 2725 | 2725 | public function headerLine($name, $value) |
| 2726 | 2726 | { |
| 2727 | - return $name . ': ' . $value . static::$LE; |
|
| 2727 | + return $name.': '.$value.static::$LE; |
|
| 2728 | 2728 | } |
| 2729 | 2729 | |
| 2730 | 2730 | /** |
@@ -2736,7 +2736,7 @@ discard block |
||
| 2736 | 2736 | */ |
| 2737 | 2737 | public function textLine($value) |
| 2738 | 2738 | { |
| 2739 | - return $value . static::$LE; |
|
| 2739 | + return $value.static::$LE; |
|
| 2740 | 2740 | } |
| 2741 | 2741 | |
| 2742 | 2742 | /** |
@@ -2758,7 +2758,7 @@ discard block |
||
| 2758 | 2758 | { |
| 2759 | 2759 | try { |
| 2760 | 2760 | if (!@is_file($path)) { |
| 2761 | - throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE); |
|
| 2761 | + throw new Exception($this->lang('file_access').$path, self::STOP_CONTINUE); |
|
| 2762 | 2762 | } |
| 2763 | 2763 | |
| 2764 | 2764 | // If a MIME type is not specified, try to work it out from the file name |
@@ -2885,7 +2885,7 @@ discard block |
||
| 2885 | 2885 | 'Content-Disposition: %s; filename="%s"%s', |
| 2886 | 2886 | $disposition, |
| 2887 | 2887 | $encoded_name, |
| 2888 | - static::$LE . static::$LE |
|
| 2888 | + static::$LE.static::$LE |
|
| 2889 | 2889 | ); |
| 2890 | 2890 | } else { |
| 2891 | 2891 | if (!empty($encoded_name)) { |
@@ -2893,13 +2893,13 @@ discard block |
||
| 2893 | 2893 | 'Content-Disposition: %s; filename=%s%s', |
| 2894 | 2894 | $disposition, |
| 2895 | 2895 | $encoded_name, |
| 2896 | - static::$LE . static::$LE |
|
| 2896 | + static::$LE.static::$LE |
|
| 2897 | 2897 | ); |
| 2898 | 2898 | } else { |
| 2899 | 2899 | $mime[] = sprintf( |
| 2900 | 2900 | 'Content-Disposition: %s%s', |
| 2901 | 2901 | $disposition, |
| 2902 | - static::$LE . static::$LE |
|
| 2902 | + static::$LE.static::$LE |
|
| 2903 | 2903 | ); |
| 2904 | 2904 | } |
| 2905 | 2905 | } |
@@ -2940,11 +2940,11 @@ discard block |
||
| 2940 | 2940 | { |
| 2941 | 2941 | try { |
| 2942 | 2942 | if (!file_exists($path)) { |
| 2943 | - throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE); |
|
| 2943 | + throw new Exception($this->lang('file_open').$path, self::STOP_CONTINUE); |
|
| 2944 | 2944 | } |
| 2945 | 2945 | $file_buffer = file_get_contents($path); |
| 2946 | 2946 | if (false === $file_buffer) { |
| 2947 | - throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE); |
|
| 2947 | + throw new Exception($this->lang('file_open').$path, self::STOP_CONTINUE); |
|
| 2948 | 2948 | } |
| 2949 | 2949 | $file_buffer = $this->encodeString($file_buffer, $encoding); |
| 2950 | 2950 | |
@@ -2991,7 +2991,7 @@ discard block |
||
| 2991 | 2991 | $encoded = $this->encodeQP($str); |
| 2992 | 2992 | break; |
| 2993 | 2993 | default: |
| 2994 | - $this->setError($this->lang('encoding') . $encoding); |
|
| 2994 | + $this->setError($this->lang('encoding').$encoding); |
|
| 2995 | 2995 | break; |
| 2996 | 2996 | } |
| 2997 | 2997 | |
@@ -3057,7 +3057,7 @@ discard block |
||
| 3057 | 3057 | $maxlen -= $maxlen % 4; |
| 3058 | 3058 | $encoded = trim(chunk_split($encoded, $maxlen, "\n")); |
| 3059 | 3059 | } |
| 3060 | - $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded); |
|
| 3060 | + $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded); |
|
| 3061 | 3061 | } elseif ($matchcount > 0) { |
| 3062 | 3062 | //1 or more chars need encoding, use Q-encode |
| 3063 | 3063 | $encoding = 'Q'; |
@@ -3065,8 +3065,8 @@ discard block |
||
| 3065 | 3065 | $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet); |
| 3066 | 3066 | $encoded = $this->encodeQ($str, $position); |
| 3067 | 3067 | $encoded = $this->wrapText($encoded, $maxlen, true); |
| 3068 | - $encoded = str_replace('=' . static::$LE, "\n", trim($encoded)); |
|
| 3069 | - $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded); |
|
| 3068 | + $encoded = str_replace('='.static::$LE, "\n", trim($encoded)); |
|
| 3069 | + $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded); |
|
| 3070 | 3070 | } elseif (strlen($str) > $maxlen) { |
| 3071 | 3071 | //No chars need encoding, but line is too long, so fold it |
| 3072 | 3072 | $encoded = trim($this->wrapText($str, $maxlen, false)); |
@@ -3127,7 +3127,7 @@ discard block |
||
| 3127 | 3127 | */ |
| 3128 | 3128 | public function base64EncodeWrapMB($str, $linebreak = null) |
| 3129 | 3129 | { |
| 3130 | - $start = '=?' . $this->CharSet . '?B?'; |
|
| 3130 | + $start = '=?'.$this->CharSet.'?B?'; |
|
| 3131 | 3131 | $end = '?='; |
| 3132 | 3132 | $encoded = ''; |
| 3133 | 3133 | if (null === $linebreak) { |
@@ -3150,7 +3150,7 @@ discard block |
||
| 3150 | 3150 | $chunk = base64_encode($chunk); |
| 3151 | 3151 | ++$lookBack; |
| 3152 | 3152 | } while (strlen($chunk) > $length); |
| 3153 | - $encoded .= $chunk . $linebreak; |
|
| 3153 | + $encoded .= $chunk.$linebreak; |
|
| 3154 | 3154 | } |
| 3155 | 3155 | |
| 3156 | 3156 | // Chomp the last linefeed |
@@ -3203,7 +3203,7 @@ discard block |
||
| 3203 | 3203 | // RFC 2047 section 5.1 |
| 3204 | 3204 | // Replace every high ascii, control, =, ? and _ characters |
| 3205 | 3205 | /** @noinspection SuspiciousAssignmentsInspection */ |
| 3206 | - $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern; |
|
| 3206 | + $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377'.$pattern; |
|
| 3207 | 3207 | break; |
| 3208 | 3208 | } |
| 3209 | 3209 | $matches = []; |
@@ -3216,7 +3216,7 @@ discard block |
||
| 3216 | 3216 | array_unshift($matches[0], '='); |
| 3217 | 3217 | } |
| 3218 | 3218 | foreach (array_unique($matches[0]) as $char) { |
| 3219 | - $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded); |
|
| 3219 | + $encoded = str_replace($char, '='.sprintf('%02X', ord($char)), $encoded); |
|
| 3220 | 3220 | } |
| 3221 | 3221 | } |
| 3222 | 3222 | // Replace spaces with _ (more readable than =20) |
@@ -3241,7 +3241,7 @@ discard block |
||
| 3241 | 3241 | $encoding = 'base64', |
| 3242 | 3242 | $type = '', |
| 3243 | 3243 | $disposition = 'attachment' |
| 3244 | - ) { |
|
| 3244 | + ){ |
|
| 3245 | 3245 | // If a MIME type is not specified, try to work it out from the file name |
| 3246 | 3246 | if ('' == $type) { |
| 3247 | 3247 | $type = static::filenameToType($filename); |
@@ -3281,7 +3281,7 @@ discard block |
||
| 3281 | 3281 | public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline') |
| 3282 | 3282 | { |
| 3283 | 3283 | if (!@is_file($path)) { |
| 3284 | - $this->setError($this->lang('file_access') . $path); |
|
| 3284 | + $this->setError($this->lang('file_access').$path); |
|
| 3285 | 3285 | |
| 3286 | 3286 | return false; |
| 3287 | 3287 | } |
@@ -3335,7 +3335,7 @@ discard block |
||
| 3335 | 3335 | $encoding = 'base64', |
| 3336 | 3336 | $type = '', |
| 3337 | 3337 | $disposition = 'inline' |
| 3338 | - ) { |
|
| 3338 | + ){ |
|
| 3339 | 3339 | // If a MIME type is not specified, try to work it out from the name |
| 3340 | 3340 | if ('' == $type and !empty($name)) { |
| 3341 | 3341 | $type = static::filenameToType($name); |
@@ -3425,7 +3425,7 @@ discard block |
||
| 3425 | 3425 | { |
| 3426 | 3426 | $this->RecipientsQueue = array_filter( |
| 3427 | 3427 | $this->RecipientsQueue, |
| 3428 | - function ($params) use ($kind) { |
|
| 3428 | + function($params) use ($kind) { |
|
| 3429 | 3429 | return $params[0] != $kind; |
| 3430 | 3430 | } |
| 3431 | 3431 | ); |
@@ -3515,15 +3515,15 @@ discard block |
||
| 3515 | 3515 | if ('smtp' == $this->Mailer and null !== $this->smtp) { |
| 3516 | 3516 | $lasterror = $this->smtp->getError(); |
| 3517 | 3517 | if (!empty($lasterror['error'])) { |
| 3518 | - $msg .= $this->lang('smtp_error') . $lasterror['error']; |
|
| 3518 | + $msg .= $this->lang('smtp_error').$lasterror['error']; |
|
| 3519 | 3519 | if (!empty($lasterror['detail'])) { |
| 3520 | - $msg .= ' Detail: ' . $lasterror['detail']; |
|
| 3520 | + $msg .= ' Detail: '.$lasterror['detail']; |
|
| 3521 | 3521 | } |
| 3522 | 3522 | if (!empty($lasterror['smtp_code'])) { |
| 3523 | - $msg .= ' SMTP code: ' . $lasterror['smtp_code']; |
|
| 3523 | + $msg .= ' SMTP code: '.$lasterror['smtp_code']; |
|
| 3524 | 3524 | } |
| 3525 | 3525 | if (!empty($lasterror['smtp_code_ex'])) { |
| 3526 | - $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex']; |
|
| 3526 | + $msg .= ' Additional SMTP info: '.$lasterror['smtp_code_ex']; |
|
| 3527 | 3527 | } |
| 3528 | 3528 | } |
| 3529 | 3529 | } |
@@ -3596,7 +3596,7 @@ discard block |
||
| 3596 | 3596 | //Is it a valid IPv4 address? |
| 3597 | 3597 | return (bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); |
| 3598 | 3598 | } |
| 3599 | - if (filter_var('http://' . $host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) { |
|
| 3599 | + if (filter_var('http://'.$host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) { |
|
| 3600 | 3600 | //Is it a syntactically valid hostname? |
| 3601 | 3601 | return true; |
| 3602 | 3602 | } |
@@ -3622,7 +3622,7 @@ discard block |
||
| 3622 | 3622 | //Include a link to troubleshooting docs on SMTP connection failure |
| 3623 | 3623 | //this is by far the biggest cause of support questions |
| 3624 | 3624 | //but it's usually not PHPMailer's fault. |
| 3625 | - return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting'; |
|
| 3625 | + return $this->language[$key].' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting'; |
|
| 3626 | 3626 | } |
| 3627 | 3627 | |
| 3628 | 3628 | return $this->language[$key]; |
@@ -3710,14 +3710,14 @@ discard block |
||
| 3710 | 3710 | } |
| 3711 | 3711 | //Hash the decoded data, not the URL so that the same data-URI image used in multiple places |
| 3712 | 3712 | //will only be embedded once, even if it used a different encoding |
| 3713 | - $cid = hash('sha256', $data) . '@phpmailer.0'; // RFC2392 S 2 |
|
| 3713 | + $cid = hash('sha256', $data).'@phpmailer.0'; // RFC2392 S 2 |
|
| 3714 | 3714 | |
| 3715 | 3715 | if (!$this->cidExists($cid)) { |
| 3716 | - $this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1]); |
|
| 3716 | + $this->addStringEmbeddedImage($data, $cid, 'embed'.$imgindex, 'base64', $match[1]); |
|
| 3717 | 3717 | } |
| 3718 | 3718 | $message = str_replace( |
| 3719 | 3719 | $images[0][$imgindex], |
| 3720 | - $images[1][$imgindex] . '="cid:' . $cid . '"', |
|
| 3720 | + $images[1][$imgindex].'="cid:'.$cid.'"', |
|
| 3721 | 3721 | $message |
| 3722 | 3722 | ); |
| 3723 | 3723 | continue; |
@@ -3736,7 +3736,7 @@ discard block |
||
| 3736 | 3736 | if ('.' == $directory) { |
| 3737 | 3737 | $directory = ''; |
| 3738 | 3738 | } |
| 3739 | - $cid = hash('sha256', $url) . '@phpmailer.0'; // RFC2392 S 2 |
|
| 3739 | + $cid = hash('sha256', $url).'@phpmailer.0'; // RFC2392 S 2 |
|
| 3740 | 3740 | if (strlen($basedir) > 1 and '/' != substr($basedir, -1)) { |
| 3741 | 3741 | $basedir .= '/'; |
| 3742 | 3742 | } |
@@ -3744,7 +3744,7 @@ discard block |
||
| 3744 | 3744 | $directory .= '/'; |
| 3745 | 3745 | } |
| 3746 | 3746 | if ($this->addEmbeddedImage( |
| 3747 | - $basedir . $directory . $filename, |
|
| 3747 | + $basedir.$directory.$filename, |
|
| 3748 | 3748 | $cid, |
| 3749 | 3749 | $filename, |
| 3750 | 3750 | 'base64', |
@@ -3752,8 +3752,8 @@ discard block |
||
| 3752 | 3752 | ) |
| 3753 | 3753 | ) { |
| 3754 | 3754 | $message = preg_replace( |
| 3755 | - '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', |
|
| 3756 | - $images[1][$imgindex] . '="cid:' . $cid . '"', |
|
| 3755 | + '/'.$images[1][$imgindex].'=["\']'.preg_quote($url, '/').'["\']/Ui', |
|
| 3756 | + $images[1][$imgindex].'="cid:'.$cid.'"', |
|
| 3757 | 3757 | $message |
| 3758 | 3758 | ); |
| 3759 | 3759 | } |
@@ -4027,7 +4027,7 @@ discard block |
||
| 4027 | 4027 | |
| 4028 | 4028 | return true; |
| 4029 | 4029 | } |
| 4030 | - $this->setError($this->lang('variable_set') . $name); |
|
| 4030 | + $this->setError($this->lang('variable_set').$name); |
|
| 4031 | 4031 | |
| 4032 | 4032 | return false; |
| 4033 | 4033 | } |
@@ -4121,7 +4121,7 @@ discard block |
||
| 4121 | 4121 | if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) { |
| 4122 | 4122 | $line .= $txt[$i]; |
| 4123 | 4123 | } else { |
| 4124 | - $line .= '=' . sprintf('%02X', $ord); |
|
| 4124 | + $line .= '='.sprintf('%02X', $ord); |
|
| 4125 | 4125 | } |
| 4126 | 4126 | } |
| 4127 | 4127 | |
@@ -4141,14 +4141,13 @@ discard block |
||
| 4141 | 4141 | { |
| 4142 | 4142 | if (!defined('PKCS7_TEXT')) { |
| 4143 | 4143 | if ($this->exceptions) { |
| 4144 | - throw new Exception($this->lang('extension_missing') . 'openssl'); |
|
| 4144 | + throw new Exception($this->lang('extension_missing').'openssl'); |
|
| 4145 | 4145 | } |
| 4146 | 4146 | |
| 4147 | 4147 | return ''; |
| 4148 | 4148 | } |
| 4149 | 4149 | $privKeyStr = !empty($this->DKIM_private_string) ? |
| 4150 | - $this->DKIM_private_string : |
|
| 4151 | - file_get_contents($this->DKIM_private); |
|
| 4150 | + $this->DKIM_private_string : file_get_contents($this->DKIM_private); |
|
| 4152 | 4151 | if ('' != $this->DKIM_passphrase) { |
| 4153 | 4152 | $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); |
| 4154 | 4153 | } else { |
@@ -4200,7 +4199,7 @@ discard block |
||
| 4200 | 4199 | //But then says to delete space before and after the colon. |
| 4201 | 4200 | //Net result is the same as trimming both ends of the value. |
| 4202 | 4201 | //by elimination, the same applies to the field name |
| 4203 | - $lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t"); |
|
| 4202 | + $lines[$key] = trim($heading, " \t").':'.trim($value, " \t"); |
|
| 4204 | 4203 | } |
| 4205 | 4204 | |
| 4206 | 4205 | return implode("\r\n", $lines); |
@@ -4226,7 +4225,7 @@ discard block |
||
| 4226 | 4225 | $body = static::normalizeBreaks($body, "\r\n"); |
| 4227 | 4226 | |
| 4228 | 4227 | //Reduce multiple trailing line breaks to a single one |
| 4229 | - return rtrim($body, "\r\n") . "\r\n"; |
|
| 4228 | + return rtrim($body, "\r\n")."\r\n"; |
|
| 4230 | 4229 | } |
| 4231 | 4230 | |
| 4232 | 4231 | /** |
@@ -4282,33 +4281,33 @@ discard block |
||
| 4282 | 4281 | if ('' == $this->DKIM_identity) { |
| 4283 | 4282 | $ident = ''; |
| 4284 | 4283 | } else { |
| 4285 | - $ident = ' i=' . $this->DKIM_identity . ';'; |
|
| 4286 | - } |
|
| 4287 | - $dkimhdrs = 'DKIM-Signature: v=1; a=' . |
|
| 4288 | - $DKIMsignatureType . '; q=' . |
|
| 4289 | - $DKIMquery . '; l=' . |
|
| 4290 | - $DKIMlen . '; s=' . |
|
| 4291 | - $this->DKIM_selector . |
|
| 4292 | - ";\r\n" . |
|
| 4293 | - "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" . |
|
| 4294 | - "\th=From:To:Date:Subject;\r\n" . |
|
| 4295 | - "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" . |
|
| 4296 | - "\tz=$from\r\n" . |
|
| 4297 | - "\t|$to\r\n" . |
|
| 4298 | - "\t|$date\r\n" . |
|
| 4299 | - "\t|$subject;\r\n" . |
|
| 4300 | - "\tbh=" . $DKIMb64 . ";\r\n" . |
|
| 4284 | + $ident = ' i='.$this->DKIM_identity.';'; |
|
| 4285 | + } |
|
| 4286 | + $dkimhdrs = 'DKIM-Signature: v=1; a='. |
|
| 4287 | + $DKIMsignatureType.'; q='. |
|
| 4288 | + $DKIMquery.'; l='. |
|
| 4289 | + $DKIMlen.'; s='. |
|
| 4290 | + $this->DKIM_selector. |
|
| 4291 | + ";\r\n". |
|
| 4292 | + "\tt=".$DKIMtime.'; c='.$DKIMcanonicalization.";\r\n". |
|
| 4293 | + "\th=From:To:Date:Subject;\r\n". |
|
| 4294 | + "\td=".$this->DKIM_domain.';'.$ident."\r\n". |
|
| 4295 | + "\tz=$from\r\n". |
|
| 4296 | + "\t|$to\r\n". |
|
| 4297 | + "\t|$date\r\n". |
|
| 4298 | + "\t|$subject;\r\n". |
|
| 4299 | + "\tbh=".$DKIMb64.";\r\n". |
|
| 4301 | 4300 | "\tb="; |
| 4302 | 4301 | $toSign = $this->DKIM_HeaderC( |
| 4303 | - $from_header . "\r\n" . |
|
| 4304 | - $to_header . "\r\n" . |
|
| 4305 | - $date_header . "\r\n" . |
|
| 4306 | - $subject_header . "\r\n" . |
|
| 4302 | + $from_header."\r\n". |
|
| 4303 | + $to_header."\r\n". |
|
| 4304 | + $date_header."\r\n". |
|
| 4305 | + $subject_header."\r\n". |
|
| 4307 | 4306 | $dkimhdrs |
| 4308 | 4307 | ); |
| 4309 | 4308 | $signed = $this->DKIM_Sign($toSign); |
| 4310 | 4309 | |
| 4311 | - return static::normalizeBreaks($dkimhdrs . $signed) . static::$LE; |
|
| 4310 | + return static::normalizeBreaks($dkimhdrs.$signed).static::$LE; |
|
| 4312 | 4311 | } |
| 4313 | 4312 | |
| 4314 | 4313 | /** |
@@ -4321,7 +4320,7 @@ discard block |
||
| 4321 | 4320 | */ |
| 4322 | 4321 | public static function hasLineLongerThanMax($str) |
| 4323 | 4322 | { |
| 4324 | - return (bool) preg_match('/^(.{' . (self::MAX_LINE_LENGTH + strlen(static::$LE)) . ',})/m', $str); |
|
| 4323 | + return (bool) preg_match('/^(.{'.(self::MAX_LINE_LENGTH + strlen(static::$LE)).',})/m', $str); |
|
| 4325 | 4324 | } |
| 4326 | 4325 | |
| 4327 | 4326 | /** |