Completed
Pull Request — develop (#718)
by
unknown
10:49
created
manager/includes/log.class.inc.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,7 +105,8 @@  discard block
 block discarded – undo
105 105
         }
106 106
     }
107 107
 
108
-    private function getUserIP() {
108
+    private function getUserIP()
109
+    {
109 110
         if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
110 111
             if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) {
111 112
                 $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
@@ -113,8 +114,7 @@  discard block
 block discarded – undo
113 114
             } else {
114 115
                 return $_SERVER['HTTP_X_FORWARDED_FOR'];
115 116
             }
116
-        }
117
-        else {
117
+        } else {
118 118
             return $_SERVER['REMOTE_ADDR'];
119 119
         }
120 120
     }
Please login to merge, or discard this patch.
manager/frames/1.php 1 patch
Braces   +31 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 header("X-XSS-Protection: 0");
@@ -11,22 +11,22 @@  discard block
 block discarded – undo
11 11
 
12 12
 $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en';
13 13
 
14
-if (!isset($modx->config['manager_menu_height'])) {
14
+if (!isset($modx->config['manager_menu_height'])) {
15 15
     $modx->config['manager_menu_height'] = 2.2; // rem
16 16
 }
17 17
 
18
-if (!isset($modx->config['manager_tree_width'])) {
18
+if (!isset($modx->config['manager_tree_width'])) {
19 19
     $modx->config['manager_tree_width'] = 20; // rem
20 20
 }
21 21
 
22
-if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) {
22
+if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) {
23 23
     $initMainframeAction = $_SESSION['onLoginForwardToAction'];
24 24
     unset($_SESSION['onLoginForwardToAction']);
25
-} else {
25
+} else {
26 26
     $initMainframeAction = 2; // welcome.static
27 27
 }
28 28
 
29
-if (!isset($_SESSION['tree_show_only_folders'])) {
29
+if (!isset($_SESSION['tree_show_only_folders'])) {
30 30
     $_SESSION['tree_show_only_folders'] = 0;
31 31
 }
32 32
 
@@ -35,29 +35,29 @@  discard block
 block discarded – undo
35 35
 $tree_width = $modx->config['manager_tree_width'];
36 36
 $tree_min_width = 0;
37 37
 
38
-if (isset($_COOKIE['MODX_widthSideBar'])) {
38
+if (isset($_COOKIE['MODX_widthSideBar'])) {
39 39
     $MODX_widthSideBar = $_COOKIE['MODX_widthSideBar'];
40
-} else {
40
+} else {
41 41
     $MODX_widthSideBar = $tree_width;
42 42
 }
43 43
 
44
-if (!$MODX_widthSideBar) {
44
+if (!$MODX_widthSideBar) {
45 45
     $body_class .= 'sidebar-closed';
46 46
 }
47 47
 
48 48
 $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
49
-if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
49
+if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
50 50
     $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']];
51
-} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
51
+} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
52 52
     $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']];
53 53
 }
54 54
 
55 55
 $navbar_position = $modx->config['manager_menu_position'];
56
-if ($navbar_position == 'left') {
56
+if ($navbar_position == 'left') {
57 57
     $body_class .= ' navbar-left navbar-left-icon-and-text';
58 58
 }
59 59
 
60
-if (isset($modx->pluginCache['ElementsInTree'])) {
60
+if (isset($modx->pluginCache['ElementsInTree'])) {
61 61
     $body_class .= ' ElementsInTree';
62 62
 }
63 63
 
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
     'type8' => $_lang["lock_element_type_8"]
74 74
 );
75 75
 
76
-foreach ($unlockTranslations as $key => $value) {
76
+foreach ($unlockTranslations as $key => $value) {
77 77
     $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
78 78
 }
79 79
 
80 80
 $user = $modx->getUserInfo($modx->getLoginUserID());
81
-if ($user['which_browser'] == 'default') {
81
+if ($user['which_browser'] == 'default') {
82 82
     $user['which_browser'] = $modx->config['which_browser'];
83 83
 }
84 84
 
85 85
 $css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime;
86 86
 
87
-if ($modx->config['manager_theme'] == 'default') {
88
-    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
87
+if ($modx->config['manager_theme'] == 'default') {
88
+    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
89 89
         require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php';
90 90
         $minifier = new Formatter\CSSMinify();
91 91
         $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css');
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $css = $minifier->minify();
103 103
         file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css);
104 104
     }
105
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
105
+    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
106 106
         $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
107 107
     }
108 108
 }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     <?php
258 258
     // invoke OnManagerTopPrerender event
259 259
     $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST);
260
-    if (is_array($evtOut)) {
260
+    if (is_array($evtOut)) {
261 261
         echo implode("\n", $evtOut);
262 262
     }
263 263
     ?>
@@ -428,11 +428,14 @@  discard block
 block discarded – undo
428 428
             <div id="evo-tab-page-home" class="evo-tab-page show iframe-scroller">
429 429
                 <iframe id="mainframe" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe>
430 430
             </div>
431
-        <?php else: ?>
431
+        <?php else {
432
+    : ?>
432 433
             <div class="iframe-scroller">
433 434
                 <iframe id="mainframe" name="main" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe>
434 435
             </div>
435
-        <?php endif; ?>
436
+        <?php endif;
437
+}
438
+?>
436 439
         <script>
437 440
             if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
438 441
                 document.getElementById('mainframe').setAttribute('scrolling', 'no');
@@ -451,11 +454,11 @@  discard block
 block discarded – undo
451 454
             'tree_sortdir',
452 455
             'tree_nodename'
453 456
         );
454
-        foreach ($sortParams as $param) {
455
-            if (isset($_REQUEST[$param])) {
457
+        foreach ($sortParams as $param) {
458
+            if (isset($_REQUEST[$param])) {
456 459
                 $modx->manager->saveLastUserSetting($param, $_REQUEST[$param]);
457 460
                 $_SESSION[$param] = $_REQUEST[$param];
458
-            } else if (!isset($_SESSION[$param])) {
461
+            } else if (!isset($_SESSION[$param])) {
459 462
                 $_SESSION[$param] = $modx->manager->getLastUserSetting($param);
460 463
             }
461 464
         }
@@ -541,9 +544,9 @@  discard block
 block discarded – undo
541 544
      * @param string $text
542 545
      * @param bool $allowed
543 546
      */
544
-    function constructLink($action, $img, $text, $allowed)
545
-    {
546
-        if ((bool)$allowed) {
547
+    function constructLink($action, $img, $text, $allowed)
548
+    {
549
+        if ((bool)$allowed) {
547 550
             echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action);
548 551
             echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
549 552
         }
@@ -648,7 +651,7 @@  discard block
 block discarded – undo
648 651
     ?>
649 652
 
650 653
 </div>
651
-<?php if ($modx->config['show_picker'] != "0") {
654
+<?php if ($modx->config['show_picker'] != "0") {
652 655
     include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
653 656
 } ?>
654 657
 </body>
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 1 patch
Braces   +59 added lines, -28 removed lines patch added patch discarded remove patch
@@ -701,13 +701,15 @@  discard block
 block discarded – undo
701 701
             $this->virtualDir = '';
702 702
         }
703 703
 
704
-        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 */
704
+        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) {
705
+/* we got an ID returned, check to make sure it's not an alias */
705 706
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
706 707
             if ($this->config['use_alias_path'] == 1) {
707 708
                 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))))) {
708 709
                     $this->documentMethod = 'id';
709 710
                     return $q;
710
-                } else { /* not a valid id in terms of virtualDir, treat as alias */
711
+                } else {
712
+/* not a valid id in terms of virtualDir, treat as alias */
711 713
                     $this->documentMethod = 'alias';
712 714
                     return $q;
713 715
                 }
@@ -715,7 +717,8 @@  discard block
 block discarded – undo
715 717
                 $this->documentMethod = 'id';
716 718
                 return $q;
717 719
             }
