@@ -29,10 +29,12 @@ |
||
| 29 | 29 | |
| 30 | 30 | <div class="tab-page"> |
| 31 | 31 | <div class="container container-body"> |
| 32 | - <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 32 | + <?php if($num_rows_pub) { |
|
| 33 | + printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 33 | 34 | <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
| 34 | 35 | <?php |
| 35 | 36 | $modx->clearCache('full', true); |
| 37 | +} |
|
| 36 | 38 | // invoke OnSiteRefresh event |
| 37 | 39 | $modx->invokeEvent("OnSiteRefresh"); |
| 38 | 40 | ?> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || 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 | // (un)publishing of documents, version 2! |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
| 33 | 33 | <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
| 34 | 34 | <?php |
| 35 | - $modx->clearCache('full', true); |
|
| 36 | - // invoke OnSiteRefresh event |
|
| 37 | - $modx->invokeEvent("OnSiteRefresh"); |
|
| 38 | - ?> |
|
| 35 | + $modx->clearCache('full', true); |
|
| 36 | + // invoke OnSiteRefresh event |
|
| 37 | + $modx->invokeEvent("OnSiteRefresh"); |
|
| 38 | + ?> |
|
| 39 | 39 | </div> |
| 40 | 40 | </div> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | <div class="tab-page"> |
| 31 | 31 | <div class="container container-body"> |
| 32 | - <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 33 | - <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
|
| 32 | + <?php if ($num_rows_pub) printf('<p>'.$_lang["refresh_published"].'</p>', $num_rows_pub) ?> |
|
| 33 | + <?php if ($num_rows_unpub) printf('<p>'.$_lang["refresh_unpublished"].'</p>', $num_rows_unpub) ?> |
|
| 34 | 34 | <?php |
| 35 | 35 | $modx->clearCache('full', true); |
| 36 | 36 | // invoke OnSiteRefresh event |
@@ -7,10 +7,10 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | // invoke OnBeforeManagerLogout event |
| 9 | 9 | $modx->invokeEvent("OnBeforeManagerLogout", |
| 10 | - array( |
|
| 11 | - "userid" => $internalKey, |
|
| 12 | - "username" => $username |
|
| 13 | - )); |
|
| 10 | + array( |
|
| 11 | + "userid" => $internalKey, |
|
| 12 | + "username" => $username |
|
| 13 | + )); |
|
| 14 | 14 | |
| 15 | 15 | //// Unset all of the session variables. |
| 16 | 16 | //$_SESSION = array(); |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // invoke OnManagerLogout event |
| 35 | 35 | $modx->invokeEvent("OnManagerLogout", |
| 36 | - array( |
|
| 37 | - "userid" => $internalKey, |
|
| 38 | - "username" => $username |
|
| 39 | - )); |
|
| 36 | + array( |
|
| 37 | + "userid" => $internalKey, |
|
| 38 | + "username" => $username |
|
| 39 | + )); |
|
| 40 | 40 | |
| 41 | 41 | // show login screen |
| 42 | 42 | header('Location: ' . MODX_MANAGER_URL); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -41,4 +41,4 @@ discard block |
||
| 41 | 41 | )); |
| 42 | 42 | |
| 43 | 43 | // show login screen |
| 44 | -header('Location: ' . MODX_MANAGER_URL); |
|
| 44 | +header('Location: '.MODX_MANAGER_URL); |
|
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | elseif(is_writable($htaccess)) |
| 23 | 23 | { |
| 24 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 24 | + $_ = preg_replace('@RewriteBase.+@',"rewritebase {$dir}", $_); |
|
| 25 | 25 | if(!@file_put_contents($htaccess,$_)) |
| 26 | 26 | { |
| 27 | 27 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | elseif($modx->config['base_url']!=='/') |
| 38 | 38 | { |
| 39 | 39 | $_ = file_get_contents($htaccess); |
| 40 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 40 | + $_ = preg_replace('@RewriteBase.+@',"rewritebase {$dir}", $_); |
|
| 41 | 41 | if(!@file_put_contents($htaccess,$_)) |
| 42 | 42 | { |
| 43 | 43 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('settings')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | $data = $_POST; |
| 9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
@@ -11,41 +11,41 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
| 13 | 13 | { |
| 14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
| 15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
| 16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
| 17 | - if(is_file($htaccess)) |
|
| 18 | - { |
|
| 19 | - $_ = file_get_contents($htaccess); |
|
| 20 | - if(strpos($_,'RewriteBase')===false) |
|
| 21 | - { |
|
| 22 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 23 | - } |
|
| 24 | - elseif(is_writable($htaccess)) |
|
| 25 | - { |
|
| 26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 27 | - if(!@file_put_contents($htaccess,$_)) |
|
| 28 | - { |
|
| 29 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 30 | - } |
|
| 31 | - } |
|
| 32 | - } |
|
| 33 | - elseif(is_file($sample_htaccess)) |
|
| 34 | - { |
|
| 35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
| 14 | + $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
| 15 | + $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
| 16 | + $dir = '/' . trim($modx->config['base_url'],'/'); |
|
| 17 | + if(is_file($htaccess)) |
|
| 18 | + { |
|
| 19 | + $_ = file_get_contents($htaccess); |
|
| 20 | + if(strpos($_,'RewriteBase')===false) |
|
| 36 | 21 | { |
| 37 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
| 38 | - } |
|
| 39 | - elseif($modx->config['base_url']!=='/') |
|
| 40 | - { |
|
| 41 | - $_ = file_get_contents($htaccess); |
|
| 42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 43 | - if(!@file_put_contents($htaccess,$_)) |
|
| 44 | - { |
|
| 45 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 22 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 23 | + } |
|
| 24 | + elseif(is_writable($htaccess)) |
|
| 25 | + { |
|
| 26 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 27 | + if(!@file_put_contents($htaccess,$_)) |
|
| 28 | + { |
|
| 29 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | + elseif(is_file($sample_htaccess)) |
|
| 34 | + { |
|
| 35 | + if(!@rename($sample_htaccess,$htaccess)) |
|
| 36 | + { |
|
| 37 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
| 38 | + } |
|
| 39 | + elseif($modx->config['base_url']!=='/') |
|
| 40 | + { |
|
| 41 | + $_ = file_get_contents($htaccess); |
|
| 42 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 43 | + if(!@file_put_contents($htaccess,$_)) |
|
| 44 | + { |
|
| 45 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
| 57 | 57 | |
| 58 | 58 | if (isset($data) && count($data) > 0) { |
| 59 | - if(isset($data['manager_language'])) { |
|
| 60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
| 61 | - if(is_file($lang_path)) { |
|
| 62 | - include($lang_path); |
|
| 59 | + if(isset($data['manager_language'])) { |
|
| 60 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
| 61 | + if(is_file($lang_path)) { |
|
| 62 | + include($lang_path); |
|
| 63 | 63 | global $modx_lang_attribute; |
| 64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
| 65 | - } |
|
| 66 | - } |
|
| 67 | - $savethese = array(); |
|
| 68 | - $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
| 69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
| 70 | - foreach ($data as $k => $v) { |
|
| 71 | - switch ($k) { |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + $savethese = array(); |
|
| 68 | + $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
| 69 | + $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
| 70 | + foreach ($data as $k => $v) { |
|
| 71 | + switch ($k) { |
|
| 72 | 72 | case 'settings_version':{ |
| 73 | 73 | if($modx->getVersionData('version')!=$data['settings_version']){ |
| 74 | 74 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -76,24 +76,24 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | break; |
| 78 | 78 | } |
| 79 | - case 'error_page': |
|
| 80 | - case 'unauthorized_page': |
|
| 81 | - if (trim($v) == '' || !is_numeric($v)) { |
|
| 82 | - $v = $data['site_start']; |
|
| 83 | - } |
|
| 84 | - break; |
|
| 79 | + case 'error_page': |
|
| 80 | + case 'unauthorized_page': |
|
| 81 | + if (trim($v) == '' || !is_numeric($v)) { |
|
| 82 | + $v = $data['site_start']; |
|
| 83 | + } |
|
| 84 | + break; |
|
| 85 | 85 | |
| 86 | - case 'lst_custom_contenttype': |
|
| 87 | - case 'txt_custom_contenttype': |
|
| 88 | - // Skip these |
|
| 89 | - $k = ''; |
|
| 90 | - break; |
|
| 91 | - case 'rb_base_dir': |
|
| 92 | - case 'rb_base_url': |
|
| 93 | - case 'filemanager_path': |
|
| 94 | - $v = trim($v); |
|
| 95 | - $v = rtrim($v,'/') . '/'; |
|
| 96 | - break; |
|
| 86 | + case 'lst_custom_contenttype': |
|
| 87 | + case 'txt_custom_contenttype': |
|
| 88 | + // Skip these |
|
| 89 | + $k = ''; |
|
| 90 | + break; |
|
| 91 | + case 'rb_base_dir': |
|
| 92 | + case 'rb_base_url': |
|
| 93 | + case 'filemanager_path': |
|
| 94 | + $v = trim($v); |
|
| 95 | + $v = rtrim($v,'/') . '/'; |
|
| 96 | + break; |
|
| 97 | 97 | case 'manager_language': |
| 98 | 98 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
| 99 | 99 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -101,56 +101,56 @@ discard block |
||
| 101 | 101 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
| 102 | 102 | $v = 'english'; |
| 103 | 103 | } |
| 104 | - break; |
|
| 105 | - case 'smtppw': |
|
| 106 | - if ($v !== '********************' && $v !== '') { |
|
| 107 | - $v = trim($v); |
|
| 108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
| 109 | - $v = str_replace('=','%',$v); |
|
| 110 | - } elseif ($v === '********************') { |
|
| 111 | - $k = ''; |
|
| 112 | - } |
|
| 113 | - break; |
|
| 104 | + break; |
|
| 105 | + case 'smtppw': |
|
| 106 | + if ($v !== '********************' && $v !== '') { |
|
| 107 | + $v = trim($v); |
|
| 108 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
| 109 | + $v = str_replace('=','%',$v); |
|
| 110 | + } elseif ($v === '********************') { |
|
| 111 | + $k = ''; |
|
| 112 | + } |
|
| 113 | + break; |
|
| 114 | 114 | case 'valid_hostnames': |
| 115 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
| 116 | - if ($v !== ',') { |
|
| 117 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
| 118 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
| 119 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
| 120 | - } |
|
| 121 | - $k = ''; |
|
| 122 | - break; |
|
| 123 | - case 'session_timeout': |
|
| 124 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
| 125 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
| 126 | - break; |
|
| 127 | - default: |
|
| 128 | - break; |
|
| 129 | - } |
|
| 130 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
| 115 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
| 116 | + if ($v !== ',') { |
|
| 117 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
| 118 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
| 119 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
| 120 | + } |
|
| 121 | + $k = ''; |
|
| 122 | + break; |
|
| 123 | + case 'session_timeout': |
|
| 124 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
| 125 | + $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
| 126 | + break; |
|
| 127 | + default: |
|
| 128 | + break; |
|
| 129 | + } |
|
| 130 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
| 131 | 131 | |
| 132 | - $modx->config[$k] = $v; |
|
| 132 | + $modx->config[$k] = $v; |
|
| 133 | 133 | |
| 134 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 135 | - } |
|
| 134 | + if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - // Run a single query to save all the values |
|
| 138 | - $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value) |
|
| 137 | + // Run a single query to save all the values |
|
| 138 | + $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value) |
|
| 139 | 139 | VALUES ".implode(', ', $savethese); |
| 140 | - $modx->getDatabase()->query($sql); |
|
| 140 | + $modx->getDatabase()->query($sql); |
|
| 141 | 141 | |
| 142 | - // Reset Template Pages |
|
| 143 | - if (isset($data['reset_template'])) { |
|
| 144 | - $newtemplate = (int)$data['default_template']; |
|
| 145 | - $oldtemplate = (int)$data['old_template']; |
|
| 146 | - $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
|
| 147 | - $reset = $data['reset_template']; |
|
| 148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 150 | - } |
|
| 142 | + // Reset Template Pages |
|
| 143 | + if (isset($data['reset_template'])) { |
|
| 144 | + $newtemplate = (int)$data['default_template']; |
|
| 145 | + $oldtemplate = (int)$data['old_template']; |
|
| 146 | + $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
|
| 147 | + $reset = $data['reset_template']; |
|
| 148 | + if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | + else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - // empty cache |
|
| 153 | - $modx->clearCache('full'); |
|
| 152 | + // empty cache |
|
| 153 | + $modx->clearCache('full'); |
|
| 154 | 154 | } |
| 155 | 155 | $header="Location: index.php?a=7&r=10"; |
| 156 | 156 | header($header); |
@@ -1,46 +1,46 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('settings')) { |
|
| 5 | +if (!$modx->hasPermission('settings')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | $data = $_POST; |
| 9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
| 10 | 10 | unset($_POST); |
| 11 | 11 | |
| 12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
| 12 | +if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false) |
|
| 13 | 13 | { |
| 14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
| 15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
| 16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
| 17 | - if(is_file($htaccess)) |
|
| 14 | + $htaccess = $modx->config['base_path'].'.htaccess'; |
|
| 15 | + $sample_htaccess = $modx->config['base_path'].'ht.access'; |
|
| 16 | + $dir = '/'.trim($modx->config['base_url'], '/'); |
|
| 17 | + if (is_file($htaccess)) |
|
| 18 | 18 | { |
| 19 | 19 | $_ = file_get_contents($htaccess); |
| 20 | - if(strpos($_,'RewriteBase')===false) |
|
| 20 | + if (strpos($_, 'RewriteBase') === false) |
|
| 21 | 21 | { |
| 22 | 22 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 23 | 23 | } |
| 24 | - elseif(is_writable($htaccess)) |
|
| 24 | + elseif (is_writable($htaccess)) |
|
| 25 | 25 | { |
| 26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 27 | - if(!@file_put_contents($htaccess,$_)) |
|
| 26 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
| 27 | + if (!@file_put_contents($htaccess, $_)) |
|
| 28 | 28 | { |
| 29 | 29 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | - elseif(is_file($sample_htaccess)) |
|
| 33 | + elseif (is_file($sample_htaccess)) |
|
| 34 | 34 | { |
| 35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
| 35 | + if (!@rename($sample_htaccess, $htaccess)) |
|
| 36 | 36 | { |
| 37 | 37 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
| 38 | 38 | } |
| 39 | - elseif($modx->config['base_url']!=='/') |
|
| 39 | + elseif ($modx->config['base_url'] !== '/') |
|
| 40 | 40 | { |
| 41 | 41 | $_ = file_get_contents($htaccess); |
| 42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 43 | - if(!@file_put_contents($htaccess,$_)) |
|
| 42 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
| 43 | + if (!@file_put_contents($htaccess, $_)) |
|
| 44 | 44 | { |
| 45 | 45 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 46 | 46 | } |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
| 52 | - unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css'); |
|
| 51 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
| 52 | + unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css'); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | -$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']); |
|
| 56 | -$data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
|
| 55 | +$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']); |
|
| 56 | +$data['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']); |
|
| 57 | 57 | |
| 58 | 58 | if (isset($data) && count($data) > 0) { |
| 59 | - if(isset($data['manager_language'])) { |
|
| 60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
| 61 | - if(is_file($lang_path)) { |
|
| 59 | + if (isset($data['manager_language'])) { |
|
| 60 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php'; |
|
| 61 | + if (is_file($lang_path)) { |
|
| 62 | 62 | include($lang_path); |
| 63 | 63 | global $modx_lang_attribute; |
| 64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | $savethese = array(); |
| 68 | 68 | $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
| 69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
| 69 | + $data['mail_check_timeperiod'] = (int) $data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
| 70 | 70 | foreach ($data as $k => $v) { |
| 71 | 71 | switch ($k) { |
| 72 | 72 | case 'settings_version':{ |
| 73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
| 74 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
| 73 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
| 74 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
| 75 | 75 | $v = $modx->getVersionData('version'); |
| 76 | 76 | } |
| 77 | 77 | break; |
@@ -92,21 +92,21 @@ discard block |
||
| 92 | 92 | case 'rb_base_url': |
| 93 | 93 | case 'filemanager_path': |
| 94 | 94 | $v = trim($v); |
| 95 | - $v = rtrim($v,'/') . '/'; |
|
| 95 | + $v = rtrim($v, '/').'/'; |
|
| 96 | 96 | break; |
| 97 | 97 | case 'manager_language': |
| 98 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
| 99 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
| 98 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
| 99 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
| 100 | 100 | $langFileDir = dirname($langFile); |
| 101 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
| 101 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
| 102 | 102 | $v = 'english'; |
| 103 | 103 | } |
| 104 | 104 | break; |
| 105 | 105 | case 'smtppw': |
| 106 | 106 | if ($v !== '********************' && $v !== '') { |
| 107 | 107 | $v = trim($v); |
| 108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
| 109 | - $v = str_replace('=','%',$v); |
|
| 108 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
| 109 | + $v = str_replace('=', '%', $v); |
|
| 110 | 110 | } elseif ($v === '********************') { |
| 111 | 111 | $k = ''; |
| 112 | 112 | } |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | $v = str_replace(array(' ,', ', '), ',', $v); |
| 116 | 116 | if ($v !== ',') { |
| 117 | 117 | $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
| 118 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
| 119 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
| 118 | + $configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n"; |
|
| 119 | + @file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString); |
|
| 120 | 120 | } |
| 121 | 121 | $k = ''; |
| 122 | 122 | break; |
| 123 | 123 | case 'session_timeout': |
| 124 | 124 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
| 125 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
| 125 | + $v = (int) $v < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
| 126 | 126 | break; |
| 127 | 127 | default: |
| 128 | 128 | break; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $modx->config[$k] = $v; |
| 133 | 133 | |
| 134 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 134 | + if (!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // Run a single query to save all the values |
@@ -141,16 +141,16 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | // Reset Template Pages |
| 143 | 143 | if (isset($data['reset_template'])) { |
| 144 | - $newtemplate = (int)$data['default_template']; |
|
| 145 | - $oldtemplate = (int)$data['old_template']; |
|
| 144 | + $newtemplate = (int) $data['default_template']; |
|
| 145 | + $oldtemplate = (int) $data['old_template']; |
|
| 146 | 146 | $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
| 147 | 147 | $reset = $data['reset_template']; |
| 148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 148 | + if ($reset == 1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | + else if ($reset == 2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // empty cache |
| 153 | 153 | $modx->clearCache('full'); |
| 154 | 154 | } |
| 155 | -$header="Location: index.php?a=7&r=10"; |
|
| 155 | +$header = "Location: index.php?a=7&r=10"; |
|
| 156 | 156 | header($header); |
@@ -9,39 +9,27 @@ discard block |
||
| 9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
| 10 | 10 | unset($_POST); |
| 11 | 11 | |
| 12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
| 13 | -{ |
|
| 12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
| 14 | 13 | $htaccess = $modx->config['base_path'] . '.htaccess'; |
| 15 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
| 16 | 15 | $dir = '/' . trim($modx->config['base_url'],'/'); |
| 17 | - if(is_file($htaccess)) |
|
| 18 | - { |
|
| 16 | + if(is_file($htaccess)) { |
|
| 19 | 17 | $_ = file_get_contents($htaccess); |
| 20 | - if(strpos($_,'RewriteBase')===false) |
|
| 21 | - { |
|
| 18 | + if(strpos($_,'RewriteBase')===false) { |
|
| 22 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 23 | - } |
|
| 24 | - elseif(is_writable($htaccess)) |
|
| 25 | - { |
|
| 20 | + } elseif(is_writable($htaccess)) { |
|
| 26 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
| 27 | - if(!@file_put_contents($htaccess,$_)) |
|
| 28 | - { |
|
| 22 | + if(!@file_put_contents($htaccess,$_)) { |
|
| 29 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 30 | 24 | } |
| 31 | 25 | } |
| 32 | - } |
|
| 33 | - elseif(is_file($sample_htaccess)) |
|
| 34 | - { |
|
| 35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
| 36 | - { |
|
| 26 | + } elseif(is_file($sample_htaccess)) { |
|
| 27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
| 37 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
| 38 | - } |
|
| 39 | - elseif($modx->config['base_url']!=='/') |
|
| 40 | - { |
|
| 29 | + } elseif($modx->config['base_url']!=='/') { |
|
| 41 | 30 | $_ = file_get_contents($htaccess); |
| 42 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
| 43 | - if(!@file_put_contents($htaccess,$_)) |
|
| 44 | - { |
|
| 32 | + if(!@file_put_contents($htaccess,$_)) { |
|
| 45 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 46 | 34 | } |
| 47 | 35 | } |
@@ -70,7 +58,7 @@ discard block |
||
| 70 | 58 | foreach ($data as $k => $v) { |
| 71 | 59 | switch ($k) { |
| 72 | 60 | case 'settings_version':{ |
| 73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
| 61 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
| 74 | 62 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
| 75 | 63 | $v = $modx->getVersionData('version'); |
| 76 | 64 | } |
@@ -131,7 +119,9 @@ discard block |
||
| 131 | 119 | |
| 132 | 120 | $modx->config[$k] = $v; |
| 133 | 121 | |
| 134 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 122 | + if(!empty($k)) { |
|
| 123 | + $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 124 | + } |
|
| 135 | 125 | } |
| 136 | 126 | |
| 137 | 127 | // Run a single query to save all the values |
@@ -145,8 +135,11 @@ discard block |
||
| 145 | 135 | $oldtemplate = (int)$data['old_template']; |
| 146 | 136 | $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
| 147 | 137 | $reset = $data['reset_template']; |
| 148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 138 | + if($reset==1) { |
|
| 139 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 140 | + } else if($reset==2) { |
|
| 141 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 142 | + } |
|
| 150 | 143 | } |
| 151 | 144 | |
| 152 | 145 | // empty cache |
@@ -239,7 +239,7 @@ |
||
| 239 | 239 | if(version_compare(PHP_VERSION, '5.2', '<')) { |
| 240 | 240 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
| 241 | 241 | } else { |
| 242 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
| 242 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, null, $secure, true); |
|
| 243 | 243 | } |
| 244 | 244 | } else { |
| 245 | 245 | $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
| 3 | - header('HTTP/1.0 404 Not Found'); |
|
| 4 | - exit('error'); |
|
| 3 | + header('HTTP/1.0 404 Not Found'); |
|
| 4 | + exit('error'); |
|
| 5 | 5 | } |
| 6 | 6 | define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
| 7 | 7 | define('MODX_API_MODE', true); |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | include_once("{$core_path}lang/english.inc.php"); |
| 17 | 17 | |
| 18 | 18 | if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
| 19 | - include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
| 19 | + include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // Initialize System Alert Message Queque |
| 23 | 23 | if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
| 24 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
| 24 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
| 25 | 25 | } |
| 26 | 26 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
| 27 | 27 | |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | // invoke OnBeforeManagerLogin event |
| 38 | 38 | $modx->invokeEvent('OnBeforeManagerLogin', array( |
| 39 | - 'username' => $username, |
|
| 40 | - 'userpassword' => $givenPassword, |
|
| 41 | - 'rememberme' => $rememberme |
|
| 42 | - )); |
|
| 39 | + 'username' => $username, |
|
| 40 | + 'userpassword' => $givenPassword, |
|
| 41 | + 'rememberme' => $rememberme |
|
| 42 | + )); |
|
| 43 | 43 | $fields = 'mu.*, ua.*'; |
| 44 | 44 | $from = $modx->getDatabase()->getFullTableName('manager_users') . ' AS mu, ' . |
| 45 | 45 | $modx->getDatabase()->getFullTableName('user_attributes') . ' AS ua'; |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | $limit = $modx->getDatabase()->getRecordCount($rs); |
| 49 | 49 | |
| 50 | 50 | if($limit == 0 || $limit > 1) { |
| 51 | - jsAlert($_lang['login_processor_unknown_user']); |
|
| 52 | - return; |
|
| 51 | + jsAlert($_lang['login_processor_unknown_user']); |
|
| 52 | + return; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $row = $modx->getDatabase()->getRow($rs); |
@@ -74,36 +74,36 @@ discard block |
||
| 74 | 74 | "user='{$internalKey}' AND setting_value!=''" |
| 75 | 75 | ); |
| 76 | 76 | while($row = $modx->getDatabase()->getRow($rs)) { |
| 77 | - extract($row); |
|
| 78 | - ${$setting_name} = $setting_value; |
|
| 77 | + extract($row); |
|
| 78 | + ${$setting_name} = $setting_value; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // blocked due to number of login errors. |
| 82 | 82 | if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
| 83 | - @session_destroy(); |
|
| 84 | - session_unset(); |
|
| 85 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
| 86 | - $ip = $cip; |
|
| 87 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
| 88 | - $ip = $cip; |
|
| 89 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
| 90 | - $ip = $cip; |
|
| 91 | - } else { |
|
| 92 | - $ip = "UNKNOWN"; |
|
| 93 | - } |
|
| 94 | - $log = new EvolutionCMS\Legacy\LogHandler(); |
|
| 95 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
| 96 | - jsAlert($_lang['login_processor_many_failed_logins']); |
|
| 97 | - return; |
|
| 83 | + @session_destroy(); |
|
| 84 | + session_unset(); |
|
| 85 | + if($cip = getenv("HTTP_CLIENT_IP")) { |
|
| 86 | + $ip = $cip; |
|
| 87 | + } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
| 88 | + $ip = $cip; |
|
| 89 | + } elseif($cip = getenv("REMOTE_ADDR")) { |
|
| 90 | + $ip = $cip; |
|
| 91 | + } else { |
|
| 92 | + $ip = "UNKNOWN"; |
|
| 93 | + } |
|
| 94 | + $log = new EvolutionCMS\Legacy\LogHandler(); |
|
| 95 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
| 96 | + jsAlert($_lang['login_processor_many_failed_logins']); |
|
| 97 | + return; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // blocked due to number of login errors, but get to try again |
| 101 | 101 | if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
| 102 | - $fields = array(); |
|
| 103 | - $fields['failedlogincount'] = '0'; |
|
| 104 | - $fields['blockeduntil'] = time() - 1; |
|
| 105 | - $modx->getDatabase()->update( |
|
| 106 | - $fields, |
|
| 102 | + $fields = array(); |
|
| 103 | + $fields['failedlogincount'] = '0'; |
|
| 104 | + $fields['blockeduntil'] = time() - 1; |
|
| 105 | + $modx->getDatabase()->update( |
|
| 106 | + $fields, |
|
| 107 | 107 | $modx->getDatabase()->getFullTableName('user_attributes'), |
| 108 | 108 | "internalKey='{$internalKey}'" |
| 109 | 109 | ); |
@@ -111,94 +111,94 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | // this user has been blocked by an admin, so no way he's loggin in! |
| 113 | 113 | if($blocked == '1') { |
| 114 | - @session_destroy(); |
|
| 115 | - session_unset(); |
|
| 116 | - jsAlert($_lang['login_processor_blocked1']); |
|
| 117 | - return; |
|
| 114 | + @session_destroy(); |
|
| 115 | + session_unset(); |
|
| 116 | + jsAlert($_lang['login_processor_blocked1']); |
|
| 117 | + return; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // blockuntil: this user has a block until date |
| 121 | 121 | if($blockeduntildate > time()) { |
| 122 | - @session_destroy(); |
|
| 123 | - session_unset(); |
|
| 124 | - jsAlert($_lang['login_processor_blocked2']); |
|
| 125 | - return; |
|
| 122 | + @session_destroy(); |
|
| 123 | + session_unset(); |
|
| 124 | + jsAlert($_lang['login_processor_blocked2']); |
|
| 125 | + return; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // blockafter: this user has a block after date |
| 129 | 129 | if($blockedafterdate > 0 && $blockedafterdate < time()) { |
| 130 | - @session_destroy(); |
|
| 131 | - session_unset(); |
|
| 132 | - jsAlert($_lang['login_processor_blocked3']); |
|
| 133 | - return; |
|
| 130 | + @session_destroy(); |
|
| 131 | + session_unset(); |
|
| 132 | + jsAlert($_lang['login_processor_blocked3']); |
|
| 133 | + return; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // allowed ip |
| 137 | 137 | if($allowed_ip) { |
| 138 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 139 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 140 | - jsAlert($_lang['login_processor_remotehost_ip']); |
|
| 141 | - return; |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 145 | - jsAlert($_lang['login_processor_remote_ip']); |
|
| 146 | - return; |
|
| 147 | - } |
|
| 138 | + if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 139 | + if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 140 | + jsAlert($_lang['login_processor_remotehost_ip']); |
|
| 141 | + return; |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 145 | + jsAlert($_lang['login_processor_remote_ip']); |
|
| 146 | + return; |
|
| 147 | + } |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // allowed days |
| 151 | 151 | if($allowed_days) { |
| 152 | - $date = getdate(); |
|
| 153 | - $day = $date['wday'] + 1; |
|
| 154 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
| 155 | - jsAlert($_lang['login_processor_date']); |
|
| 156 | - return; |
|
| 157 | - } |
|
| 152 | + $date = getdate(); |
|
| 153 | + $day = $date['wday'] + 1; |
|
| 154 | + if(!in_array($day,explode(',',$allowed_days))) { |
|
| 155 | + jsAlert($_lang['login_processor_date']); |
|
| 156 | + return; |
|
| 157 | + } |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // invoke OnManagerAuthentication event |
| 161 | 161 | $rt = $modx->invokeEvent('OnManagerAuthentication', array( |
| 162 | - 'userid' => $internalKey, |
|
| 163 | - 'username' => $username, |
|
| 164 | - 'userpassword' => $givenPassword, |
|
| 165 | - 'savedpassword' => $dbasePassword, |
|
| 166 | - 'rememberme' => $rememberme |
|
| 167 | - )); |
|
| 162 | + 'userid' => $internalKey, |
|
| 163 | + 'username' => $username, |
|
| 164 | + 'userpassword' => $givenPassword, |
|
| 165 | + 'savedpassword' => $dbasePassword, |
|
| 166 | + 'rememberme' => $rememberme |
|
| 167 | + )); |
|
| 168 | 168 | |
| 169 | 169 | // check if plugin authenticated the user |
| 170 | 170 | $matchPassword = false; |
| 171 | 171 | if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
| 172 | - // check user password - local authentication |
|
| 173 | - $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
|
| 174 | - if($hashType == 'phpass') { |
|
| 175 | - $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
| 176 | - } elseif($hashType == 'md5') { |
|
| 177 | - $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
| 178 | - } elseif($hashType == 'v1') { |
|
| 179 | - $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
| 180 | - } else { |
|
| 181 | - $matchPassword = false; |
|
| 182 | - } |
|
| 172 | + // check user password - local authentication |
|
| 173 | + $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
|
| 174 | + if($hashType == 'phpass') { |
|
| 175 | + $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
| 176 | + } elseif($hashType == 'md5') { |
|
| 177 | + $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
| 178 | + } elseif($hashType == 'v1') { |
|
| 179 | + $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
| 180 | + } else { |
|
| 181 | + $matchPassword = false; |
|
| 182 | + } |
|
| 183 | 183 | } else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
| 184 | - $matchPassword = true; |
|
| 184 | + $matchPassword = true; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if(!$matchPassword) { |
| 188 | - jsAlert($_lang['login_processor_wrong_password']); |
|
| 189 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
| 190 | - return; |
|
| 188 | + jsAlert($_lang['login_processor_wrong_password']); |
|
| 189 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
| 190 | + return; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if($modx->config['use_captcha'] == 1) { |
| 194 | - if(!isset ($_SESSION['veriword'])) { |
|
| 195 | - jsAlert($_lang['login_processor_captcha_config']); |
|
| 196 | - return; |
|
| 197 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
| 198 | - jsAlert($_lang['login_processor_bad_code']); |
|
| 199 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
| 200 | - return; |
|
| 201 | - } |
|
| 194 | + if(!isset ($_SESSION['veriword'])) { |
|
| 195 | + jsAlert($_lang['login_processor_captcha_config']); |
|
| 196 | + return; |
|
| 197 | + } elseif($_SESSION['veriword'] != $captcha_code) { |
|
| 198 | + jsAlert($_lang['login_processor_bad_code']); |
|
| 199 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
| 200 | + return; |
|
| 201 | + } |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $modx->cleanupExpiredLocks(); |
@@ -237,36 +237,36 @@ discard block |
||
| 237 | 237 | $_SESSION['mgrToken'] = md5($currentsessionid); |
| 238 | 238 | |
| 239 | 239 | if($rememberme == '1') { |
| 240 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
| 241 | - |
|
| 242 | - // Set a cookie separate from the session cookie with the username in it. |
|
| 243 | - // Are we using secure connection? If so, make sure the cookie is secure |
|
| 244 | - global $https_port; |
|
| 245 | - |
|
| 246 | - $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
| 247 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 248 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
| 249 | - } else { |
|
| 250 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
| 251 | - } |
|
| 240 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
| 241 | + |
|
| 242 | + // Set a cookie separate from the session cookie with the username in it. |
|
| 243 | + // Are we using secure connection? If so, make sure the cookie is secure |
|
| 244 | + global $https_port; |
|
| 245 | + |
|
| 246 | + $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
| 247 | + if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 248 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
| 249 | + } else { |
|
| 250 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
| 251 | + } |
|
| 252 | 252 | } else { |
| 253 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
| 253 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
| 254 | 254 | |
| 255 | - // Remove the Remember Me cookie |
|
| 256 | - setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
| 255 | + // Remove the Remember Me cookie |
|
| 256 | + setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // Check if user already has an active session, if not check if user pressed logout end of last session |
| 260 | 260 | $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
| 261 | 261 | $activeSession = $modx->getDatabase()->getValue($rs); |
| 262 | 262 | if(!$activeSession) { |
| 263 | - $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
| 264 | - if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
| 265 | - $_SESSION['show_logout_reminder'] = array( |
|
| 266 | - 'type' => 'logout_reminder', |
|
| 267 | - 'lastHit' => $lastHit |
|
| 268 | - ); |
|
| 269 | - } |
|
| 263 | + $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
| 264 | + if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
| 265 | + $_SESSION['show_logout_reminder'] = array( |
|
| 266 | + 'type' => 'logout_reminder', |
|
| 267 | + 'lastHit' => $lastHit |
|
| 268 | + ); |
|
| 269 | + } |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | $log = new EvolutionCMS\Legacy\LogHandler(); |
@@ -274,11 +274,11 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | // invoke OnManagerLogin event |
| 276 | 276 | $modx->invokeEvent('OnManagerLogin', array( |
| 277 | - 'userid' => $internalKey, |
|
| 278 | - 'username' => $username, |
|
| 279 | - 'userpassword' => $givenPassword, |
|
| 280 | - 'rememberme' => $rememberme |
|
| 281 | - )); |
|
| 277 | + 'userid' => $internalKey, |
|
| 278 | + 'username' => $username, |
|
| 279 | + 'userpassword' => $givenPassword, |
|
| 280 | + 'rememberme' => $rememberme |
|
| 281 | + )); |
|
| 282 | 282 | |
| 283 | 283 | // check if we should redirect user to a web page |
| 284 | 284 | $rs = $modx->getDatabase()->select( |
@@ -288,17 +288,17 @@ discard block |
||
| 288 | 288 | ); |
| 289 | 289 | $id = (int)$modx->getDatabase()->getValue($rs); |
| 290 | 290 | if($id > 0) { |
| 291 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
| 292 | - if($_POST['ajax'] == 1) { |
|
| 293 | - echo $header; |
|
| 294 | - } else { |
|
| 295 | - header($header); |
|
| 296 | - } |
|
| 291 | + $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
| 292 | + if($_POST['ajax'] == 1) { |
|
| 293 | + echo $header; |
|
| 294 | + } else { |
|
| 295 | + header($header); |
|
| 296 | + } |
|
| 297 | 297 | } else { |
| 298 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
| 299 | - if($_POST['ajax'] == 1) { |
|
| 300 | - echo $header; |
|
| 301 | - } else { |
|
| 302 | - header($header); |
|
| 303 | - } |
|
| 298 | + $header = 'Location: ' . MODX_MANAGER_URL; |
|
| 299 | + if($_POST['ajax'] == 1) { |
|
| 300 | + echo $header; |
|
| 301 | + } else { |
|
| 302 | + header($header); |
|
| 303 | + } |
|
| 304 | 304 | } |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 2 | +if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 3 | 3 | header('HTTP/1.0 404 Not Found'); |
| 4 | 4 | exit('error'); |
| 5 | 5 | } |
| 6 | -define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
| 6 | +define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
| 7 | 7 | define('MODX_API_MODE', true); |
| 8 | -include_once(__DIR__ . '/../../index.php'); |
|
| 8 | +include_once(__DIR__.'/../../index.php'); |
|
| 9 | 9 | $modx->getDatabase()->connect(); |
| 10 | 10 | $modx->getSettings(); |
| 11 | 11 | $modx->invokeEvent('OnManagerPageInit'); |
| 12 | 12 | |
| 13 | -$core_path = MODX_MANAGER_PATH . 'includes/'; |
|
| 13 | +$core_path = MODX_MANAGER_PATH.'includes/'; |
|
| 14 | 14 | // include_once the language file |
| 15 | 15 | $_lang = array(); |
| 16 | 16 | include_once("{$core_path}lang/english.inc.php"); |
| 17 | 17 | |
| 18 | -if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
| 18 | +if ($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
| 19 | 19 | include_once("{$core_path}lang/{$manager_language}.inc.php"); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // Initialize System Alert Message Queque |
| 23 | -if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
| 23 | +if (!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
| 24 | 24 | $_SESSION['SystemAlertMsgQueque'] = array(); |
| 25 | 25 | } |
| 26 | 26 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | 'rememberme' => $rememberme |
| 42 | 42 | )); |
| 43 | 43 | $fields = 'mu.*, ua.*'; |
| 44 | -$from = $modx->getDatabase()->getFullTableName('manager_users') . ' AS mu, ' . |
|
| 45 | - $modx->getDatabase()->getFullTableName('user_attributes') . ' AS ua'; |
|
| 44 | +$from = $modx->getDatabase()->getFullTableName('manager_users').' AS mu, '. |
|
| 45 | + $modx->getDatabase()->getFullTableName('user_attributes').' AS ua'; |
|
| 46 | 46 | $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id"; |
| 47 | 47 | $rs = $modx->getDatabase()->select($fields, $from, $where); |
| 48 | 48 | $limit = $modx->getDatabase()->getRecordCount($rs); |
| 49 | 49 | |
| 50 | -if($limit == 0 || $limit > 1) { |
|
| 50 | +if ($limit == 0 || $limit > 1) { |
|
| 51 | 51 | jsAlert($_lang['login_processor_unknown_user']); |
| 52 | 52 | return; |
| 53 | 53 | } |
@@ -73,32 +73,32 @@ discard block |
||
| 73 | 73 | $modx->getDatabase()->getFullTableName('user_settings'), |
| 74 | 74 | "user='{$internalKey}' AND setting_value!=''" |
| 75 | 75 | ); |
| 76 | -while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 76 | +while ($row = $modx->getDatabase()->getRow($rs)) { |
|
| 77 | 77 | extract($row); |
| 78 | 78 | ${$setting_name} = $setting_value; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // blocked due to number of login errors. |
| 82 | -if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
| 82 | +if ($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
| 83 | 83 | @session_destroy(); |
| 84 | 84 | session_unset(); |
| 85 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
| 85 | + if ($cip = getenv("HTTP_CLIENT_IP")) { |
|
| 86 | 86 | $ip = $cip; |
| 87 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
| 87 | + } elseif ($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
| 88 | 88 | $ip = $cip; |
| 89 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
| 89 | + } elseif ($cip = getenv("REMOTE_ADDR")) { |
|
| 90 | 90 | $ip = $cip; |
| 91 | 91 | } else { |
| 92 | 92 | $ip = "UNKNOWN"; |
| 93 | 93 | } |
| 94 | 94 | $log = new EvolutionCMS\Legacy\LogHandler(); |
| 95 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
| 95 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: ".$ip); |
|
| 96 | 96 | jsAlert($_lang['login_processor_many_failed_logins']); |
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // blocked due to number of login errors, but get to try again |
| 101 | -if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
| 101 | +if ($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
| 102 | 102 | $fields = array(); |
| 103 | 103 | $fields['failedlogincount'] = '0'; |
| 104 | 104 | $fields['blockeduntil'] = time() - 1; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | // this user has been blocked by an admin, so no way he's loggin in! |
| 113 | -if($blocked == '1') { |
|
| 113 | +if ($blocked == '1') { |
|
| 114 | 114 | @session_destroy(); |
| 115 | 115 | session_unset(); |
| 116 | 116 | jsAlert($_lang['login_processor_blocked1']); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // blockuntil: this user has a block until date |
| 121 | -if($blockeduntildate > time()) { |
|
| 121 | +if ($blockeduntildate > time()) { |
|
| 122 | 122 | @session_destroy(); |
| 123 | 123 | session_unset(); |
| 124 | 124 | jsAlert($_lang['login_processor_blocked2']); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // blockafter: this user has a block after date |
| 129 | -if($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
| 129 | +if ($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
| 130 | 130 | @session_destroy(); |
| 131 | 131 | session_unset(); |
| 132 | 132 | jsAlert($_lang['login_processor_blocked3']); |
@@ -134,24 +134,24 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // allowed ip |
| 137 | -if($allowed_ip) { |
|
| 138 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 139 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 137 | +if ($allowed_ip) { |
|
| 138 | + if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 139 | + if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 140 | 140 | jsAlert($_lang['login_processor_remotehost_ip']); |
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 144 | + if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 145 | 145 | jsAlert($_lang['login_processor_remote_ip']); |
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // allowed days |
| 151 | -if($allowed_days) { |
|
| 151 | +if ($allowed_days) { |
|
| 152 | 152 | $date = getdate(); |
| 153 | 153 | $day = $date['wday'] + 1; |
| 154 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
| 154 | + if (!in_array($day, explode(',', $allowed_days))) { |
|
| 155 | 155 | jsAlert($_lang['login_processor_date']); |
| 156 | 156 | return; |
| 157 | 157 | } |
@@ -168,33 +168,33 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // check if plugin authenticated the user |
| 170 | 170 | $matchPassword = false; |
| 171 | -if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
| 171 | +if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
| 172 | 172 | // check user password - local authentication |
| 173 | 173 | $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
| 174 | - if($hashType == 'phpass') { |
|
| 174 | + if ($hashType == 'phpass') { |
|
| 175 | 175 | $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
| 176 | - } elseif($hashType == 'md5') { |
|
| 176 | + } elseif ($hashType == 'md5') { |
|
| 177 | 177 | $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
| 178 | - } elseif($hashType == 'v1') { |
|
| 178 | + } elseif ($hashType == 'v1') { |
|
| 179 | 179 | $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
| 180 | 180 | } else { |
| 181 | 181 | $matchPassword = false; |
| 182 | 182 | } |
| 183 | -} else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
| 183 | +} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
| 184 | 184 | $matchPassword = true; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | -if(!$matchPassword) { |
|
| 187 | +if (!$matchPassword) { |
|
| 188 | 188 | jsAlert($_lang['login_processor_wrong_password']); |
| 189 | 189 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
| 190 | 190 | return; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | -if($modx->config['use_captcha'] == 1) { |
|
| 194 | - if(!isset ($_SESSION['veriword'])) { |
|
| 193 | +if ($modx->config['use_captcha'] == 1) { |
|
| 194 | + if (!isset ($_SESSION['veriword'])) { |
|
| 195 | 195 | jsAlert($_lang['login_processor_captcha_config']); |
| 196 | 196 | return; |
| 197 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
| 197 | + } elseif ($_SESSION['veriword'] != $captcha_code) { |
|
| 198 | 198 | jsAlert($_lang['login_processor_bad_code']); |
| 199 | 199 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
| 200 | 200 | return; |
@@ -223,28 +223,28 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | // successful login so reset fail count and update key values |
| 225 | 225 | $modx->getDatabase()->update( |
| 226 | - 'failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'", |
|
| 226 | + 'failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'", |
|
| 227 | 227 | $modx->getDatabase()->getFullTableName('user_attributes'), |
| 228 | 228 | "internalKey='{$internalKey}'" |
| 229 | 229 | ); |
| 230 | 230 | |
| 231 | 231 | // get user's document groups |
| 232 | 232 | $i = 0; |
| 233 | -$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getDatabase()->getFullTableName('member_groups') . ' ug |
|
| 234 | - INNER JOIN ' . $modx->getDatabase()->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
| 233 | +$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getDatabase()->getFullTableName('member_groups').' ug |
|
| 234 | + INNER JOIN ' . $modx->getDatabase()->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
| 235 | 235 | $_SESSION['mgrDocgroups'] = $modx->getDatabase()->getColumn('documentgroup', $rs); |
| 236 | 236 | |
| 237 | 237 | $_SESSION['mgrToken'] = md5($currentsessionid); |
| 238 | 238 | |
| 239 | -if($rememberme == '1') { |
|
| 240 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
| 239 | +if ($rememberme == '1') { |
|
| 240 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int) $modx->config['session.cookie.lifetime']; |
|
| 241 | 241 | |
| 242 | 242 | // Set a cookie separate from the session cookie with the username in it. |
| 243 | 243 | // Are we using secure connection? If so, make sure the cookie is secure |
| 244 | 244 | global $https_port; |
| 245 | 245 | |
| 246 | 246 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
| 247 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 247 | + if (version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 248 | 248 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
| 249 | 249 | } else { |
| 250 | 250 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | // Check if user already has an active session, if not check if user pressed logout end of last session |
| 260 | 260 | $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
| 261 | 261 | $activeSession = $modx->getDatabase()->getValue($rs); |
| 262 | -if(!$activeSession) { |
|
| 262 | +if (!$activeSession) { |
|
| 263 | 263 | $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
| 264 | - if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
| 264 | + if ($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
| 265 | 265 | $_SESSION['show_logout_reminder'] = array( |
| 266 | 266 | 'type' => 'logout_reminder', |
| 267 | 267 | 'lastHit' => $lastHit |
@@ -286,17 +286,17 @@ discard block |
||
| 286 | 286 | $modx->getDatabase()->getFullTableName('user_settings'), |
| 287 | 287 | "user='{$internalKey}' AND setting_name='manager_login_startup'" |
| 288 | 288 | ); |
| 289 | -$id = (int)$modx->getDatabase()->getValue($rs); |
|
| 290 | -if($id > 0) { |
|
| 291 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
| 292 | - if($_POST['ajax'] == 1) { |
|
| 289 | +$id = (int) $modx->getDatabase()->getValue($rs); |
|
| 290 | +if ($id > 0) { |
|
| 291 | + $header = 'Location: '.$modx->makeUrl($id, '', '', 'full'); |
|
| 292 | + if ($_POST['ajax'] == 1) { |
|
| 293 | 293 | echo $header; |
| 294 | 294 | } else { |
| 295 | 295 | header($header); |
| 296 | 296 | } |
| 297 | 297 | } else { |
| 298 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
| 299 | - if($_POST['ajax'] == 1) { |
|
| 298 | + $header = 'Location: '.MODX_MANAGER_URL; |
|
| 299 | + if ($_POST['ajax'] == 1) { |
|
| 300 | 300 | echo $header; |
| 301 | 301 | } else { |
| 302 | 302 | header($header); |
@@ -236,9 +236,9 @@ |
||
| 236 | 236 | lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . "\n" ?> |
| 237 | 237 | }; |
| 238 | 238 | <?php |
| 239 | - $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray'])));
|
|
| 240 | - echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n";
|
|
| 241 | - ?> |
|
| 239 | + $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray'])));
|
|
| 240 | + echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n";
|
|
| 241 | + ?> |
|
| 242 | 242 | </script> |
| 243 | 243 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/modx.min.js?v=<?= $lastInstallTime ?>"></script> |
| 244 | 244 | <?php if ($modx->config['show_picker'] != "0") { ?>
|
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | header("X-XSS-Protection: 0");
|
@@ -11,22 +11,22 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; |
| 13 | 13 | |
| 14 | -if (!isset($modx->config['manager_menu_height'])) {
|
|
| 14 | +if (!isset($modx->config['manager_menu_height'])) { |
|
| 15 | 15 | $modx->config['manager_menu_height'] = 2.2; // rem |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if (!isset($modx->config['manager_tree_width'])) {
|
|
| 18 | +if (!isset($modx->config['manager_tree_width'])) { |
|
| 19 | 19 | $modx->config['manager_tree_width'] = 20; // rem |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) {
|
|
| 22 | +if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) { |
|
| 23 | 23 | $initMainframeAction = $_SESSION['onLoginForwardToAction']; |
| 24 | 24 | unset($_SESSION['onLoginForwardToAction']); |
| 25 | -} else {
|
|
| 25 | +} else { |
|
| 26 | 26 | $initMainframeAction = 2; // welcome.static |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -if (!isset($_SESSION['tree_show_only_folders'])) {
|
|
| 29 | +if (!isset($_SESSION['tree_show_only_folders'])) { |
|
| 30 | 30 | $_SESSION['tree_show_only_folders'] = 0; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -35,29 +35,29 @@ discard block |
||
| 35 | 35 | $tree_width = $modx->config['manager_tree_width']; |
| 36 | 36 | $tree_min_width = 0; |
| 37 | 37 | |
| 38 | -if (isset($_COOKIE['MODX_widthSideBar'])) {
|
|
| 38 | +if (isset($_COOKIE['MODX_widthSideBar'])) { |
|
| 39 | 39 | $MODX_widthSideBar = $_COOKIE['MODX_widthSideBar']; |
| 40 | -} else {
|
|
| 40 | +} else { |
|
| 41 | 41 | $MODX_widthSideBar = $tree_width; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -if (!$MODX_widthSideBar) {
|
|
| 44 | +if (!$MODX_widthSideBar) { |
|
| 45 | 45 | $body_class .= 'sidebar-closed'; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
|
| 49 | -if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
|
|
| 49 | +if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
|
| 50 | 50 | $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
| 51 | -} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
|
|
| 51 | +} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
|
| 52 | 52 | $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $navbar_position = $modx->config['manager_menu_position']; |
| 56 | -if ($navbar_position == 'left') {
|
|
| 56 | +if ($navbar_position == 'left') { |
|
| 57 | 57 | $body_class .= ' navbar-left navbar-left-icon-and-text'; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -if (isset($modx->pluginCache['ElementsInTree'])) {
|
|
| 60 | +if (isset($modx->pluginCache['ElementsInTree'])) { |
|
| 61 | 61 | $body_class .= ' ElementsInTree'; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -73,19 +73,19 @@ discard block |
||
| 73 | 73 | 'type8' => $_lang["lock_element_type_8"] |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | -foreach ($unlockTranslations as $key => $value) {
|
|
| 76 | +foreach ($unlockTranslations as $key => $value) { |
|
| 77 | 77 | $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $user = $modx->getUserInfo($modx->getLoginUserID()); |
| 81 | -if ($user['which_browser'] == 'default') {
|
|
| 81 | +if ($user['which_browser'] == 'default') { |
|
| 82 | 82 | $user['which_browser'] = $modx->config['which_browser']; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
| 86 | 86 | |
| 87 | -if ($modx->config['manager_theme'] == 'default') {
|
|
| 88 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
|
|
| 87 | +if ($modx->config['manager_theme'] == 'default') { |
|
| 88 | + if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
| 89 | 89 | require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
| 90 | 90 | $minifier = new Formatter\CSSMinify(); |
| 91 | 91 | $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $css = $minifier->minify(); |
| 103 | 103 | file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
| 104 | 104 | } |
| 105 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
|
|
| 105 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
| 106 | 106 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | <?php |
| 258 | 258 | // invoke OnManagerTopPrerender event |
| 259 | 259 | $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST);
|
| 260 | - if (is_array($evtOut)) {
|
|
| 260 | + if (is_array($evtOut)) { |
|
| 261 | 261 | echo implode("\n", $evtOut);
|
| 262 | 262 | } |
| 263 | 263 | ?> |
@@ -428,11 +428,14 @@ discard block |
||
| 428 | 428 | <div id="evo-tab-page-home" class="evo-tab-page show iframe-scroller"> |
| 429 | 429 | <iframe id="mainframe" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
| 430 | 430 | </div> |
| 431 | - <?php else: ?> |
|
| 431 | + <?php else { |
|
| 432 | + : ?> |
|
| 432 | 433 | <div class="iframe-scroller"> |
| 433 | 434 | <iframe id="mainframe" name="main" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
| 434 | 435 | </div> |
| 435 | - <?php endif; ?> |
|
| 436 | + <?php endif; |
|
| 437 | +} |
|
| 438 | +?> |
|
| 436 | 439 | <script> |
| 437 | 440 | if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
| 438 | 441 | document.getElementById('mainframe').setAttribute('scrolling', 'no');
|
@@ -451,11 +454,11 @@ discard block |
||
| 451 | 454 | 'tree_sortdir', |
| 452 | 455 | 'tree_nodename' |
| 453 | 456 | ); |
| 454 | - foreach ($sortParams as $param) {
|
|
| 455 | - if (isset($_REQUEST[$param])) {
|
|
| 457 | + foreach ($sortParams as $param) { |
|
| 458 | + if (isset($_REQUEST[$param])) { |
|
| 456 | 459 | $modx->getManagerApi()->saveLastUserSetting($param, $_REQUEST[$param]); |
| 457 | 460 | $_SESSION[$param] = $_REQUEST[$param]; |
| 458 | - } else if (!isset($_SESSION[$param])) {
|
|
| 461 | + } else if (!isset($_SESSION[$param])) { |
|
| 459 | 462 | $_SESSION[$param] = $modx->getManagerApi()->getLastUserSetting($param); |
| 460 | 463 | } |
| 461 | 464 | } |
@@ -506,16 +509,16 @@ discard block |
||
| 506 | 509 | </div> |
| 507 | 510 | |
| 508 | 511 | <?php |
| 509 | - if(!function_exists('constructLink')) {
|
|
| 512 | + if(!function_exists('constructLink')) { |
|
| 510 | 513 | /** |
| 511 | 514 | * @param string $action |
| 512 | 515 | * @param string $img |
| 513 | 516 | * @param string $text |
| 514 | 517 | * @param bool $allowed |
| 515 | 518 | */ |
| 516 | - function constructLink($action, $img, $text, $allowed) |
|
| 517 | - {
|
|
| 518 | - if ((bool)$allowed) {
|
|
| 519 | + function constructLink($action, $img, $text, $allowed) |
|
| 520 | + { |
|
| 521 | + if ((bool)$allowed) { |
|
| 519 | 522 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action,
|
| 520 | 523 | $action); |
| 521 | 524 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
|
@@ -650,7 +653,7 @@ discard block |
||
| 650 | 653 | ?> |
| 651 | 654 | |
| 652 | 655 | </div> |
| 653 | -<?php if ($modx->config['show_picker'] != "0") {
|
|
| 656 | +<?php if ($modx->config['show_picker'] != "0") { |
|
| 654 | 657 | include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
|
| 655 | 658 | } ?> |
| 656 | 659 | </body> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | header("X-XSS-Protection: 0");
|
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
|
| 49 | 49 | if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
|
| 50 | - $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
|
| 50 | + $body_class .= ' '.$theme_modes[$_COOKIE['MODX_themeMode']]; |
|
| 51 | 51 | } elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
|
| 52 | - $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
|
| 52 | + $body_class .= ' '.$theme_modes[$modx->config['manager_theme_mode']]; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $navbar_position = $modx->config['manager_menu_position']; |
@@ -82,36 +82,36 @@ discard block |
||
| 82 | 82 | $user['which_browser'] = $modx->config['which_browser']; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
|
| 85 | +$css = 'media/style/'.$modx->config['manager_theme'].'/css/page.css?v='.$lastInstallTime; |
|
| 86 | 86 | |
| 87 | 87 | if ($modx->config['manager_theme'] == 'default') {
|
| 88 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
|
|
| 89 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
| 88 | + if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) {
|
|
| 89 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
| 90 | 90 | $minifier = new Formatter\CSSMinify(); |
| 91 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
| 92 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
| 93 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css'); |
|
| 94 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css'); |
|
| 95 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css'); |
|
| 96 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css'); |
|
| 97 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css'); |
|
| 98 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css'); |
|
| 99 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css'); |
|
| 100 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css'); |
|
| 101 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'); |
|
| 91 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
| 92 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
| 93 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css'); |
|
| 94 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css'); |
|
| 95 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css'); |
|
| 96 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css'); |
|
| 97 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css'); |
|
| 98 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css'); |
|
| 99 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css'); |
|
| 100 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css'); |
|
| 101 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'); |
|
| 102 | 102 | $css = $minifier->minify(); |
| 103 | - file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
|
| 103 | + file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css); |
|
| 104 | 104 | } |
| 105 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
|
|
| 106 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
| 105 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
|
|
| 106 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | -$modx->config['global_tabs'] = (int)($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin')));
|
|
| 110 | +$modx->config['global_tabs'] = (int) ($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin')));
|
|
| 111 | 111 | |
| 112 | 112 | ?> |
| 113 | 113 | <!DOCTYPE html> |
| 114 | -<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="') . $mxla . '" xml:lang="' . $mxla . '"' ?>> |
|
| 114 | +<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="').$mxla.'" xml:lang="'.$mxla.'"' ?>> |
|
| 115 | 115 | <head> |
| 116 | 116 | <title><?= $modx->getPhpCompat()->entities($site_name) ?>- (EVO CMS Manager)</title> |
| 117 | 117 | <meta http-equiv="Content-Type" content="text/html; charset=<?= $modx_manager_charset ?>" /> |
@@ -142,21 +142,21 @@ discard block |
||
| 142 | 142 | MODX_SITE_URL: '<?= MODX_SITE_URL ?>', |
| 143 | 143 | MODX_MANAGER_URL: '<?= MODX_MANAGER_URL ?>', |
| 144 | 144 | user: {
|
| 145 | - role: <?= (int)$user['role'] ?>, |
|
| 145 | + role: <?= (int) $user['role'] ?>, |
|
| 146 | 146 | username: '<?= $user['username'] ?>' |
| 147 | 147 | }, |
| 148 | 148 | config: {
|
| 149 | 149 | mail_check_timeperiod: <?= $modx->config['mail_check_timeperiod'] ?>, |
| 150 | - menu_height: <?= (int)$menu_height ?>, |
|
| 151 | - tree_width: <?= (int)$tree_width ?>, |
|
| 152 | - tree_min_width: <?= (int)$tree_min_width ?>, |
|
| 153 | - session_timeout: <?= (int)$modx->config['session_timeout'] ?>, |
|
| 154 | - site_start: <?= (int)$modx->config['site_start'] ?>, |
|
| 155 | - tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int)$modx->config['tree_page_click'] : 27) ?>, |
|
| 150 | + menu_height: <?= (int) $menu_height ?>, |
|
| 151 | + tree_width: <?= (int) $tree_width ?>, |
|
| 152 | + tree_min_width: <?= (int) $tree_min_width ?>, |
|
| 153 | + session_timeout: <?= (int) $modx->config['session_timeout'] ?>, |
|
| 154 | + site_start: <?= (int) $modx->config['site_start'] ?>, |
|
| 155 | + tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int) $modx->config['tree_page_click'] : 27) ?>, |
|
| 156 | 156 | theme: '<?= $modx->config['manager_theme'] ?>', |
| 157 | 157 | theme_mode: '<?= $modx->config['manager_theme_mode'] ?>', |
| 158 | 158 | which_browser: '<?= $user['which_browser'] ?>', |
| 159 | - layout: <?= (int)$manager_layout ?>, |
|
| 159 | + layout: <?= (int) $manager_layout ?>, |
|
| 160 | 160 | textdir: '<?= $modx_textdir ?>', |
| 161 | 161 | global_tabs: <?= $modx->config['global_tabs'] ?> |
| 162 | 162 | |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | delete a[b]; |
| 242 | 242 | }, |
| 243 | 243 | openedArray: [], |
| 244 | - lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . "\n" ?> |
|
| 244 | + lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)."\n" ?> |
|
| 245 | 245 | }; |
| 246 | 246 | <?php |
| 247 | 247 | $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray'])));
|
| 248 | - echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n";
|
|
| 248 | + echo (empty($opened) ? '' : 'modx.openedArray['.implode("] = 1;\n modx.openedArray[", $opened).'] = 1;')."\n";
|
|
| 249 | 249 | ?> |
| 250 | 250 | </script> |
| 251 | 251 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/modx.min.js?v=<?= $lastInstallTime ?>"></script> |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | <a href="javascript:;" class="dropdown-toggle" onclick="return false;"> |
| 328 | 328 | <span class="username"><?= $user['username'] ?></span> |
| 329 | 329 | <?php if ($user['photo']) { ?>
|
| 330 | - <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL . $user['photo'] ?>);"></span> |
|
| 330 | + <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL.$user['photo'] ?>);"></span> |
|
| 331 | 331 | <?php } else { ?>
|
| 332 | 332 | <span class="icon"><?= $_style['menu_user'] ?></span> |
| 333 | 333 | <?php } ?> |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $version = 'Evolution'; |
| 355 | 355 | ?> |
| 356 | 356 | <?php |
| 357 | - echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>' . $version . ' %s</span></li>', $modx->getPhpCompat()->entities($site_name), $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']);
|
|
| 357 | + echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>'.$version.' %s</span></li>', $modx->getPhpCompat()->entities($site_name), $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']);
|
|
| 358 | 358 | ?> |
| 359 | 359 | </ul> |
| 360 | 360 | </li> |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | </div> |
| 507 | 507 | |
| 508 | 508 | <?php |
| 509 | - if(!function_exists('constructLink')) {
|
|
| 509 | + if (!function_exists('constructLink')) {
|
|
| 510 | 510 | /** |
| 511 | 511 | * @param string $action |
| 512 | 512 | * @param string $img |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | */ |
| 516 | 516 | function constructLink($action, $img, $text, $allowed) |
| 517 | 517 | {
|
| 518 | - if ((bool)$allowed) {
|
|
| 518 | + if ((bool) $allowed) {
|
|
| 519 | 519 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action,
|
| 520 | 520 | $action); |
| 521 | 521 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
|
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | <script type="text/javascript"> |
| 557 | 557 | |
| 558 | 558 | if (document.getElementById('treeMenu')) {
|
| 559 | - <?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?>
|
|
| 559 | + <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?>
|
|
| 560 | 560 | |
| 561 | 561 | document.getElementById('treeMenu_openelements').onclick = function(e) {
|
| 562 | 562 | e.preventDefault(); |
@@ -574,12 +574,12 @@ discard block |
||
| 574 | 574 | } |
| 575 | 575 | }; |
| 576 | 576 | <?php } ?> |
| 577 | - <?php if($use_browser && $modx->hasPermission('assets_images')) { ?>
|
|
| 577 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { ?>
|
|
| 578 | 578 | |
| 579 | 579 | document.getElementById('treeMenu_openimages').onclick = function(e) {
|
| 580 | 580 | e.preventDefault(); |
| 581 | 581 | if (modx.config.global_tabs && !e.shiftKey) {
|
| 582 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'});
|
|
| 582 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'});
|
|
| 583 | 583 | } else {
|
| 584 | 584 | var randomNum = '<?= $_lang["files_files"] ?>'; |
| 585 | 585 | if (e.shiftKey) {
|
@@ -592,12 +592,12 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | }; |
| 594 | 594 | <?php } ?> |
| 595 | - <?php if($use_browser && $modx->hasPermission('assets_files')) { ?>
|
|
| 595 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { ?>
|
|
| 596 | 596 | |
| 597 | 597 | document.getElementById('treeMenu_openfiles').onclick = function(e) {
|
| 598 | 598 | e.preventDefault(); |
| 599 | 599 | if (modx.config.global_tabs && !e.shiftKey) {
|
| 600 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'});
|
|
| 600 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'});
|
|
| 601 | 601 | } else {
|
| 602 | 602 | var randomNum = '<?= $_lang["files_files"] ?>'; |
| 603 | 603 | if (e.shiftKey) {
|
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | |
| 652 | 652 | </div> |
| 653 | 653 | <?php if ($modx->config['show_picker'] != "0") {
|
| 654 | - include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
|
|
| 654 | + include('media/style/'.$modx->config['manager_theme'].'/color.switcher.php');
|
|
| 655 | 655 | } ?> |
| 656 | 656 | </body> |
| 657 | 657 | </html> |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** This file is part of KCFinder project |
| 4 | - * |
|
| 5 | - * @desc Image detection class |
|
| 6 | - * @package KCFinder |
|
| 7 | - * @version 2.54 |
|
| 8 | - * @author Pavel Tzonkov <[email protected]> |
|
| 9 | - * @copyright 2010-2014 KCFinder Project |
|
| 10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | - * @link http://kcfinder.sunhater.com |
|
| 13 | - */ |
|
| 4 | + * |
|
| 5 | + * @desc Image detection class |
|
| 6 | + * @package KCFinder |
|
| 7 | + * @version 2.54 |
|
| 8 | + * @author Pavel Tzonkov <[email protected]> |
|
| 9 | + * @copyright 2010-2014 KCFinder Project |
|
| 10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | + * @link http://kcfinder.sunhater.com |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class type_img { |
| 16 | 16 | |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class type_img { |
|
| 15 | +class type_img{ |
|
| 16 | 16 | |
| 17 | - public function checkFile($file, array $config) { |
|
| 17 | + public function checkFile($file, array $config){ |
|
| 18 | 18 | |
| 19 | 19 | $driver = isset($config['imageDriversPriority']) |
| 20 | 20 | ? image::getDriver(explode(" ", $config['imageDriversPriority'])) : "gd"; |
@@ -12,17 +12,20 @@ |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class type_img { |
|
| 15 | +class type_img |
|
| 16 | +{ |
|
| 16 | 17 | |
| 17 | - public function checkFile($file, array $config) { |
|
| 18 | + public function checkFile($file, array $config) |
|
| 19 | + { |
|
| 18 | 20 | |
| 19 | 21 | $driver = isset($config['imageDriversPriority']) |
| 20 | 22 | ? image::getDriver(explode(" ", $config['imageDriversPriority'])) : "gd"; |
| 21 | 23 | |
| 22 | 24 | $img = image::factory($driver, $file); |
| 23 | 25 | |
| 24 | - if ($img->initError) |
|
| 25 | - return "Unknown image format/encoding."; |
|
| 26 | + if ($img->initError) { |
|
| 27 | + return "Unknown image format/encoding."; |
|
| 28 | + } |
|
| 26 | 29 | |
| 27 | 30 | return true; |
| 28 | 31 | } |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** This file is part of KCFinder project |
| 4 | - * |
|
| 5 | - * @desc MIME type detection class |
|
| 6 | - * @package KCFinder |
|
| 7 | - * @version 2.54 |
|
| 8 | - * @author Pavel Tzonkov <[email protected]> |
|
| 9 | - * @copyright 2010-2014 KCFinder Project |
|
| 10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | - * @link http://kcfinder.sunhater.com |
|
| 13 | - */ |
|
| 4 | + * |
|
| 5 | + * @desc MIME type detection class |
|
| 6 | + * @package KCFinder |
|
| 7 | + * @version 2.54 |
|
| 8 | + * @author Pavel Tzonkov <[email protected]> |
|
| 9 | + * @copyright 2010-2014 KCFinder Project |
|
| 10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | + * @link http://kcfinder.sunhater.com |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class type_mime { |
| 16 | 16 | |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class type_mime { |
|
| 15 | +class type_mime{ |
|
| 16 | 16 | |
| 17 | - public function checkFile($file, array $config) { |
|
| 17 | + public function checkFile($file, array $config){ |
|
| 18 | 18 | if (!class_exists("finfo")) |
| 19 | 19 | return "Fileinfo PECL extension is missing."; |
| 20 | 20 | |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | $mimes = $config['params']; |
| 34 | 34 | if (substr($mimes, 0, 1) == "!") { |
| 35 | 35 | $mimes = trim(substr($mimes, 1)); |
| 36 | - return in_array($type , explode(" ", $mimes)) |
|
| 36 | + return in_array($type, explode(" ", $mimes)) |
|
| 37 | 37 | ? "You can't upload such files." |
| 38 | 38 | : true; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - return !in_array($type , explode(" ", $mimes)) |
|
| 41 | + return !in_array($type, explode(" ", $mimes)) |
|
| 42 | 42 | ? "You can't upload such files." |
| 43 | 43 | : true; |
| 44 | 44 | } |
@@ -12,20 +12,25 @@ |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class type_mime { |
|
| 15 | +class type_mime |
|
| 16 | +{ |
|
| 16 | 17 | |
| 17 | - public function checkFile($file, array $config) { |
|
| 18 | - if (!class_exists("finfo")) |
|
| 19 | - return "Fileinfo PECL extension is missing."; |
|
| 18 | + public function checkFile($file, array $config) |
|
| 19 | + { |
|
| 20 | + if (!class_exists("finfo")) { |
|
| 21 | + return "Fileinfo PECL extension is missing."; |
|
| 22 | + } |
|
| 20 | 23 | |
| 21 | - if (!isset($config['params'])) |
|
| 22 | - return "Undefined MIME types."; |
|
| 24 | + if (!isset($config['params'])) { |
|
| 25 | + return "Undefined MIME types."; |
|
| 26 | + } |
|
| 23 | 27 | |
| 24 | 28 | $finfo = strlen($config['mime_magic']) |
| 25 | 29 | ? new finfo(FILEINFO_MIME, $config['mime_magic']) |
| 26 | 30 | : new finfo(FILEINFO_MIME); |
| 27 | - if (!$finfo) |
|
| 28 | - return "Opening fileinfo database failed."; |
|
| 31 | + if (!$finfo) { |
|
| 32 | + return "Opening fileinfo database failed."; |
|
| 33 | + } |
|
| 29 | 34 | |
| 30 | 35 | $type = $finfo->file($file); |
| 31 | 36 | $type = substr($type, 0, strrpos($type, ";")); |
@@ -1,24 +1,24 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** This file is part of KCFinder project |
| 4 | - * |
|
| 5 | - * @desc This file is included first, before each other |
|
| 6 | - * @package KCFinder |
|
| 7 | - * @version 2.54 |
|
| 8 | - * @author Pavel Tzonkov <[email protected]> |
|
| 9 | - * @copyright 2010-2014 KCFinder Project |
|
| 10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | - * @link http://kcfinder.sunhater.com |
|
| 13 | - * |
|
| 14 | - * This file is the place you can put any code (at the end of the file), |
|
| 15 | - * which will be executed before any other. Suitable for: |
|
| 16 | - * 1. Set PHP ini settings using ini_set() |
|
| 17 | - * 2. Custom session save handler with session_set_save_handler() |
|
| 18 | - * 3. Any custom integration code. If you use any global variables |
|
| 19 | - * here, they can be accessed in config.php via $GLOBALS array. |
|
| 20 | - * It's recommended to use constants instead. |
|
| 21 | - */ |
|
| 4 | + * |
|
| 5 | + * @desc This file is included first, before each other |
|
| 6 | + * @package KCFinder |
|
| 7 | + * @version 2.54 |
|
| 8 | + * @author Pavel Tzonkov <[email protected]> |
|
| 9 | + * @copyright 2010-2014 KCFinder Project |
|
| 10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | + * @link http://kcfinder.sunhater.com |
|
| 13 | + * |
|
| 14 | + * This file is the place you can put any code (at the end of the file), |
|
| 15 | + * which will be executed before any other. Suitable for: |
|
| 16 | + * 1. Set PHP ini settings using ini_set() |
|
| 17 | + * 2. Custom session save handler with session_set_save_handler() |
|
| 18 | + * 3. Any custom integration code. If you use any global variables |
|
| 19 | + * here, they can be accessed in config.php via $GLOBALS array. |
|
| 20 | + * It's recommended to use constants instead. |
|
| 21 | + */ |
|
| 22 | 22 | include_once(dirname(__FILE__)."/../../../../../assets/cache/siteManager.php"); |
| 23 | 23 | require_once('../../../includes/protect.inc.php'); |
| 24 | 24 | include_once('../../../includes/config.inc.php'); |
@@ -41,17 +41,20 @@ discard block |
||
| 41 | 41 | $_GET['langCode'] = $modx_lang_attribute; |
| 42 | 42 | |
| 43 | 43 | // PHP VERSION CHECK |
| 44 | -if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5) |
|
| 44 | +if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5) { |
|
| 45 | 45 | die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
| 46 | +} |
|
| 46 | 47 | |
| 47 | 48 | |
| 48 | 49 | // SAFE MODE CHECK |
| 49 | -if (ini_get("safe_mode")) |
|
| 50 | +if (ini_get("safe_mode")) { |
|
| 50 | 51 | die("The \"safe_mode\" PHP ini setting is turned on! You cannot run KCFinder in safe mode."); |
| 52 | +} |
|
| 51 | 53 | |
| 52 | 54 | |
| 53 | 55 | // MAGIC AUTOLOAD CLASSES FUNCTION |
| 54 | -function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { |
|
| 56 | +function autoloadda9d06472ccb71b84928677ce2a6ca89($class) |
|
| 57 | +{ |
|
| 55 | 58 | static $classes = null; |
| 56 | 59 | if ($classes === null) { |
| 57 | 60 | $classes = array( |
@@ -84,7 +87,8 @@ discard block |
||
| 84 | 87 | // json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING |
| 85 | 88 | if (!function_exists("json_encode")) { |
| 86 | 89 | |
| 87 | - function kcfinder_json_string_encode($string) { |
|
| 90 | + function kcfinder_json_string_encode($string) |
|
| 91 | + { |
|
| 88 | 92 | return '"' . |
| 89 | 93 | str_replace('/', "\\/", |
| 90 | 94 | str_replace("\t", "\\t", |
@@ -95,37 +99,43 @@ discard block |
||
| 95 | 99 | $string)))))) . '"'; |
| 96 | 100 | } |
| 97 | 101 | |
| 98 | - function json_encode($data) { |
|
| 102 | + function json_encode($data) |
|
| 103 | + { |
|
| 99 | 104 | |
| 100 | 105 | if (is_array($data)) { |
| 101 | 106 | $ret = array(); |
| 102 | 107 | |
| 103 | 108 | // OBJECT |
| 104 | 109 | if (array_keys($data) !== range(0, count($data) - 1)) { |
| 105 | - foreach ($data as $key => $val) |
|
| 106 | - $ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val); |
|
| 110 | + foreach ($data as $key => $val) { |
|
| 111 | + $ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val); |
|
| 112 | + } |
|
| 107 | 113 | return "{" . implode(",", $ret) . "}"; |
| 108 | 114 | |
| 109 | 115 | // ARRAY |
| 110 | 116 | } else { |
| 111 | - foreach ($data as $val) |
|
| 112 | - $ret[] = json_encode($val); |
|
| 117 | + foreach ($data as $val) { |
|
| 118 | + $ret[] = json_encode($val); |
|
| 119 | + } |
|
| 113 | 120 | return "[" . implode(",", $ret) . "]"; |
| 114 | 121 | } |
| 115 | 122 | |
| 116 | 123 | // BOOLEAN OR NULL |
| 117 | - } elseif (is_bool($data) || ($data === null)) |
|
| 118 | - return ($data === null) |
|
| 124 | + } elseif (is_bool($data) || ($data === null)) { |
|
| 125 | + return ($data === null) |
|
| 119 | 126 | ? "null" |
| 120 | 127 | : ($data ? "true" : "false"); |
| 128 | + } |
|
| 121 | 129 | |
| 122 | 130 | // FLOAT |
| 123 | - elseif (is_float($data)) |
|
| 124 | - return rtrim(rtrim(number_format($data, 14, ".", ""), "0"), "."); |
|
| 131 | + elseif (is_float($data)) { |
|
| 132 | + return rtrim(rtrim(number_format($data, 14, ".", ""), "0"), "."); |
|
| 133 | + } |
|
| 125 | 134 | |
| 126 | 135 | // INTEGER |
| 127 | - elseif (is_int($data)) |
|
| 128 | - return $data; |
|
| 136 | + elseif (is_int($data)) { |
|
| 137 | + return $data; |
|
| 138 | + } |
|
| 129 | 139 | |
| 130 | 140 | // STRING |
| 131 | 141 | return kcfinder_json_string_encode($data); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $modx = evolutionCMS(); |
| 27 | 27 | $modx->getDatabase()->connect(); |
| 28 | 28 | startCMSSession(); |
| 29 | -if(!isset($_SESSION['mgrValidated'])) { |
|
| 29 | +if (!isset($_SESSION['mgrValidated'])) { |
|
| 30 | 30 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 31 | 31 | } |
| 32 | 32 | define('IN_MANAGER_MODE', true); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $manager_language = $modx->config['manager_language']; |
| 36 | 36 | // Pass language code from MODX to KCFinder |
| 37 | -if(!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
| 37 | +if (!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
| 38 | 38 | $manager_language = "english"; // if not set, get the english language file. |
| 39 | 39 | } |
| 40 | 40 | include_once "../../../includes/lang/".$manager_language.".inc.php"; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | // PHP VERSION CHECK |
| 44 | 44 | if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5) |
| 45 | - die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
|
| 45 | + die("You are using PHP ".PHP_VERSION." when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | // SAFE MODE CHECK |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | // MAGIC AUTOLOAD CLASSES FUNCTION |
| 54 | -function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { |
|
| 54 | +function autoloadda9d06472ccb71b84928677ce2a6ca89($class){ |
|
| 55 | 55 | static $classes = null; |
| 56 | 56 | if ($classes === null) { |
| 57 | 57 | $classes = array( |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ); |
| 76 | 76 | } |
| 77 | 77 | if (isset($classes[$class])) { |
| 78 | - require dirname(__FILE__) . $classes[$class]; |
|
| 78 | + require dirname(__FILE__).$classes[$class]; |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true); |
@@ -84,18 +84,18 @@ discard block |
||
| 84 | 84 | // json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING |
| 85 | 85 | if (!function_exists("json_encode")) { |
| 86 | 86 | |
| 87 | - function kcfinder_json_string_encode($string) { |
|
| 88 | - return '"' . |
|
| 87 | + function kcfinder_json_string_encode($string){ |
|
| 88 | + return '"'. |
|
| 89 | 89 | str_replace('/', "\\/", |
| 90 | 90 | str_replace("\t", "\\t", |
| 91 | 91 | str_replace("\r", "\\r", |
| 92 | 92 | str_replace("\n", "\\n", |
| 93 | 93 | str_replace('"', "\\\"", |
| 94 | 94 | str_replace("\\", "\\\\", |
| 95 | - $string)))))) . '"'; |
|
| 95 | + $string)))))).'"'; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - function json_encode($data) { |
|
| 98 | + function json_encode($data){ |
|
| 99 | 99 | |
| 100 | 100 | if (is_array($data)) { |
| 101 | 101 | $ret = array(); |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | // OBJECT |
| 104 | 104 | if (array_keys($data) !== range(0, count($data) - 1)) { |
| 105 | 105 | foreach ($data as $key => $val) |
| 106 | - $ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val); |
|
| 107 | - return "{" . implode(",", $ret) . "}"; |
|
| 106 | + $ret[] = kcfinder_json_string_encode($key).':'.json_encode($val); |
|
| 107 | + return "{".implode(",", $ret)."}"; |
|
| 108 | 108 | |
| 109 | 109 | // ARRAY |
| 110 | 110 | } else { |
| 111 | 111 | foreach ($data as $val) |
| 112 | 112 | $ret[] = json_encode($val); |
| 113 | - return "[" . implode(",", $ret) . "]"; |
|
| 113 | + return "[".implode(",", $ret)."]"; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // BOOLEAN OR NULL |
@@ -1,2 +1,2 @@ |
||
| 1 | -<link href="css.php?type=<?php echo $this->type ?><?php echo ($this->cms ? "&cms={$this->cms}" : "" ) ?>" rel="stylesheet" type="text/css" /> |
|
| 1 | +<link href="css.php?type=<?php echo $this->type ?><?php echo ($this->cms ? "&cms={$this->cms}" : "") ?>" rel="stylesheet" type="text/css" /> |
|
| 2 | 2 | <link href="themes/<?php echo $this->config['theme'] ?>/style.css" rel="stylesheet" type="text/css" /> |