@@ -1,3 +1,5 @@ |
||
| 1 | 1 | <?php namespace EvolutionCMS\Interfaces; |
| 2 | 2 | |
| 3 | -interface ManagerThemeInterface{} |
|
| 3 | +interface ManagerThemeInterface |
|
| 4 | +{ |
|
| 5 | +} |
|
@@ -403,10 +403,12 @@ |
||
| 403 | 403 | $failedlogins += 1; |
| 404 | 404 | |
| 405 | 405 | $fields = array('failedlogincount' => $failedlogins); |
| 406 | - if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
| 406 | + if ($failedlogins >= $failed_allowed) { |
|
| 407 | + //block user for too many fail attempts |
|
| 407 | 408 | { |
| 408 | 409 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
| 409 | 410 | } |
| 411 | + } |
|
| 410 | 412 | |
| 411 | 413 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
| 412 | 414 | |
@@ -710,13 +710,15 @@ discard block |
||
| 710 | 710 | $this->virtualDir = ''; |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | - if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
|
| 713 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
| 714 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
| 714 | 715 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 715 | 716 | if ($this->config['use_alias_path'] == 1) { |
| 716 | 717 | if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
| 717 | 718 | $this->documentMethod = 'id'; |
| 718 | 719 | return $q; |
| 719 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
| 720 | + } else { |
|
| 721 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
| 720 | 722 | $this->documentMethod = 'alias'; |
| 721 | 723 | return $q; |
| 722 | 724 | } |
@@ -724,7 +726,8 @@ discard block |
||
| 724 | 726 | $this->documentMethod = 'id'; |
| 725 | 727 | return $q; |
| 726 | 728 | } |
| 727 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 729 | + } else { |
|
| 730 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 728 | 731 | if ($this->config['friendly_alias_urls'] != 1) { |
| 729 | 732 | $q = $qOrig; |
| 730 | 733 | } |
@@ -754,13 +757,14 @@ discard block |
||
| 754 | 757 | * @param $id |
| 755 | 758 | * @return array|mixed|null|string |
| 756 | 759 | */ |
| 757 | - public function makePageCacheKey($id){ |
|
| 760 | + public function makePageCacheKey($id) |
|
| 761 | + { |
|
| 758 | 762 | $hash = $id; |
| 759 | 763 | $tmp = null; |
| 760 | 764 | $params = array(); |
| 761 | - if(!empty($this->systemCacheKey)){ |
|
| 765 | + if(!empty($this->systemCacheKey)) { |
|
| 762 | 766 | $hash = $this->systemCacheKey; |
| 763 | - }else { |
|
| 767 | + } else { |
|
| 764 | 768 | if (!empty($_GET)) { |
| 765 | 769 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 766 | 770 | $params = $_GET; |
@@ -769,7 +773,7 @@ discard block |
||
| 769 | 773 | } |
| 770 | 774 | } |
| 771 | 775 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
| 772 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 776 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 773 | 777 | $tmp = array_pop($evtOut); |
| 774 | 778 | } |
| 775 | 779 | return empty($tmp) ? $hash : $tmp; |
@@ -1096,7 +1100,8 @@ discard block |
||
| 1096 | 1100 | $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0"; |
| 1097 | 1101 | $result_pub = $this->db->select( 'id', '[+prefix+]site_content', $where); |
| 1098 | 1102 | $this->db->update($field, '[+prefix+]site_content', $where); |
| 1099 | - if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc |
|
| 1103 | + if ($this->db->getRecordCount($result_pub) >= 1) { |
|
| 1104 | +//Event unPublished doc |
|
| 1100 | 1105 | while ($row_pub = $this->db->getRow($result_pub)) { |
| 1101 | 1106 | $this->invokeEvent("OnDocUnPublished", array( |
| 1102 | 1107 | "docid" => $row_pub['id'] |
@@ -1109,7 +1114,8 @@ discard block |
||
| 1109 | 1114 | $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1"; |
| 1110 | 1115 | $result_unpub = $this->db->select( 'id', '[+prefix+]site_content', $where); |
| 1111 | 1116 | $this->db->update($field, '[+prefix+]site_content', $where); |
| 1112 | - if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
|
| 1117 | + if ($this->db->getRecordCount($result_unpub) >= 1) { |
|
| 1118 | +//Event unPublished doc |
|
| 1113 | 1119 | while ($row_unpub = $this->db->getRow($result_unpub)) { |
| 1114 | 1120 | $this->invokeEvent("OnDocUnPublished", array( |
| 1115 | 1121 | "docid" => $row_unpub['id'] |
@@ -1196,10 +1202,18 @@ discard block |
||
| 1196 | 1202 | return array(); |
| 1197 | 1203 | } |
| 1198 | 1204 | $spacer = md5('<<<EVO>>>'); |
| 1199 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1200 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1201 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1202 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1205 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
| 1206 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1207 | + } |
|
| 1208 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
| 1209 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1210 | + } |
|
| 1211 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
| 1212 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1213 | + } |
|
| 1214 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
| 1215 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1216 | + } |
|
| 1203 | 1217 | |
| 1204 | 1218 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1205 | 1219 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1252,7 +1266,8 @@ discard block |
||
| 1252 | 1266 | } |
| 1253 | 1267 | } |
| 1254 | 1268 | |
| 1255 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
| 1269 | + if (!in_array($fetch, $tags)) { |
|
| 1270 | +// Avoid double Matches |
|
| 1256 | 1271 | $tags[] = $fetch; // Fetch |
| 1257 | 1272 | }; |
| 1258 | 1273 | $fetch = ''; // and reset |
@@ -1270,7 +1285,9 @@ discard block |
||
| 1270 | 1285 | } |
| 1271 | 1286 | } |
| 1272 | 1287 | foreach($tags as $i=>$tag) { |
| 1273 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1288 | + if(strpos($tag,$spacer)!==false) { |
|
| 1289 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1290 | + } |
|
| 1274 | 1291 | } |
| 1275 | 1292 | return $tags; |
| 1276 | 1293 | } |
@@ -1310,7 +1327,10 @@ discard block |
||
| 1310 | 1327 | } |
| 1311 | 1328 | |
| 1312 | 1329 | foreach ($matches[1] as $i => $key) { |
| 1313 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1330 | + if(strpos($key,'[+')!==false) { |
|
| 1331 | + continue; |
|
| 1332 | + } |
|
| 1333 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1314 | 1334 | if (substr($key, 0, 1) == '#') { |
| 1315 | 1335 | $key = substr($key, 1); |
| 1316 | 1336 | } // remove # for QuickEdit format |
@@ -2033,7 +2053,8 @@ discard block |
||
| 2033 | 2053 | * @return mixed|string |
| 2034 | 2054 | */ |
| 2035 | 2055 | public function _getSGVar($value) |
| 2036 | - { // Get super globals |
|
| 2056 | + { |
|
| 2057 | +// Get super globals |
|
| 2037 | 2058 | $key = $value; |
| 2038 | 2059 | $_ = $this->config['enable_filter']; |
| 2039 | 2060 | $this->config['enable_filter'] = 1; |
@@ -2438,7 +2459,8 @@ discard block |
||
| 2438 | 2459 | if ($this->config['friendly_urls'] == 1) { |
| 2439 | 2460 | $aliases = array(); |
| 2440 | 2461 | if (is_array($this->documentListing)) { |
| 2441 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
| 2462 | + foreach ($this->documentListing as $path => $docid) { |
|
| 2463 | +// This is big Loop on large site! |
|
| 2442 | 2464 | $aliases[$docid] = $path; |
| 2443 | 2465 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
| 2444 | 2466 | } |
@@ -2471,7 +2493,7 @@ discard block |
||
| 2471 | 2493 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2472 | 2494 | $pref = $this->config['friendly_url_prefix']; |
| 2473 | 2495 | $suff = $this->config['friendly_url_suffix']; |
| 2474 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2496 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
| 2475 | 2497 | global $modx; |
| 2476 | 2498 | $thealias = $aliases[$m[1]]; |
| 2477 | 2499 | $thefolder = $isfolder[$m[1]]; |
@@ -4255,7 +4277,8 @@ discard block |
||
| 4255 | 4277 | if (isset ($this->snippetCache[$snippetName])) { |
| 4256 | 4278 | $snippet = $this->snippetCache[$snippetName]; |
| 4257 | 4279 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
| 4258 | - } else { // not in cache so let's check the db |
|
| 4280 | + } else { |
|
| 4281 | +// not in cache so let's check the db |
|
| 4259 | 4282 | $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
| 4260 | 4283 | $result = $this->db->query($sql); |
| 4261 | 4284 | if ($this->db->getRecordCount($result) == 1) { |
@@ -4756,7 +4779,7 @@ discard block |
||
| 4756 | 4779 | $result = $this->db->makeArray($rs); |
| 4757 | 4780 | |
| 4758 | 4781 | // get default/built-in template variables |
| 4759 | - if(is_array($docRow)){ |
|
| 4782 | + if(is_array($docRow)) { |
|
| 4760 | 4783 | ksort($docRow); |
| 4761 | 4784 | |
| 4762 | 4785 | foreach ($docRow as $key => $value) { |
@@ -5231,12 +5254,16 @@ discard block |
||
| 5231 | 5254 | return ''; |
| 5232 | 5255 | } // nothing to register |
| 5233 | 5256 | if (!is_array($options)) { |
| 5234 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
| 5257 | + if (is_bool($options)) { |
|
| 5258 | + // backward compatibility with old plaintext parameter |
|
| 5235 | 5259 | { |
| 5236 | 5260 | $options = array('plaintext' => $options); |
| 5237 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
| 5261 | + } |
|
| 5262 | + } elseif (is_string($options)) { |
|
| 5263 | + // Also allow script name as 2nd param |
|
| 5238 | 5264 | { |
| 5239 | 5265 | $options = array('name' => $options); |
| 5266 | + } |
|
| 5240 | 5267 | } else { |
| 5241 | 5268 | $options = array(); |
| 5242 | 5269 | } |
@@ -5248,7 +5275,8 @@ discard block |
||
| 5248 | 5275 | unset($overwritepos); // probably unnecessary--just making sure |
| 5249 | 5276 | |
| 5250 | 5277 | $useThisVer = true; |
| 5251 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
| 5278 | + if (isset($this->loadedjscripts[$key])) { |
|
| 5279 | +// a matching script was found |
|
| 5252 | 5280 | // if existing script is a startup script, make sure the candidate is also a startup script |
| 5253 | 5281 | if ($this->loadedjscripts[$key]['startup']) { |
| 5254 | 5282 | $startup = true; |
@@ -5268,7 +5296,8 @@ discard block |
||
| 5268 | 5296 | // overwrite the old script (the position may be important for dependent scripts) |
| 5269 | 5297 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
| 5270 | 5298 | } |
| 5271 | - } else { // Use the original version |
|
| 5299 | + } else { |
|
| 5300 | +// Use the original version |
|
| 5272 | 5301 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
| 5273 | 5302 | // need to move the exisiting script to the head |
| 5274 | 5303 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5393,7 +5422,8 @@ discard block |
||
| 5393 | 5422 | } |
| 5394 | 5423 | |
| 5395 | 5424 | $results = null; |
| 5396 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
| 5425 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
| 5426 | +// start for loop |
|
| 5397 | 5427 | if ($this->dumpPlugins) { |
| 5398 | 5428 | $eventtime = $this->getMicroTime(); |
| 5399 | 5429 | } |
@@ -5538,8 +5568,7 @@ discard block |
||
| 5538 | 5568 | } |
| 5539 | 5569 | } |
| 5540 | 5570 | } |
| 5541 | - } |
|
| 5542 | - elseif(\is_array($propertyString)) { |
|
| 5571 | + } elseif(\is_array($propertyString)) { |
|
| 5543 | 5572 | $property = $propertyString; |
| 5544 | 5573 | } |
| 5545 | 5574 | if (!empty($elementName) && !empty($elementType)) { |
@@ -5946,7 +5975,8 @@ discard block |
||
| 5946 | 5975 | * @return bool |
| 5947 | 5976 | */ |
| 5948 | 5977 | public function isSafeCode($phpcode = '', $safe_functions = '') |
| 5949 | - { // return true or false |
|
| 5978 | + { |
|
| 5979 | +// return true or false |
|
| 5950 | 5980 | if ($safe_functions == '') { |
| 5951 | 5981 | return false; |
| 5952 | 5982 | } |
@@ -6355,7 +6385,7 @@ discard block |
||
| 6355 | 6385 | $args = array_pad(array(), $_, '$var'); |
| 6356 | 6386 | $args = implode(", ", $args); |
| 6357 | 6387 | $modx = &$this; |
| 6358 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6388 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
| 6359 | 6389 | $arg = $val['args'][$tmp - 1]; |
| 6360 | 6390 | switch (true) { |
| 6361 | 6391 | case is_null($arg): { |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | $style_path = 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
| 12 | 12 | $modx->config['mgr_date_picker_path'] = 'media/calendar/datepicker.inc.php'; |
| 13 | -if(!$modx->config['lang_code']) {
|
|
| 13 | +if(!$modx->config['lang_code']) { |
|
| 14 | 14 | global $modx_lang_attribute; |
| 15 | 15 | $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if(!empty($_GET['a']) && $_GET['a'] == 2) {
|
|
| 18 | +if(!empty($_GET['a']) && $_GET['a'] == 2) { |
|
| 19 | 19 | include_once('welcome.php');
|
| 20 | 20 | } |
| 21 | 21 | |
@@ -262,68 +262,68 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | // actions buttons templates |
| 264 | 264 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
| 265 | -if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) {
|
|
| 265 | +if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) { |
|
| 266 | 266 | $_REQUEST['stay'] = 2; |
| 267 | 267 | } |
| 268 | -if (isset($_REQUEST['stay'])) {
|
|
| 268 | +if (isset($_REQUEST['stay'])) { |
|
| 269 | 269 | $_SESSION['stay'] = $_REQUEST['stay']; |
| 270 | -} else if (isset($_SESSION['stay'])) {
|
|
| 270 | +} else if (isset($_SESSION['stay'])) { |
|
| 271 | 271 | $_REQUEST['stay'] = $_SESSION['stay']; |
| 272 | 272 | } |
| 273 | 273 | $stay = isset($_REQUEST['stay']) ? $_REQUEST['stay'] : ''; |
| 274 | 274 | $addnew = 0; |
| 275 | 275 | $run = 0; |
| 276 | -switch($action) {
|
|
| 276 | +switch($action) { |
|
| 277 | 277 | case '3': |
| 278 | 278 | case '4': |
| 279 | 279 | case '27': |
| 280 | 280 | case '72': |
| 281 | - if($modx->hasPermission('new_document')) {
|
|
| 281 | + if($modx->hasPermission('new_document')) { |
|
| 282 | 282 | $addnew = 1; |
| 283 | 283 | } |
| 284 | 284 | break; |
| 285 | 285 | case '16': |
| 286 | 286 | case '19': |
| 287 | - if($modx->hasPermission('new_template')) {
|
|
| 287 | + if($modx->hasPermission('new_template')) { |
|
| 288 | 288 | $addnew = 1; |
| 289 | 289 | } |
| 290 | 290 | break; |
| 291 | 291 | case '300': |
| 292 | 292 | case '301': |
| 293 | - if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) {
|
|
| 293 | + if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
| 294 | 294 | $addnew = 1; |
| 295 | 295 | } |
| 296 | 296 | break; |
| 297 | 297 | case '77': |
| 298 | 298 | case '78': |
| 299 | - if($modx->hasPermission('new_chunk')) {
|
|
| 299 | + if($modx->hasPermission('new_chunk')) { |
|
| 300 | 300 | $addnew = 1; |
| 301 | 301 | } |
| 302 | 302 | break; |
| 303 | 303 | case '22': |
| 304 | 304 | case '23': |
| 305 | - if($modx->hasPermission('new_snippet')) {
|
|
| 305 | + if($modx->hasPermission('new_snippet')) { |
|
| 306 | 306 | $addnew = 1; |
| 307 | 307 | } |
| 308 | 308 | break; |
| 309 | 309 | case '101': |
| 310 | 310 | case '102': |
| 311 | - if($modx->hasPermission('new_plugin')) {
|
|
| 311 | + if($modx->hasPermission('new_plugin')) { |
|
| 312 | 312 | $addnew = 1; |
| 313 | 313 | } |
| 314 | 314 | break; |
| 315 | 315 | case '106': |
| 316 | 316 | case '107': |
| 317 | 317 | case '108': |
| 318 | - if($modx->hasPermission('new_module')) {
|
|
| 318 | + if($modx->hasPermission('new_module')) { |
|
| 319 | 319 | $addnew = 1; |
| 320 | 320 | } |
| 321 | - if($modx->hasPermission('exec_module')) {
|
|
| 321 | + if($modx->hasPermission('exec_module')) { |
|
| 322 | 322 | $run = 1; |
| 323 | 323 | } |
| 324 | 324 | break; |
| 325 | 325 | case '88': |
| 326 | - if($modx->hasPermission('new_web_user')) {
|
|
| 326 | + if($modx->hasPermission('new_web_user')) { |
|
| 327 | 327 | $addnew = 1; |
| 328 | 328 | } |
| 329 | 329 | break; |
@@ -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,7 +16,7 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 19 | +if($modx->hasPermission('messages')) { |
|
| 20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -33,46 +33,46 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $iconTpl = $modx->getChunk('manager#welcome\WrapIcon');
|
| 35 | 35 | // setup icons |
| 36 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 36 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
| 37 | 37 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 38 | 38 | $ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75); |
| 39 | 39 | } |
| 40 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 40 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
| 41 | 41 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 42 | 42 | $ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99); |
| 43 | 43 | } |
| 44 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 44 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
| 45 | 45 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 46 | 46 | $ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106); |
| 47 | 47 | } |
| 48 | -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 | +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')) { |
|
| 49 | 49 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 50 | 50 | $ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76); |
| 51 | 51 | } |
| 52 | -if($modx->hasPermission('bk_manager')) {
|
|
| 52 | +if($modx->hasPermission('bk_manager')) { |
|
| 53 | 53 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 54 | 54 | $ph['BackupIcon'] = sprintf($iconTpl,$icon, 93); |
| 55 | 55 | } |
| 56 | -if($modx->hasPermission('help')) {
|
|
| 56 | +if($modx->hasPermission('help')) { |
|
| 57 | 57 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 58 | 58 | $ph['HelpIcon'] = sprintf($iconTpl,$icon, 9); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -if($modx->hasPermission('new_document')) {
|
|
| 61 | +if($modx->hasPermission('new_document')) { |
|
| 62 | 62 | $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]'; |
| 63 | 63 | $ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4); |
| 64 | 64 | $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]'; |
| 65 | 65 | $ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72); |
| 66 | 66 | } |
| 67 | -if($modx->hasPermission('assets_images')) {
|
|
| 67 | +if($modx->hasPermission('assets_images')) { |
|
| 68 | 68 | $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]'; |
| 69 | 69 | $ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72); |
| 70 | 70 | } |
| 71 | -if($modx->hasPermission('assets_files')) {
|
|
| 71 | +if($modx->hasPermission('assets_files')) { |
|
| 72 | 72 | $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]'; |
| 73 | 73 | $ph['FilesIcon'] = sprintf($iconTpl,$icon, 72); |
| 74 | 74 | } |
| 75 | -if($modx->hasPermission('change_password')) {
|
|
| 75 | +if($modx->hasPermission('change_password')) { |
|
| 76 | 76 | $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]'; |
| 77 | 77 | $ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28); |
| 78 | 78 | } |
@@ -80,21 +80,21 @@ discard block |
||
| 80 | 80 | $ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8); |
| 81 | 81 | |
| 82 | 82 | // do some config checks |
| 83 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 83 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
| 84 | 84 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
| 85 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 85 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
| 86 | 86 | $ph['config_check_results'] = $config_check_results; |
| 87 | 87 | $ph['config_display'] = 'block'; |
| 88 | - } else {
|
|
| 88 | + } else { |
|
| 89 | 89 | $ph['config_display'] = 'none'; |
| 90 | 90 | } |
| 91 | -} else {
|
|
| 91 | +} else { |
|
| 92 | 92 | $ph['config_display'] = 'none'; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Check logout-reminder |
| 96 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 97 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 96 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
| 97 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
| 98 | 98 | case 'logout_reminder': |
| 99 | 99 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 100 | 100 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | $ph['show_logout_reminder'] = 'block'; |
| 104 | 104 | unset($_SESSION['show_logout_reminder']); |
| 105 | -} else {
|
|
| 105 | +} else { |
|
| 106 | 106 | $ph['show_logout_reminder'] = 'none'; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 164 | 164 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 165 | 165 | |
| 166 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 166 | +if($modx->db->getRecordCount($rs) < 1) { |
|
| 167 | 167 | $html = '<p>[%no_active_users_found%]</p>'; |
| 168 | -} else {
|
|
| 168 | +} else { |
|
| 169 | 169 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
| 170 | 170 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 171 | 171 | $ph['now'] = strftime('%H:%M:%S', $now);
|
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $userList = array(); |
| 192 | 192 | $userCount = array(); |
| 193 | 193 | // Create userlist with session-count first before output |
| 194 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 194 | + while($activeusers = $modx->db->getRow($rs)) { |
|
| 195 | 195 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 196 | 196 | |
| 197 | 197 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $currentaction |
| 210 | 210 | ); |
| 211 | 211 | } |
| 212 | - foreach($userList as $params) {
|
|
| 212 | + foreach($userList as $params) { |
|
| 213 | 213 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 214 | 214 | $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);
|
| 215 | 215 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | // invoke event OnManagerWelcomePrerender |
| 256 | 256 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 257 | -if(is_array($evtOut)) {
|
|
| 257 | +if(is_array($evtOut)) { |
|
| 258 | 258 | $output = implode('', $evtOut);
|
| 259 | 259 | $ph['OnManagerWelcomePrerender'] = $output; |
| 260 | 260 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
| 360 | 360 | 'hide'=>'0' |
| 361 | 361 | ); |
| 362 | -if ($modx->config['rss_url_news']) {
|
|
| 362 | +if ($modx->config['rss_url_news']) { |
|
| 363 | 363 | $widgets['news'] = array( |
| 364 | 364 | 'menuindex' => '40', |
| 365 | 365 | 'id' => 'news', |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | 'hide'=>'0' |
| 371 | 371 | ); |
| 372 | 372 | } |
| 373 | -if ($modx->config['rss_url_security']) {
|
|
| 373 | +if ($modx->config['rss_url_security']) { |
|
| 374 | 374 | $widgets['security'] = array( |
| 375 | 375 | 'menuindex' => '50', |
| 376 | 376 | 'id' => 'security', |
@@ -384,29 +384,29 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | // invoke OnManagerWelcomeHome event |
| 386 | 386 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 387 | -if(is_array($sitewidgets)) {
|
|
| 387 | +if(is_array($sitewidgets)) { |
|
| 388 | 388 | $newwidgets = array(); |
| 389 | - foreach($sitewidgets as $widget){
|
|
| 389 | + foreach($sitewidgets as $widget) { |
|
| 390 | 390 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 391 | 391 | } |
| 392 | 392 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | -usort($widgets, function ($a, $b) {
|
|
| 395 | +usort($widgets, function ($a, $b){ |
|
| 396 | 396 | return $a['menuindex'] - $b['menuindex']; |
| 397 | 397 | }); |
| 398 | 398 | |
| 399 | 399 | $tpl = $modx->getChunk('manager#welcome\Widget');
|
| 400 | 400 | $output = ''; |
| 401 | -foreach($widgets as $widget) {
|
|
| 402 | - if ($widget['hide'] != '1'){
|
|
| 401 | +foreach($widgets as $widget) { |
|
| 402 | + if ($widget['hide'] != '1') { |
|
| 403 | 403 | $output .= $modx->parseText($tpl, $widget); |
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | $ph['widgets'] = $output; |
| 407 | 407 | |
| 408 | 408 | // load template |
| 409 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 409 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
| 410 | 410 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
| 411 | 411 | } |
| 412 | 412 | |
@@ -414,26 +414,28 @@ discard block |
||
| 414 | 414 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 415 | 415 | $target = $modx->mergeSettingsContent($target); |
| 416 | 416 | |
| 417 | -if(substr($target, 0, 1) === '@') {
|
|
| 418 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 417 | +if(substr($target, 0, 1) === '@') { |
|
| 418 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
| 419 | 419 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 420 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 420 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
| 421 | 421 | $content = file_get_contents(trim(substr($target, 6))); |
| 422 | - } else {
|
|
| 422 | + } else { |
|
| 423 | 423 | $content = ''; |
| 424 | 424 | } |
| 425 | -} else {
|
|
| 425 | +} else { |
|
| 426 | 426 | $chunk = $modx->getChunk($target); |
| 427 | - if($chunk !== false && !empty($chunk)) {
|
|
| 427 | + if($chunk !== false && !empty($chunk)) { |
|
| 428 | 428 | $content = $chunk; |
| 429 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 429 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 430 | 430 | $content = file_get_contents(MODX_BASE_PATH . $target); |
| 431 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 431 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
| 432 | 432 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
| 433 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 433 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
| 434 | + // ClipperCMS compatible |
|
| 434 | 435 | {
|
| 435 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 436 | - } else {
|
|
| 436 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 437 | + } |
|
| 438 | + } else { |
|
| 437 | 439 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
| 438 | 440 | } |
| 439 | 441 | } |
@@ -442,7 +444,7 @@ discard block |
||
| 442 | 444 | $content = $modx->mergeConditionalTagsContent($content); |
| 443 | 445 | $content = $modx->mergeSettingsContent($content); |
| 444 | 446 | $content = $modx->parseText($content, $ph); |
| 445 | -if(strpos($content, '[+') !== false) {
|
|
| 447 | +if(strpos($content, '[+') !== false) { |
|
| 446 | 448 | $modx->toPlaceholders($ph); |
| 447 | 449 | $content = $modx->mergePlaceholderContent($content); |
| 448 | 450 | } |
@@ -451,7 +453,7 @@ discard block |
||
| 451 | 453 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 452 | 454 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 453 | 455 | |
| 454 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 456 | +if($js = $modx->getRegisteredClientScripts()) { |
|
| 455 | 457 | $content .= $js; |
| 456 | 458 | } |
| 457 | 459 | |