@@ -492,7 +492,7 @@ |
||
492 | 492 | }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
493 | 493 | $publishedon = $pub_date; |
494 | 494 | $publishedby = $modx->getLoginUserID(); |
495 | - }elseif ($was_published && !$published) { |
|
495 | + }elseif ($was_published && !$published) { |
|
496 | 496 | $publishedon = 0; |
497 | 497 | $publishedby = 0; |
498 | 498 | } else { |
@@ -280,19 +280,19 @@ |
||
280 | 280 | // invoke OnBeforeDocFormSave event |
281 | 281 | switch($modx->config['docid_incrmnt_method']) |
282 | 282 | { |
283 | - case '1': |
|
284 | - $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
285 | - $where = "T1.id IS NULL"; |
|
286 | - $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
287 | - $id = $modx->db->getValue($rs); |
|
283 | + case '1': |
|
284 | + $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
285 | + $where = "T1.id IS NULL"; |
|
286 | + $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
287 | + $id = $modx->db->getValue($rs); |
|
288 | + break; |
|
289 | + case '2': |
|
290 | + $rs = $modx->db->select('MAX(id)+1', $tbl_site_content); |
|
291 | + $id = $modx->db->getValue($rs); |
|
288 | 292 | break; |
289 | - case '2': |
|
290 | - $rs = $modx->db->select('MAX(id)+1', $tbl_site_content); |
|
291 | - $id = $modx->db->getValue($rs); |
|
292 | - break; |
|
293 | 293 | |
294 | - default: |
|
295 | - $id = ''; |
|
294 | + default: |
|
295 | + $id = ''; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | $modx->invokeEvent("OnBeforeDocFormSave", array( |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | case 'new' : |
279 | 279 | |
280 | 280 | // invoke OnBeforeDocFormSave event |
281 | - switch($modx->config['docid_incrmnt_method']) |
|
281 | + switch ($modx->config['docid_incrmnt_method']) |
|
282 | 282 | { |
283 | 283 | case '1': |
284 | 284 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | if (!$was_published && $published) { |
490 | 490 | $publishedon = $currentdate; |
491 | 491 | $publishedby = $modx->getLoginUserID(); |
492 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
492 | + }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) { |
|
493 | 493 | $publishedon = $pub_date; |
494 | 494 | $publishedby = $modx->getLoginUserID(); |
495 | 495 | }elseif ($was_published && !$published) { |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | } |
502 | 502 | |
503 | 503 | // invoke OnBeforeDocFormSave event |
504 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
504 | + $modx->invokeEvent("OnBeforeDocFormSave", array( |
|
505 | 505 | "mode" => "upd", |
506 | 506 | "id" => $id |
507 | 507 | )); |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | . "menuindex={$menuindex}, " |
527 | 527 | . "searchable={$searchable}, " |
528 | 528 | . "cacheable={$cacheable}, " |
529 | - . "editedby=" . $modx->getLoginUserID() . ", " |
|
529 | + . "editedby=".$modx->getLoginUserID().", " |
|
530 | 530 | . "editedon={$currentdate}, " |
531 | 531 | . "publishedon={$publishedon}, " |
532 | 532 | . "publishedby={$publishedby}, " |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | // update template variables |
542 | 542 | $rs = $modx->db->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'"); |
543 | - $tvIds = array (); |
|
543 | + $tvIds = array(); |
|
544 | 544 | while ($row = $modx->db->getRow($rs)) { |
545 | 545 | $tvIds[$row['tmplvarid']] = $row['id']; |
546 | 546 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | 'groups.id, groups.document_group', |
594 | 594 | "{$tbl_document_groups} AS groups |
595 | 595 | LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group", |
596 | - "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
596 | + "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
597 | 597 | ); |
598 | 598 | $old_groups = array(); |
599 | 599 | while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | unset($old_groups[$group]); |
606 | 606 | continue; |
607 | 607 | } elseif ($link_id == 'new') { |
608 | - $insertions[] = '('.(int)$group.','.$id.')'; |
|
608 | + $insertions[] = '('.(int) $group.','.$id.')'; |
|
609 | 609 | } |
610 | 610 | } |
611 | 611 | if (!empty($insertions)) { |
@@ -637,17 +637,17 @@ discard block |
||
637 | 637 | |
638 | 638 | |
639 | 639 | // invoke OnDocFormSave event |
640 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
640 | + $modx->invokeEvent("OnDocFormSave", array( |
|
641 | 641 | "mode" => "upd", |
642 | 642 | "id" => $id |
643 | 643 | )); |
644 | 644 | |
645 | 645 | // secure web documents - flag as private |
646 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
646 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
647 | 647 | secureWebDocument($id); |
648 | 648 | |
649 | 649 | // secure manager documents - flag as private |
650 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
650 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
651 | 651 | secureMgrDocument($id); |
652 | 652 | |
653 | 653 | // Set the item name for logger |
@@ -673,13 +673,13 @@ discard block |
||
673 | 673 | // document |
674 | 674 | $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent"; |
675 | 675 | } |
676 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path; |
|
676 | + $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path; |
|
677 | 677 | } else { |
678 | 678 | $header = "Location: index.php?a=3&id=$id&r=1".$add_path; |
679 | 679 | } |
680 | 680 | } |
681 | 681 | if (headers_sent()) { |
682 | - $header = str_replace('Location: ','',$header); |
|
682 | + $header = str_replace('Location: ', '', $header); |
|
683 | 683 | echo "<script>document.location.href='$header';</script>\n"; |
684 | 684 | } else { |
685 | 685 | header($header); |
@@ -134,8 +134,7 @@ discard block |
||
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 |
||
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 |
||
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"; |
@@ -347,8 +344,9 @@ discard block |
||
347 | 344 | "alias_visible" => $aliasvisible |
348 | 345 | ); |
349 | 346 | |
350 | - if ($id != '') |
|
351 | - $dbInsert["id"] = $id; |
|
347 | + if ($id != '') { |
|
348 | + $dbInsert["id"] = $id; |
|
349 | + } |
|
352 | 350 | |
353 | 351 | $key = $modx->db->insert($dbInsert, $tbl_site_content); |
354 | 352 | |
@@ -424,11 +422,13 @@ discard block |
||
424 | 422 | // redirect/stay options |
425 | 423 | if ($_POST['stay'] != '') { |
426 | 424 | // weblink |
427 | - if ($_POST['mode'] == "72") |
|
428 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
425 | + if ($_POST['mode'] == "72") { |
|
426 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
427 | + } |
|
429 | 428 | // document |
430 | - if ($_POST['mode'] == "4") |
|
431 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
429 | + if ($_POST['mode'] == "4") { |
|
430 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
431 | + } |
|
432 | 432 | $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay']; |
433 | 433 | } else { |
434 | 434 | $header = "Location: index.php?a=3&id=$key&r=1"; |
@@ -489,10 +489,10 @@ discard block |
||
489 | 489 | if (!$was_published && $published) { |
490 | 490 | $publishedon = $currentdate; |
491 | 491 | $publishedby = $modx->getLoginUserID(); |
492 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
492 | + } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
493 | 493 | $publishedon = $pub_date; |
494 | 494 | $publishedby = $modx->getLoginUserID(); |
495 | - }elseif ($was_published && !$published) { |
|
495 | + } elseif ($was_published && !$published) { |
|
496 | 496 | $publishedon = 0; |
497 | 497 | $publishedby = 0; |
498 | 498 | } else { |
@@ -548,7 +548,9 @@ discard block |
||
548 | 548 | $tvChanges = array(); |
549 | 549 | foreach ($tmplvars as $field => $value) { |
550 | 550 | if (!is_array($value)) { |
551 | - if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
551 | + if (isset($tvIds[$value])) { |
|
552 | + $tvDeletions[] = $tvIds[$value]; |
|
553 | + } |
|
552 | 554 | } else { |
553 | 555 | $tvId = $value[0]; |
554 | 556 | $tvVal = $value[1]; |
@@ -596,7 +598,9 @@ discard block |
||
596 | 598 | "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
597 | 599 | ); |
598 | 600 | $old_groups = array(); |
599 | - while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
|
601 | + while ($row = $modx->db->getRow($rs)) { |
|
602 | + $old_groups[$row['document_group']] = $row['id']; |
|
603 | + } |
|
600 | 604 | |
601 | 605 | // update the permissions in the database |
602 | 606 | $insertions = $deletions = array(); |
@@ -658,9 +662,9 @@ discard block |
||
658 | 662 | $modx->clearCache('full'); |
659 | 663 | } |
660 | 664 | |
661 | - if ($_POST['refresh_preview'] == '1') |
|
662 | - $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
663 | - else { |
|
665 | + if ($_POST['refresh_preview'] == '1') { |
|
666 | + $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
667 | + } else { |
|
664 | 668 | if ($_POST['stay'] != '2' && $id > 0) { |
665 | 669 | $modx->unlockElement(7, $id); |
666 | 670 | } |