Completed
Push — develop ( dae083...3a9224 )
by Dmytro
05:30
created
manager/processors/save_content.processor.php 1 patch
Braces   +25 added lines, -21 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 }
85 85
                 $alias = $tempAlias;
86 86
             }
87
-        }else{
87
+        } else {
88 88
             if ($modx->db->getValue($modx->db->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND parent=$parent AND alias='$alias'")) != 0) {
89 89
                 $cnt = 1;
90 90
                 $tempAlias = $alias;
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
         }
135 135
         //end webber
136 136
     }
137
-}
138
-elseif ($alias) {
137
+} elseif ($alias) {
139 138
     $alias = $modx->stripAlias($alias);
140 139
 }
141 140
 
@@ -149,8 +148,7 @@  discard block
 block discarded – undo
149 148
 
150 149
     if ($pub_date < $currentdate) {
151 150
         $published = 1;
152
-    }
153
-    elseif ($pub_date > $currentdate) {
151
+    } elseif ($pub_date > $currentdate) {
154 152
         $published = 0;
155 153
     }
156 154
 }
@@ -278,8 +276,7 @@  discard block
 block discarded – undo
278 276
     case 'new' :
279 277
 
280 278
         // invoke OnBeforeDocFormSave event
281
-        switch($modx->config['docid_incrmnt_method'])
282
-        {
279
+        switch($modx->config['docid_incrmnt_method']) {
283 280
             case '1':
284 281
                 $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
285 282
                 $where = "T1.id IS NULL";
@@ -310,7 +307,7 @@  discard block
 block discarded – undo
310 307
         $publishedon = ($published ? $currentdate : 0);
311 308
         $publishedby = ($published ? $modx->getLoginUserID() : 0);
312 309
 
313
-        if ((!empty($pub_date))&&($published)){
310
+        if ((!empty($pub_date))&&($published)) {
314 311
             $publishedon=$pub_date;
315 312
         }
316 313
 
@@ -348,8 +345,9 @@  discard block
 block discarded – undo
348 345
             "alias_visible"    => $aliasvisible
349 346
         );
350 347
 
351
-        if ($id != '')
352
-            $dbInsert["id"] = $id;
348
+        if ($id != '') {
349
+                    $dbInsert["id"] = $id;
350
+        }
353 351
 
354 352
         $key = $modx->db->insert( $dbInsert, $tbl_site_content);
355 353
 
@@ -425,11 +423,13 @@  discard block
 block discarded – undo
425 423
         // redirect/stay options
426 424
         if ($_POST['stay'] != '') {
427 425
             // weblink
428
-            if ($_POST['mode'] == "72")
429
-                $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent";
426
+            if ($_POST['mode'] == "72") {
427
+                            $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent";
428
+            }
430 429
             // document
431
-            if ($_POST['mode'] == "4")
432
-                $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent";
430
+            if ($_POST['mode'] == "4") {
431
+                            $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent";
432
+            }
433 433
             $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'];
434 434
         } else {
435 435
             $header = "Location: index.php?a=3&id=$key&r=1";
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
         if (!$was_published && $published) {
491 491
             $publishedon = $currentdate;
492 492
             $publishedby = $modx->getLoginUserID();
493
-            }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
493
+            } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
494 494
             $publishedon = $pub_date;
495 495
             $publishedby = $modx->getLoginUserID();
496
-               }elseif ($was_published && !$published) {
496
+               } elseif ($was_published && !$published) {
497 497
             $publishedon = 0;
498 498
             $publishedby = 0;
499 499
         } else {
@@ -549,7 +549,9 @@  discard block
 block discarded – undo
549 549
         $tvChanges = array();
550 550
         foreach ($tmplvars as $field => $value) {
551 551
             if (!is_array($value)) {
552
-                if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value];
552
+                if (isset($tvIds[$value])) {
553
+                    $tvDeletions[] = $tvIds[$value];
554
+                }
553 555
             } else {
554 556
                 $tvId = $value[0];
555 557
                 $tvVal = $value[1];
@@ -597,7 +599,9 @@  discard block
 block discarded – undo
597 599
                 "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
598 600
                 );
599 601
             $old_groups = array();
600
-            while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id'];
602
+            while ($row = $modx->db->getRow($rs)) {
603
+                $old_groups[$row['document_group']] = $row['id'];
604
+            }
601 605
 
602 606
             // update the permissions in the database
603 607
             $insertions = $deletions = array();
@@ -659,9 +663,9 @@  discard block
 block discarded – undo
659 663
             $modx->clearCache('full');
660 664
         }
661 665
 
662
-        if ($_POST['refresh_preview'] == '1')
663
-            $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev";
664
-        else {
666
+        if ($_POST['refresh_preview'] == '1') {
667
+                    $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev";
668
+        } else {
665 669
             if ($_POST['stay'] != '2' && $id > 0) {
666 670
                 $modx->unlockElement(7, $id);
667 671
             }
Please login to merge, or discard this patch.