@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('delete_eventlog')) { |
|
5 | +if (!$modx->hasPermission('delete_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -if (isset($_GET['cls']) && $_GET['cls']==1) { |
|
9 | +if (isset($_GET['cls']) && $_GET['cls'] == 1) { |
|
10 | 10 | $where = ''; |
11 | 11 | } else { |
12 | - $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
13 | - if($id==0) { |
|
12 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
13 | + if ($id == 0) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
15 | 15 | } |
16 | 16 | $where = "id='{$id}'"; |
@@ -19,5 +19,5 @@ discard block |
||
19 | 19 | // delete event log |
20 | 20 | $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('event_log'), $where); |
21 | 21 | |
22 | -$header="Location: index.php?a=114"; |
|
22 | +$header = "Location: index.php?a=114"; |
|
23 | 23 | header($header); |
@@ -1,20 +1,20 @@ 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('new_chunk')) { |
|
5 | +if (!$modx->hasPermission('new_chunk')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate htmlsnippet |
@@ -32,5 +32,5 @@ discard block |
||
32 | 32 | $_SESSION['itemname'] = $name; |
33 | 33 | |
34 | 34 | // finish duplicating - redirect to new chunk |
35 | -$header="Location: index.php?r=2&a=78&id=$newid"; |
|
35 | +$header = "Location: index.php?r=2&a=78&id=$newid"; |
|
36 | 36 | header($header); |
@@ -1,19 +1,19 @@ 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('new_module')) { |
|
5 | +if (!$modx->hasPermission('new_module')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | // count duplicates |
14 | 14 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'")); |
15 | 15 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
16 | -if($count>=1) $count = ' '.($count+1); |
|
16 | +if ($count >= 1) $count = ' '.($count + 1); |
|
17 | 17 | else $count = ''; |
18 | 18 | |
19 | 19 | // duplicate module |
@@ -58,5 +58,5 @@ discard block |
||
58 | 58 | $_SESSION['itemname'] = $name; |
59 | 59 | |
60 | 60 | // finish duplicating - redirect to new module |
61 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
61 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
62 | 62 | header($header); |
@@ -1,20 +1,20 @@ 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('new_template')) { |
|
5 | +if (!$modx->hasPermission('new_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate template |
@@ -41,5 +41,5 @@ discard block |
||
41 | 41 | $_SESSION['itemname'] = $name; |
42 | 42 | |
43 | 43 | // finish duplicating - redirect to new template |
44 | -$header="Location: index.php?r=2&a=16&id=$newid"; |
|
44 | +$header = "Location: index.php?r=2&a=16&id=$newid"; |
|
45 | 45 | header($header); |
@@ -1,24 +1,24 @@ 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('delete_template')) { |
|
5 | +if (!$modx->hasPermission('delete_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
10 | -if($id == 0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | $forced = isset($_GET['force']) ? $_GET['force'] : 0; |
15 | 15 | |
16 | 16 | // check for relations |
17 | -if(!$forced) { |
|
18 | - $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getDatabase()->getFullTableName('site_content') . " AS sc |
|
19 | - INNER JOIN " . $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues') . " AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'"); |
|
17 | +if (!$forced) { |
|
18 | + $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getDatabase()->getFullTableName('site_content')." AS sc |
|
19 | + INNER JOIN " . $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues')." AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'"); |
|
20 | 20 | $count = $modx->getDatabase()->getRecordCount($drs); |
21 | - if($count > 0) { |
|
21 | + if ($count > 0) { |
|
22 | 22 | include_once "header.inc.php"; |
23 | 23 | ?> |
24 | 24 | <script> |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | <p><?= $_lang['tmplvar_inuse'] ?></p> |
43 | 43 | <ul> |
44 | 44 | <?php |
45 | - while($row = $modx->getDatabase()->getRow($drs)) { |
|
46 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>'; |
|
45 | + while ($row = $modx->getDatabase()->getRow($drs)) { |
|
46 | + echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['description'] != '' ? ' - '.$row['description'] : '').'</li>'; |
|
47 | 47 | } |
48 | 48 | ?> |
49 | 49 | </ul> |
@@ -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); |
@@ -1,25 +1,25 @@ 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('save_document')||!$modx->hasPermission('publish_document')) { |
|
5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | /************webber ********/ |
15 | -$content=$modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
15 | +$content = $modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
17 | 17 | |
18 | 18 | /************** webber *************/ |
19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
22 | -$add_path=$sd.$sb.$pg; |
|
19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
22 | +$add_path = $sd.$sb.$pg; |
|
23 | 23 | |
24 | 24 | /***********************************/ |
25 | 25 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $udperms->document = $id; |
32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
33 | 33 | |
34 | -if(!$udperms->checkPermissions()) { |
|
34 | +if (!$udperms->checkPermissions()) { |
|
35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
36 | 36 | } |
37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'"); |
49 | 49 | |
50 | 50 | // invoke OnDocPublished event |
51 | -$modx->invokeEvent("OnDocPublished",array("docid"=>$id)); |
|
51 | +$modx->invokeEvent("OnDocPublished", array("docid"=>$id)); |
|
52 | 52 | |
53 | 53 | // Set the item name for logger |
54 | 54 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -56,6 +56,6 @@ discard block |
||
56 | 56 | // empty cache |
57 | 57 | $modx->clearCache('full'); |
58 | 58 | |
59 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
59 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
60 | 60 | |
61 | 61 | header($header); |
@@ -1,20 +1,20 @@ 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('delete_template')) { |
|
5 | +if (!$modx->hasPermission('delete_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
10 | -if($id == 0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getDatabase()->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->getDatabase()->getRecordCount($rs); |
17 | -if($limit > 0) { |
|
17 | +if ($limit > 0) { |
|
18 | 18 | include "header.inc.php"; |
19 | 19 | ?> |
20 | 20 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
31 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['introtext'] != '' ? ' - '.$row['introtext'] : '').'</li>'; |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | </ul> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | exit; |
41 | 41 | } |
42 | 42 | |
43 | -if($id == $default_template) { |
|
43 | +if ($id == $default_template) { |
|
44 | 44 | $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
45 | 45 | } |
46 | 46 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('messages')) { |
|
5 | +if (!$modx->hasPermission('messages')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | $userid = $_REQUEST['user']; |
11 | 11 | $groupid = $_REQUEST['group']; |
12 | 12 | $subject = $modx->getDatabase()->escape($_REQUEST['messagesubject']); |
13 | -if($subject=="") $subject="(no subject)"; |
|
13 | +if ($subject == "") $subject = "(no subject)"; |
|
14 | 14 | $message = $modx->getDatabase()->escape($_REQUEST['messagebody']); |
15 | -if($message=="") $message="(no message)"; |
|
15 | +if ($message == "") $message = "(no message)"; |
|
16 | 16 | $postdate = time(); |
17 | 17 | |
18 | -if($sendto=='u') { |
|
19 | - if($userid==0) { |
|
18 | +if ($sendto == 'u') { |
|
19 | + if ($userid == 0) { |
|
20 | 20 | $modx->webAlertAndQuit($_lang["error_no_user_selected"]); |
21 | 21 | } |
22 | 22 | $modx->getDatabase()->insert( |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | ), $modx->getDatabase()->getFullTableName('user_messages')); |
32 | 32 | } |
33 | 33 | |
34 | -if($sendto=='g') { |
|
35 | - if($groupid==0) { |
|
34 | +if ($sendto == 'g') { |
|
35 | + if ($groupid == 0) { |
|
36 | 36 | $modx->webAlertAndQuit($_lang["error_no_group_selected"]); |
37 | 37 | } |
38 | 38 | $rs = $modx->getDatabase()->select('internalKey', $modx->getDatabase()->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'"); |
39 | - while ($row=$modx->getDatabase()->getRow($rs)) { |
|
39 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
40 | 40 | $modx->getDatabase()->insert( |
41 | 41 | array( |
42 | 42 | 'recipient' => $row['internalKey'], |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | -if($sendto=='a') { |
|
54 | +if ($sendto == 'a') { |
|
55 | 55 | $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'"); |
56 | - while ($row=$modx->getDatabase()->getRow($rs)) { |
|
56 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
57 | 57 | $modx->getDatabase()->insert( |
58 | 58 | array( |
59 | 59 | 'recipient' => $row['id'], |