Completed
Pull Request — develop (#546)
by Maxim
05:36
created
manager/includes/preload.functions.inc.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     $_ = crc32(__FILE__);
12 12
     $_ = sprintf('%u', $_);
13 13
 
14
-    return 'evo' . base_convert($_, 10, 36);
14
+    return 'evo'.base_convert($_, 10, 36);
15 15
 }
16 16
 
17 17
 /**
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 function startCMSSession()
21 21
 {
22 22
     global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain;
23
-    if(MODX_CLI) return;
23
+    if (MODX_CLI) return;
24 24
 
25 25
     session_name($site_sessionname);
26 26
     removeInvalidCmsSessionIds($site_sessionname);
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     session_start();
33 33
     $key = "modx.mgr.session.cookie.lifetime";
34 34
     if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
35
-        $cookieLifetime = (int)$_SESSION[$key];
35
+        $cookieLifetime = (int) $_SESSION[$key];
36 36
         if ($cookieLifetime) {
37 37
             $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
38 38
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function removeInvalidCmsSessionIds($session_name)
63 63
 {
64
-    if(MODX_CLI) return;
64
+    if (MODX_CLI) return;
65 65
     // session ids is invalid iff it is empty string
66 66
     // storage priorioty can see in PHP source ext/session/session.c
67 67
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.
Braces   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 /**
7 7
  * @return string
8 8
  */
9
-function genEvoSessionName()
10
-{
9
+function genEvoSessionName()
10
+{
11 11
     $_ = crc32(__FILE__);
12 12
     $_ = sprintf('%u', $_);
13 13
 
@@ -17,10 +17,12 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * @return void
19 19
  */
20
-function startCMSSession()
21
-{
20
+function startCMSSession()
21
+{
22 22
     global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain;
23
-    if(MODX_CLI) return;
23
+    if(MODX_CLI) {
24
+        return;
25
+    }
24 26
 
25 27
     session_name($site_sessionname);
26 28
     removeInvalidCmsSessionIds($site_sessionname);
@@ -31,14 +33,14 @@  discard block
 block discarded – undo
31 33
     session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
32 34
     session_start();
33 35
     $key = "modx.mgr.session.cookie.lifetime";
34
-    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
36
+    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
35 37
         $cookieLifetime = (int)$_SESSION[$key];
36
-        if ($cookieLifetime) {
38
+        if ($cookieLifetime) {
37 39
             $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
38 40
         }
39 41
         setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
40 42
     }
41
-    if (!isset($_SESSION['modx.session.created.time'])) {
43
+    if (!isset($_SESSION['modx.session.created.time'])) {
42 44
         $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME'];
43 45
     }
44 46
 }
@@ -48,9 +50,9 @@  discard block
 block discarded – undo
48 50
  * @param $session_name
49 51
  * @return void
50 52
  */
51
-function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
52
-{
53
-    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
53
+function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
54
+{
55
+    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
54 56
         unset($storage[$session_name]);
55 57
     }
56 58
 }
@@ -59,9 +61,11 @@  discard block
 block discarded – undo
59 61
  * @param $session_name
60 62
  * @return void
61 63
  */
62
-function removeInvalidCmsSessionIds($session_name)
63
-{
64
-    if(MODX_CLI) return;
64
+function removeInvalidCmsSessionIds($session_name)
65
+{
66
+    if(MODX_CLI) {
67
+        return;
68
+    }
65 69
     // session ids is invalid iff it is empty string
66 70
     // storage priorioty can see in PHP source ext/session/session.c
67 71
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.
manager/frames/nodes.functions.inc.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
         case 'publishedon':
39 39
         case 'pub_date':
40 40
         case 'unpub_date':
41
-            $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']);
41
+            $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], 'sc.'.$_SESSION['tree_sortby']);
42 42
             break;
43 43
         default:
44
-            $sortby = 'sc.' . $_SESSION['tree_sortby'];
44
+            $sortby = 'sc.'.$_SESSION['tree_sortby'];
45 45
     };
46 46
 
47
-    $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']);
47
+    $orderby = $modx->db->escape($sortby.' '.$_SESSION['tree_sortdir']);
48 48
 
49 49
     // Folder sorting gets special setup ;) Add menuindex and pagetitle
50 50
     if ($_SESSION['tree_sortby'] == 'isfolder') {
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
     $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
59 59
     $showProtected = false;
60 60
     if (isset ($modx->config['tree_show_protected'])) {
61
-        $showProtected = (boolean)$modx->config['tree_show_protected'];
61
+        $showProtected = (boolean) $modx->config['tree_show_protected'];
62 62
     }
63
-    $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0';
63
+    $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
64 64
     if ($showProtected == false) {
65
-        $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
65
+        $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
66 66
     } else {
67 67
         $access = '';
68 68
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         }
99 99
 
100 100
         $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : '';
101
-        $pageIdDisplay = '<small>(' . ($modx_textdir ? '&rlm;' : '') . $row['id'] . ')</small>';
101
+        $pageIdDisplay = '<small>('.($modx_textdir ? '&rlm;' : '').$row['id'].')</small>';
102 102
 
103 103
         // Prepare displaying user-locks
104 104
         $lockedByUser = '';
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                     'element_type' => $_lang["lock_element_type_7"],
110 110
                     'lasthit_df' => $rowLock['lasthit_df']
111 111
                 ));
112
-                $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>';
112
+                $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>';
113 113
             } else {
114 114
                 $title = $modx->parseText($_lang["lock_element_locked_by"], array(
115 115
                     'element_type' => $_lang["lock_element_type_7"],
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
                     'lasthit_df' => $rowLock['lasthit_df']
118 118
                 ));
119 119
                 if ($modx->hasPermission('remove_locks')) {
120
-                    $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
120
+                    $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
121 121
                 } else {
122
-                    $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
122
+                    $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
123 123
                 }
124 124
             }
125 125
         }
@@ -128,22 +128,22 @@  discard block
 block discarded – undo
128 128
 
129 129
         $title = '';
130 130
         if (isDateNode($nodeNameSource)) {
131
-            $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]';
131
+            $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]';
132 132
         }
133
-        $title .= $_lang['id'] . ': ' . $row['id'];
134
-        $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle'];
135
-        $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex'];
136
-        $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-');
137
-        $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename'];
138
-        $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']);
139
-        $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']);
140
-        $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']);
141
-        $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
142
-        $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
143
-        $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
144
-        $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
133
+        $title .= $_lang['id'].': '.$row['id'];
134
+        $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle'];
135
+        $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex'];
136
+        $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-');
137
+        $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename'];
138
+        $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']);
139
+        $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']);
140
+        $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']);
141
+        $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
142
+        $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
143
+        $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
144
+        $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
145 145
         $title = $modx->htmlspecialchars($title);
146
-        $title = str_replace('[+lf+]', ' &#13;', $title);   // replace line-breaks with empty space as fall-back
146
+        $title = str_replace('[+lf+]', ' &#13;', $title); // replace line-breaks with empty space as fall-back
147 147
 
148 148
         $data = array(
149 149
             'id' => $row['id'],
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             }
228 228
 
229 229
             if ($ph['contextmenu']) {
230
-                $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
230
+                $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
231 231
             }
232 232
 
233 233
             if ($_SESSION['tree_show_only_folders']) {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                     }
286 286
 
287 287
                     if ($ph['contextmenu']) {
288
-                        $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
288
+                        $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
289 289
                     }
290 290
 
291 291
                     $node .= $modx->parseText($tpl, $ph);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                     }
324 324
 
325 325
                     if ($ph['contextmenu']) {
326
-                        $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
326
+                        $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
327 327
                     }
328 328
 
329 329
                     $node .= $modx->parseText($tpl, $ph);
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
                     }
375 375
 
376 376
                     if ($ph['contextmenu']) {
377
-                        $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
377
+                        $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
378 378
                     }
379 379
 
380 380
                     $node .= $modx->parseText($tpl, $ph);
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                     }
417 417
 
418 418
                     if ($ph['contextmenu']) {
419
-                        $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
419
+                        $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
420 420
                     }
421 421
 
422 422
                     $node .= $modx->parseText($tpl, $ph);
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
                     $nodetitle .= $modx->config['friendly_url_suffix'];
494 494
                 }
495 495
             }
496
-            $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle;
496
+            $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle;
497 497
             break;
498 498
         case 'pagetitle':
499 499
             $nodetitle = $row['pagetitle'];
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 {
554 554
     global $modx;
555 555
 
556
-    return (int)$modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' '));
556
+    return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' '));
557 557
 }
558 558
 
559 559
 /**
Please login to merge, or discard this patch.