@@ -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,22 +56,22 @@ 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->manager->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 | - case 'site_name': |
|
73 | - $v = htmlspecialchars($v); |
|
74 | - break; |
|
65 | + } |
|
66 | + } |
|
67 | + $savethese = array(); |
|
68 | + $data['sys_files_checksum'] = $modx->manager->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 | + case 'site_name': |
|
73 | + $v = htmlspecialchars($v); |
|
74 | + break; |
|
75 | 75 | case 'settings_version':{ |
76 | 76 | if($modx->getVersionData('version')!=$data['settings_version']){ |
77 | 77 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -79,24 +79,24 @@ discard block |
||
79 | 79 | } |
80 | 80 | break; |
81 | 81 | } |
82 | - case 'error_page': |
|
83 | - case 'unauthorized_page': |
|
84 | - if (trim($v) == '' || !is_numeric($v)) { |
|
85 | - $v = $data['site_start']; |
|
86 | - } |
|
87 | - break; |
|
82 | + case 'error_page': |
|
83 | + case 'unauthorized_page': |
|
84 | + if (trim($v) == '' || !is_numeric($v)) { |
|
85 | + $v = $data['site_start']; |
|
86 | + } |
|
87 | + break; |
|
88 | 88 | |
89 | - case 'lst_custom_contenttype': |
|
90 | - case 'txt_custom_contenttype': |
|
91 | - // Skip these |
|
92 | - $k = ''; |
|
93 | - break; |
|
94 | - case 'rb_base_dir': |
|
95 | - case 'rb_base_url': |
|
96 | - case 'filemanager_path': |
|
97 | - $v = trim($v); |
|
98 | - $v = rtrim($v,'/') . '/'; |
|
99 | - break; |
|
89 | + case 'lst_custom_contenttype': |
|
90 | + case 'txt_custom_contenttype': |
|
91 | + // Skip these |
|
92 | + $k = ''; |
|
93 | + break; |
|
94 | + case 'rb_base_dir': |
|
95 | + case 'rb_base_url': |
|
96 | + case 'filemanager_path': |
|
97 | + $v = trim($v); |
|
98 | + $v = rtrim($v,'/') . '/'; |
|
99 | + break; |
|
100 | 100 | case 'manager_language': |
101 | 101 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
102 | 102 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -104,56 +104,56 @@ discard block |
||
104 | 104 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
105 | 105 | $v = 'english'; |
106 | 106 | } |
107 | - break; |
|
108 | - case 'smtppw': |
|
109 | - if ($v !== '********************' && $v !== '') { |
|
110 | - $v = trim($v); |
|
111 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | - $v = str_replace('=','%',$v); |
|
113 | - } elseif ($v === '********************') { |
|
114 | - $k = ''; |
|
115 | - } |
|
116 | - break; |
|
107 | + break; |
|
108 | + case 'smtppw': |
|
109 | + if ($v !== '********************' && $v !== '') { |
|
110 | + $v = trim($v); |
|
111 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | + $v = str_replace('=','%',$v); |
|
113 | + } elseif ($v === '********************') { |
|
114 | + $k = ''; |
|
115 | + } |
|
116 | + break; |
|
117 | 117 | case 'valid_hostnames': |
118 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
119 | - if ($v !== ',') { |
|
120 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
121 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
123 | - } |
|
124 | - $k = ''; |
|
125 | - break; |
|
126 | - case 'session_timeout': |
|
127 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
128 | - $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 |
|
129 | - break; |
|
130 | - default: |
|
131 | - break; |
|
132 | - } |
|
133 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
118 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
119 | + if ($v !== ',') { |
|
120 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
121 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
123 | + } |
|
124 | + $k = ''; |
|
125 | + break; |
|
126 | + case 'session_timeout': |
|
127 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
128 | + $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 |
|
129 | + break; |
|
130 | + default: |
|
131 | + break; |
|
132 | + } |
|
133 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
134 | 134 | |
135 | - $modx->config[$k] = $v; |
|
135 | + $modx->config[$k] = $v; |
|
136 | 136 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
138 | - } |
|
137 | + if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
138 | + } |
|
139 | 139 | |
140 | - // Run a single query to save all the values |
|
141 | - $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
140 | + // Run a single query to save all the values |
|
141 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
142 | 142 | VALUES ".implode(', ', $savethese); |
143 | - $modx->db->query($sql); |
|
143 | + $modx->db->query($sql); |
|
144 | 144 | |
145 | - // Reset Template Pages |
|
146 | - if (isset($data['reset_template'])) { |
|
147 | - $newtemplate = (int)$data['default_template']; |
|
148 | - $oldtemplate = (int)$data['old_template']; |
|
149 | - $tbl = $modx->getFullTableName('site_content'); |
|
150 | - $reset = $data['reset_template']; |
|
151 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | - } |
|
145 | + // Reset Template Pages |
|
146 | + if (isset($data['reset_template'])) { |
|
147 | + $newtemplate = (int)$data['default_template']; |
|
148 | + $oldtemplate = (int)$data['old_template']; |
|
149 | + $tbl = $modx->getFullTableName('site_content'); |
|
150 | + $reset = $data['reset_template']; |
|
151 | + if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | + else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | + } |
|
154 | 154 | |
155 | - // empty cache |
|
156 | - $modx->clearCache('full'); |
|
155 | + // empty cache |
|
156 | + $modx->clearCache('full'); |
|
157 | 157 | } |
158 | 158 | $header="Location: index.php?a=7&r=10"; |
159 | 159 | 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,15 +66,15 @@ discard block |
||
66 | 66 | } |
67 | 67 | $savethese = array(); |
68 | 68 | $data['sys_files_checksum'] = $modx->manager->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 'site_name': |
73 | 73 | $v = htmlspecialchars($v); |
74 | 74 | break; |
75 | 75 | case 'settings_version':{ |
76 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
77 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
76 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
77 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
78 | 78 | $v = $modx->getVersionData('version'); |
79 | 79 | } |
80 | 80 | break; |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | case 'rb_base_url': |
96 | 96 | case 'filemanager_path': |
97 | 97 | $v = trim($v); |
98 | - $v = rtrim($v,'/') . '/'; |
|
98 | + $v = rtrim($v, '/').'/'; |
|
99 | 99 | break; |
100 | 100 | case 'manager_language': |
101 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
102 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
101 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
102 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
103 | 103 | $langFileDir = dirname($langFile); |
104 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
104 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
105 | 105 | $v = 'english'; |
106 | 106 | } |
107 | 107 | break; |
108 | 108 | case 'smtppw': |
109 | 109 | if ($v !== '********************' && $v !== '') { |
110 | 110 | $v = trim($v); |
111 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | - $v = str_replace('=','%',$v); |
|
111 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | + $v = str_replace('=', '%', $v); |
|
113 | 113 | } elseif ($v === '********************') { |
114 | 114 | $k = ''; |
115 | 115 | } |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | $v = str_replace(array(' ,', ', '), ',', $v); |
119 | 119 | if ($v !== ',') { |
120 | 120 | $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
121 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
121 | + $configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n"; |
|
122 | + @file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString); |
|
123 | 123 | } |
124 | 124 | $k = ''; |
125 | 125 | break; |
126 | 126 | case 'session_timeout': |
127 | 127 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
128 | - $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 |
|
128 | + $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 |
|
129 | 129 | break; |
130 | 130 | default: |
131 | 131 | break; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $modx->config[$k] = $v; |
136 | 136 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
137 | + if (!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Run a single query to save all the values |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | |
145 | 145 | // Reset Template Pages |
146 | 146 | if (isset($data['reset_template'])) { |
147 | - $newtemplate = (int)$data['default_template']; |
|
148 | - $oldtemplate = (int)$data['old_template']; |
|
147 | + $newtemplate = (int) $data['default_template']; |
|
148 | + $oldtemplate = (int) $data['old_template']; |
|
149 | 149 | $tbl = $modx->getFullTableName('site_content'); |
150 | 150 | $reset = $data['reset_template']; |
151 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
151 | + if ($reset == 1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | + else if ($reset == 2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // empty cache |
156 | 156 | $modx->clearCache('full'); |
157 | 157 | } |
158 | -$header="Location: index.php?a=7&r=10"; |
|
158 | +$header = "Location: index.php?a=7&r=10"; |
|
159 | 159 | 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 | } |
@@ -73,7 +61,7 @@ discard block |
||
73 | 61 | $v = htmlspecialchars($v); |
74 | 62 | break; |
75 | 63 | case 'settings_version':{ |
76 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
64 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
77 | 65 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
78 | 66 | $v = $modx->getVersionData('version'); |
79 | 67 | } |
@@ -134,7 +122,9 @@ discard block |
||
134 | 122 | |
135 | 123 | $modx->config[$k] = $v; |
136 | 124 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
125 | + if(!empty($k)) { |
|
126 | + $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
127 | + } |
|
138 | 128 | } |
139 | 129 | |
140 | 130 | // Run a single query to save all the values |
@@ -148,8 +138,11 @@ discard block |
||
148 | 138 | $oldtemplate = (int)$data['old_template']; |
149 | 139 | $tbl = $modx->getFullTableName('site_content'); |
150 | 140 | $reset = $data['reset_template']; |
151 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
141 | + if($reset==1) { |
|
142 | + $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
143 | + } else if($reset==2) { |
|
144 | + $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
145 | + } |
|
153 | 146 | } |
154 | 147 | |
155 | 148 | // empty cache |