718
-        } else { /* we didn't get an ID back, so instead we assume it's an alias */
720
+        } else {
721
+/* we didn't get an ID back, so instead we assume it's an alias */
719 722
             if ($this->config['friendly_alias_urls'] != 1) {
720 723
                 $q = $qOrig;
721 724
             }
@@ -745,13 +748,14 @@  discard block
 block discarded – undo
745 748
      * @param $id
746 749
      * @return array|mixed|null|string
747 750
      */
748
-    public function makePageCacheKey($id){
751
+    public function makePageCacheKey($id)
752
+    {
749 753
         $hash = $id;
750 754
         $tmp = null;
751 755
         $params = array();
752
-        if(!empty($this->systemCacheKey)){
756
+        if(!empty($this->systemCacheKey)) {
753 757
             $hash = $this->systemCacheKey;
754
-        }else {
758
+        } else {
755 759
             if (!empty($_GET)) {
756 760
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
757 761
                 $params = $_GET;
@@ -760,7 +764,7 @@  discard block
 block discarded – undo
760 764
             }
761 765
         }
762 766
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
763
-        if (is_array($evtOut) && count($evtOut) > 0){
767
+        if (is_array($evtOut) && count($evtOut) > 0) {
764 768
             $tmp = array_pop($evtOut);
765 769
         }
766 770
         return empty($tmp) ? $hash : $tmp;
@@ -1087,7 +1091,8 @@  discard block
 block discarded – undo
1087 1091
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1088 1092
         $result_pub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1089 1093
         $this->db->update($field, '[+prefix+]site_content', $where);
1090
-        if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1094
+        if ($this->db->getRecordCount($result_pub) >= 1) {
1095
+//Event unPublished doc
1091 1096
             while ($row_pub = $this->db->getRow($result_pub)) {
1092 1097
                 $this->invokeEvent("OnDocUnPublished", array(
1093 1098
                     "docid" => $row_pub['id']
@@ -1100,7 +1105,8 @@  discard block
 block discarded – undo
1100 1105
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1101 1106
         $result_unpub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1102 1107
         $this->db->update($field, '[+prefix+]site_content', $where);
1103
-        if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1108
+        if ($this->db->getRecordCount($result_unpub) >= 1) {
1109
+//Event unPublished doc
1104 1110
             while ($row_unpub = $this->db->getRow($result_unpub)) {
1105 1111
                 $this->invokeEvent("OnDocUnPublished", array(
1106 1112
                     "docid" => $row_unpub['id']
@@ -1187,10 +1193,18 @@  discard block
 block discarded – undo
1187 1193
             return array();
1188 1194
         }
1189 1195
         $spacer = md5('<<<EVO>>>');
1190
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1191
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1192
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1193
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1196
+        if($left==='{{' && strpos($content,';}}')!==false) {
1197
+            $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1198
+        }
1199
+        if($left==='{{' && strpos($content,'{{}}')!==false) {
1200
+            $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1201
+        }
1202
+        if($left==='[[' && strpos($content,']]]]')!==false) {
1203
+            $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1204
+        }
1205
+        if($left==='[[' && strpos($content,']]]')!==false) {
1206
+            $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1207
+        }
1194 1208
 
1195 1209
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1196 1210
         $pos[']]>'] = strpos($content, ']]>');
@@ -1243,7 +1257,8 @@  discard block
 block discarded – undo
1243 1257
                         }
1244 1258
                     }
1245 1259
 
1246
-                    if (!in_array($fetch, $tags)) {  // Avoid double Matches
1260
+                    if (!in_array($fetch, $tags)) {
1261
+// Avoid double Matches
1247 1262
                         $tags[] = $fetch; // Fetch
1248 1263
                     };
1249 1264
                     $fetch = ''; // and reset
@@ -1261,7 +1276,9 @@  discard block
 block discarded – undo
1261 1276
             }
1262 1277
         }
1263 1278
         foreach($tags as $i=>$tag) {
1264
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1279
+            if(strpos($tag,$spacer)!==false) {
1280
+                $tags[$i] = str_replace($spacer, '', $tag);
1281
+            }
1265 1282
         }
1266 1283
         return $tags;
1267 1284
     }
@@ -1301,7 +1318,10 @@  discard block
 block discarded – undo
1301 1318
         }
1302 1319
 
1303 1320
         foreach ($matches[1] as $i => $key) {
1304
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1321
+            if(strpos($key,'[+')!==false) {
1322
+                continue;
1323
+            }
1324
+            // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1305 1325
             if (substr($key, 0, 1) == '#') {
1306 1326
                 $key = substr($key, 1);
1307 1327
             } // remove # for QuickEdit format
@@ -2026,7 +2046,8 @@  discard block
 block discarded – undo
2026 2046
      * @return mixed|string
2027 2047
      */
2028 2048
     public function _getSGVar($value)
2029
-    { // Get super globals
2049
+    {
2050
+// Get super globals
2030 2051
         $key = $value;
2031 2052
         $_ = $this->config['enable_filter'];
2032 2053
         $this->config['enable_filter'] = 1;
@@ -2430,7 +2451,8 @@  discard block
 block discarded – undo
2430 2451
         if ($this->config['friendly_urls'] == 1) {
2431 2452
             $aliases = array();
2432 2453
             if (is_array($this->documentListing)) {
2433
-                foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site!
2454
+                foreach ($this->documentListing as $path => $docid) {
2455
+// This is big Loop on large site!
2434 2456
                     $aliases[$docid] = $path;
2435 2457
                     $isfolder[$docid] = $this->aliasListing[$docid]['isfolder'];
2436 2458
                 }
@@ -2463,7 +2485,7 @@  discard block
 block discarded – undo
2463 2485
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2464 2486
             $pref = $this->config['friendly_url_prefix'];
2465 2487
             $suff = $this->config['friendly_url_suffix'];
2466
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2488
+            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){
2467 2489
                 global $modx;
2468 2490
                 $thealias = $aliases[$m[1]];
2469 2491
                 $thefolder = $isfolder[$m[1]];
@@ -4239,7 +4261,8 @@  discard block
 block discarded – undo
4239 4261
         if (isset ($this->snippetCache[$snippetName])) {
4240 4262
             $snippet = $this->snippetCache[$snippetName];
4241 4263
             $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4242
-        } else { // not in cache so let's check the db
4264
+        } else {
4265
+// not in cache so let's check the db
4243 4266
             $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;";
4244 4267
             $result = $this->db->query($sql);
4245 4268
             if ($this->db->getRecordCount($result) == 1) {
@@ -4740,7 +4763,7 @@  discard block
 block discarded – undo
4740 4763
             $result = $this->db->makeArray($rs);
4741 4764
 
4742 4765
             // get default/built-in template variables
4743
-            if(is_array($docRow)){
4766
+            if(is_array($docRow)) {
4744 4767
                 ksort($docRow);
4745 4768
 
4746 4769
                 foreach ($docRow as $key => $value) {
@@ -5219,12 +5242,16 @@  discard block
 block discarded – undo
5219 5242
             return '';
5220 5243
         } // nothing to register
5221 5244
         if (!is_array($options)) {
5222
-            if (is_bool($options))  // backward compatibility with old plaintext parameter
5245
+            if (is_bool($options)) {
5246
+                // backward compatibility with old plaintext parameter
5223 5247
             {
5224 5248
                 $options = array('plaintext' => $options);
5225
-            } elseif (is_string($options)) // Also allow script name as 2nd param
5249
+            }
5250
+            } elseif (is_string($options)) {
5251
+                // Also allow script name as 2nd param
5226 5252
             {
5227 5253
                 $options = array('name' => $options);
5254
+            }
5228 5255
             } else {
5229 5256
                 $options = array();
5230 5257
             }
@@ -5236,7 +5263,8 @@  discard block
 block discarded – undo
5236 5263
         unset($overwritepos); // probably unnecessary--just making sure
5237 5264
 
5238 5265
         $useThisVer = true;
5239
-        if (isset($this->loadedjscripts[$key])) { // a matching script was found
5266
+        if (isset($this->loadedjscripts[$key])) {
5267
+// a matching script was found
5240 5268
             // if existing script is a startup script, make sure the candidate is also a startup script
5241 5269
             if ($this->loadedjscripts[$key]['startup']) {
5242 5270
                 $startup = true;
@@ -5256,7 +5284,8 @@  discard block
 block discarded – undo
5256 5284
                     // overwrite the old script (the position may be important for dependent scripts)
5257 5285
                     $overwritepos = $this->loadedjscripts[$key]['pos'];
5258 5286
                 }
5259
-            } else { // Use the original version
5287
+            } else {
5288
+// Use the original version
5260 5289
                 if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) {
5261 5290
                     // need to move the exisiting script to the head
5262 5291
                     $version = $this->loadedjscripts[$key][$version];
@@ -5381,7 +5410,8 @@  discard block
 block discarded – undo
5381 5410
         }
5382 5411
 
5383 5412
         $results = null;
5384
-        foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop
5413
+        foreach ($this->pluginEvent[$evtName] as $pluginName) {
5414
+// start for loop
5385 5415
             if ($this->dumpPlugins) {
5386 5416
                 $eventtime = $this->getMicroTime();
5387 5417
             }
@@ -5929,7 +5959,8 @@  discard block
 block discarded – undo
5929 5959
      * @return bool
5930 5960
      */
5931 5961
     public function isSafeCode($phpcode = '', $safe_functions = '')
5932
-    { // return true or false
5962
+    {
5963
+// return true or false
5933 5964
         if ($safe_functions == '') {
5934 5965
             return false;
5935 5966
         }
@@ -6345,7 +6376,7 @@  discard block
 block discarded – undo
6345 6376
             $args = array_pad(array(), $_, '$var');
6346 6377
             $args = implode(", ", $args);
6347 6378
             $modx = &$this;
6348
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6379
+            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){
6349 6380
                 $arg = $val['args'][$tmp - 1];
6350 6381
                 switch (true) {
6351 6382
                     case is_null($arg): {
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 1 patch
Braces   +81 added lines, -71 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
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,21 +79,21 @@  discard block
 block discarded – undo
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) {
82
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83 83
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
-	if($config_check_results != $_lang['configcheck_ok']) {
84
+	if($config_check_results != $_lang['configcheck_ok']) {
85 85
 		$ph['config_check_results'] = $config_check_results;
86 86
 		$ph['config_display'] = 'block';
87
-	} else {
87
+	} else {
88 88
 		$ph['config_display'] = 'none';
89 89
 	}
90
-} else {
90
+} else {
91 91
 	$ph['config_display'] = 'none';
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']);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	$ph['show_logout_reminder'] = 'block';
103 103
 	unset($_SESSION['show_logout_reminder']);
104
-} else {
104
+} else {
105 105
 	$ph['show_logout_reminder'] = 'none';
106 106
 }
107 107
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
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
-} else {
167
+} else {
168 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);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
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,7 +208,7 @@  discard block
 block discarded – undo
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 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
 	}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
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
 }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
359 359
 	'hide'=>'0'
360 360
 );
361
-if ($modx->config['rss_url_news']) {
361
+if ($modx->config['rss_url_news']) {
362 362
     $widgets['news'] = array(
363 363
         'menuindex' => '40',
364 364
         'id' => 'news',
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         'hide'=>'0'
370 370
     );
371 371
 }
372
-if ($modx->config['rss_url_security']) {
372
+if ($modx->config['rss_url_security']) {
373 373
     $widgets['security'] = array(
374 374
         'menuindex' => '50',
375 375
         'id' => 'security',
@@ -383,29 +383,29 @@  discard block
 block discarded – undo
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'])) {
408
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409 409
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
410 410
 }
411 411
 
@@ -413,26 +413,28 @@  discard block
 block discarded – undo
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
-	} else {
421
+	} else {
422 422
 		$content = '';
423 423
 	}
424
-} else {
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)) {
428
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
429 429
 		$content = file_get_contents(MODX_BASE_PATH . $target);
430
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
430
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431 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
432
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
433
+	    // ClipperCMS compatible
433 434
 	{
434
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
-	} else {
435
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
436
+	}
437
+	} else {
436 438
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437 439
 	}
438 440
 }
@@ -441,7 +443,7 @@  discard block
 block discarded – undo
441 443
 $content = $modx->mergeConditionalTagsContent($content);
442 444
 $content = $modx->mergeSettingsContent($content);
443 445
 $content = $modx->parseText($content, $ph);
444
-if(strpos($content, '[+') !== false) {
446
+if(strpos($content, '[+') !== false) {
445 447
 	$modx->toPlaceholders($ph);
446 448
 	$content = $modx->mergePlaceholderContent($content);
447 449
 }
@@ -450,7 +452,7 @@  discard block
 block discarded – undo
450 452
 $content = $modx->parseText($content, $_style, '[&', '&]');
451 453
 $content = $modx->cleanUpMODXTags($content); //cleanup
452 454
 
453
-if($js = $modx->getRegisteredClientScripts()) {
455
+if($js = $modx->getRegisteredClientScripts()) {
454 456
 	$content .= $js;
455 457
 }
456 458
 
@@ -460,7 +462,9 @@  discard block
 block discarded – undo
460 462
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
461 463
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
462 464
 //</span>
463
-function getTplWidget() { // recent document info
465
+function getTplWidget()
466
+{
467
+// recent document info
464 468
 	return '
465 469
 		<div class="[+cols+]" id="[+id+]">
466 470
 			<div class="card"[+cardAttr+]>
@@ -471,7 +475,9 @@  discard block
 block discarded – undo
471 475
 ';
472 476
 }
473 477
 
474
-function getRecentInfo() { // recent document info
478
+function getRecentInfo()
479
+{
480
+// recent document info
475 481
 	$modx = evolutionCMS();
476 482
 
477 483
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -497,12 +503,13 @@  discard block
 block discarded – undo
497 503
 	return $html;
498 504
 }
499 505
 
500
-function getRecentInfoList() {
506
+function getRecentInfoList()
507
+{
501 508
 	$modx = evolutionCMS();
502 509
 
503 510
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504 511
 
505
-	if($modx->db->getRecordCount($rs) < 1) {
512
+	if($modx->db->getRecordCount($rs) < 1) {
506 513
 		return '<tr><td>[%no_activity_message%]</td></tr>';
507 514
 	}
508 515
 
@@ -512,22 +519,22 @@  discard block
 block discarded – undo
512 519
 	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513 520
 
514 521
 	$output = array();
515
-	while($ph = $modx->db->getRow($rs)) {
522
+	while($ph = $modx->db->getRow($rs)) {
516 523
 		$docid = $ph['id'];
517 524
 		$_ = $modx->getUserInfo($ph['editedby']);
518 525
 		$ph['username'] = $_['username'];
519 526
 
520
-		if($ph['deleted'] == 1) {
527
+		if($ph['deleted'] == 1) {
521 528
 			$ph['status'] = 'deleted text-danger';
522
-		} elseif($ph['published'] == 0) {
529
+		} elseif($ph['published'] == 0) {
523 530
 			$ph['status'] = 'unpublished font-italic text-muted';
524
-		} else {
531
+		} else {
525 532
 			$ph['status'] = 'published';
526 533
 		}
527 534
 
528
-		if($modx->hasPermission('edit_document')) {
535
+		if($modx->hasPermission('edit_document')) {
529 536
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530
-		} else {
537
+		} else {
531 538
 			$ph['edit_btn'] = '';
532 539
 		}
533 540
 
@@ -540,40 +547,40 @@  discard block
 block discarded – undo
540 547
 			$preview_disabled
541 548
 		), $btntpl['preview_btn']);
542 549
 
543
-		if($modx->hasPermission('delete_document')) {
544
-			if($ph['deleted'] == 0) {
550
+		if($modx->hasPermission('delete_document')) {
551
+			if($ph['deleted'] == 0) {
545 552
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546
-			} else {
553
+			} else {
547 554
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
548 555
 			}
549 556
 			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
550
-		} else {
557
+		} else {
551 558
 			$ph['delete_btn'] = '';
552 559
 		}
553 560
 
554
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
561
+		if($ph['deleted'] == 1 && $ph['published'] == 0) {
555 562
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
563
+		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
557 564
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
565
+		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
559 566
 			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560
-		} else {
567
+		} else {
561 568
 			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
562 569
 		}
563 570
 		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
564 571
 
565 572
 		$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 573
 
567
-		if($ph['longtitle'] == '') {
574
+		if($ph['longtitle'] == '') {
568 575
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
569 576
 		}
570
-		if($ph['description'] == '') {
577
+		if($ph['description'] == '') {
571 578
 			$ph['description'] = '(<i>[%not_set%]</i>)';
572 579
 		}
573
-		if($ph['introtext'] == '') {
580
+		if($ph['introtext'] == '') {
574 581
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
575 582
 		}
576
-		if($ph['alias'] == '') {
583
+		if($ph['alias'] == '') {
577 584
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
578 585
 		}
579 586
 
@@ -582,7 +589,8 @@  discard block
 block discarded – undo
582 589
 	return implode("\n", $output);
583 590
 }
584 591
 
585
-function getRecentInfoRowTpl() {
592
+function getRecentInfoRowTpl()
593
+{
586 594
 	$tpl = '
587 595
 						<tr>
588 596
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -611,11 +619,13 @@  discard block
 block discarded – undo
611 619
 }
612 620
 
613 621
 // setup icons
614
-function wrapIcon($i, $action) {
622
+function wrapIcon($i, $action)
623
+{
615 624
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
616 625
 }
617 626
 
618
-function getStartUpScript() {
627
+function getStartUpScript()
628
+{
619 629
 	$script = '
620 630
         <script type="text/javascript">
621 631
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab5_security_settings.inc.php 1 patch
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
     $MODX_SITE_HOSTNAMES = MODX_SITE_HOSTNAMES; // Fix for PHP 5.4
3
-    if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) {
3
+    if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) {
4 4
         $valid_hostnames = $_SERVER['HTTP_HOST'];
5
-    } else {
5
+    } else {
6 6
         $valid_hostnames = $MODX_SITE_HOSTNAMES;
7 7
     }
8 8
 ?>
@@ -157,7 +157,9 @@  discard block
 block discarded – undo
157 157
 <th><?php echo $_lang['pwd_hash_algo_title'] ?><br><small>[(pwd_hash_algo)]</small></th>
158 158
 <td>
159 159
 <?php
160
-if(empty($pwd_hash_algo)) $phm['sel']['UNCRYPT'] = 1;
160
+if(empty($pwd_hash_algo)) {
161
+    $phm['sel']['UNCRYPT'] = 1;
162
+}
161 163
 $phm['e']['BLOWFISH_Y'] = $modx->manager->checkHashAlgorithm('BLOWFISH_Y') ? 0:1;
162 164
 $phm['e']['BLOWFISH_A'] = $modx->manager->checkHashAlgorithm('BLOWFISH_A') ? 0:1;
163 165
 $phm['e']['SHA512']     = $modx->manager->checkHashAlgorithm('SHA512') ? 0:1;
@@ -186,7 +188,9 @@  discard block
 block discarded – undo
186 188
   ?>
187 189
 <?php
188 190
 $gdAvailable = extension_loaded('gd');
189
-if(!$gdAvailable) $use_captcha = 0;
191
+if(!$gdAvailable) {
192
+    $use_captcha = 0;
193
+}
190 194
 ?>
191 195
   <tr>
192 196
     <td nowrap class="warning"><?php echo $_lang['captcha_title'] ?><br><small>[(use_captcha)]</small></td>
@@ -226,7 +230,9 @@  discard block
 block discarded – undo
226 230
         <?php
227 231
             // invoke OnMiscSettingsRender event
228 232
             $evtOut = $modx->invokeEvent('OnSecuritySettingsRender');
229
-            if(is_array($evtOut)) echo implode("",$evtOut);
233
+            if(is_array($evtOut)) {
234
+                echo implode("",$evtOut);
235
+            }
230 236
         ?>
231 237
     </td>
232 238
   </tr>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab6_filemanager_settings.inc.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,9 @@
 block discarded – undo
113 113
         <?php
114 114
             // invoke OnMiscSettingsRender event
115 115
             $evtOut = $modx->invokeEvent('OnFileManagerSettingsRender');
116
-            if(is_array($evtOut)) echo implode("",$evtOut);
116
+            if(is_array($evtOut)) {
117
+                echo implode("",$evtOut);
118
+            }
117 119
         ?>
118 120
     </td>
119 121
   </tr>
Please login to merge, or discard this patch.
manager/processors/save_settings.processor.php 1 patch
Braces   +18 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,39 +9,27 @@  discard block
 block discarded – undo
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
10 10
 unset($_POST);
11 11
 
12
-if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
13
-{
12
+if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) {
14 13
 	$htaccess        = $modx->config['base_path'] . '.htaccess';
15 14
 	$sample_htaccess = $modx->config['base_path'] . 'ht.access';
16 15
 	$dir = '/' . trim($modx->config['base_url'],'/');
17
-	if(is_file($htaccess))
18
-	{
16
+	if(is_file($htaccess)) {
19 17
 		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
21
-		{
18
+		if(strpos($_,'RewriteBase')===false) {
22 19
 			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23
-		}
24
-		elseif(is_writable($htaccess))
25
-		{
20
+		} elseif(is_writable($htaccess)) {
26 21
 			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
28
-			{
22
+			if(!@file_put_contents($htaccess,$_)) {
29 23
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30 24
 			}
31 25
 		}
32
-	}
33
-	elseif(is_file($sample_htaccess))
34
-	{
35
-		if(!@rename($sample_htaccess,$htaccess))
36
-        {
26
+	} elseif(is_file($sample_htaccess)) {
27
+		if(!@rename($sample_htaccess,$htaccess)) {
37 28
         	$warnings[] = $_lang["settings_friendlyurls_alert"];
38
-		}
39
-		elseif($modx->config['base_url']!=='/')
40
-		{
29
+		} elseif($modx->config['base_url']!=='/') {
41 30
 			$_ = file_get_contents($htaccess);
42 31
 			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
44
-			{
32
+			if(!@file_put_contents($htaccess,$_)) {
45 33
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46 34
 			}
47 35
 		}
@@ -73,7 +61,7 @@  discard block
 block discarded – undo
73 61
 				$v = htmlspecialchars($v);
74 62
 				break;
75 63
             case 'settings_version':{
76
-                if($modx->getVersionData('version')!=$data['settings_version']){
64
+                if($modx->getVersionData('version')!=$data['settings_version']) {
77 65
                     $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
78 66
                     $v = $modx->getVersionData('version');
79 67
                 }
@@ -134,7 +122,9 @@  discard block
 block discarded – undo
134 122
 
135 123
 		$modx->config[$k] = $v;
136 124
 
137
-		if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
125
+		if(!empty($k)) {
126
+		    $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
127
+		}
138 128
 	}
139 129
 
140 130
 	// Run a single query to save all the values
@@ -148,8 +138,11 @@  discard block
 block discarded – undo
148 138
 		$oldtemplate = (int)$data['old_template'];
149 139
 		$tbl = $modx->getFullTableName('site_content');
150 140
 		$reset = $data['reset_template'];
151
-		if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
152
-		else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
141
+		if($reset==1) {
142
+		    $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
143
+		} else if($reset==2) {
144
+		    $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
145
+		}
153 146
 	}
154 147
 
155 148
 	// empty cache
Please login to merge, or discard this patch.
manager/actions/mutate_user.dynamic.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@  discard block
 block discarded – undo
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while($row = $modx->db->getRow($rs)) {
43
+	    $usersettings[$row['setting_name']] = $row['setting_value'];
44
+	}
43 45
 	// manually extract so that user display settings are not overwritten
44 46
 	foreach($usersettings as $k => $v) {
45 47
 		if($k != 'manager_language' && $k != 'manager_theme') {
@@ -763,13 +765,16 @@  discard block
 block discarded – undo
763 765
 
764 766
 			$groupsarray = array();
765 767
 
766
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
768
+			if($modx->manager->action == '12') {
769
+// only do this bit if the user is being edited
767 770
 				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
768 771
 				$groupsarray = $modx->db->getColumn('user_group', $rs);
769 772
 			}
770 773
 			// retain selected doc groups between post
771 774
 			if(is_array($_POST['user_groups'])) {
772
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
775
+				foreach($_POST['user_groups'] as $n => $v) {
776
+				    $groupsarray[] = $v;
777
+				}
773 778
 			}
774 779
 			?>
775 780
 			<div class="tab-page" id="tabAccess">
Please login to merge, or discard this patch.
manager/includes/preload.functions.inc.php 1 patch
Braces   +24 added lines, -20 removed lines patch added patch discarded remove patch
@@ -4,21 +4,21 @@  discard block
 block discarded – undo
4 4
 $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession
5 5
 
6 6
 
7
-if( ! function_exists('evolutionCMS')) {
7
+if( ! function_exists('evolutionCMS')) {
8 8
     /**
9 9
      * @return DocumentParser
10 10
      */
11
-    function evolutionCMS()
12
-    {
13
-        if( ! defined('MODX_CLASS')) {
14
-            if( ! class_exists('DocumentParser')) {
11
+    function evolutionCMS()
12
+    {
13
+        if( ! defined('MODX_CLASS')) {
14
+            if( ! class_exists('DocumentParser')) {
15 15
                 throw new RuntimeException('MODX_CLASS not defined and DocumentParser class not exists');
16 16
             }
17 17
             define('MODX_CLASS', 'DocumentParser');
18 18
         }
19 19
         
20 20
         global $modx;
21
-        if ($modx === null) {
21
+        if ($modx === null) {
22 22
             $obj = new ReflectionClass(MODX_CLASS);
23 23
             $modx = $obj->newInstanceWithoutConstructor()->getInstance();
24 24
         }
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * @return string
31 31
  */
32
-function genEvoSessionName()
33
-{
32
+function genEvoSessionName()
33
+{
34 34
     $_ = crc32(__FILE__);
35 35
     $_ = sprintf('%u', $_);
36 36
 
@@ -40,10 +40,12 @@  discard block
 block discarded – undo
40 40
 /**
41 41
  * @return void
42 42
  */
43
-function startCMSSession()
44
-{
43
+function startCMSSession()
44
+{
45 45
     global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain;
46
-    if(MODX_CLI) return;
46
+    if(MODX_CLI) {
47
+        return;
48
+    }
47 49
 
48 50
     session_name($site_sessionname);
49 51
     removeInvalidCmsSessionIds($site_sessionname);
@@ -54,14 +56,14 @@  discard block
 block discarded – undo
54 56
     session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
55 57
     session_start();
56 58
     $key = "modx.mgr.session.cookie.lifetime";
57
-    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
59
+    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
58 60
         $cookieLifetime = (int)$_SESSION[$key];
59
-        if ($cookieLifetime) {
61
+        if ($cookieLifetime) {
60 62
             $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
61 63
         }
62 64
         setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
63 65
     }
64
-    if (!isset($_SESSION['modx.session.created.time'])) {
66
+    if (!isset($_SESSION['modx.session.created.time'])) {
65 67
         $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME'];
66 68
     }
67 69
 }
@@ -71,9 +73,9 @@  discard block
 block discarded – undo
71 73
  * @param $session_name
72 74
  * @return void
73 75
  */
74
-function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
75
-{
76
-    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
76
+function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
77
+{
78
+    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
77 79
         unset($storage[$session_name]);
78 80
     }
79 81
 }
@@ -82,9 +84,11 @@  discard block
 block discarded – undo
82 84
  * @param $session_name
83 85
  * @return void
84 86
  */
85
-function removeInvalidCmsSessionIds($session_name)
86
-{
87
-    if(MODX_CLI) return;
87
+function removeInvalidCmsSessionIds($session_name)
88
+{
89
+    if(MODX_CLI) {
90
+        return;
91
+    }
88 92
     // session ids is invalid iff it is empty string
89 93
     // storage priorioty can see in PHP source ext/session/session.c
90 94
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.