@@ -170,70 +170,70 @@ |
||
| 170 | 170 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
| 171 | 171 | ); |
| 172 | 172 | } |
| 173 | - if (intval($params['shareparams']) || !empty($params['dependencies'])) { |
|
| 174 | - $dependencies = explode(',', $params['dependencies']); |
|
| 175 | - foreach ($dependencies as $dependency) { |
|
| 176 | - $dependency = explode(':', $dependency); |
|
| 177 | - switch (trim($dependency[0])) { |
|
| 178 | - case 'template': |
|
| 179 | - $mdp[] = array( |
|
| 180 | - 'module' => $params['name'], |
|
| 181 | - 'table' => 'templates', |
|
| 182 | - 'column' => 'templatename', |
|
| 183 | - 'type' => 50, |
|
| 184 | - 'name' => trim($dependency[1]) |
|
| 185 | - ); |
|
| 186 | - break; |
|
| 187 | - case 'tv': |
|
| 188 | - case 'tmplvar': |
|
| 189 | - $mdp[] = array( |
|
| 190 | - 'module' => $params['name'], |
|
| 191 | - 'table' => 'tmplvars', |
|
| 192 | - 'column' => 'name', |
|
| 193 | - 'type' => 60, |
|
| 194 | - 'name' => trim($dependency[1]) |
|
| 195 | - ); |
|
| 196 | - break; |
|
| 197 | - case 'chunk': |
|
| 198 | - case 'htmlsnippet': |
|
| 199 | - $mdp[] = array( |
|
| 200 | - 'module' => $params['name'], |
|
| 201 | - 'table' => 'htmlsnippets', |
|
| 202 | - 'column' => 'name', |
|
| 203 | - 'type' => 10, |
|
| 204 | - 'name' => trim($dependency[1]) |
|
| 205 | - ); |
|
| 206 | - break; |
|
| 207 | - case 'snippet': |
|
| 208 | - $mdp[] = array( |
|
| 209 | - 'module' => $params['name'], |
|
| 210 | - 'table' => 'snippets', |
|
| 211 | - 'column' => 'name', |
|
| 212 | - 'type' => 40, |
|
| 213 | - 'name' => trim($dependency[1]) |
|
| 214 | - ); |
|
| 215 | - break; |
|
| 216 | - case 'plugin': |
|
| 217 | - $mdp[] = array( |
|
| 218 | - 'module' => $params['name'], |
|
| 219 | - 'table' => 'plugins', |
|
| 220 | - 'column' => 'name', |
|
| 221 | - 'type' => 30, |
|
| 222 | - 'name' => trim($dependency[1]) |
|
| 223 | - ); |
|
| 224 | - break; |
|
| 225 | - case 'resource': |
|
| 226 | - $mdp[] = array( |
|
| 227 | - 'module' => $params['name'], |
|
| 228 | - 'table' => 'content', |
|
| 229 | - 'column' => 'pagetitle', |
|
| 230 | - 'type' => 20, |
|
| 231 | - 'name' => trim($dependency[1]) |
|
| 232 | - ); |
|
| 233 | - break; |
|
| 234 | - } |
|
| 235 | - } |
|
| 236 | - } |
|
| 173 | + if (intval($params['shareparams']) || !empty($params['dependencies'])) { |
|
| 174 | + $dependencies = explode(',', $params['dependencies']); |
|
| 175 | + foreach ($dependencies as $dependency) { |
|
| 176 | + $dependency = explode(':', $dependency); |
|
| 177 | + switch (trim($dependency[0])) { |
|
| 178 | + case 'template': |
|
| 179 | + $mdp[] = array( |
|
| 180 | + 'module' => $params['name'], |
|
| 181 | + 'table' => 'templates', |
|
| 182 | + 'column' => 'templatename', |
|
| 183 | + 'type' => 50, |
|
| 184 | + 'name' => trim($dependency[1]) |
|
| 185 | + ); |
|
| 186 | + break; |
|
| 187 | + case 'tv': |
|
| 188 | + case 'tmplvar': |
|
| 189 | + $mdp[] = array( |
|
| 190 | + 'module' => $params['name'], |
|
| 191 | + 'table' => 'tmplvars', |
|
| 192 | + 'column' => 'name', |
|
| 193 | + 'type' => 60, |
|
| 194 | + 'name' => trim($dependency[1]) |
|
| 195 | + ); |
|
| 196 | + break; |
|
| 197 | + case 'chunk': |
|
| 198 | + case 'htmlsnippet': |
|
| 199 | + $mdp[] = array( |
|
| 200 | + 'module' => $params['name'], |
|
| 201 | + 'table' => 'htmlsnippets', |
|
| 202 | + 'column' => 'name', |
|
| 203 | + 'type' => 10, |
|
| 204 | + 'name' => trim($dependency[1]) |
|
| 205 | + ); |
|
| 206 | + break; |
|
| 207 | + case 'snippet': |
|
| 208 | + $mdp[] = array( |
|
| 209 | + 'module' => $params['name'], |
|
| 210 | + 'table' => 'snippets', |
|
| 211 | + 'column' => 'name', |
|
| 212 | + 'type' => 40, |
|
| 213 | + 'name' => trim($dependency[1]) |
|
| 214 | + ); |
|
| 215 | + break; |
|
| 216 | + case 'plugin': |
|
| 217 | + $mdp[] = array( |
|
| 218 | + 'module' => $params['name'], |
|
| 219 | + 'table' => 'plugins', |
|
| 220 | + 'column' => 'name', |
|
| 221 | + 'type' => 30, |
|
| 222 | + 'name' => trim($dependency[1]) |
|
| 223 | + ); |
|
| 224 | + break; |
|
| 225 | + case 'resource': |
|
| 226 | + $mdp[] = array( |
|
| 227 | + 'module' => $params['name'], |
|
| 228 | + 'table' => 'content', |
|
| 229 | + 'column' => 'pagetitle', |
|
| 230 | + 'type' => 20, |
|
| 231 | + 'name' => trim($dependency[1]) |
|
| 232 | + ); |
|
| 233 | + break; |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | 237 | } |
| 238 | 238 | $d->close(); |
| 239 | 239 | } |
@@ -4,7 +4,9 @@ discard block |
||
| 4 | 4 | if (is_file($base_path . 'assets/cache/siteManager.php')) { |
| 5 | 5 | include_once($base_path . 'assets/cache/siteManager.php'); |
| 6 | 6 | } |
| 7 | -if(!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
| 7 | +if(!defined('MGR_DIR')) { |
|
| 8 | + define('MGR_DIR', 'manager'); |
|
| 9 | +} |
|
| 8 | 10 | |
| 9 | 11 | require_once('../'.MGR_DIR.'/includes/version.inc.php'); |
| 10 | 12 | |
@@ -19,12 +21,12 @@ discard block |
||
| 19 | 21 | $mt = &$moduleTemplates; |
| 20 | 22 | if(is_dir($templatePath) && is_readable($templatePath)) { |
| 21 | 23 | $d = dir($templatePath); |
| 22 | - while (false !== ($tplfile = $d->read())) |
|
| 23 | - { |
|
| 24 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
| 24 | + while (false !== ($tplfile = $d->read())) { |
|
| 25 | + if(substr($tplfile, -4) != '.tpl') { |
|
| 26 | + continue; |
|
| 27 | + } |
|
| 25 | 28 | $params = parse_docblock($templatePath, $tplfile); |
| 26 | - if(is_array($params) && (count($params)>0)) |
|
| 27 | - { |
|
| 29 | + if(is_array($params) && (count($params)>0)) { |
|
| 28 | 30 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 29 | 31 | $mt[] = array |
| 30 | 32 | ( |
@@ -48,7 +50,9 @@ discard block |
||
| 48 | 50 | if(is_dir($tvPath) && is_readable($tvPath)) { |
| 49 | 51 | $d = dir($tvPath); |
| 50 | 52 | while (false !== ($tplfile = $d->read())) { |
| 51 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
| 53 | + if(substr($tplfile, -4) != '.tpl') { |
|
| 54 | + continue; |
|
| 55 | + } |
|
| 52 | 56 | $params = parse_docblock($tvPath, $tplfile); |
| 53 | 57 | if(is_array($params) && (count($params)>0)) { |
| 54 | 58 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
@@ -241,7 +245,8 @@ discard block |
||
| 241 | 245 | // setup callback function |
| 242 | 246 | $callBackFnc = "clean_up"; |
| 243 | 247 | |
| 244 | -function clean_up($sqlParser) { |
|
| 248 | +function clean_up($sqlParser) |
|
| 249 | +{ |
|
| 245 | 250 | $ids = array(); |
| 246 | 251 | $mysqlVerOk = -1; |
| 247 | 252 | |
@@ -259,9 +264,10 @@ discard block |
||
| 259 | 264 | $ds = mysqli_query($sqlParser->conn,$sql); |
| 260 | 265 | if(!$ds) { |
| 261 | 266 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
| 262 | - } |
|
| 263 | - else { |
|
| 264 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
| 267 | + } else { |
|
| 268 | + while($r = mysqli_fetch_assoc($ds)) { |
|
| 269 | + $ids[]=$r["id"]; |
|
| 270 | + } |
|
| 265 | 271 | if(count($ids)>0) { |
| 266 | 272 | mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
| 267 | 273 | unset($ids); |
@@ -278,9 +284,10 @@ discard block |
||
| 278 | 284 | $ds = mysqli_query($sqlParser->conn,$sql); |
| 279 | 285 | if(!$ds) { |
| 280 | 286 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
| 281 | - } |
|
| 282 | - else { |
|
| 283 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
| 287 | + } else { |
|
| 288 | + while($r = mysqli_fetch_assoc($ds)) { |
|
| 289 | + $ids[]=$r["id"]; |
|
| 290 | + } |
|
| 284 | 291 | if(count($ids)>0) { |
| 285 | 292 | mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
| 286 | 293 | unset($ids); |
@@ -288,7 +295,8 @@ discard block |
||
| 288 | 295 | } |
| 289 | 296 | } |
| 290 | 297 | |
| 291 | -function parse_docblock($element_dir, $filename) { |
|
| 298 | +function parse_docblock($element_dir, $filename) |
|
| 299 | +{ |
|
| 292 | 300 | $params = array(); |
| 293 | 301 | $fullpath = $element_dir . '/' . $filename; |
| 294 | 302 | if(is_readable($fullpath)) { |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | <form name="install" id="install_form" action="index.php?action=options" method="post"> |
| 21 | 21 | <?php |
| 22 | 22 | if ($errors == 0) { |
| 23 | - // check if install folder is removeable |
|
| 23 | + // check if install folder is removeable |
|
| 24 | 24 | if (is_writable("../install")) { ?> |
| 25 | 25 | <span id="removeinstall" style="float:left;cursor:pointer;color:#505050;line-height:18px;" onclick="var chk=document.install.rminstaller; if(chk) chk.checked=!chk.checked;"><input type="checkbox" name="rminstaller" onclick="event.cancelBubble=true;" <?php echo (empty ($errors) ? 'checked="checked"' : '') ?> style="cursor:default;" /><?php echo $_lang['remove_install_folder_auto'] ?></span> |
| 26 | 26 | <?php |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | $self = 'install/connection.databasetest.php'; |
| 9 | 9 | $base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
| 10 | 10 | if (is_file("{$base_path}assets/cache/siteManager.php")) { |
| 11 | - include_once("{$base_path}assets/cache/siteManager.php"); |
|
| 11 | + include_once("{$base_path}assets/cache/siteManager.php"); |
|
| 12 | 12 | } |
| 13 | 13 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
| 14 | - define('MGR_DIR','manager'); |
|
| 14 | + define('MGR_DIR','manager'); |
|
| 15 | 15 | } |
| 16 | 16 | require_once("lang.php"); |
| 17 | 17 | |
@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | $output = $_lang["status_checking_database"]; |
| 19 | 19 | if (!$conn = mysqli_connect($host, $uid, $pwd)) { |
| 20 | 20 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>'; |
| 21 | -} |
|
| 22 | -else { |
|
| 21 | +} else { |
|
| 23 | 22 | $database_name = mysqli_real_escape_string($conn, $_POST['database_name']); |
| 24 | 23 | $database_name = str_replace("`", "", $database_name); |
| 25 | 24 | $tableprefix = mysqli_real_escape_string($conn, $_POST['tableprefix']); |
@@ -31,20 +30,16 @@ discard block |
||
| 31 | 30 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
| 32 | 31 | $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";"; |
| 33 | 32 | |
| 34 | - if (! mysqli_query($conn, $query)){ |
|
| 33 | + if (! mysqli_query($conn, $query)) { |
|
| 35 | 34 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>'; |
| 36 | - } |
|
| 37 | - else { |
|
| 35 | + } else { |
|
| 38 | 36 | $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>'; |
| 39 | 37 | } |
| 40 | - } |
|
| 41 | - elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) { |
|
| 38 | + } elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) { |
|
| 42 | 39 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>'; |
| 43 | - } |
|
| 44 | - elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) { |
|
| 40 | + } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) { |
|
| 45 | 41 | $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'], $row[1]).'</span>'; |
| 46 | - } |
|
| 47 | - else { |
|
| 42 | + } else { |
|
| 48 | 43 | $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>'; |
| 49 | 44 | } |
| 50 | 45 | } |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function install_sessionCheck() |
| 3 | 3 | { |
| 4 | - global $_lang; |
|
| 4 | + global $_lang; |
|
| 5 | 5 | |
| 6 | - // session loop-back tester |
|
| 7 | - if(!isset($_GET['action']) || $_GET['action']!=='mode') |
|
| 8 | - { |
|
| 9 | - if(!isset($_SESSION['test']) || $_SESSION['test']!=1) |
|
| 10 | - { |
|
| 11 | - echo ' |
|
| 6 | + // session loop-back tester |
|
| 7 | + if(!isset($_GET['action']) || $_GET['action']!=='mode') |
|
| 8 | + { |
|
| 9 | + if(!isset($_SESSION['test']) || $_SESSION['test']!=1) |
|
| 10 | + { |
|
| 11 | + echo ' |
|
| 12 | 12 | <html> |
| 13 | 13 | <head> |
| 14 | 14 | <title>Install Problem</title> |
@@ -27,86 +27,86 @@ discard block |
||
| 27 | 27 | </div> |
| 28 | 28 | </body> |
| 29 | 29 | </html>'; |
| 30 | - exit; |
|
| 31 | - } |
|
| 32 | - } |
|
| 30 | + exit; |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | function parse($src,$ph,$left='[+',$right='+]') |
| 36 | 36 | { |
| 37 | - foreach($ph as $k=>$v) |
|
| 38 | - { |
|
| 39 | - $k = $left . $k . $right; |
|
| 40 | - $src = str_replace($k,$v,$src); |
|
| 41 | - } |
|
| 42 | - return $src; |
|
| 37 | + foreach($ph as $k=>$v) |
|
| 38 | + { |
|
| 39 | + $k = $left . $k . $right; |
|
| 40 | + $src = str_replace($k,$v,$src); |
|
| 41 | + } |
|
| 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']; |
|
| 50 | - else $installmode = get_installmode(); |
|
| 49 | + if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode']; |
|
| 50 | + else $installmode = get_installmode(); |
|
| 51 | 51 | |
| 52 | - $ph['pagetitle'] = $_lang['modx_install']; |
|
| 53 | - $ph['textdir'] = $modx_textdir ? ' id="rtl"':''; |
|
| 54 | - $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd']; |
|
| 55 | - $ph['version'] = $moduleVersion; |
|
| 56 | - $ph['release_date'] = ($modx_textdir ? '‏':'') . $modx_release_date; |
|
| 57 | - $ph['footer1'] = $_lang['modx_footer1']; |
|
| 58 | - $ph['footer2'] = $_lang['modx_footer2']; |
|
| 59 | - $ph['current_year'] = date('Y'); |
|
| 60 | - return $ph; |
|
| 52 | + $ph['pagetitle'] = $_lang['modx_install']; |
|
| 53 | + $ph['textdir'] = $modx_textdir ? ' id="rtl"':''; |
|
| 54 | + $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd']; |
|
| 55 | + $ph['version'] = $moduleVersion; |
|
| 56 | + $ph['release_date'] = ($modx_textdir ? '‏':'') . $modx_release_date; |
|
| 57 | + $ph['footer1'] = $_lang['modx_footer1']; |
|
| 58 | + $ph['footer2'] = $_lang['modx_footer2']; |
|
| 59 | + $ph['current_year'] = date('Y'); |
|
| 60 | + return $ph; |
|
| 61 | 61 | } |
| 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 | - $conf_path = "{$base_path}manager/includes/config.inc.php"; |
|
| 68 | - if (!is_file($conf_path)) $installmode = 0; |
|
| 69 | - elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
| 70 | - else |
|
| 71 | - { |
|
| 72 | - include_once("{$base_path}manager/includes/config.inc.php"); |
|
| 67 | + $conf_path = "{$base_path}manager/includes/config.inc.php"; |
|
| 68 | + if (!is_file($conf_path)) $installmode = 0; |
|
| 69 | + elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
| 70 | + else |
|
| 71 | + { |
|
| 72 | + include_once("{$base_path}manager/includes/config.inc.php"); |
|
| 73 | 73 | |
| 74 | - if(!isset($dbase) || empty($dbase)) $installmode = 0; |
|
| 75 | - else |
|
| 76 | - { |
|
| 77 | - $conn = mysqli_connect($database_server, $database_user, $database_password); |
|
| 78 | - if($conn) |
|
| 79 | - { |
|
| 80 | - $_SESSION['database_server'] = $database_server; |
|
| 81 | - $_SESSION['database_user'] = $database_user; |
|
| 82 | - $_SESSION['database_password'] = $database_password; |
|
| 74 | + if(!isset($dbase) || empty($dbase)) $installmode = 0; |
|
| 75 | + else |
|
| 76 | + { |
|
| 77 | + $conn = mysqli_connect($database_server, $database_user, $database_password); |
|
| 78 | + if($conn) |
|
| 79 | + { |
|
| 80 | + $_SESSION['database_server'] = $database_server; |
|
| 81 | + $_SESSION['database_user'] = $database_user; |
|
| 82 | + $_SESSION['database_password'] = $database_password; |
|
| 83 | 83 | |
| 84 | - $dbase = trim($dbase, '`'); |
|
| 85 | - $rs = mysqli_select_db($conn, $dbase); |
|
| 86 | - } |
|
| 87 | - else $rs = false; |
|
| 84 | + $dbase = trim($dbase, '`'); |
|
| 85 | + $rs = mysqli_select_db($conn, $dbase); |
|
| 86 | + } |
|
| 87 | + else $rs = false; |
|
| 88 | 88 | |
| 89 | - if($rs) |
|
| 90 | - { |
|
| 91 | - $_SESSION['dbase'] = $dbase; |
|
| 92 | - $_SESSION['table_prefix'] = $table_prefix; |
|
| 93 | - $_SESSION['database_collation'] = 'utf8_general_ci'; |
|
| 94 | - $_SESSION['database_connection_method'] = 'SET CHARACTER SET'; |
|
| 89 | + if($rs) |
|
| 90 | + { |
|
| 91 | + $_SESSION['dbase'] = $dbase; |
|
| 92 | + $_SESSION['table_prefix'] = $table_prefix; |
|
| 93 | + $_SESSION['database_collation'] = 'utf8_general_ci'; |
|
| 94 | + $_SESSION['database_connection_method'] = 'SET CHARACTER SET'; |
|
| 95 | 95 | |
| 96 | - $tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`"; |
|
| 97 | - $rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'"); |
|
| 98 | - if($rs) |
|
| 99 | - { |
|
| 100 | - $row = mysqli_fetch_assoc($rs); |
|
| 101 | - $settings_version = $row['setting_value']; |
|
| 102 | - } |
|
| 103 | - else $settings_version = ''; |
|
| 96 | + $tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`"; |
|
| 97 | + $rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'"); |
|
| 98 | + if($rs) |
|
| 99 | + { |
|
| 100 | + $row = mysqli_fetch_assoc($rs); |
|
| 101 | + $settings_version = $row['setting_value']; |
|
| 102 | + } |
|
| 103 | + else $settings_version = ''; |
|
| 104 | 104 | |
| 105 | - if (empty($settings_version)) $installmode = 0; |
|
| 106 | - else $installmode = 1; |
|
| 107 | - } |
|
| 108 | - else $installmode = 1; |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - return $installmode; |
|
| 105 | + if (empty($settings_version)) $installmode = 0; |
|
| 106 | + else $installmode = 1; |
|
| 107 | + } |
|
| 108 | + else $installmode = 1; |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + return $installmode; |
|
| 112 | 112 | } |
@@ -4,10 +4,8 @@ discard block |
||
| 4 | 4 | global $_lang; |
| 5 | 5 | |
| 6 | 6 | // session loop-back tester |
| 7 | - if(!isset($_GET['action']) || $_GET['action']!=='mode') |
|
| 8 | - { |
|
| 9 | - if(!isset($_SESSION['test']) || $_SESSION['test']!=1) |
|
| 10 | - { |
|
| 7 | + if(!isset($_GET['action']) || $_GET['action']!=='mode') { |
|
| 8 | + if(!isset($_SESSION['test']) || $_SESSION['test']!=1) { |
|
| 11 | 9 | echo ' |
| 12 | 10 | <html> |
| 13 | 11 | <head> |
@@ -34,8 +32,7 @@ discard block |
||
| 34 | 32 | |
| 35 | 33 | function parse($src,$ph,$left='[+',$right='+]') |
| 36 | 34 | { |
| 37 | - foreach($ph as $k=>$v) |
|
| 38 | - { |
|
| 35 | + foreach($ph as $k=>$v) { |
|
| 39 | 36 | $k = $left . $k . $right; |
| 40 | 37 | $src = str_replace($k,$v,$src); |
| 41 | 38 | } |
@@ -46,8 +43,11 @@ discard block |
||
| 46 | 43 | { |
| 47 | 44 | global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date; |
| 48 | 45 | |
| 49 | - if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode']; |
|
| 50 | - else $installmode = get_installmode(); |
|
| 46 | + if(isset($_SESSION['installmode'])) { |
|
| 47 | + $installmode = $_SESSION['installmode']; |
|
| 48 | + } else { |
|
| 49 | + $installmode = get_installmode(); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | $ph['pagetitle'] = $_lang['modx_install']; |
| 53 | 53 | $ph['textdir'] = $modx_textdir ? ' id="rtl"':''; |
@@ -65,29 +65,29 @@ discard block |
||
| 65 | 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 | - if (!is_file($conf_path)) $installmode = 0; |
|
| 69 | - elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
| 70 | - else |
|
| 71 | - { |
|
| 68 | + if (!is_file($conf_path)) { |
|
| 69 | + $installmode = 0; |
|
| 70 | + } elseif(isset($_POST['installmode'])) { |
|
| 71 | + $installmode = $_POST['installmode']; |
|
| 72 | + } else { |
|
| 72 | 73 | include_once("{$base_path}manager/includes/config.inc.php"); |
| 73 | 74 | |
| 74 | - if(!isset($dbase) || empty($dbase)) $installmode = 0; |
|
| 75 | - else |
|
| 76 | - { |
|
| 75 | + if(!isset($dbase) || empty($dbase)) { |
|
| 76 | + $installmode = 0; |
|
| 77 | + } else { |
|
| 77 | 78 | $conn = mysqli_connect($database_server, $database_user, $database_password); |
| 78 | - if($conn) |
|
| 79 | - { |
|
| 79 | + if($conn) { |
|
| 80 | 80 | $_SESSION['database_server'] = $database_server; |
| 81 | 81 | $_SESSION['database_user'] = $database_user; |
| 82 | 82 | $_SESSION['database_password'] = $database_password; |
| 83 | 83 | |
| 84 | 84 | $dbase = trim($dbase, '`'); |
| 85 | 85 | $rs = mysqli_select_db($conn, $dbase); |
| 86 | + } else { |
|
| 87 | + $rs = false; |
|
| 86 | 88 | } |
| 87 | - else $rs = false; |
|
| 88 | 89 | |
| 89 | - if($rs) |
|
| 90 | - { |
|
| 90 | + if($rs) { |
|
| 91 | 91 | $_SESSION['dbase'] = $dbase; |
| 92 | 92 | $_SESSION['table_prefix'] = $table_prefix; |
| 93 | 93 | $_SESSION['database_collation'] = 'utf8_general_ci'; |
@@ -95,17 +95,21 @@ 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) |
|
| 99 | - { |
|
| 98 | + if($rs) { |
|
| 100 | 99 | $row = mysqli_fetch_assoc($rs); |
| 101 | 100 | $settings_version = $row['setting_value']; |
| 101 | + } else { |
|
| 102 | + $settings_version = ''; |
|
| 102 | 103 | } |
| 103 | - else $settings_version = ''; |
|
| 104 | 104 | |
| 105 | - if (empty($settings_version)) $installmode = 0; |
|
| 106 | - else $installmode = 1; |
|
| 105 | + if (empty($settings_version)) { |
|
| 106 | + $installmode = 0; |
|
| 107 | + } else { |
|
| 108 | + $installmode = 1; |
|
| 109 | + } |
|
| 110 | + } else { |
|
| 111 | + $installmode = 1; |
|
| 107 | 112 | } |
| 108 | - else $installmode = 1; |
|
| 109 | 113 | } |
| 110 | 114 | } |
| 111 | 115 | return $installmode; |
@@ -7,10 +7,10 @@ discard block |
||
| 7 | 7 | $self = 'install/connection.servertest.php'; |
| 8 | 8 | $base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
| 9 | 9 | if (is_file("{$base_path}assets/cache/siteManager.php")) { |
| 10 | - include_once("{$base_path}assets/cache/siteManager.php"); |
|
| 10 | + include_once("{$base_path}assets/cache/siteManager.php"); |
|
| 11 | 11 | } |
| 12 | 12 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
| 13 | - define('MGR_DIR','manager'); |
|
| 13 | + define('MGR_DIR','manager'); |
|
| 14 | 14 | } |
| 15 | 15 | require_once("lang.php"); |
| 16 | 16 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
| 32 | 32 | $strictMode = false; |
| 33 | 33 | foreach ($modes as $mode) { |
| 34 | - if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) $strictMode = true; |
|
| 34 | + if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) $strictMode = true; |
|
| 35 | 35 | } |
| 36 | 36 | if ($strictMode) $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>'; |
| 37 | 37 | } |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | $output = $_lang["status_connecting"]; |
| 18 | 18 | if (!$conn = @mysqli_connect($host, $uid, $pwd)) { |
| 19 | 19 | $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed'].'</span>'; |
| 20 | -} |
|
| 21 | -else { |
|
| 20 | +} else { |
|
| 22 | 21 | $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>'; |
| 23 | 22 | |
| 24 | 23 | // Mysql version check |
@@ -27,13 +26,17 @@ discard block |
||
| 27 | 26 | } |
| 28 | 27 | // Mode check |
| 29 | 28 | $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode"); |
| 30 | - if (@mysqli_num_rows($mysqlmode) > 0){ |
|
| 29 | + if (@mysqli_num_rows($mysqlmode) > 0) { |
|
| 31 | 30 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
| 32 | 31 | $strictMode = false; |
| 33 | 32 | foreach ($modes as $mode) { |
| 34 | - if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) $strictMode = true; |
|
| 33 | + if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
|
| 34 | + $strictMode = true; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | + if ($strictMode) { |
|
| 38 | + $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>'; |
|
| 35 | 39 | } |
| 36 | - if ($strictMode) $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>'; |
|
| 37 | 40 | } |
| 38 | 41 | } |
| 39 | 42 | echo $output; |
@@ -7,10 +7,10 @@ discard block |
||
| 7 | 7 | $self = 'install/connection.collation.php'; |
| 8 | 8 | $base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
| 9 | 9 | if (is_file("{$base_path}assets/cache/siteManager.php")) { |
| 10 | - include_once("{$base_path}assets/cache/siteManager.php"); |
|
| 10 | + include_once("{$base_path}assets/cache/siteManager.php"); |
|
| 11 | 11 | } |
| 12 | 12 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
| 13 | - define('MGR_DIR','manager'); |
|
| 13 | + define('MGR_DIR','manager'); |
|
| 14 | 14 | } |
| 15 | 15 | require_once('lang.php'); |
| 16 | 16 | |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | $rs = array('recommend'=>''); |
| 60 | 60 | $order = explode(',', $order); |
| 61 | 61 | foreach($order as $v) { |
| 62 | - foreach($array as $name=>$sel) { |
|
| 63 | - if(strpos($name,$v)!==false) { |
|
| 64 | - $rs[$name] = $array[$name]; |
|
| 65 | - unset($array[$name]); |
|
| 66 | - } |
|
| 67 | - } |
|
| 62 | + foreach($array as $name=>$sel) { |
|
| 63 | + if(strpos($name,$v)!==false) { |
|
| 64 | + $rs[$name] = $array[$name]; |
|
| 65 | + unset($array[$name]); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | $rs['unrecommend']=''; |
| 70 | 70 | return $rs + $array; |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | require_once('lang.php'); |
| 16 | 16 | |
| 17 | 17 | $conn = mysqli_connect($host, $uid, $pwd); |
| 18 | -if(!$conn) exit('can not connect'); |
|
| 18 | +if(!$conn) { |
|
| 19 | + exit('can not connect'); |
|
| 20 | +} |
|
| 19 | 21 | |
| 20 | 22 | // get collation |
| 21 | 23 | $rs = mysqli_query($conn, "SHOW COLLATION"); |
@@ -29,23 +31,31 @@ discard block |
||
| 29 | 31 | $database_collation = htmlentities($_POST['database_collation']); |
| 30 | 32 | $recommend_collation = $_lang['recommend_collation']; |
| 31 | 33 | |
| 32 | - if (isset($_[$recommend_collation])) $_[$recommend_collation] = ' selected'; |
|
| 33 | - elseif(isset($_['utf8mb4_general_ci'])) $_['utf8mb4_general_ci'] = ' selected'; |
|
| 34 | - elseif(isset($_['utf8_general_ci'])) $_['utf8_general_ci'] = ' selected'; |
|
| 35 | - elseif(isset($_[$database_collation])) $_[$database_collation] = ' selected'; |
|
| 34 | + if (isset($_[$recommend_collation])) { |
|
| 35 | + $_[$recommend_collation] = ' selected'; |
|
| 36 | + } elseif(isset($_['utf8mb4_general_ci'])) { |
|
| 37 | + $_['utf8mb4_general_ci'] = ' selected'; |
|
| 38 | + } elseif(isset($_['utf8_general_ci'])) { |
|
| 39 | + $_['utf8_general_ci'] = ' selected'; |
|
| 40 | + } elseif(isset($_[$database_collation])) { |
|
| 41 | + $_[$database_collation] = ' selected'; |
|
| 42 | + } |
|
| 36 | 43 | |
| 37 | 44 | $_ = sortItem($_,$_lang['recommend_collations_order']); |
| 38 | 45 | |
| 39 | 46 | foreach($_ as $collation=>$selected) { |
| 40 | 47 | $collation = htmlentities($collation); |
| 41 | 48 | // if(substr($collation,0,4)!=='utf8') continue; |
| 42 | - if(strpos($collation,'sjis')===0) continue; |
|
| 43 | - if($collation=='recommend') |
|
| 44 | - $output .= '<optgroup label="recommend">'; |
|
| 45 | - elseif($collation=='unrecommend') |
|
| 46 | - $output .= '</optgroup><optgroup label="unrecommend">'; |
|
| 47 | - else |
|
| 48 | - $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation); |
|
| 49 | + if(strpos($collation,'sjis')===0) { |
|
| 50 | + continue; |
|
| 51 | + } |
|
| 52 | + if($collation=='recommend') { |
|
| 53 | + $output .= '<optgroup label="recommend">'; |
|
| 54 | + } elseif($collation=='unrecommend') { |
|
| 55 | + $output .= '</optgroup><optgroup label="unrecommend">'; |
|
| 56 | + } else { |
|
| 57 | + $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation); |
|
| 58 | + } |
|
| 49 | 59 | } |
| 50 | 60 | $output .= '</optgroup></select>'; |
| 51 | 61 | } |
@@ -55,7 +65,8 @@ discard block |
||
| 55 | 65 | |
| 56 | 66 | |
| 57 | 67 | |
| 58 | -function sortItem($array=array(),$order='utf8mb4,utf8') { |
|
| 68 | +function sortItem($array=array(),$order='utf8mb4,utf8') |
|
| 69 | +{ |
|
| 59 | 70 | $rs = array('recommend'=>''); |
| 60 | 71 | $order = explode(',', $order); |
| 61 | 72 | foreach($order as $v) { |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); |
| 17 | 17 | |
| 18 | 18 | if (is_file("{$base_path}assets/cache/siteManager.php")) { |
| 19 | - include_once("{$base_path}assets/cache/siteManager.php"); |
|
| 19 | + include_once("{$base_path}assets/cache/siteManager.php"); |
|
| 20 | 20 | } |
| 21 | 21 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
| 22 | - define('MGR_DIR', 'manager'); |
|
| 22 | + define('MGR_DIR', 'manager'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
| 86 | 86 | $create = true; |
| 87 | 87 | } else { |
| 88 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
| 88 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
| 89 | 89 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
| 90 | 90 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
| 91 | 91 | } |
@@ -280,23 +280,23 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | // Reset database for installation of demo-site |
| 282 | 282 | if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) { |
| 283 | - echo "<p>" . $_lang['resetting_database']; |
|
| 284 | - $sqlParser->process($moduleSQLResetFile); |
|
| 285 | - // display database results |
|
| 286 | - if ($sqlParser->installFailed == true) { |
|
| 287 | - $errors += 1; |
|
| 288 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 289 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 290 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 291 | - for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
|
| 292 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 293 | - } |
|
| 294 | - echo "</p>"; |
|
| 295 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 296 | - return; |
|
| 297 | - } else { |
|
| 298 | - echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
|
| 299 | - } |
|
| 283 | + echo "<p>" . $_lang['resetting_database']; |
|
| 284 | + $sqlParser->process($moduleSQLResetFile); |
|
| 285 | + // display database results |
|
| 286 | + if ($sqlParser->installFailed == true) { |
|
| 287 | + $errors += 1; |
|
| 288 | + echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 289 | + echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 290 | + echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 291 | + for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
|
| 292 | + echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 293 | + } |
|
| 294 | + echo "</p>"; |
|
| 295 | + echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 296 | + return; |
|
| 297 | + } else { |
|
| 298 | + echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
|
| 299 | + } |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | // Install Templates |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $tRow = mysqli_fetch_assoc($ts); |
| 419 | 419 | $templateId = $tRow['id']; |
| 420 | 420 | mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
| 421 | - } |
|
| 421 | + } |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | } |
@@ -687,51 +687,51 @@ discard block |
||
| 687 | 687 | |
| 688 | 688 | // Install Dependencies |
| 689 | 689 | foreach ($moduleDependencies as $dependency) { |
| 690 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
| 691 | - if (!$ds) { |
|
| 692 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 693 | - return; |
|
| 694 | - } else { |
|
| 695 | - $row = mysqli_fetch_assoc($ds); |
|
| 696 | - $moduleId = $row["id"]; |
|
| 697 | - $moduleGuid = $row["guid"]; |
|
| 698 | - } |
|
| 699 | - // get extra id |
|
| 700 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
| 701 | - if (!$ds) { |
|
| 702 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 703 | - return; |
|
| 704 | - } else { |
|
| 705 | - $row = mysqli_fetch_assoc($ds); |
|
| 706 | - $extraId = $row["id"]; |
|
| 707 | - } |
|
| 708 | - // setup extra as module dependency |
|
| 709 | - $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
| 710 | - if (!$ds) { |
|
| 711 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 712 | - return; |
|
| 713 | - } else { |
|
| 714 | - if (mysqli_num_rows($ds) === 0) { |
|
| 715 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
| 716 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
| 717 | - } else { |
|
| 718 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
| 719 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
| 720 | - } |
|
| 721 | - if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
|
| 722 | - // set extra guid for plugins and snippets |
|
| 723 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
| 724 | - if (!$ds) { |
|
| 725 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 726 | - return; |
|
| 727 | - } else { |
|
| 728 | - if (mysqli_num_rows($ds) != 0) { |
|
| 729 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
| 730 | - echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
| 731 | - } |
|
| 732 | - } |
|
| 733 | - } |
|
| 734 | - } |
|
| 690 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
| 691 | + if (!$ds) { |
|
| 692 | + echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 693 | + return; |
|
| 694 | + } else { |
|
| 695 | + $row = mysqli_fetch_assoc($ds); |
|
| 696 | + $moduleId = $row["id"]; |
|
| 697 | + $moduleGuid = $row["guid"]; |
|
| 698 | + } |
|
| 699 | + // get extra id |
|
| 700 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
| 701 | + if (!$ds) { |
|
| 702 | + echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 703 | + return; |
|
| 704 | + } else { |
|
| 705 | + $row = mysqli_fetch_assoc($ds); |
|
| 706 | + $extraId = $row["id"]; |
|
| 707 | + } |
|
| 708 | + // setup extra as module dependency |
|
| 709 | + $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
| 710 | + if (!$ds) { |
|
| 711 | + echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 712 | + return; |
|
| 713 | + } else { |
|
| 714 | + if (mysqli_num_rows($ds) === 0) { |
|
| 715 | + mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
| 716 | + echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
| 717 | + } else { |
|
| 718 | + mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
| 719 | + echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
| 720 | + } |
|
| 721 | + if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
|
| 722 | + // set extra guid for plugins and snippets |
|
| 723 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
| 724 | + if (!$ds) { |
|
| 725 | + echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 726 | + return; |
|
| 727 | + } else { |
|
| 728 | + if (mysqli_num_rows($ds) != 0) { |
|
| 729 | + mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
| 730 | + echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
| 731 | + } |
|
| 732 | + } |
|
| 733 | + } |
|
| 734 | + } |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | // call back function |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) { |
| 3 | 3 | include_once(dirname(__FILE__)."/../assets/cache/siteManager.php"); |
| 4 | -}else{ |
|
| 4 | +} else { |
|
| 5 | 5 | define('MGR_DIR', 'manager'); |
| 6 | 6 | } |
| 7 | 7 | |
@@ -58,13 +58,15 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | // get base path and url |
| 60 | 60 | $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); |
| 61 | -if (count($a) > 1) |
|
| 61 | +if (count($a) > 1) { |
|
| 62 | 62 | array_pop($a); |
| 63 | +} |
|
| 63 | 64 | $url = implode("install", $a); |
| 64 | 65 | reset($a); |
| 65 | 66 | $a = explode("install", str_replace("\\", "/", realpath(dirname(__FILE__)))); |
| 66 | -if (count($a) > 1) |
|
| 67 | +if (count($a) > 1) { |
|
| 67 | 68 | array_pop($a); |
| 69 | +} |
|
| 68 | 70 | $pth = implode("install", $a); |
| 69 | 71 | unset ($a); |
| 70 | 72 | $base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
@@ -85,7 +87,9 @@ discard block |
||
| 85 | 87 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
| 86 | 88 | $create = true; |
| 87 | 89 | } else { |
| 88 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
| 90 | + if (function_exists('mysqli_set_charset')) { |
|
| 91 | + mysqli_set_charset($conn, $database_charset); |
|
| 92 | + } |
|
| 89 | 93 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
| 90 | 94 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
| 91 | 95 | } |
@@ -127,7 +131,8 @@ discard block |
||
| 127 | 131 | if(!function_exists('parseProperties')) { |
| 128 | 132 | // parses a resource property string and returns the result as an array |
| 129 | 133 | // duplicate of method in documentParser class |
| 130 | - function parseProperties($propertyString) { |
|
| 134 | + function parseProperties($propertyString) |
|
| 135 | + { |
|
| 131 | 136 | $parameter= array (); |
| 132 | 137 | if (!empty ($propertyString)) { |
| 133 | 138 | $tmpParams= explode("&", $propertyString); |
@@ -135,11 +140,14 @@ discard block |
||
| 135 | 140 | if (strpos($tmpParams[$x], '=', 0)) { |
| 136 | 141 | $pTmp= explode("=", $tmpParams[$x]); |
| 137 | 142 | $pvTmp= explode(";", trim($pTmp[1])); |
| 138 | - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
|
| 139 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
| 143 | + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { |
|
| 144 | + $parameter[trim($pTmp[0])]= $pvTmp[3]; |
|
| 145 | + } |
|
| 146 | + //list default |
|
| 140 | 147 | else |
| 141 | - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
|
| 142 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
| 148 | + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { |
|
| 149 | + $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
| 150 | + } |
|
| 143 | 151 | } |
| 144 | 152 | } |
| 145 | 153 | } |
@@ -210,7 +218,7 @@ discard block |
||
| 210 | 218 | // custom or not |
| 211 | 219 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
| 212 | 220 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
| 213 | -}else{ |
|
| 221 | +} else { |
|
| 214 | 222 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
| 215 | 223 | } |
| 216 | 224 | |
@@ -346,7 +354,9 @@ discard block |
||
| 346 | 354 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 347 | 355 | return; |
| 348 | 356 | } |
| 349 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 357 | + if(!is_null($save_sql_id_as)) { |
|
| 358 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 359 | + } |
|
| 350 | 360 | echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
| 351 | 361 | } |
| 352 | 362 | } |
@@ -440,9 +450,9 @@ discard block |
||
| 440 | 450 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
| 441 | 451 | $filecontent = $moduleChunk[2]; |
| 442 | 452 | |
| 443 | - if (!file_exists($filecontent)) |
|
| 444 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 445 | - else { |
|
| 453 | + if (!file_exists($filecontent)) { |
|
| 454 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 455 | + } else { |
|
| 446 | 456 | |
| 447 | 457 | // Create the category if it does not already exist |
| 448 | 458 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -494,9 +504,9 @@ discard block |
||
| 494 | 504 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
| 495 | 505 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
| 496 | 506 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
| 497 | - if (!file_exists($filecontent)) |
|
| 498 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 499 | - else { |
|
| 507 | + if (!file_exists($filecontent)) { |
|
| 508 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 509 | + } else { |
|
| 500 | 510 | |
| 501 | 511 | // Create the category if it does not already exist |
| 502 | 512 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -546,9 +556,9 @@ discard block |
||
| 546 | 556 | // parse comma-separated legacy names and prepare them for sql IN clause |
| 547 | 557 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
| 548 | 558 | } |
| 549 | - if (!file_exists($filecontent)) |
|
| 550 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 551 | - else { |
|
| 559 | + if (!file_exists($filecontent)) { |
|
| 560 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 561 | + } else { |
|
| 552 | 562 | |
| 553 | 563 | // disable legacy versions based on legacy_names provided |
| 554 | 564 | if(!empty($leg_names)) { |
@@ -567,7 +577,7 @@ discard block |
||
| 567 | 577 | $insert = true; |
| 568 | 578 | while($row = mysqli_fetch_assoc($rs)) { |
| 569 | 579 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 570 | - if($row['description'] == $desc){ |
|
| 580 | + if($row['description'] == $desc) { |
|
| 571 | 581 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
| 572 | 582 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 573 | 583 | return; |
@@ -625,9 +635,9 @@ discard block |
||
| 625 | 635 | $filecontent = $moduleSnippet[2]; |
| 626 | 636 | $properties = $moduleSnippet[3]; |
| 627 | 637 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
| 628 | - if (!file_exists($filecontent)) |
|
| 629 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 630 | - else { |
|
| 638 | + if (!file_exists($filecontent)) { |
|
| 639 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 640 | + } else { |
|
| 631 | 641 | |
| 632 | 642 | // Create the category if it does not already exist |
| 633 | 643 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -735,13 +745,16 @@ discard block |
||
| 735 | 745 | } |
| 736 | 746 | |
| 737 | 747 | // call back function |
| 738 | -if ($callBackFnc != "") |
|
| 748 | +if ($callBackFnc != "") { |
|
| 739 | 749 | $callBackFnc ($sqlParser); |
| 750 | +} |
|
| 740 | 751 | |
| 741 | 752 | // Setup the MODX API -- needed for the cache processor |
| 742 | 753 | define('MODX_API_MODE', true); |
| 743 | 754 | define('MODX_BASE_PATH', $base_path); |
| 744 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
| 755 | +if (!defined('MODX_MANAGER_PATH')) { |
|
| 756 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
| 757 | +} |
|
| 745 | 758 | $database_type = 'mysqli'; |
| 746 | 759 | // initiate a new document parser |
| 747 | 760 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |
@@ -780,11 +793,12 @@ discard block |
||
| 780 | 793 | } |
| 781 | 794 | |
| 782 | 795 | // Property Update function |
| 783 | -function propUpdate($new,$old){ |
|
| 796 | +function propUpdate($new,$old) |
|
| 797 | +{ |
|
| 784 | 798 | $newArr = parseProperties($new); |
| 785 | 799 | $oldArr = parseProperties($old); |
| 786 | - foreach ($oldArr as $k => $v){ |
|
| 787 | - if (isset($v['0']['options'])){ |
|
| 800 | + foreach ($oldArr as $k => $v) { |
|
| 801 | + if (isset($v['0']['options'])) { |
|
| 788 | 802 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
| 789 | 803 | } |
| 790 | 804 | } |
@@ -794,12 +808,17 @@ discard block |
||
| 794 | 808 | return $return; |
| 795 | 809 | } |
| 796 | 810 | |
| 797 | -function parseProperties($propertyString, $json=false) { |
|
| 811 | +function parseProperties($propertyString, $json=false) |
|
| 812 | +{ |
|
| 798 | 813 | $propertyString = str_replace('{}', '', $propertyString ); |
| 799 | 814 | $propertyString = str_replace('} {', ',', $propertyString ); |
| 800 | 815 | |
| 801 | - if(empty($propertyString)) return array(); |
|
| 802 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
| 816 | + if(empty($propertyString)) { |
|
| 817 | + return array(); |
|
| 818 | + } |
|
| 819 | + if($propertyString=='{}' || $propertyString=='[]') { |
|
| 820 | + return array(); |
|
| 821 | + } |
|
| 803 | 822 | |
| 804 | 823 | $jsonFormat = isJson($propertyString, true); |
| 805 | 824 | $property = array(); |
@@ -809,7 +828,7 @@ discard block |
||
| 809 | 828 | $arr = array(); |
| 810 | 829 | $key = array(); |
| 811 | 830 | foreach ($props as $prop) { |
| 812 | - if ($prop != ''){ |
|
| 831 | + if ($prop != '') { |
|
| 813 | 832 | $arr = explode(';', $prop); |
| 814 | 833 | $key = explode('=', $arr['0']); |
| 815 | 834 | $property[$key['0']]['0']['label'] = trim($key['1']); |
@@ -833,7 +852,7 @@ discard block |
||
| 833 | 852 | |
| 834 | 853 | } |
| 835 | 854 | // new json-format |
| 836 | - } else if(!empty($jsonFormat)){ |
|
| 855 | + } else if(!empty($jsonFormat)) { |
|
| 837 | 856 | $property = $jsonFormat; |
| 838 | 857 | } |
| 839 | 858 | if ($json) { |
@@ -843,12 +862,14 @@ discard block |
||
| 843 | 862 | return $property; |
| 844 | 863 | } |
| 845 | 864 | |
| 846 | -function isJson($string, $returnData=false) { |
|
| 865 | +function isJson($string, $returnData=false) |
|
| 866 | +{ |
|
| 847 | 867 | $data = json_decode($string, true); |
| 848 | 868 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
| 849 | 869 | } |
| 850 | 870 | |
| 851 | -function getCreateDbCategory($category, $sqlParser) { |
|
| 871 | +function getCreateDbCategory($category, $sqlParser) |
|
| 872 | +{ |
|
| 852 | 873 | $dbase = $sqlParser->dbname; |
| 853 | 874 | $dbase = '`' . trim($dbase,'`') . '`'; |
| 854 | 875 | $table_prefix = $sqlParser->prefix; |
@@ -870,7 +891,8 @@ discard block |
||
| 870 | 891 | } |
| 871 | 892 | |
| 872 | 893 | // Remove installer Docblock only from components using plugin FileSource / fileBinding |
| 873 | -function removeDocblock($code, $type) { |
|
| 894 | +function removeDocblock($code, $type) |
|
| 895 | +{ |
|
| 874 | 896 | |
| 875 | 897 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
| 876 | 898 | |
@@ -891,8 +913,9 @@ discard block |
||
| 891 | 913 | default: |
| 892 | 914 | return $cleaned; |
| 893 | 915 | }; |
| 894 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
| 895 | - return $cleaned; |
|
| 916 | + if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') { |
|
| 917 | + return $cleaned; |
|
| 918 | + } |
|
| 896 | 919 | |
| 897 | 920 | // fileBinding not found - return code incl docblock |
| 898 | 921 | return $code; |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != 'true') {
|
| 3 | - die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
|
| 3 | + die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
| 9 | - // seems to be a new install - send the user to the configuration page |
|
| 10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
|
| 9 | + // seems to be a new install - send the user to the configuration page |
|
| 10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // set placeholders |
@@ -17,70 +17,70 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | 19 | if($modx->hasPermission('messages')) {
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
| 22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
| 23 | - |
|
| 24 | - $msg = array(); |
|
| 25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
| 30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
|
| 31 | - $ph['MessageInfo'] = join("\n", $msg);
|
|
| 20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
| 22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
| 23 | + |
|
| 24 | + $msg = array(); |
|
| 25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
| 30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
|
| 31 | + $ph['MessageInfo'] = join("\n", $msg);
|
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | 35 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
| 36 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
| 37 | - $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
| 36 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
| 37 | + $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
| 38 | 38 | } |
| 39 | 39 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
| 40 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
| 41 | - $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
| 40 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
| 41 | + $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
| 42 | 42 | } |
| 43 | 43 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
| 44 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
| 45 | - $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
| 44 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
| 45 | + $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
| 46 | 46 | } |
| 47 | 47 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
| 48 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
| 49 | - $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
| 48 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
| 49 | + $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
| 50 | 50 | } |
| 51 | 51 | if($modx->hasPermission('bk_manager')) {
|
| 52 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
| 53 | - $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
| 52 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
| 53 | + $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
| 54 | 54 | } |
| 55 | 55 | if($modx->hasPermission('help')) {
|
| 56 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
| 57 | - $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
| 56 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
| 57 | + $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | 60 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
| 61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | - $ph['config_check_results'] = $config_check_results; |
|
| 64 | - $ph['config_display'] = 'block'; |
|
| 65 | - } else {
|
|
| 66 | - $ph['config_display'] = 'none'; |
|
| 67 | - } |
|
| 61 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | + if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | + $ph['config_check_results'] = $config_check_results; |
|
| 64 | + $ph['config_display'] = 'block'; |
|
| 65 | + } else {
|
|
| 66 | + $ph['config_display'] = 'none'; |
|
| 67 | + } |
|
| 68 | 68 | } else {
|
| 69 | - $ph['config_display'] = 'none'; |
|
| 69 | + $ph['config_display'] = 'none'; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | 73 | if(isset($_SESSION['show_logout_reminder'])) {
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | - case 'logout_reminder': |
|
| 76 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
| 77 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
|
| 78 | - break; |
|
| 79 | - } |
|
| 80 | - $ph['show_logout_reminder'] = 'block'; |
|
| 81 | - unset($_SESSION['show_logout_reminder']); |
|
| 74 | + switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | + case 'logout_reminder': |
|
| 76 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
| 77 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
|
| 78 | + break; |
|
| 79 | + } |
|
| 80 | + $ph['show_logout_reminder'] = 'block'; |
|
| 81 | + unset($_SESSION['show_logout_reminder']); |
|
| 82 | 82 | } else {
|
| 83 | - $ph['show_logout_reminder'] = 'none'; |
|
| 83 | + $ph['show_logout_reminder'] = 'none'; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Check multiple sessions |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
| 129 | 129 | |
| 130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 131 | - 'username' => $modx->getLoginUserName(), |
|
| 132 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
| 133 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
| 134 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
| 135 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
| 131 | + 'username' => $modx->getLoginUserName(), |
|
| 132 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
| 133 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
| 134 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
| 135 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
| 136 | 136 | )); |
| 137 | 137 | |
| 138 | 138 | $from = array(); |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | 143 | if($modx->db->getRecordCount($rs) < 1) {
|
| 144 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
| 144 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
| 145 | 145 | } else {
|
| 146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 147 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
| 148 | - $ph['now'] = strftime('%H:%M:%S', $now);
|
|
| 149 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
| 150 | - $html = ' |
|
| 146 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 147 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
| 148 | + $ph['now'] = strftime('%H:%M:%S', $now);
|
|
| 149 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
| 150 | + $html = ' |
|
| 151 | 151 | <div class="card-body"> |
| 152 | 152 | [%onlineusers_message%] |
| 153 | 153 | <b>[+now+]</b>): |
@@ -165,33 +165,33 @@ discard block |
||
| 165 | 165 | </thead> |
| 166 | 166 | <tbody>'; |
| 167 | 167 | |
| 168 | - $userList = array(); |
|
| 169 | - $userCount = array(); |
|
| 170 | - // Create userlist with session-count first before output |
|
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
| 173 | - |
|
| 174 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
| 175 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
| 176 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
| 177 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
| 178 | - $userList[] = array( |
|
| 179 | - $idle, |
|
| 180 | - '', |
|
| 181 | - $activeusers['username'], |
|
| 182 | - $webicon, |
|
| 183 | - abs($activeusers['internalKey']), |
|
| 184 | - $ip, |
|
| 185 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
|
| 186 | - $currentaction |
|
| 187 | - ); |
|
| 188 | - } |
|
| 189 | - foreach($userList as $params) {
|
|
| 190 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
| 191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - $html .= ' |
|
| 168 | + $userList = array(); |
|
| 169 | + $userCount = array(); |
|
| 170 | + // Create userlist with session-count first before output |
|
| 171 | + while($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
| 173 | + |
|
| 174 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
| 175 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
| 176 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
| 177 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
| 178 | + $userList[] = array( |
|
| 179 | + $idle, |
|
| 180 | + '', |
|
| 181 | + $activeusers['username'], |
|
| 182 | + $webicon, |
|
| 183 | + abs($activeusers['internalKey']), |
|
| 184 | + $ip, |
|
| 185 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
|
| 186 | + $currentaction |
|
| 187 | + ); |
|
| 188 | + } |
|
| 189 | + foreach($userList as $params) {
|
|
| 190 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
| 191 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + $html .= ' |
|
| 195 | 195 | </tbody> |
| 196 | 196 | </table> |
| 197 | 197 | </div> |
@@ -232,17 +232,17 @@ discard block |
||
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | 234 | if(is_array($evtOut)) {
|
| 235 | - $output = implode('', $evtOut);
|
|
| 236 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
| 235 | + $output = implode('', $evtOut);
|
|
| 236 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $widgets['welcome'] = array( |
| 240 | - 'menuindex' => '10', |
|
| 241 | - 'id' => 'welcome', |
|
| 242 | - 'cols' => 'col-sm-6', |
|
| 243 | - 'icon' => 'fa-home', |
|
| 244 | - 'title' => '[%welcome_title%]', |
|
| 245 | - 'body' => ' |
|
| 240 | + 'menuindex' => '10', |
|
| 241 | + 'id' => 'welcome', |
|
| 242 | + 'cols' => 'col-sm-6', |
|
| 243 | + 'icon' => 'fa-home', |
|
| 244 | + 'title' => '[%welcome_title%]', |
|
| 245 | + 'body' => ' |
|
| 246 | 246 | <div class="wm_buttons card-body"> |
| 247 | 247 | <!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> |
| 248 | 248 | <span class="wm_button"> |
@@ -320,25 +320,25 @@ discard block |
||
| 320 | 320 | </table> |
| 321 | 321 | </div> |
| 322 | 322 | ', |
| 323 | - 'hide'=>'0' |
|
| 323 | + 'hide'=>'0' |
|
| 324 | 324 | ); |
| 325 | 325 | $widgets['onlineinfo'] = array( |
| 326 | - 'menuindex' => '20', |
|
| 327 | - 'id' => 'onlineinfo', |
|
| 328 | - 'cols' => 'col-sm-6', |
|
| 329 | - 'icon' => 'fa-user', |
|
| 330 | - 'title' => '[%onlineusers_title%]', |
|
| 331 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
| 332 | - 'hide'=>'0' |
|
| 326 | + 'menuindex' => '20', |
|
| 327 | + 'id' => 'onlineinfo', |
|
| 328 | + 'cols' => 'col-sm-6', |
|
| 329 | + 'icon' => 'fa-user', |
|
| 330 | + 'title' => '[%onlineusers_title%]', |
|
| 331 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
| 332 | + 'hide'=>'0' |
|
| 333 | 333 | ); |
| 334 | 334 | $widgets['recentinfo'] = array( |
| 335 | - 'menuindex' => '30', |
|
| 336 | - 'id' => 'modxrecent_widget', |
|
| 337 | - 'cols' => 'col-sm-12', |
|
| 338 | - 'icon' => 'fa-pencil-square-o', |
|
| 339 | - 'title' => '[%activity_title%]', |
|
| 340 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
| 341 | - 'hide'=>'0' |
|
| 335 | + 'menuindex' => '30', |
|
| 336 | + 'id' => 'modxrecent_widget', |
|
| 337 | + 'cols' => 'col-sm-12', |
|
| 338 | + 'icon' => 'fa-pencil-square-o', |
|
| 339 | + 'title' => '[%activity_title%]', |
|
| 340 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
| 341 | + 'hide'=>'0' |
|
| 342 | 342 | ); |
| 343 | 343 | if ($modx->config['rss_url_news']) {
|
| 344 | 344 | $widgets['news'] = array( |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | 368 | if(is_array($sitewidgets)) {
|
| 369 | - $newwidgets = array(); |
|
| 369 | + $newwidgets = array(); |
|
| 370 | 370 | foreach($sitewidgets as $widget){
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
@@ -374,21 +374,21 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | usort($widgets, function ($a, $b) {
|
| 377 | - return $a['menuindex'] - $b['menuindex']; |
|
| 377 | + return $a['menuindex'] - $b['menuindex']; |
|
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | 382 | foreach($widgets as $widget) {
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 384 | - $output .= $modx->parseText($tpl, $widget); |
|
| 385 | - } |
|
| 383 | + if ($widget['hide'] != '1'){
|
|
| 384 | + $output .= $modx->parseText($tpl, $widget); |
|
| 385 | + } |
|
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | 390 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
| 391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
@@ -396,27 +396,27 @@ discard block |
||
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | 398 | if(substr($target, 0, 1) === '@') {
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 402 | - $content = file_get_contents(trim(substr($target, 6))); |
|
| 403 | - } else {
|
|
| 404 | - $content = ''; |
|
| 405 | - } |
|
| 399 | + if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
| 401 | + } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 402 | + $content = file_get_contents(trim(substr($target, 6))); |
|
| 403 | + } else {
|
|
| 404 | + $content = ''; |
|
| 405 | + } |
|
| 406 | 406 | } else {
|
| 407 | - $chunk = $modx->getChunk($target); |
|
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 409 | - $content = $chunk; |
|
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | - {
|
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | - } else {
|
|
| 418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 419 | - } |
|
| 407 | + $chunk = $modx->getChunk($target); |
|
| 408 | + if($chunk !== false && !empty($chunk)) {
|
|
| 409 | + $content = $chunk; |
|
| 410 | + } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | + {
|
|
| 416 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | + } else {
|
|
| 418 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 419 | + } |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // merge placeholders |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | $content = $modx->mergeSettingsContent($content); |
| 425 | 425 | $content = $modx->parseText($content, $ph); |
| 426 | 426 | if(strpos($content, '[+') !== false) {
|
| 427 | - $modx->toPlaceholders($ph); |
|
| 428 | - $content = $modx->mergePlaceholderContent($content); |
|
| 427 | + $modx->toPlaceholders($ph); |
|
| 428 | + $content = $modx->mergePlaceholderContent($content); |
|
| 429 | 429 | } |
| 430 | 430 | $content = $modx->parseDocumentSource($content); |
| 431 | 431 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 434 | |
| 435 | 435 | if($js = $modx->getRegisteredClientScripts()) {
|
| 436 | - $content .= $js; |
|
| 436 | + $content .= $js; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | echo $content; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 444 | //</span> |
| 445 | 445 | function getTplWidget() { // recent document info
|
| 446 | - return ' |
|
| 446 | + return ' |
|
| 447 | 447 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 448 | <div class="card"[+cardAttr+]> |
| 449 | 449 | <div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div> |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | function getRecentInfo() { // recent document info
|
| 457 | - global $modx; |
|
| 457 | + global $modx; |
|
| 458 | 458 | |
| 459 | - $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
|
| 459 | + $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
|
| 460 | 460 | |
| 461 | - $html = ' |
|
| 461 | + $html = ' |
|
| 462 | 462 | <div class="table-responsive"> |
| 463 | 463 | <table class="table data"> |
| 464 | 464 | <thead> |
@@ -476,96 +476,96 @@ discard block |
||
| 476 | 476 | </table> |
| 477 | 477 | </div> |
| 478 | 478 | '; |
| 479 | - return $html; |
|
| 479 | + return $html; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | function getRecentInfoList() {
|
| 483 | - global $modx; |
|
| 484 | - |
|
| 485 | - $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
|
| 486 | - |
|
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | - return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
| 489 | - } |
|
| 490 | - |
|
| 491 | - $tpl = getRecentInfoRowTpl(); |
|
| 492 | - |
|
| 493 | - $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
| 494 | - $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
| 495 | - |
|
| 496 | - $output = array(); |
|
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 498 | - $docid = $ph['id']; |
|
| 499 | - $_ = $modx->getUserInfo($ph['editedby']); |
|
| 500 | - $ph['username'] = $_['username']; |
|
| 501 | - |
|
| 502 | - if($ph['deleted'] == 1) {
|
|
| 503 | - $ph['status'] = 'deleted text-danger'; |
|
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 505 | - $ph['status'] = 'unpublished font-italic text-muted'; |
|
| 506 | - } else {
|
|
| 507 | - $ph['status'] = 'published'; |
|
| 508 | - } |
|
| 509 | - |
|
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 511 | - $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
|
| 512 | - } else {
|
|
| 513 | - $ph['edit_btn'] = ''; |
|
| 514 | - } |
|
| 515 | - |
|
| 516 | - $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
| 517 | - $ph['preview_btn'] = str_replace(array( |
|
| 518 | - '[+id+]', |
|
| 519 | - '[+preview_disabled+]' |
|
| 520 | - ), array( |
|
| 521 | - $docid, |
|
| 522 | - $preview_disabled |
|
| 523 | - ), $btntpl['preview_btn']); |
|
| 524 | - |
|
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 527 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
| 528 | - } else {
|
|
| 529 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
| 530 | - } |
|
| 531 | - $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
|
| 532 | - } else {
|
|
| 533 | - $ph['delete_btn'] = ''; |
|
| 534 | - } |
|
| 535 | - |
|
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | - $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 542 | - } else {
|
|
| 543 | - $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 544 | - } |
|
| 545 | - $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
|
| 546 | - |
|
| 547 | - $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
|
| 548 | - |
|
| 549 | - if($ph['longtitle'] == '') {
|
|
| 550 | - $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
| 551 | - } |
|
| 552 | - if($ph['description'] == '') {
|
|
| 553 | - $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
| 554 | - } |
|
| 555 | - if($ph['introtext'] == '') {
|
|
| 556 | - $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
| 557 | - } |
|
| 558 | - if($ph['alias'] == '') {
|
|
| 559 | - $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
| 560 | - } |
|
| 561 | - |
|
| 562 | - $output[] = $modx->parseText($tpl, $ph); |
|
| 563 | - } |
|
| 564 | - return join("\n", $output);
|
|
| 483 | + global $modx; |
|
| 484 | + |
|
| 485 | + $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
|
| 486 | + |
|
| 487 | + if($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | + return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
| 489 | + } |
|
| 490 | + |
|
| 491 | + $tpl = getRecentInfoRowTpl(); |
|
| 492 | + |
|
| 493 | + $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
| 494 | + $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
| 495 | + |
|
| 496 | + $output = array(); |
|
| 497 | + while($ph = $modx->db->getRow($rs)) {
|
|
| 498 | + $docid = $ph['id']; |
|
| 499 | + $_ = $modx->getUserInfo($ph['editedby']); |
|
| 500 | + $ph['username'] = $_['username']; |
|
| 501 | + |
|
| 502 | + if($ph['deleted'] == 1) {
|
|
| 503 | + $ph['status'] = 'deleted text-danger'; |
|
| 504 | + } elseif($ph['published'] == 0) {
|
|
| 505 | + $ph['status'] = 'unpublished font-italic text-muted'; |
|
| 506 | + } else {
|
|
| 507 | + $ph['status'] = 'published'; |
|
| 508 | + } |
|
| 509 | + |
|
| 510 | + if($modx->hasPermission('edit_document')) {
|
|
| 511 | + $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
|
| 512 | + } else {
|
|
| 513 | + $ph['edit_btn'] = ''; |
|
| 514 | + } |
|
| 515 | + |
|
| 516 | + $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
| 517 | + $ph['preview_btn'] = str_replace(array( |
|
| 518 | + '[+id+]', |
|
| 519 | + '[+preview_disabled+]' |
|
| 520 | + ), array( |
|
| 521 | + $docid, |
|
| 522 | + $preview_disabled |
|
| 523 | + ), $btntpl['preview_btn']); |
|
| 524 | + |
|
| 525 | + if($modx->hasPermission('delete_document')) {
|
|
| 526 | + if($ph['deleted'] == 0) {
|
|
| 527 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
| 528 | + } else {
|
|
| 529 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
| 530 | + } |
|
| 531 | + $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
|
| 532 | + } else {
|
|
| 533 | + $ph['delete_btn'] = ''; |
|
| 534 | + } |
|
| 535 | + |
|
| 536 | + if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 538 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 540 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | + $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 542 | + } else {
|
|
| 543 | + $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 544 | + } |
|
| 545 | + $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
|
| 546 | + |
|
| 547 | + $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
|
| 548 | + |
|
| 549 | + if($ph['longtitle'] == '') {
|
|
| 550 | + $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
| 551 | + } |
|
| 552 | + if($ph['description'] == '') {
|
|
| 553 | + $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
| 554 | + } |
|
| 555 | + if($ph['introtext'] == '') {
|
|
| 556 | + $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
| 557 | + } |
|
| 558 | + if($ph['alias'] == '') {
|
|
| 559 | + $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
| 560 | + } |
|
| 561 | + |
|
| 562 | + $output[] = $modx->parseText($tpl, $ph); |
|
| 563 | + } |
|
| 564 | + return join("\n", $output);
|
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | function getRecentInfoRowTpl() {
|
| 568 | - $tpl = ' |
|
| 568 | + $tpl = ' |
|
| 569 | 569 | <tr> |
| 570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
| 571 | 571 | <td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&id=[+id+]" target="main">[+pagetitle+]</a></td> |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | </div> |
| 590 | 590 | </td> |
| 591 | 591 | </tr>'; |
| 592 | - return $tpl; |
|
| 592 | + return $tpl; |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | // setup icons |
| 596 | 596 | function wrapIcon($i, $action) {
|
| 597 | - return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
|
| 597 | + return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | function getStartUpScript() {
|
| 601 | - $script = ' |
|
| 601 | + $script = ' |
|
| 602 | 602 | <script type="text/javascript"> |
| 603 | 603 | function hideConfigCheckWarning(key) {
|
| 604 | 604 | var xhr = new XMLHttpRequest(); |
@@ -622,5 +622,5 @@ discard block |
||
| 622 | 622 | })(jQuery); |
| 623 | 623 | </script> |
| 624 | 624 | '; |
| 625 | - return $script; |
|
| 625 | + return $script; |
|
| 626 | 626 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != 'true') {
|
|
| 2 | +if(IN_MANAGER_MODE != 'true') { |
|
| 3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 19 | +if($modx->hasPermission('messages')) { |
|
| 20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -32,46 +32,46 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 47 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if($modx->hasPermission('bk_manager')) { |
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if($modx->hasPermission('help')) { |
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 60 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
| 61 | 61 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | - } else {
|
|
| 65 | + } else { |
|
| 66 | 66 | $ph['config_display'] = 'none'; |
| 67 | 67 | } |
| 68 | -} else {
|
|
| 68 | +} else { |
|
| 69 | 69 | $ph['config_display'] = 'none'; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
| 74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | $ph['show_logout_reminder'] = 'block'; |
| 81 | 81 | unset($_SESSION['show_logout_reminder']); |
| 82 | -} else {
|
|
| 82 | +} else { |
|
| 83 | 83 | $ph['show_logout_reminder'] = 'none'; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if($modx->db->getRecordCount($rs) < 1) { |
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | -} else {
|
|
| 145 | +} else { |
|
| 146 | 146 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach($userList as $params) { |
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | 191 | $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
| 192 | 192 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if(is_array($evtOut)) { |
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
| 341 | 341 | 'hide'=>'0' |
| 342 | 342 | ); |
| 343 | -if ($modx->config['rss_url_news']) {
|
|
| 343 | +if ($modx->config['rss_url_news']) { |
|
| 344 | 344 | $widgets['news'] = array( |
| 345 | 345 | 'menuindex' => '40', |
| 346 | 346 | 'id' => 'news', |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | 'hide'=>'0' |
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | -if ($modx->config['rss_url_security']) {
|
|
| 354 | +if ($modx->config['rss_url_security']) { |
|
| 355 | 355 | $widgets['security'] = array( |
| 356 | 356 | 'menuindex' => '50', |
| 357 | 357 | 'id' => 'security', |
@@ -365,29 +365,29 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if(is_array($sitewidgets)) { |
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach($sitewidgets as $widget) { |
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function ($a, $b){ |
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach($widgets as $widget) { |
|
| 383 | + if ($widget['hide'] != '1') { |
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 390 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
| 391 | 391 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -395,26 +395,28 @@ discard block |
||
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if(substr($target, 0, 1) === '@') { |
|
| 399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | - } else {
|
|
| 403 | + } else { |
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | -} else {
|
|
| 406 | +} else { |
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if($chunk !== false && !empty($chunk)) { |
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 411 | 411 | $content = file_get_contents(MODX_BASE_PATH . $target); |
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
| 413 | 413 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
| 415 | + // ClipperCMS compatible |
|
| 415 | 416 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | - } else {
|
|
| 417 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 418 | + } |
|
| 419 | + } else { |
|
| 418 | 420 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
| 419 | 421 | } |
| 420 | 422 | } |
@@ -423,7 +425,7 @@ discard block |
||
| 423 | 425 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 426 | $content = $modx->mergeSettingsContent($content); |
| 425 | 427 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 428 | +if(strpos($content, '[+') !== false) { |
|
| 427 | 429 | $modx->toPlaceholders($ph); |
| 428 | 430 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 431 | } |
@@ -432,7 +434,7 @@ discard block |
||
| 432 | 434 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 435 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 436 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 437 | +if($js = $modx->getRegisteredClientScripts()) { |
|
| 436 | 438 | $content .= $js; |
| 437 | 439 | } |
| 438 | 440 | |
@@ -442,7 +444,9 @@ discard block |
||
| 442 | 444 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 445 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 446 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 447 | +function getTplWidget() |
|
| 448 | +{ |
|
| 449 | +// recent document info |
|
| 446 | 450 | return ' |
| 447 | 451 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 452 | <div class="card"[+cardAttr+]> |
@@ -453,7 +457,9 @@ discard block |
||
| 453 | 457 | '; |
| 454 | 458 | } |
| 455 | 459 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 460 | +function getRecentInfo() |
|
| 461 | +{ |
|
| 462 | +// recent document info |
|
| 457 | 463 | global $modx; |
| 458 | 464 | |
| 459 | 465 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +485,13 @@ discard block |
||
| 479 | 485 | return $html; |
| 480 | 486 | } |
| 481 | 487 | |
| 482 | -function getRecentInfoList() {
|
|
| 488 | +function getRecentInfoList() |
|
| 489 | +{ |
|
| 483 | 490 | global $modx; |
| 484 | 491 | |
| 485 | 492 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 493 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 494 | + if($modx->db->getRecordCount($rs) < 1) { |
|
| 488 | 495 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 496 | } |
| 490 | 497 | |
@@ -494,22 +501,22 @@ discard block |
||
| 494 | 501 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 502 | |
| 496 | 503 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 504 | + while($ph = $modx->db->getRow($rs)) { |
|
| 498 | 505 | $docid = $ph['id']; |
| 499 | 506 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 507 | $ph['username'] = $_['username']; |
| 501 | 508 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 509 | + if($ph['deleted'] == 1) { |
|
| 503 | 510 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 511 | + } elseif($ph['published'] == 0) { |
|
| 505 | 512 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | - } else {
|
|
| 513 | + } else { |
|
| 507 | 514 | $ph['status'] = 'published'; |
| 508 | 515 | } |
| 509 | 516 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 517 | + if($modx->hasPermission('edit_document')) { |
|
| 511 | 518 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | - } else {
|
|
| 519 | + } else { |
|
| 513 | 520 | $ph['edit_btn'] = ''; |
| 514 | 521 | } |
| 515 | 522 | |
@@ -522,40 +529,40 @@ discard block |
||
| 522 | 529 | $preview_disabled |
| 523 | 530 | ), $btntpl['preview_btn']); |
| 524 | 531 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 532 | + if($modx->hasPermission('delete_document')) { |
|
| 533 | + if($ph['deleted'] == 0) { |
|
| 527 | 534 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | - } else {
|
|
| 535 | + } else { |
|
| 529 | 536 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
| 530 | 537 | } |
| 531 | 538 | $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
| 532 | - } else {
|
|
| 539 | + } else { |
|
| 533 | 540 | $ph['delete_btn'] = ''; |
| 534 | 541 | } |
| 535 | 542 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 543 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
| 537 | 544 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 545 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
| 539 | 546 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 547 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
| 541 | 548 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | - } else {
|
|
| 549 | + } else { |
|
| 543 | 550 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 544 | 551 | } |
| 545 | 552 | $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
| 546 | 553 | |
| 547 | 554 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 555 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 556 | + if($ph['longtitle'] == '') { |
|
| 550 | 557 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 558 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 559 | + if($ph['description'] == '') { |
|
| 553 | 560 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 561 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 562 | + if($ph['introtext'] == '') { |
|
| 556 | 563 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 564 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 565 | + if($ph['alias'] == '') { |
|
| 559 | 566 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 567 | } |
| 561 | 568 | |
@@ -564,7 +571,8 @@ discard block |
||
| 564 | 571 | return join("\n", $output);
|
| 565 | 572 | } |
| 566 | 573 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 574 | +function getRecentInfoRowTpl() |
|
| 575 | +{ |
|
| 568 | 576 | $tpl = ' |
| 569 | 577 | <tr> |
| 570 | 578 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +601,13 @@ discard block |
||
| 593 | 601 | } |
| 594 | 602 | |
| 595 | 603 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 604 | +function wrapIcon($i, $action) |
|
| 605 | +{ |
|
| 597 | 606 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 607 | } |
| 599 | 608 | |
| 600 | -function getStartUpScript() {
|
|
| 609 | +function getStartUpScript() |
|
| 610 | +{ |
|
| 601 | 611 | $script = ' |
| 602 | 612 | <script type="text/javascript"> |
| 603 | 613 | function hideConfigCheckWarning(key) {
|