@@ -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); |