@@ -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('save_web_user')) { |
|
| 5 | +if (!$modx->hasPermission('save_web_user')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -11,14 +11,14 @@ discard block |
||
| 11 | 11 | $tbl_web_groups = $modx->getFullTableName('web_groups'); |
| 12 | 12 | |
| 13 | 13 | $input = $_POST; |
| 14 | -foreach($input as $k => $v) { |
|
| 15 | - if($k !== 'comment') { |
|
| 14 | +foreach ($input as $k => $v) { |
|
| 15 | + if ($k !== 'comment') { |
|
| 16 | 16 | $v = sanitize($v); |
| 17 | 17 | } |
| 18 | 18 | $input[$k] = $v; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -$id = (int)$input['id']; |
|
| 21 | +$id = (int) $input['id']; |
|
| 22 | 22 | $oldusername = $input['oldusername']; |
| 23 | 23 | $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User"; |
| 24 | 24 | $esc_newusername = $modx->db->escape($newusername); |
@@ -50,21 +50,21 @@ discard block |
||
| 50 | 50 | $user_groups = $input['user_groups']; |
| 51 | 51 | |
| 52 | 52 | // verify password |
| 53 | -if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
| 53 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
| 54 | 54 | webAlertAndQuit("Password typed is mismatched"); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // verify email |
| 58 | -if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
| 58 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
| 59 | 59 | webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -switch($input['mode']) { |
|
| 62 | +switch ($input['mode']) { |
|
| 63 | 63 | case '87' : // new user |
| 64 | 64 | // check if this user name already exist |
| 65 | 65 | $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
| 66 | 66 | $limit = $modx->db->getValue($rs); |
| 67 | - if($limit > 0) { |
|
| 67 | + if ($limit > 0) { |
|
| 68 | 68 | webAlertAndQuit("User name is already in use!"); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -72,21 +72,21 @@ discard block |
||
| 72 | 72 | if ($modx->config['allow_multiple_emails'] != 1) { |
| 73 | 73 | $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
| 74 | 74 | $limit = $modx->db->getValue($rs); |
| 75 | - if($limit > 0) { |
|
| 75 | + if ($limit > 0) { |
|
| 76 | 76 | webAlertAndQuit("Email is already in use!"); |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // generate a new password for this user |
| 81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | - if(strlen($specifiedpassword) < 6) { |
|
| 81 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | + if (strlen($specifiedpassword) < 6) { |
|
| 83 | 83 | webAlertAndQuit("Password is too short!"); |
| 84 | 84 | } else { |
| 85 | 85 | $newpassword = $specifiedpassword; |
| 86 | 86 | } |
| 87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 87 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | 88 | webAlertAndQuit("You didn't specify a password for this user!"); |
| 89 | - } elseif($passwordgenmethod == 'g') { |
|
| 89 | + } elseif ($passwordgenmethod == 'g') { |
|
| 90 | 90 | $newpassword = generate_password(8); |
| 91 | 91 | } else { |
| 92 | 92 | webAlertAndQuit("No password generation method specified!"); |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | /*******************************************************************************/ |
| 117 | 117 | // put the user in the user_groups he/ she should be in |
| 118 | 118 | // first, check that up_perms are switched on! |
| 119 | - if($use_udperms == 1) { |
|
| 120 | - if(!empty($user_groups)) { |
|
| 121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 119 | + if ($use_udperms == 1) { |
|
| 120 | + if (!empty($user_groups)) { |
|
| 121 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | 122 | $f = array(); |
| 123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
| 123 | + $f['webgroup'] = (int) $user_groups[$i]; |
|
| 124 | 124 | $f['webuser'] = $internalKey; |
| 125 | 125 | $modx->db->insert($f, $tbl_web_groups); |
| 126 | 126 | } |
@@ -144,20 +144,20 @@ discard block |
||
| 144 | 144 | "id" => $internalKey |
| 145 | 145 | )); |
| 146 | 146 | |
| 147 | - if($passwordnotifymethod == 'e') { |
|
| 147 | + if ($passwordnotifymethod == 'e') { |
|
| 148 | 148 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
| 149 | - if($input['stay'] != '') { |
|
| 149 | + if ($input['stay'] != '') { |
|
| 150 | 150 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
| 151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 151 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 152 | 152 | header($header); |
| 153 | 153 | } else { |
| 154 | 154 | $header = "Location: index.php?a=99&r=2"; |
| 155 | 155 | header($header); |
| 156 | 156 | } |
| 157 | 157 | } else { |
| 158 | - if($input['stay'] != '') { |
|
| 158 | + if ($input['stay'] != '') { |
|
| 159 | 159 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
| 160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 160 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 161 | 161 | } else { |
| 162 | 162 | $stayUrl = "index.php?a=99&r=2"; |
| 163 | 163 | } |
@@ -190,29 +190,29 @@ discard block |
||
| 190 | 190 | break; |
| 191 | 191 | case '88' : // edit user |
| 192 | 192 | // generate a new password for this user |
| 193 | - if($genpassword == 1) { |
|
| 194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | - if(strlen($specifiedpassword) < 6) { |
|
| 193 | + if ($genpassword == 1) { |
|
| 194 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | + if (strlen($specifiedpassword) < 6) { |
|
| 196 | 196 | webAlertAndQuit("Password is too short!"); |
| 197 | 197 | } else { |
| 198 | 198 | $newpassword = $specifiedpassword; |
| 199 | 199 | } |
| 200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 200 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 201 | 201 | webAlertAndQuit("You didn't specify a password for this user!"); |
| 202 | - } elseif($passwordgenmethod == 'g') { |
|
| 202 | + } elseif ($passwordgenmethod == 'g') { |
|
| 203 | 203 | $newpassword = generate_password(8); |
| 204 | 204 | } else { |
| 205 | 205 | webAlertAndQuit("No password generation method specified!"); |
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | - if($passwordnotifymethod == 'e') { |
|
| 208 | + if ($passwordnotifymethod == 'e') { |
|
| 209 | 209 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // check if the username already exist |
| 213 | 213 | $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
| 214 | 214 | $limit = $modx->db->getValue($rs); |
| 215 | - if($limit > 0) { |
|
| 215 | + if ($limit > 0) { |
|
| 216 | 216 | webAlertAndQuit("User name is already in use!"); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | if ($modx->config['allow_multiple_emails'] != 1) { |
| 221 | 221 | $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
| 222 | 222 | $limit = $modx->db->getValue($rs); |
| 223 | - if($limit > 0) { |
|
| 223 | + if ($limit > 0) { |
|
| 224 | 224 | webAlertAndQuit("Email is already in use!"); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | // update user name and password |
| 235 | 235 | $field = array(); |
| 236 | 236 | $field['username'] = $esc_newusername; |
| 237 | - if($genpassword == 1) { |
|
| 237 | + if ($genpassword == 1) { |
|
| 238 | 238 | $field['password'] = md5($newpassword); |
| 239 | 239 | } |
| 240 | 240 | $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | /*******************************************************************************/ |
| 252 | 252 | // put the user in the user_groups he/ she should be in |
| 253 | 253 | // first, check that up_perms are switched on! |
| 254 | - if($use_udperms == 1) { |
|
| 254 | + if ($use_udperms == 1) { |
|
| 255 | 255 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
| 256 | 256 | $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
| 257 | - if(!empty($user_groups)) { |
|
| 258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 257 | + if (!empty($user_groups)) { |
|
| 258 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 259 | 259 | $field = array(); |
| 260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
| 260 | + $field['webgroup'] = (int) $user_groups[$i]; |
|
| 261 | 261 | $field['webuser'] = $id; |
| 262 | 262 | $modx->db->insert($field, $tbl_web_groups); |
| 263 | 263 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | )); |
| 280 | 280 | |
| 281 | 281 | // invoke OnWebChangePassword event |
| 282 | - if($genpassword == 1) { |
|
| 282 | + if ($genpassword == 1) { |
|
| 283 | 283 | $modx->invokeEvent("OnWebChangePassword", array( |
| 284 | 284 | "userid" => $id, |
| 285 | 285 | "username" => $newusername, |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | "id" => $id |
| 294 | 294 | )); |
| 295 | 295 | |
| 296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | - if($input['stay'] != '') { |
|
| 296 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | + if ($input['stay'] != '') { |
|
| 298 | 298 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
| 299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 299 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 300 | 300 | } else { |
| 301 | 301 | $stayUrl = "index.php?a=99&r=2"; |
| 302 | 302 | } |
@@ -324,9 +324,9 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | include_once "footer.inc.php"; |
| 326 | 326 | } else { |
| 327 | - if($input['stay'] != '') { |
|
| 327 | + if ($input['stay'] != '') { |
|
| 328 | 328 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
| 329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 329 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 330 | 330 | header($header); |
| 331 | 331 | } else { |
| 332 | 332 | $header = "Location: index.php?a=99&r=2"; |
@@ -344,15 +344,15 @@ discard block |
||
| 344 | 344 | * @param string $string |
| 345 | 345 | * @return string |
| 346 | 346 | */ |
| 347 | -function save_user_quoted_printable($string) { |
|
| 347 | +function save_user_quoted_printable($string){ |
|
| 348 | 348 | $crlf = "\n"; |
| 349 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
| 349 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string).$crlf; |
|
| 350 | 350 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
| 351 | 351 | $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
| 352 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
| 353 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
| 352 | + $f[] = '/([\011\040])'.$crlf.'/e'; |
|
| 353 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '".$crlf."'"; |
|
| 354 | 354 | $string = preg_replace($f, $r, $string); |
| 355 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
| 355 | + return trim(wordwrap($string, 70, ' ='.$crlf)); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @param string $pwd |
| 364 | 364 | * @param string $ufn |
| 365 | 365 | */ |
| 366 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
| 366 | +function sendMailMessage($email, $uid, $pwd, $ufn){ |
|
| 367 | 367 | $modx = evolutionCMS(); global $_lang, $websignupemail_message; |
| 368 | 368 | global $emailsubject, $emailsender; |
| 369 | 369 | global $site_name, $site_url; |
@@ -384,14 +384,14 @@ discard block |
||
| 384 | 384 | $param['to'] = $email; |
| 385 | 385 | $param['type'] = 'text'; |
| 386 | 386 | $rs = $modx->sendmail($param); |
| 387 | - if(!$rs) { |
|
| 387 | + if (!$rs) { |
|
| 388 | 388 | $modx->manager->saveFormValues(); |
| 389 | 389 | $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // Save User Settings |
| 394 | -function saveUserSettings($id) { |
|
| 394 | +function saveUserSettings($id){ |
|
| 395 | 395 | $modx = evolutionCMS(); |
| 396 | 396 | $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
| 397 | 397 | |
@@ -403,12 +403,12 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
| 405 | 405 | |
| 406 | - foreach($settings as $n) { |
|
| 406 | + foreach ($settings as $n) { |
|
| 407 | 407 | $vl = $_POST[$n]; |
| 408 | - if(is_array($vl)) { |
|
| 408 | + if (is_array($vl)) { |
|
| 409 | 409 | $vl = implode(",", $vl); |
| 410 | 410 | } |
| 411 | - if($vl != '') { |
|
| 411 | + if ($vl != '') { |
|
| 412 | 412 | $f = array(); |
| 413 | 413 | $f['webuser'] = $id; |
| 414 | 414 | $f['setting_name'] = $n; |
@@ -420,33 +420,33 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // Web alert - sends an alert to web browser |
| 423 | -function webAlertAndQuit($msg) { |
|
| 423 | +function webAlertAndQuit($msg){ |
|
| 424 | 424 | global $id, $modx; |
| 425 | 425 | $mode = $_POST['mode']; |
| 426 | 426 | $modx->manager->saveFormValues($mode); |
| 427 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
| 427 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '88' ? "&id={$id}" : '')); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // Generate password |
| 431 | -function generate_password($length = 10) { |
|
| 431 | +function generate_password($length = 10){ |
|
| 432 | 432 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
| 433 | 433 | $ps_len = strlen($allowable_characters); |
| 434 | 434 | mt_srand((double) microtime() * 1000000); |
| 435 | 435 | $pass = ""; |
| 436 | - for($i = 0; $i < $length; $i++) { |
|
| 436 | + for ($i = 0; $i < $length; $i++) { |
|
| 437 | 437 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
| 438 | 438 | } |
| 439 | 439 | return $pass; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | -function sanitize($str = '', $safecount = 0) { |
|
| 442 | +function sanitize($str = '', $safecount = 0){ |
|
| 443 | 443 | $modx = evolutionCMS(); |
| 444 | 444 | $safecount++; |
| 445 | - if(1000 < $safecount) { |
|
| 445 | + if (1000 < $safecount) { |
|
| 446 | 446 | exit("error too many loops '{$safecount}'"); |
| 447 | 447 | } |
| 448 | - if(is_array($str)) { |
|
| 449 | - foreach($str as $i => $v) { |
|
| 448 | + if (is_array($str)) { |
|
| 449 | + foreach ($str as $i => $v) { |
|
| 450 | 450 | $str[$i] = sanitize($v, $safecount); |
| 451 | 451 | } |
| 452 | 452 | } else { |
@@ -1,18 +1,18 @@ 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('exec_module')) { |
|
| 5 | +if (!$modx->hasPermission('exec_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 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | -if($_SESSION['mgrRole']!=1){ |
|
| 15 | +if ($_SESSION['mgrRole'] != 1) { |
|
| 16 | 16 | $rs = $modx->db->select( |
| 17 | 17 | 'sma.usergroup,mg.member', |
| 18 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -24,18 +24,18 @@ discard block |
||
| 24 | 24 | $permissionAccessInt = -1; |
| 25 | 25 | |
| 26 | 26 | while ($row = $modx->db->getRow($rs)) { |
| 27 | - if($row["usergroup"] && $row["member"]) { |
|
| 27 | + if ($row["usergroup"] && $row["member"]) { |
|
| 28 | 28 | //if there are permissions and this member has permission, ofcourse |
| 29 | 29 | //this is granted |
| 30 | 30 | $permissionAccessInt = 1; |
| 31 | - } elseif ($permissionAccessInt==-1) { |
|
| 31 | + } elseif ($permissionAccessInt == -1) { |
|
| 32 | 32 | //if there are permissions but this member has no permission and the |
| 33 | 33 | //variable was still in init state we set permission to 0; no permissions |
| 34 | 34 | $permissionAccessInt = 0; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if($permissionAccessInt==0) { |
|
| 38 | + if ($permissionAccessInt == 0) { |
|
| 39 | 39 | $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | // get module data |
| 44 | 44 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
| 45 | 45 | $content = $modx->db->getRow($rs); |
| 46 | -if(!$content) { |
|
| 46 | +if (!$content) { |
|
| 47 | 47 | $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
| 48 | 48 | } |
| 49 | -if($content['disabled']) { |
|
| 49 | +if ($content['disabled']) { |
|
| 50 | 50 | $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $_SESSION['itemname'] = $content['name']; |
| 61 | 61 | |
| 62 | 62 | |
| 63 | -$output = evalModule($content["modulecode"],$parameter); |
|
| 64 | -if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
|
| 63 | +$output = evalModule($content["modulecode"], $parameter); |
|
| 64 | +if (strpos(trim($output), '<') === 0 && strpos(trim($output), '<?xml') !== 0) { |
|
| 65 | 65 | echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
| 66 | 66 | } |
| 67 | 67 | echo $output; |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * @param array $params |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | -function evalModule($moduleCode,$params){ |
|
| 77 | +function evalModule($moduleCode, $params){ |
|
| 78 | 78 | $modx = evolutionCMS(); |
| 79 | 79 | $modx->event->params = &$params; // store params inside event object |
| 80 | - if(is_array($params)) { |
|
| 80 | + if (is_array($params)) { |
|
| 81 | 81 | extract($params, EXTR_SKIP); |
| 82 | 82 | } |
| 83 | 83 | ob_start(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if (isset($php_errormsg)) |
| 88 | 88 | { |
| 89 | 89 | $error_info = error_get_last(); |
| 90 | - switch($error_info['type']) |
|
| 90 | + switch ($error_info['type']) |
|
| 91 | 91 | { |
| 92 | 92 | case E_NOTICE : |
| 93 | 93 | $error_level = 1; |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | default: |
| 102 | 102 | $error_level = 99; |
| 103 | 103 | } |
| 104 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 104 | + if ($modx->config['error_reporting'] === '99' || 2 < $error_level) |
|
| 105 | 105 | { |
| 106 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 106 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | 107 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -1,23 +1,23 @@ 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->db->connect(); |
| 10 | 10 | $modx->getSettings(); |
| 11 | 11 | $modx->invokeEvent('OnManagerPageInit'); |
| 12 | 12 | $modx->loadExtension('ManagerAPI'); |
| 13 | 13 | $modx->loadExtension('phpass'); |
| 14 | 14 | |
| 15 | -$core_path = MODX_MANAGER_PATH . 'includes/'; |
|
| 15 | +$core_path = MODX_MANAGER_PATH.'includes/'; |
|
| 16 | 16 | // include_once the language file |
| 17 | 17 | $_lang = array(); |
| 18 | 18 | include_once("{$core_path}lang/english.inc.php"); |
| 19 | 19 | |
| 20 | -if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
| 20 | +if ($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
| 21 | 21 | include_once("{$core_path}lang/{$manager_language}.inc.php"); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | include_once("{$core_path}log.class.inc.php"); |
| 26 | 26 | |
| 27 | 27 | // Initialize System Alert Message Queque |
| 28 | -if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
| 28 | +if (!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
| 29 | 29 | $_SESSION['SystemAlertMsgQueque'] = array(); |
| 30 | 30 | } |
| 31 | 31 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $rs = $modx->db->select($fields, $from, $where); |
| 52 | 52 | $limit = $modx->db->getRecordCount($rs); |
| 53 | 53 | |
| 54 | -if($limit == 0 || $limit > 1) { |
|
| 54 | +if ($limit == 0 || $limit > 1) { |
|
| 55 | 55 | jsAlert($_lang['login_processor_unknown_user']); |
| 56 | 56 | return; |
| 57 | 57 | } |
@@ -73,32 +73,32 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // get the user settings from the database |
| 75 | 75 | $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
| 76 | -while($row = $modx->db->getRow($rs)) { |
|
| 76 | +while ($row = $modx->db->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 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; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // this user has been blocked by an admin, so no way he's loggin in! |
| 109 | -if($blocked == '1') { |
|
| 109 | +if ($blocked == '1') { |
|
| 110 | 110 | @session_destroy(); |
| 111 | 111 | session_unset(); |
| 112 | 112 | jsAlert($_lang['login_processor_blocked1']); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // blockuntil: this user has a block until date |
| 117 | -if($blockeduntildate > time()) { |
|
| 117 | +if ($blockeduntildate > time()) { |
|
| 118 | 118 | @session_destroy(); |
| 119 | 119 | session_unset(); |
| 120 | 120 | jsAlert($_lang['login_processor_blocked2']); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // blockafter: this user has a block after date |
| 125 | -if($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
| 125 | +if ($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
| 126 | 126 | @session_destroy(); |
| 127 | 127 | session_unset(); |
| 128 | 128 | jsAlert($_lang['login_processor_blocked3']); |
@@ -130,24 +130,24 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // allowed ip |
| 133 | -if($allowed_ip) { |
|
| 134 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 135 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 133 | +if ($allowed_ip) { |
|
| 134 | + if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 135 | + if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 136 | 136 | jsAlert($_lang['login_processor_remotehost_ip']); |
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 140 | + if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 141 | 141 | jsAlert($_lang['login_processor_remote_ip']); |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // allowed days |
| 147 | -if($allowed_days) { |
|
| 147 | +if ($allowed_days) { |
|
| 148 | 148 | $date = getdate(); |
| 149 | 149 | $day = $date['wday'] + 1; |
| 150 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
| 150 | + if (!in_array($day, explode(',', $allowed_days))) { |
|
| 151 | 151 | jsAlert($_lang['login_processor_date']); |
| 152 | 152 | return; |
| 153 | 153 | } |
@@ -164,33 +164,33 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | // check if plugin authenticated the user |
| 166 | 166 | $matchPassword = false; |
| 167 | -if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
| 167 | +if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
| 168 | 168 | // check user password - local authentication |
| 169 | 169 | $hashType = $modx->manager->getHashType($dbasePassword); |
| 170 | - if($hashType == 'phpass') { |
|
| 170 | + if ($hashType == 'phpass') { |
|
| 171 | 171 | $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
| 172 | - } elseif($hashType == 'md5') { |
|
| 172 | + } elseif ($hashType == 'md5') { |
|
| 173 | 173 | $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
| 174 | - } elseif($hashType == 'v1') { |
|
| 174 | + } elseif ($hashType == 'v1') { |
|
| 175 | 175 | $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
| 176 | 176 | } else { |
| 177 | 177 | $matchPassword = false; |
| 178 | 178 | } |
| 179 | -} else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
| 179 | +} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
| 180 | 180 | $matchPassword = true; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | -if(!$matchPassword) { |
|
| 183 | +if (!$matchPassword) { |
|
| 184 | 184 | jsAlert($_lang['login_processor_wrong_password']); |
| 185 | 185 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
| 186 | 186 | return; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | -if($modx->config['use_captcha'] == 1) { |
|
| 190 | - if(!isset ($_SESSION['veriword'])) { |
|
| 189 | +if ($modx->config['use_captcha'] == 1) { |
|
| 190 | + if (!isset ($_SESSION['veriword'])) { |
|
| 191 | 191 | jsAlert($_lang['login_processor_captcha_config']); |
| 192 | 192 | return; |
| 193 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
| 193 | + } elseif ($_SESSION['veriword'] != $captcha_code) { |
|
| 194 | 194 | jsAlert($_lang['login_processor_bad_code']); |
| 195 | 195 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
| 196 | 196 | return; |
@@ -218,25 +218,25 @@ discard block |
||
| 218 | 218 | $_SESSION['mgrPermissions'] = $modx->db->getRow($rs); |
| 219 | 219 | |
| 220 | 220 | // successful login so reset fail count and update key values |
| 221 | -$modx->db->update('failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
| 221 | +$modx->db->update('failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
| 222 | 222 | |
| 223 | 223 | // get user's document groups |
| 224 | 224 | $i = 0; |
| 225 | -$rs = $modx->db->select('uga.documentgroup', $modx->getFullTableName('member_groups') . ' ug |
|
| 226 | - INNER JOIN ' . $modx->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
| 225 | +$rs = $modx->db->select('uga.documentgroup', $modx->getFullTableName('member_groups').' ug |
|
| 226 | + INNER JOIN ' . $modx->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
| 227 | 227 | $_SESSION['mgrDocgroups'] = $modx->db->getColumn('documentgroup', $rs); |
| 228 | 228 | |
| 229 | 229 | $_SESSION['mgrToken'] = md5($currentsessionid); |
| 230 | 230 | |
| 231 | -if($rememberme == '1') { |
|
| 232 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
| 231 | +if ($rememberme == '1') { |
|
| 232 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int) $modx->config['session.cookie.lifetime']; |
|
| 233 | 233 | |
| 234 | 234 | // Set a cookie separate from the session cookie with the username in it. |
| 235 | 235 | // Are we using secure connection? If so, make sure the cookie is secure |
| 236 | 236 | global $https_port; |
| 237 | 237 | |
| 238 | 238 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
| 239 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 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 | 242 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | // Check if user already has an active session, if not check if user pressed logout end of last session |
| 252 | 252 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
| 253 | 253 | $activeSession = $modx->db->getValue($rs); |
| 254 | -if(!$activeSession) { |
|
| 254 | +if (!$activeSession) { |
|
| 255 | 255 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
| 256 | - if($lastHit = $modx->db->getValue($rs)) { |
|
| 256 | + if ($lastHit = $modx->db->getValue($rs)) { |
|
| 257 | 257 | $_SESSION['show_logout_reminder'] = array( |
| 258 | 258 | 'type' => 'logout_reminder', |
| 259 | 259 | 'lastHit' => $lastHit |
@@ -274,17 +274,17 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | // check if we should redirect user to a web page |
| 276 | 276 | $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
| 277 | -$id = (int)$modx->db->getValue($rs); |
|
| 278 | -if($id > 0) { |
|
| 279 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
| 280 | - if($_POST['ajax'] == 1) { |
|
| 277 | +$id = (int) $modx->db->getValue($rs); |
|
| 278 | +if ($id > 0) { |
|
| 279 | + $header = 'Location: '.$modx->makeUrl($id, '', '', 'full'); |
|
| 280 | + if ($_POST['ajax'] == 1) { |
|
| 281 | 281 | echo $header; |
| 282 | 282 | } else { |
| 283 | 283 | header($header); |
| 284 | 284 | } |
| 285 | 285 | } else { |
| 286 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
| 287 | - if($_POST['ajax'] == 1) { |
|
| 286 | + $header = 'Location: '.MODX_MANAGER_URL; |
|
| 287 | + if ($_POST['ajax'] == 1) { |
|
| 288 | 288 | echo $header; |
| 289 | 289 | } else { |
| 290 | 290 | header($header); |
@@ -296,12 +296,12 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @param string $msg |
| 298 | 298 | */ |
| 299 | -function jsAlert($msg) { |
|
| 299 | +function jsAlert($msg){ |
|
| 300 | 300 | $modx = evolutionCMS(); |
| 301 | - if($_POST['ajax'] != 1) { |
|
| 302 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
| 301 | + if ($_POST['ajax'] != 1) { |
|
| 302 | + echo "<script>window.setTimeout(\"alert('".addslashes($modx->db->escape($msg))."')\",10);history.go(-1)</script>"; |
|
| 303 | 303 | } else { |
| 304 | - echo $msg . "\n"; |
|
| 304 | + echo $msg."\n"; |
|
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @param string $dbasePassword |
| 312 | 312 | * @return bool |
| 313 | 313 | */ |
| 314 | -function login($username, $givenPassword, $dbasePassword) { |
|
| 314 | +function login($username, $givenPassword, $dbasePassword){ |
|
| 315 | 315 | $modx = evolutionCMS(); |
| 316 | 316 | return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
| 317 | 317 | } |
@@ -323,21 +323,21 @@ discard block |
||
| 323 | 323 | * @param string $username |
| 324 | 324 | * @return bool |
| 325 | 325 | */ |
| 326 | -function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
|
| 326 | +function loginV1($internalKey, $givenPassword, $dbasePassword, $username){ |
|
| 327 | 327 | $modx = evolutionCMS(); |
| 328 | 328 | |
| 329 | 329 | $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
| 330 | 330 | |
| 331 | - if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
| 331 | + if (!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
| 332 | 332 | $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
| 335 | + if ($user_algo !== $modx->config['pwd_hash_algo']) { |
|
| 336 | 336 | $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
| 337 | 337 | $modx->config['pwd_hash_algo'] = $user_algo; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
| 340 | + if ($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
| 341 | 341 | return false; |
| 342 | 342 | } |
| 343 | 343 | |
@@ -353,10 +353,10 @@ discard block |
||
| 353 | 353 | * @param string $username |
| 354 | 354 | * @return bool |
| 355 | 355 | */ |
| 356 | -function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
|
| 356 | +function loginMD5($internalKey, $givenPassword, $dbasePassword, $username){ |
|
| 357 | 357 | $modx = evolutionCMS(); |
| 358 | 358 | |
| 359 | - if($dbasePassword != md5($givenPassword)) { |
|
| 359 | + if ($dbasePassword != md5($givenPassword)) { |
|
| 360 | 360 | return false; |
| 361 | 361 | } |
| 362 | 362 | updateNewHash($username, $givenPassword); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * @param string $username |
| 368 | 368 | * @param string $password |
| 369 | 369 | */ |
| 370 | -function updateNewHash($username, $password) { |
|
| 370 | +function updateNewHash($username, $password){ |
|
| 371 | 371 | $modx = evolutionCMS(); |
| 372 | 372 | |
| 373 | 373 | $field = array(); |
@@ -381,23 +381,23 @@ discard block |
||
| 381 | 381 | * @param int $failed_allowed |
| 382 | 382 | * @param int $blocked_minutes |
| 383 | 383 | */ |
| 384 | -function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
|
| 384 | +function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes){ |
|
| 385 | 385 | $modx = evolutionCMS(); |
| 386 | 386 | |
| 387 | 387 | $failedlogins += 1; |
| 388 | 388 | |
| 389 | 389 | $fields = array('failedlogincount' => $failedlogins); |
| 390 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
| 390 | + if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
| 391 | 391 | { |
| 392 | 392 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
| 396 | 396 | |
| 397 | - if($failedlogins < $failed_allowed) { |
|
| 397 | + if ($failedlogins < $failed_allowed) { |
|
| 398 | 398 | //sleep to help prevent brute force attacks |
| 399 | 399 | $sleep = (int) $failedlogins / 2; |
| 400 | - if($sleep > 5) { |
|
| 400 | + if ($sleep > 5) { |
|
| 401 | 401 | $sleep = 5; |
| 402 | 402 | } |
| 403 | 403 | sleep($sleep); |
@@ -1,11 +1,11 @@ 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 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,62 +16,62 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 19 | +if ($modx->hasPermission('messages')) {
|
|
| 20 | + include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php'); |
|
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
| 23 | 23 | |
| 24 | 24 | $msg = array(); |
| 25 | 25 | $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : ''; |
|
| 27 | 27 | $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0'; |
|
| 29 | 29 | $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
| 30 | 30 | $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
| 31 | 31 | $ph['MessageInfo'] = implode("\n", $msg);
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 47 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if ($modx->hasPermission('bk_manager')) {
|
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if ($modx->hasPermission('help')) {
|
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -if($modx->hasPermission('new_document')) {
|
|
| 60 | +if ($modx->hasPermission('new_document')) {
|
|
| 61 | 61 | $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]'; |
| 62 | 62 | $ph['ResourceIcon'] = wrapIcon($icon, 4); |
| 63 | 63 | $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]'; |
| 64 | 64 | $ph['WeblinkIcon'] = wrapIcon($icon, 72); |
| 65 | 65 | } |
| 66 | -if($modx->hasPermission('assets_images')) {
|
|
| 66 | +if ($modx->hasPermission('assets_images')) {
|
|
| 67 | 67 | $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]'; |
| 68 | 68 | $ph['ImagesIcon'] = wrapIcon($icon, 72); |
| 69 | 69 | } |
| 70 | -if($modx->hasPermission('assets_files')) {
|
|
| 70 | +if ($modx->hasPermission('assets_files')) {
|
|
| 71 | 71 | $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]'; |
| 72 | 72 | $ph['FilesIcon'] = wrapIcon($icon, 72); |
| 73 | 73 | } |
| 74 | -if($modx->hasPermission('change_password')) {
|
|
| 74 | +if ($modx->hasPermission('change_password')) {
|
|
| 75 | 75 | $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]'; |
| 76 | 76 | $ph['PasswordIcon'] = wrapIcon($icon, 28); |
| 77 | 77 | } |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | $ph['LogoutIcon'] = wrapIcon($icon, 8); |
| 80 | 80 | |
| 81 | 81 | // do some config checks |
| 82 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 83 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 84 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 82 | +if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 83 | + include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php'); |
|
| 84 | + if ($config_check_results != $_lang['configcheck_ok']) {
|
|
| 85 | 85 | $ph['config_check_results'] = $config_check_results; |
| 86 | 86 | $ph['config_display'] = 'block'; |
| 87 | 87 | } else {
|
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Check logout-reminder |
| 95 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 96 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 95 | +if (isset($_SESSION['show_logout_reminder'])) {
|
|
| 96 | + switch ($_SESSION['show_logout_reminder']['type']) {
|
|
| 97 | 97 | case 'logout_reminder': |
| 98 | 98 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 99 | 99 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | </tr> |
| 148 | 148 | </table>'; |
| 149 | 149 | |
| 150 | -$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
|
| 150 | +$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>'; |
|
| 151 | 151 | |
| 152 | 152 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 153 | 153 | 'username' => $modx->getLoginUserName(), |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 163 | 163 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 164 | 164 | |
| 165 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 165 | +if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 166 | 166 | $html = '<p>[%no_active_users_found%]</p>'; |
| 167 | 167 | } else {
|
| 168 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 168 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
| 169 | 169 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 170 | 170 | $ph['now'] = strftime('%H:%M:%S', $now);
|
| 171 | 171 | $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $userList = array(); |
| 191 | 191 | $userCount = array(); |
| 192 | 192 | // Create userlist with session-count first before output |
| 193 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 193 | + while ($activeusers = $modx->db->getRow($rs)) {
|
|
| 194 | 194 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 195 | 195 | |
| 196 | 196 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | $currentaction |
| 209 | 209 | ); |
| 210 | 210 | } |
| 211 | - foreach($userList as $params) {
|
|
| 211 | + foreach ($userList as $params) {
|
|
| 212 | 212 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 213 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 213 | + $html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $html .= ' |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $ph['OnlineInfo'] = $html; |
| 223 | 223 | |
| 224 | 224 | // include rss feeds for important forum topics |
| 225 | -include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php'); |
|
| 225 | +include_once(MODX_MANAGER_PATH.'includes/rss.inc.php'); |
|
| 226 | 226 | $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content']; |
| 227 | 227 | $ph['modx_news_content'] = $feedData['modx_news_content']; |
| 228 | 228 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | // invoke event OnManagerWelcomePrerender |
| 255 | 255 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 256 | -if(is_array($evtOut)) {
|
|
| 256 | +if (is_array($evtOut)) {
|
|
| 257 | 257 | $output = implode('', $evtOut);
|
| 258 | 258 | $ph['OnManagerWelcomePrerender'] = $output; |
| 259 | 259 | } |
@@ -383,57 +383,57 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | // invoke OnManagerWelcomeHome event |
| 385 | 385 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 386 | -if(is_array($sitewidgets)) {
|
|
| 386 | +if (is_array($sitewidgets)) {
|
|
| 387 | 387 | $newwidgets = array(); |
| 388 | - foreach($sitewidgets as $widget){
|
|
| 388 | + foreach ($sitewidgets as $widget) {
|
|
| 389 | 389 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 390 | 390 | } |
| 391 | 391 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | -usort($widgets, function ($a, $b) {
|
|
| 394 | +usort($widgets, function($a, $b){
|
|
| 395 | 395 | return $a['menuindex'] - $b['menuindex']; |
| 396 | 396 | }); |
| 397 | 397 | |
| 398 | 398 | $tpl = getTplWidget(); |
| 399 | 399 | $output = ''; |
| 400 | -foreach($widgets as $widget) {
|
|
| 401 | - if ($widget['hide'] != '1'){
|
|
| 400 | +foreach ($widgets as $widget) {
|
|
| 401 | + if ($widget['hide'] != '1') {
|
|
| 402 | 402 | $output .= $modx->parseText($tpl, $widget); |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | $ph['widgets'] = $output; |
| 406 | 406 | |
| 407 | 407 | // load template |
| 408 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 409 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 408 | +if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 409 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl'; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | $target = $modx->config['manager_welcome_tpl']; |
| 413 | 413 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 414 | 414 | $target = $modx->mergeSettingsContent($target); |
| 415 | 415 | |
| 416 | -if(substr($target, 0, 1) === '@') {
|
|
| 417 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 416 | +if (substr($target, 0, 1) === '@') {
|
|
| 417 | + if (substr($target, 0, 6) === '@CHUNK') {
|
|
| 418 | 418 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 419 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 419 | + } elseif (substr($target, 0, 5) === '@FILE') {
|
|
| 420 | 420 | $content = file_get_contents(trim(substr($target, 6))); |
| 421 | 421 | } else {
|
| 422 | 422 | $content = ''; |
| 423 | 423 | } |
| 424 | 424 | } else {
|
| 425 | 425 | $chunk = $modx->getChunk($target); |
| 426 | - if($chunk !== false && !empty($chunk)) {
|
|
| 426 | + if ($chunk !== false && !empty($chunk)) {
|
|
| 427 | 427 | $content = $chunk; |
| 428 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 429 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 430 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 431 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 432 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 428 | + } elseif (is_file(MODX_BASE_PATH.$target)) {
|
|
| 429 | + $content = file_get_contents(MODX_BASE_PATH.$target); |
|
| 430 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
|
|
| 431 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl'); |
|
| 432 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible |
|
| 433 | 433 | {
|
| 434 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 434 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html'); |
|
| 435 | 435 | } else {
|
| 436 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 436 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl'); |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $content = $modx->mergeConditionalTagsContent($content); |
| 442 | 442 | $content = $modx->mergeSettingsContent($content); |
| 443 | 443 | $content = $modx->parseText($content, $ph); |
| 444 | -if(strpos($content, '[+') !== false) {
|
|
| 444 | +if (strpos($content, '[+') !== false) {
|
|
| 445 | 445 | $modx->toPlaceholders($ph); |
| 446 | 446 | $content = $modx->mergePlaceholderContent($content); |
| 447 | 447 | } |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 451 | 451 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 452 | 452 | |
| 453 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 453 | +if ($js = $modx->getRegisteredClientScripts()) {
|
|
| 454 | 454 | $content .= $js; |
| 455 | 455 | } |
| 456 | 456 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 461 | 461 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 462 | 462 | //</span> |
| 463 | -function getTplWidget() { // recent document info
|
|
| 463 | +function getTplWidget(){ // recent document info
|
|
| 464 | 464 | return ' |
| 465 | 465 | <div class="[+cols+]" id="[+id+]"> |
| 466 | 466 | <div class="card"[+cardAttr+]> |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | '; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | -function getRecentInfo() { // recent document info
|
|
| 474 | +function getRecentInfo(){ // recent document info
|
|
| 475 | 475 | $modx = evolutionCMS(); |
| 476 | 476 | |
| 477 | 477 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -497,12 +497,12 @@ discard block |
||
| 497 | 497 | return $html; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | -function getRecentInfoList() {
|
|
| 500 | +function getRecentInfoList(){
|
|
| 501 | 501 | $modx = evolutionCMS(); |
| 502 | 502 | |
| 503 | 503 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 504 | 504 | |
| 505 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 505 | + if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 506 | 506 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 507 | 507 | } |
| 508 | 508 | |
@@ -512,20 +512,20 @@ discard block |
||
| 512 | 512 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 513 | 513 | |
| 514 | 514 | $output = array(); |
| 515 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 515 | + while ($ph = $modx->db->getRow($rs)) {
|
|
| 516 | 516 | $docid = $ph['id']; |
| 517 | 517 | $_ = $modx->getUserInfo($ph['editedby']); |
| 518 | 518 | $ph['username'] = $_['username']; |
| 519 | 519 | |
| 520 | - if($ph['deleted'] == 1) {
|
|
| 520 | + if ($ph['deleted'] == 1) {
|
|
| 521 | 521 | $ph['status'] = 'deleted text-danger'; |
| 522 | - } elseif($ph['published'] == 0) {
|
|
| 522 | + } elseif ($ph['published'] == 0) {
|
|
| 523 | 523 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 524 | 524 | } else {
|
| 525 | 525 | $ph['status'] = 'published'; |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | - if($modx->hasPermission('edit_document')) {
|
|
| 528 | + if ($modx->hasPermission('edit_document')) {
|
|
| 529 | 529 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 530 | 530 | } else {
|
| 531 | 531 | $ph['edit_btn'] = ''; |
@@ -540,8 +540,8 @@ discard block |
||
| 540 | 540 | $preview_disabled |
| 541 | 541 | ), $btntpl['preview_btn']); |
| 542 | 542 | |
| 543 | - if($modx->hasPermission('delete_document')) {
|
|
| 544 | - if($ph['deleted'] == 0) {
|
|
| 543 | + if ($modx->hasPermission('delete_document')) {
|
|
| 544 | + if ($ph['deleted'] == 0) {
|
|
| 545 | 545 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
| 546 | 546 | } else {
|
| 547 | 547 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
@@ -551,11 +551,11 @@ discard block |
||
| 551 | 551 | $ph['delete_btn'] = ''; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 554 | + if ($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 555 | 555 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 556 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 556 | + } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 557 | 557 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 558 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 558 | + } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 559 | 559 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 560 | 560 | } else {
|
| 561 | 561 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
@@ -564,16 +564,16 @@ discard block |
||
| 564 | 564 | |
| 565 | 565 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 566 | 566 | |
| 567 | - if($ph['longtitle'] == '') {
|
|
| 567 | + if ($ph['longtitle'] == '') {
|
|
| 568 | 568 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 569 | 569 | } |
| 570 | - if($ph['description'] == '') {
|
|
| 570 | + if ($ph['description'] == '') {
|
|
| 571 | 571 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 572 | 572 | } |
| 573 | - if($ph['introtext'] == '') {
|
|
| 573 | + if ($ph['introtext'] == '') {
|
|
| 574 | 574 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 575 | 575 | } |
| 576 | - if($ph['alias'] == '') {
|
|
| 576 | + if ($ph['alias'] == '') {
|
|
| 577 | 577 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 578 | 578 | } |
| 579 | 579 | |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | return implode("\n", $output);
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | -function getRecentInfoRowTpl() {
|
|
| 585 | +function getRecentInfoRowTpl(){
|
|
| 586 | 586 | $tpl = ' |
| 587 | 587 | <tr> |
| 588 | 588 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -611,11 +611,11 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // setup icons |
| 614 | -function wrapIcon($i, $action) {
|
|
| 614 | +function wrapIcon($i, $action){
|
|
| 615 | 615 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | -function getStartUpScript() {
|
|
| 618 | +function getStartUpScript(){
|
|
| 619 | 619 | $script = ' |
| 620 | 620 | <script type="text/javascript"> |
| 621 | 621 | function hideConfigCheckWarning(key) {
|
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | $action = "", |
| 37 | 37 | $itemid = "", |
| 38 | 38 | $itemname = "" |
| 39 | - ) { |
|
| 39 | + ){ |
|
| 40 | 40 | $modx = evolutionCMS(); |
| 41 | 41 | $this->entry['msg'] = $msg; // writes testmessage to the object |
| 42 | - $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
| 42 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
| 43 | 43 | |
| 44 | 44 | // User Credentials |
| 45 | 45 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
| 46 | 46 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
| 47 | 47 | |
| 48 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
| 48 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
| 49 | 49 | if ($this->entry['itemId'] == 0) { |
| 50 | 50 | $this->entry['itemId'] = "-"; |
| 51 | 51 | } // to stop items having id 0 |
@@ -96,20 +96,20 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
| 98 | 98 | if (!$insert_id) { |
| 99 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError()); |
|
| 99 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
|
| 100 | 100 | } else { |
| 101 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
| 102 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
| 101 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
| 102 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
| 103 | 103 | if (($insert_id % $trim) === 0) { |
| 104 | 104 | $modx->rotate_log('manager_log', $limit, $trim); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - private function getUserIP() { |
|
| 110 | - if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { |
|
| 111 | - if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) { |
|
| 112 | - $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
| 109 | + private function getUserIP(){ |
|
| 110 | + if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
| 111 | + if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) { |
|
| 112 | + $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
| 113 | 113 | return trim($addr[0]); |
| 114 | 114 | } else { |
| 115 | 115 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |