Completed
Pull Request — develop (#545)
by Agel_Nash
05:36
created
manager/includes/extenders/export.class.inc.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -279,7 +279,8 @@  discard block
 block discarded – undo
279 279
             $row['count'] = $this->count;
280 280
             $row['url'] = $modx->makeUrl($row['id']);
281 281
 
282
-            if (!$row['wasNull']) { // needs writing a document
282
+            if (!$row['wasNull']) {
283
+// needs writing a document
283 284
                 $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix);
284 285
                 $filename = $dirpath . $docname;
285 286
                 if (!is_file($filename)) {
@@ -307,7 +308,8 @@  discard block
 block discarded – undo
307 308
                 $this->output[] = $this->parsePlaceholder($_lang['export_site_exporting_document'], $row);
308 309
             }
309 310
             if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'],
310
-                        '.') === false)) { // needs making a folder
311
+                        '.') === false)) {
312
+// needs making a folder
311 313
                 $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id'];
312 314
                 $dir_path = $dirpath . $end_dir;
313 315
                 if (strpos($dir_path, MODX_BASE_PATH) === false) {
Please login to merge, or discard this patch.
manager/includes/extenders/dbapi.mysqli.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -373,7 +373,8 @@  discard block
 block discarded – undo
373 373
      * @return bool|mixed|mysqli_result
374 374
      */
375 375
     public function save($fields, $table, $where = '')
376
-    { // This is similar to "replace into table".
376
+    {
377
+// This is similar to "replace into table".
377 378
 
378 379
         if ($where === '') {
379 380
             $mode = 'insert';
@@ -490,7 +491,7 @@  discard block
 block discarded – undo
490 491
     {
491 492
         $out = false;
492 493
         if ($ds instanceof mysqli_result) {
493
-            switch($mode){
494
+            switch($mode) {
494 495
                 case 'assoc':
495 496
                     $out = $ds->fetch_assoc();
496 497
                     break;
Please login to merge, or discard this patch.
manager/includes/extenders/maketable.class.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -457,7 +457,8 @@
 block discarded – undo
457 457
             if ($this->formElementType) {
458 458
                 $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table;
459 459
             }
460
-            if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists.
460
+            if (strlen($this->pageNav) > 1) {
461
+//changed to display the pagination if exists.
461 462
                 /* commented this part because of cookie
462 463
                 $table .= '<div id="max-display-records" ><select style="display:inline" onchange="javascript:updatePageSize(this[this.selectedIndex].value);">';
463 464
                 $pageSizes= array (10, 25, 50, 100, 250);
Please login to merge, or discard this patch.
manager/includes/accesscontrol.inc.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@  discard block
 block discarded – undo
21 21
 if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) {
22 22
     include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
23 23
     if (isset($installStartTime)) {
24
-        if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
24
+        if ((time() - $installStartTime) > 5 * 60) {
25
+// if install flag older than 5 minutes, discard
25 26
             unset($installStartTime);
26 27
             @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755);
27 28
             unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
@@ -163,7 +164,8 @@  discard block
 block discarded – undo
163 164
         } elseif (is_file($theme_path . 'templates/actions/login.tpl')) {
164 165
             $target = $theme_path . 'templates/actions/login.tpl';
165 166
             $login_tpl = file_get_contents($target);
166
-        } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
167
+        } elseif (is_file($theme_path . 'html/login.html')) {
168
+// ClipperCMS compatible
167 169
             $target = $theme_path . 'html/login.html';
168 170
             $login_tpl = file_get_contents($target);
169 171
         } else {
Please login to merge, or discard this patch.
manager/includes/preload.functions.inc.php 1 patch
Braces   +12 added lines, -12 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,8 +17,8 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * @return void
19 19
  */
20
-function startCMSSession()
21
-{
20
+function startCMSSession()
21
+{
22 22
 
23 23
     global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain;
24 24
 
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
     session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
32 32
     session_start();
33 33
     $key = "modx.mgr.session.cookie.lifetime";
34
-    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
34
+    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
35 35
         $cookieLifetime = (int)$_SESSION[$key];
36
-        if ($cookieLifetime) {
36
+        if ($cookieLifetime) {
37 37
             $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
38 38
         }
39 39
         setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
40 40
     }
41
-    if (!isset($_SESSION['modx.session.created.time'])) {
41
+    if (!isset($_SESSION['modx.session.created.time'])) {
42 42
         $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME'];
43 43
     }
44 44
 }
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
  * @param $session_name
49 49
  * @return void
50 50
  */
51
-function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
52
-{
53
-    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
51
+function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
52
+{
53
+    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
54 54
         unset($storage[$session_name]);
55 55
     }
56 56
 }
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
  * @param $session_name
60 60
  * @return void
61 61
  */
62
-function removeInvalidCmsSessionIds($session_name)
63
-{
62
+function removeInvalidCmsSessionIds($session_name)
63
+{
64 64
     // session ids is invalid iff it is empty string
65 65
     // storage priorioty can see in PHP source ext/session/session.c
66 66
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.
manager/processors/duplicate_module.processor.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @return string
18 18
  */
19
-function createGUID(){
19
+function createGUID()
20
+{
20 21
 	srand((double)microtime()*1000000);
21 22
 	$r = rand() ;
22 23
 	$u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
@@ -27,8 +28,11 @@  discard block
 block discarded – undo
27 28
 // count duplicates
28 29
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'"));
29 30
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
30
-if($count>=1) $count = ' '.($count+1);
31
-else $count = '';
31
+if($count>=1) {
32
+    $count = ' '.($count+1);
33
+} else {
34
+    $count = '';
35
+}
32 36
 
33 37
 // duplicate module
34 38
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
manager/processors/remove_installer.processor.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,10 +17,14 @@  discard block
 block discarded – undo
17 17
 $pth = str_replace("\\","/",$pth);
18 18
 if(isset($_GET["rminstall"])) {
19 19
 	if(is_dir($pth)) {
20
-		if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder";
20
+		if(!rmdirRecursive($pth)) {
21
+		    $msg="An error occured while attempting to remove the install folder";
22
+		}
21 23
 	}
22 24
 }
23
-if($msg) echo "<script>alert('".addslashes($msg)."');</script>";
25
+if($msg) {
26
+    echo "<script>alert('".addslashes($msg)."');</script>";
27
+}
24 28
 echo "<script>window.location='../index.php?a=2';</script>";
25 29
 
26 30
 /**
@@ -30,13 +34,13 @@  discard block
 block discarded – undo
30 34
  * @param bool $followLinks
31 35
  * @return bool
32 36
  */
33
-function rmdirRecursive($path, $followLinks=false) {
37
+function rmdirRecursive($path, $followLinks=false)
38
+{
34 39
    $dir = opendir($path) ;
35 40
    while ($entry = readdir($dir)) {
36 41
 	   if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) {
37 42
 		   @unlink( "$path/$entry" );
38
-	   }
39
-	   elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
43
+	   } elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
40 44
 		   rmdirRecursive("$path/$entry"); // recursive
41 45
 	   }
42 46
    }
Please login to merge, or discard this patch.
manager/processors/move_document.processor.php 1 patch
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,12 +12,20 @@  discard block
 block discarded – undo
12 12
 // ok, two things to check.
13 13
 // first, document cannot be moved to itself
14 14
 // second, new parent must be a folder. If not, set it to folder.
15
-if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]);
16
-if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
17
-if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
15
+if($documentID==$newParentID) {
16
+    $modx->webAlertAndQuit($_lang["error_movedocument1"]);
17
+}
18
+if($documentID <= 0) {
19
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
20
+}
21
+if($newParentID < 0) {
22
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
23
+}
18 24
 
19 25
 $parents = $modx->getParentIds($newParentID);
20
-if (in_array($documentID, $parents))  $modx->webAlertAndQuit($_lang["error_movedocument2"]);
26
+if (in_array($documentID, $parents)) {
27
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
28
+}
21 29
 
22 30
 $rs = $modx->db->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'");
23 31
 $oldparent = $modx->db->getValue($rs);
@@ -42,7 +50,8 @@  discard block
 block discarded – undo
42 50
  * @param int $currDocID
43 51
  * @return array
44 52
  */
45
-function allChildren($currDocID) {
53
+function allChildren($currDocID)
54
+{
46 55
 	$modx = DocumentParser::getInstance();
47 56
 	$children= array();
48 57
 	$currDocID = $modx->db->escape($currDocID);
@@ -59,11 +68,11 @@  discard block
 block discarded – undo
59 68
 	"old_parent" => $oldparent,
60 69
 	"new_parent" => $newParentID
61 70
 ));
62
-if (is_array($evtOut) && count($evtOut) > 0){
71
+if (is_array($evtOut) && count($evtOut) > 0) {
63 72
 	$newParent = array_pop($evtOut);
64 73
 	if($newParent == $oldparent) {
65 74
 		$modx->webAlertAndQuit($_lang["error_movedocument2"]);
66
-	}else{
75
+	} else {
67 76
 		$newParentID = $newParent;
68 77
 	}
69 78
 }
Please login to merge, or discard this patch.
manager/processors/save_plugin.processor.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -177,7 +177,9 @@  discard block
 block discarded – undo
177 177
     // save selected system events
178 178
     $formEventList = array();
179 179
     foreach ($sysevents as $evtId) {
180
-        if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId);
180
+        if(!preg_match('@^[1-9][0-9]*$@',$evtId)) {
181
+            $evtId = getEventIdByName($evtId);
182
+        }
181 183
         if ($mode == '101') {
182 184
             $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'");
183 185
         } else {
@@ -203,10 +205,14 @@  discard block
 block discarded – undo
203 205
     $dbEventList = array();
204 206
     $del = array();
205 207
     while($row = $modx->db->getRow($rs)) {
206
-        if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid'];
208
+        if(!in_array($row['evtid'], $evtids)) {
209
+            $del[] = $row['evtid'];
210
+        }
207 211
     }
208 212
 
209
-    if(empty($del)) return;
213
+    if(empty($del)) {
214
+        return;
215
+    }
210 216
 
211 217
     foreach($del as $delid) {
212 218
         $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id));
@@ -222,7 +228,9 @@  discard block
 block discarded – undo
222 228
     $modx = DocumentParser::getInstance();
223 229
     static $eventIds=array();
224 230
 
225
-    if(isset($eventIds[$name])) return $eventIds[$name];
231
+    if(isset($eventIds[$name])) {
232
+        return $eventIds[$name];
233
+    }
226 234
 
227 235
     $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames');
228 236
     while ($row = $modx->db->getRow($rs)) {
Please login to merge, or discard this patch.