Completed
Push — develop ( 053968...47dc8d )
by Maxim
12s
created
manager/actions/mutate_content.dynamic.php 3 patches
Indentation   +411 added lines, -411 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 /********************/
@@ -12,30 +12,30 @@  discard block
 block discarded – undo
12 12
 
13 13
 // check permissions
14 14
 switch($modx->manager->action) {
15
-	case 27:
16
-		if(!$modx->hasPermission('edit_document')) {
17
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18
-		}
19
-		break;
20
-	case 85:
21
-	case 72:
22
-	case 4:
23
-		if(!$modx->hasPermission('new_document')) {
24
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
-		} elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26
-			// check user has permissions for parent
27
-			include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
28
-			$udperms = new udperms();
29
-			$udperms->user = $modx->getLoginUserID();
30
-			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
31
-			$udperms->role = $_SESSION['mgrRole'];
32
-			if(!$udperms->checkPermissions()) {
33
-				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34
-			}
35
-		}
36
-		break;
37
-	default:
38
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+    case 27:
16
+        if(!$modx->hasPermission('edit_document')) {
17
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
18
+        }
19
+        break;
20
+    case 85:
21
+    case 72:
22
+    case 4:
23
+        if(!$modx->hasPermission('new_document')) {
24
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
+        } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26
+            // check user has permissions for parent
27
+            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
28
+            $udperms = new udperms();
29
+            $udperms->user = $modx->getLoginUserID();
30
+            $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
31
+            $udperms->role = $_SESSION['mgrRole'];
32
+            if(!$udperms->checkPermissions()) {
33
+                $modx->webAlertAndQuit($_lang["access_permission_denied"]);
34
+            }
35
+        }
36
+        break;
37
+    default:
38
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
39 39
 }
40 40
 
41 41
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
55 55
 
56 56
 if($modx->manager->action == 27) {
57
-	//editing an existing document
58
-	// check permissions on the document
59
-	include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
60
-	$udperms = new udperms();
61
-	$udperms->user = $modx->getLoginUserID();
62
-	$udperms->document = $id;
63
-	$udperms->role = $_SESSION['mgrRole'];
64
-
65
-	if(!$udperms->checkPermissions()) {
66
-		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
67
-	}
57
+    //editing an existing document
58
+    // check permissions on the document
59
+    include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
60
+    $udperms = new udperms();
61
+    $udperms->user = $modx->getLoginUserID();
62
+    $udperms->document = $id;
63
+    $udperms->role = $_SESSION['mgrRole'];
64
+
65
+    if(!$udperms->checkPermissions()) {
66
+        $modx->webAlertAndQuit($_lang["access_permission_denied"]);
67
+    }
68 68
 }
69 69
 
70 70
 // check to see if resource isn't locked
71 71
 if($lockedEl = $modx->elementIsLocked(7, $id)) {
72
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
72
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
73 73
 }
74 74
 // end check for lock
75 75
 
@@ -78,74 +78,74 @@  discard block
 block discarded – undo
78 78
 
79 79
 // get document groups for current user
80 80
 if($_SESSION['mgrDocgroups']) {
81
-	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
81
+    $docgrp = implode(',', $_SESSION['mgrDocgroups']);
82 82
 }
83 83
 
84 84
 if(!empty ($id)) {
85
-	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
86
-	if($docgrp) {
87
-		$access .= " OR dg.document_group IN ({$docgrp})";
88
-	}
89
-	$rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
90
-	$content = array();
91
-	$content = $modx->db->getRow($rs);
92
-	$modx->documentObject = &$content;
93
-	if(!$content) {
94
-		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
95
-	}
96
-	$_SESSION['itemname'] = $content['pagetitle'];
85
+    $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
86
+    if($docgrp) {
87
+        $access .= " OR dg.document_group IN ({$docgrp})";
88
+    }
89
+    $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
90
+    $content = array();
91
+    $content = $modx->db->getRow($rs);
92
+    $modx->documentObject = &$content;
93
+    if(!$content) {
94
+        $modx->webAlertAndQuit($_lang["access_permission_denied"]);
95
+    }
96
+    $_SESSION['itemname'] = $content['pagetitle'];
97 97
 } else {
98
-	$content = array();
98
+    $content = array();
99 99
 
100
-	if(isset($_REQUEST['newtemplate'])) {
101
-		$content['template'] = $_REQUEST['newtemplate'];
102
-	} else {
103
-		$content['template'] = getDefaultTemplate();
104
-	}
100
+    if(isset($_REQUEST['newtemplate'])) {
101
+        $content['template'] = $_REQUEST['newtemplate'];
102
+    } else {
103
+        $content['template'] = getDefaultTemplate();
104
+    }
105 105
 
106
-	$_SESSION['itemname'] = $_lang["new_resource"];
106
+    $_SESSION['itemname'] = $_lang["new_resource"];
107 107
 }
108 108
 
109 109
 // restore saved form
110 110
 $formRestored = $modx->manager->loadFormValues();
111 111
 if(isset($_REQUEST['newtemplate'])) {
112
-	$formRestored = true;
112
+    $formRestored = true;
113 113
 }
114 114
 
115 115
 // retain form values if template was changed
116 116
 // edited to convert pub_date and unpub_date
117 117
 // sottwell 02-09-2006
118 118
 if($formRestored == true) {
119
-	$content = array_merge($content, $_POST);
120
-	$content['content'] = $_POST['ta'];
121
-	if(empty ($content['pub_date'])) {
122
-		unset ($content['pub_date']);
123
-	} else {
124
-		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
125
-	}
126
-	if(empty ($content['unpub_date'])) {
127
-		unset ($content['unpub_date']);
128
-	} else {
129
-		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
130
-	}
119
+    $content = array_merge($content, $_POST);
120
+    $content['content'] = $_POST['ta'];
121
+    if(empty ($content['pub_date'])) {
122
+        unset ($content['pub_date']);
123
+    } else {
124
+        $content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
125
+    }
126
+    if(empty ($content['unpub_date'])) {
127
+        unset ($content['unpub_date']);
128
+    } else {
129
+        $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
130
+    }
131 131
 }
132 132
 
133 133
 // increase menu index if this is a new document
134 134
 if(!isset ($_REQUEST['id'])) {
135
-	if(!isset ($modx->config['auto_menuindex'])) {
136
-		$modx->config['auto_menuindex'] = 1;
137
-	}
138
-	if($modx->config['auto_menuindex']) {
139
-		$pid = (int)$_REQUEST['pid'];
140
-		$rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'");
141
-		$content['menuindex'] = $modx->db->getValue($rs);
142
-	} else {
143
-		$content['menuindex'] = 0;
144
-	}
135
+    if(!isset ($modx->config['auto_menuindex'])) {
136
+        $modx->config['auto_menuindex'] = 1;
137
+    }
138
+    if($modx->config['auto_menuindex']) {
139
+        $pid = (int)$_REQUEST['pid'];
140
+        $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'");
141
+        $content['menuindex'] = $modx->db->getValue($rs);
142
+    } else {
143
+        $content['menuindex'] = 0;
144
+    }
145 145
 }
146 146
 
147 147
 if(isset ($_POST['which_editor'])) {
148
-	$modx->config['which_editor'] = $_POST['which_editor'];
148
+    $modx->config['which_editor'] = $_POST['which_editor'];
149 149
 }
150 150
 
151 151
 // Add lock-element JS-Script
@@ -545,23 +545,23 @@  discard block
 block discarded – undo
545 545
 
546 546
 	<form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;">
547 547
 		<?php
548
-		// invoke OnDocFormPrerender event
549
-		$evtOut = $modx->invokeEvent('OnDocFormPrerender', array(
550
-			'id' => $id,
551
-			'template' => $content['template']
552
-		));
553
-
554
-		if(is_array($evtOut)) {
555
-			echo implode('', $evtOut);
556
-		}
557
-
558
-		/*************************/
559
-		$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
560
-		$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
561
-		$page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : '';
562
-		/*************************/
563
-
564
-		?>
548
+        // invoke OnDocFormPrerender event
549
+        $evtOut = $modx->invokeEvent('OnDocFormPrerender', array(
550
+            'id' => $id,
551
+            'template' => $content['template']
552
+        ));
553
+
554
+        if(is_array($evtOut)) {
555
+            echo implode('', $evtOut);
556
+        }
557
+
558
+        /*************************/
559
+        $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
560
+        $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
561
+        $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : '';
562
+        /*************************/
563
+
564
+        ?>
565 565
 		<input type="hidden" name="a" value="5" />
566 566
 		<input type="hidden" name="id" value="<?= $content['id'] ?>" />
567 567
 		<input type="hidden" name="mode" value="<?= $modx->manager->action ?>" />
@@ -576,54 +576,54 @@  discard block
 block discarded – undo
576 576
 
577 577
 			<h1>
578 578
 				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
579
-					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
580
-				} else {
581
-				    if ($modx->manager->action == '4') {
579
+                    echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
580
+                } else {
581
+                    if ($modx->manager->action == '4') {
582 582
                         echo $_lang['add_resource'];
583 583
                     } else if ($modx->manager->action == '72') {
584 584
                         echo $_lang['add_weblink'];
585 585
                     } else {
586 586
                         echo $_lang['create_resource_title'];
587 587
                     }
588
-				} ?>
588
+                } ?>
589 589
 			</h1>
590 590
 
591 591
 			<?= $_style['actionbuttons']['dynamic']['document'] ?>
592 592
 
593 593
 			<?php
594
-			// breadcrumbs
595
-			if($modx->config['use_breadcrumbs']) {
596
-				$temp = array();
597
-				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
598
-
599
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
600
-					$bID = (int) $_REQUEST['id'];
601
-					$temp = $modx->getParentIds($bID);
602
-				} else if(isset($_REQUEST['pid'])) {
603
-					$bID = (int) $_REQUEST['pid'];
604
-					$temp = $modx->getParentIds($bID);
605
-					array_unshift($temp, $bID);
606
-				}
607
-
608
-				if($temp) {
609
-					$parents = implode(',', $temp);
610
-
611
-					if(!empty($parents)) {
612
-						$where = "FIND_IN_SET(id,'{$parents}') DESC";
613
-						$rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
614
-						while($row = $modx->db->getRow($rs)) {
615
-							$out .= '<li class="breadcrumbs__li">
594
+            // breadcrumbs
595
+            if($modx->config['use_breadcrumbs']) {
596
+                $temp = array();
597
+                $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
598
+
599
+                if(isset($_REQUEST['id']) && $content['parent'] != 0) {
600
+                    $bID = (int) $_REQUEST['id'];
601
+                    $temp = $modx->getParentIds($bID);
602
+                } else if(isset($_REQUEST['pid'])) {
603
+                    $bID = (int) $_REQUEST['pid'];
604
+                    $temp = $modx->getParentIds($bID);
605
+                    array_unshift($temp, $bID);
606
+                }
607
+
608
+                if($temp) {
609
+                    $parents = implode(',', $temp);
610
+
611
+                    if(!empty($parents)) {
612
+                        $where = "FIND_IN_SET(id,'{$parents}') DESC";
613
+                        $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
614
+                        while($row = $modx->db->getRow($rs)) {
615
+                            $out .= '<li class="breadcrumbs__li">
616 616
                                 <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
617 617
                                 <span class="breadcrumbs__sep">&gt;</span>
618 618
                             </li>';
619
-						}
620
-					}
621
-				}
619
+                        }
620
+                    }
621
+                }
622 622
 
623
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
624
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
625
-			}
626
-			?>
623
+                $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
624
+                echo '<ul class="breadcrumbs">' . $out . '</ul>';
625
+            }
626
+            ?>
627 627
 
628 628
 			<!-- start main wrapper -->
629 629
 			<div class="sectionBody">
@@ -635,13 +635,13 @@  discard block
 block discarded – undo
635 635
 
636 636
 					<!-- General -->
637 637
 					<?php
638
-					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
639
-						'id' => $id
640
-					));
641
-					if(is_array($evtOut)) {
642
-						echo implode('', $evtOut);
643
-					} else {
644
-						?>
638
+                    $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
639
+                        'id' => $id
640
+                    ));
641
+                    if(is_array($evtOut)) {
642
+                        echo implode('', $evtOut);
643
+                    } else {
644
+                        ?>
645 645
 						<div class="tab-page" id="tabGeneral">
646 646
 							<h2 class="tab"><?= $_lang['settings_general'] ?></h2>
647 647
 							<script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script>
@@ -726,36 +726,36 @@  discard block
 block discarded – undo
726 726
 										<select id="template" name="template" class="inputBox" onchange="templateWarning();">
727 727
 											<option value="0">(blank)</option>
728 728
 											<?php
729
-											$field = "t.templatename, t.selectable, t.id, c.category";
730
-											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
731
-											$rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC');
732
-											$currentCategory = '';
733
-											while($row = $modx->db->getRow($rs)) {
734
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
735
-													continue;
736
-												};
737
-												// Skip if not selectable but show if selected!
738
-												$thisCategory = $row['category'];
739
-												if($thisCategory == null) {
740
-													$thisCategory = $_lang["no_category"];
741
-												}
742
-												if($thisCategory != $currentCategory) {
743
-													if($closeOptGroup) {
744
-														echo "\t\t\t\t\t</optgroup>\n";
745
-													}
746
-													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
747
-													$closeOptGroup = true;
748
-												}
729
+                                            $field = "t.templatename, t.selectable, t.id, c.category";
730
+                                            $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
731
+                                            $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC');
732
+                                            $currentCategory = '';
733
+                                            while($row = $modx->db->getRow($rs)) {
734
+                                                if($row['selectable'] != 1 && $row['id'] != $content['template']) {
735
+                                                    continue;
736
+                                                };
737
+                                                // Skip if not selectable but show if selected!
738
+                                                $thisCategory = $row['category'];
739
+                                                if($thisCategory == null) {
740
+                                                    $thisCategory = $_lang["no_category"];
741
+                                                }
742
+                                                if($thisCategory != $currentCategory) {
743
+                                                    if($closeOptGroup) {
744
+                                                        echo "\t\t\t\t\t</optgroup>\n";
745
+                                                    }
746
+                                                    echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
747
+                                                    $closeOptGroup = true;
748
+                                                }
749 749
 
750
-												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
750
+                                                $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
751 751
 
752
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
753
-												$currentCategory = $thisCategory;
754
-											}
755
-											if($thisCategory != '') {
756
-												echo "\t\t\t\t\t</optgroup>\n";
757
-											}
758
-											?>
752
+                                                echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
753
+                                                $currentCategory = $thisCategory;
754
+                                            }
755
+                                            if($thisCategory != '') {
756
+                                                echo "\t\t\t\t\t</optgroup>\n";
757
+                                            }
758
+                                            ?>
759 759
 										</select>
760 760
 									</td>
761 761
 								</tr>
@@ -795,37 +795,37 @@  discard block
 block discarded – undo
795 795
 									</td>
796 796
 									<td valign="top">
797 797
 										<?php
798
-										$parentlookup = false;
799
-										if(isset ($_REQUEST['id'])) {
800
-											if($content['parent'] == 0) {
801
-												$parentname = $site_name;
802
-											} else {
803
-												$parentlookup = $content['parent'];
804
-											}
805
-										} elseif(isset ($_REQUEST['pid'])) {
806
-											if($_REQUEST['pid'] == 0) {
807
-												$parentname = $site_name;
808
-											} else {
809
-												$parentlookup = $_REQUEST['pid'];
810
-											}
811
-										} elseif(isset($_POST['parent'])) {
812
-											if($_POST['parent'] == 0) {
813
-												$parentname = $site_name;
814
-											} else {
815
-												$parentlookup = $_POST['parent'];
816
-											}
817
-										} else {
818
-											$parentname = $site_name;
819
-											$content['parent'] = 0;
820
-										}
821
-										if($parentlookup !== false && is_numeric($parentlookup)) {
822
-											$rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
823
-											$parentname = $modx->db->getValue($rs);
824
-											if(!$parentname) {
825
-												$modx->webAlertAndQuit($_lang["error_no_parent"]);
826
-											}
827
-										}
828
-										?>
798
+                                        $parentlookup = false;
799
+                                        if(isset ($_REQUEST['id'])) {
800
+                                            if($content['parent'] == 0) {
801
+                                                $parentname = $site_name;
802
+                                            } else {
803
+                                                $parentlookup = $content['parent'];
804
+                                            }
805
+                                        } elseif(isset ($_REQUEST['pid'])) {
806
+                                            if($_REQUEST['pid'] == 0) {
807
+                                                $parentname = $site_name;
808
+                                            } else {
809
+                                                $parentlookup = $_REQUEST['pid'];
810
+                                            }
811
+                                        } elseif(isset($_POST['parent'])) {
812
+                                            if($_POST['parent'] == 0) {
813
+                                                $parentname = $site_name;
814
+                                            } else {
815
+                                                $parentlookup = $_POST['parent'];
816
+                                            }
817
+                                        } else {
818
+                                            $parentname = $site_name;
819
+                                            $content['parent'] = 0;
820
+                                        }
821
+                                        if($parentlookup !== false && is_numeric($parentlookup)) {
822
+                                            $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
823
+                                            $parentname = $modx->db->getValue($rs);
824
+                                            if(!$parentname) {
825
+                                                $modx->webAlertAndQuit($_lang["error_no_parent"]);
826
+                                            }
827
+                                        }
828
+                                        ?>
829 829
 										<i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i>
830 830
 										<b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b>
831 831
 										<input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" />
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 								</tr>
834 834
 								<tr></tr>
835 835
 								<?php
836
-								/*
836
+                                /*
837 837
 								if($content['type'] == 'reference' || $modx->manager->action == '72') {
838 838
 									?>
839 839
 									<tr>
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 									</tr>
862 862
 									<?php
863 863
 								}*/
864
-								?>
864
+                                ?>
865 865
 
866 866
 								<?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?>
867 867
 									<tr>
@@ -874,36 +874,36 @@  discard block
 block discarded – undo
874 874
 													<select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();">
875 875
 													<option value="none"><?= $_lang['none'] ?></option>
876 876
 														<?php
877
-														// invoke OnRichTextEditorRegister event
878
-														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
879
-														if(is_array($evtOut)) {
880
-															for($i = 0; $i < count($evtOut); $i++) {
881
-																$editor = $evtOut[$i];
882
-																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
883
-															}
884
-														}
885
-														?>
877
+                                                        // invoke OnRichTextEditorRegister event
878
+                                                        $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
879
+                                                        if(is_array($evtOut)) {
880
+                                                            for($i = 0; $i < count($evtOut); $i++) {
881
+                                                                $editor = $evtOut[$i];
882
+                                                                echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
883
+                                                            }
884
+                                                        }
885
+                                                        ?>
886 886
 													</select>
887 887
 												</label>
888 888
 											</div>
889 889
 											<div id="content_body">
890 890
 												<?php
891
-												if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
892
-													$htmlContent = $content['content'];
893
-													?>
891
+                                                if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
892
+                                                    $htmlContent = $content['content'];
893
+                                                    ?>
894 894
 													<div class="section-editor clearfix">
895 895
 														<textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea>
896 896
 													</div>
897 897
 													<?php
898
-													// Richtext-[*content*]
899
-													$richtexteditorIds = array();
900
-													$richtexteditorOptions = array();
901
-													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
902
-													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
903
-												} else {
904
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
905
-												}
906
-												?>
898
+                                                    // Richtext-[*content*]
899
+                                                    $richtexteditorIds = array();
900
+                                                    $richtexteditorOptions = array();
901
+                                                    $richtexteditorIds[$modx->config['which_editor']][] = 'ta';
902
+                                                    $richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
903
+                                                } else {
904
+                                                    echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
905
+                                                }
906
+                                                ?>
907 907
 											</div>
908 908
 										</td>
909 909
 									</tr>
@@ -1190,8 +1190,8 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 								<?php
1192 1192
 
1193
-								if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1194
-									?>
1193
+                                if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1194
+                                    ?>
1195 1195
 									<tr>
1196 1196
 										<td>
1197 1197
 											<span class="warning"><?= $_lang['resource_type'] ?></span>
@@ -1213,15 +1213,15 @@  discard block
 block discarded – undo
1213 1213
 										<td>
1214 1214
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1215 1215
 												<?php
1216
-												if(!$content['contentType']) {
1217
-													$content['contentType'] = 'text/html';
1218
-												}
1219
-												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1220
-												$ct = explode(",", $custom_contenttype);
1221
-												for($i = 0; $i < count($ct); $i++) {
1222
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1223
-												}
1224
-												?>
1216
+                                                if(!$content['contentType']) {
1217
+                                                    $content['contentType'] = 'text/html';
1218
+                                                }
1219
+                                                $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1220
+                                                $ct = explode(",", $custom_contenttype);
1221
+                                                for($i = 0; $i < count($ct); $i++) {
1222
+                                                    echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1223
+                                                }
1224
+                                                ?>
1225 1225
 											</select>
1226 1226
 										</td>
1227 1227
 									</tr>
@@ -1244,23 +1244,23 @@  discard block
 block discarded – undo
1244 1244
 										</td>
1245 1245
 									</tr>
1246 1246
 									<?php
1247
-								} else {
1248
-									if($content['type'] != 'reference' && $modx->manager->action != '72') {
1249
-										// non-admin managers creating or editing a document resource
1250
-										?>
1247
+                                } else {
1248
+                                    if($content['type'] != 'reference' && $modx->manager->action != '72') {
1249
+                                        // non-admin managers creating or editing a document resource
1250
+                                        ?>
1251 1251
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
1252 1252
 										<input type="hidden" name="type" value="document" />
1253 1253
 										<input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" />
1254 1254
 										<?php
1255
-									} else {
1256
-										// non-admin managers creating or editing a reference (weblink) resource
1257
-										?>
1255
+                                    } else {
1256
+                                        // non-admin managers creating or editing a reference (weblink) resource
1257
+                                        ?>
1258 1258
 										<input type="hidden" name="type" value="reference" />
1259 1259
 										<input type="hidden" name="contentType" value="text/html" />
1260 1260
 										<?php
1261
-									}
1262
-								}//if mgrRole
1263
-								?>
1261
+                                    }
1262
+                                }//if mgrRole
1263
+                                ?>
1264 1264
 
1265 1265
 								<tr>
1266 1266
 									<td>
@@ -1343,112 +1343,112 @@  discard block
 block discarded – undo
1343 1343
                     ?>
1344 1344
 
1345 1345
 						<?php
1346
-					/*******************************
1346
+                    /*******************************
1347 1347
 					 * Document Access Permissions */
1348
-					if($use_udperms == 1) {
1349
-						$groupsarray = array();
1350
-						$sql = '';
1351
-
1352
-						$documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1353
-						if($documentId > 0) {
1354
-							// Load up, the permissions from the parent (if new document) or existing document
1355
-							$rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1356
-							while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1357
-
1358
-							// Load up the current permissions and names
1359
-							$vs = array(
1360
-								$tbl_document_group_names,
1361
-								$tbl_document_groups,
1362
-								$documentId
1363
-							);
1364
-							$from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs);
1365
-							$rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name');
1366
-						} else {
1367
-							// Just load up the names, we're starting clean
1368
-							$rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name');
1369
-						}
1370
-
1371
-						// retain selected doc groups between post
1372
-						if(isset($_POST['docgroups'])) {
1373
-							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1374
-						}
1348
+                    if($use_udperms == 1) {
1349
+                        $groupsarray = array();
1350
+                        $sql = '';
1351
+
1352
+                        $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1353
+                        if($documentId > 0) {
1354
+                            // Load up, the permissions from the parent (if new document) or existing document
1355
+                            $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1356
+                            while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1357
+
1358
+                            // Load up the current permissions and names
1359
+                            $vs = array(
1360
+                                $tbl_document_group_names,
1361
+                                $tbl_document_groups,
1362
+                                $documentId
1363
+                            );
1364
+                            $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs);
1365
+                            $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name');
1366
+                        } else {
1367
+                            // Just load up the names, we're starting clean
1368
+                            $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name');
1369
+                        }
1370
+
1371
+                        // retain selected doc groups between post
1372
+                        if(isset($_POST['docgroups'])) {
1373
+                            $groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1374
+                        }
1375
+
1376
+                        $isManager = $modx->hasPermission('access_permissions');
1377
+                        $isWeb = $modx->hasPermission('web_access_permissions');
1378
+
1379
+                        // Setup Basic attributes for each Input box
1380
+                        $inputAttributes = array(
1381
+                            'type' => 'checkbox',
1382
+                            'class' => 'checkbox',
1383
+                            'name' => 'docgroups[]',
1384
+                            'onclick' => 'makePublic(false);',
1385
+                        );
1386
+                        $permissions = array(); // New Permissions array list (this contains the HTML)
1387
+                        $permissions_yes = 0; // count permissions the current mgr user has
1388
+                        $permissions_no = 0; // count permissions the current mgr user doesn't have
1389
+
1390
+                        // Loop through the permissions list
1391
+                        while($row = $modx->db->getRow($rs)) {
1392
+
1393
+                            // Create an inputValue pair (group ID and group link (if it exists))
1394
+                            $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1395
+                            $inputId = 'group-' . $row['id'];
1396
+
1397
+                            $checked = in_array($inputValue, $groupsarray);
1398
+                            if($checked) {
1399
+                                $notPublic = true;
1400
+                            } // Mark as private access (either web or manager)
1401
+
1402
+                            // Skip the access permission if the user doesn't have access...
1403
+                            if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1404
+                                continue;
1405
+                            }
1375 1406
 
1376
-						$isManager = $modx->hasPermission('access_permissions');
1377
-						$isWeb = $modx->hasPermission('web_access_permissions');
1378
-
1379
-						// Setup Basic attributes for each Input box
1380
-						$inputAttributes = array(
1381
-							'type' => 'checkbox',
1382
-							'class' => 'checkbox',
1383
-							'name' => 'docgroups[]',
1384
-							'onclick' => 'makePublic(false);',
1385
-						);
1386
-						$permissions = array(); // New Permissions array list (this contains the HTML)
1387
-						$permissions_yes = 0; // count permissions the current mgr user has
1388
-						$permissions_no = 0; // count permissions the current mgr user doesn't have
1389
-
1390
-						// Loop through the permissions list
1391
-						while($row = $modx->db->getRow($rs)) {
1392
-
1393
-							// Create an inputValue pair (group ID and group link (if it exists))
1394
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1395
-							$inputId = 'group-' . $row['id'];
1396
-
1397
-							$checked = in_array($inputValue, $groupsarray);
1398
-							if($checked) {
1399
-								$notPublic = true;
1400
-							} // Mark as private access (either web or manager)
1401
-
1402
-							// Skip the access permission if the user doesn't have access...
1403
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1404
-								continue;
1405
-							}
1406
-
1407
-							// Setup attributes for this Input box
1408
-							$inputAttributes['id'] = $inputId;
1409
-							$inputAttributes['value'] = $inputValue;
1410
-							if($checked) {
1411
-								$inputAttributes['checked'] = 'checked';
1412
-							} else {
1413
-								unset($inputAttributes['checked']);
1414
-							}
1415
-
1416
-							// Create attribute string list
1417
-							$inputString = array();
1418
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1419
-
1420
-							// Make the <input> HTML
1421
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1422
-
1423
-							// does user have this permission?
1424
-							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
1425
-							$vs = array(
1426
-								$row['id'],
1427
-								$_SESSION['mgrInternalKey']
1428
-							);
1429
-							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1430
-							$rsp = $modx->db->select('COUNT(mg.id)', $from, $where);
1431
-							$count = $modx->db->getValue($rsp);
1432
-							if($count > 0) {
1433
-								++$permissions_yes;
1434
-							} else {
1435
-								++$permissions_no;
1436
-							}
1437
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1438
-						}
1439
-						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1440
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1441
-							$permissions = array();
1442
-						}
1407
+                            // Setup attributes for this Input box
1408
+                            $inputAttributes['id'] = $inputId;
1409
+                            $inputAttributes['value'] = $inputValue;
1410
+                            if($checked) {
1411
+                                $inputAttributes['checked'] = 'checked';
1412
+                            } else {
1413
+                                unset($inputAttributes['checked']);
1414
+                            }
1443 1415
 
1444
-						// See if the Access Permissions section is worth displaying...
1445
-						if(!empty($permissions)) {
1446
-							// Add the "All Document Groups" item if we have rights in both contexts
1447
-							if($isManager && $isWeb) {
1448
-								array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1449
-							}
1450
-							// Output the permissions list...
1451
-							?>
1416
+                            // Create attribute string list
1417
+                            $inputString = array();
1418
+                            foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1419
+
1420
+                            // Make the <input> HTML
1421
+                            $inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1422
+
1423
+                            // does user have this permission?
1424
+                            $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
1425
+                            $vs = array(
1426
+                                $row['id'],
1427
+                                $_SESSION['mgrInternalKey']
1428
+                            );
1429
+                            $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1430
+                            $rsp = $modx->db->select('COUNT(mg.id)', $from, $where);
1431
+                            $count = $modx->db->getValue($rsp);
1432
+                            if($count > 0) {
1433
+                                ++$permissions_yes;
1434
+                            } else {
1435
+                                ++$permissions_no;
1436
+                            }
1437
+                            $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1438
+                        }
1439
+                        // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1440
+                        if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1441
+                            $permissions = array();
1442
+                        }
1443
+
1444
+                        // See if the Access Permissions section is worth displaying...
1445
+                        if(!empty($permissions)) {
1446
+                            // Add the "All Document Groups" item if we have rights in both contexts
1447
+                            if($isManager && $isWeb) {
1448
+                                array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1449
+                            }
1450
+                            // Output the permissions list...
1451
+                            ?>
1452 1452
 							<!-- Access Permissions -->
1453 1453
 							<div class="tab-page" id="tabAccess">
1454 1454
 								<h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2>
@@ -1482,31 +1482,31 @@  discard block
 block discarded – undo
1482 1482
 								</ul>
1483 1483
 							</div><!--div class="tab-page" id="tabAccess"-->
1484 1484
 							<?php
1485
-						} // !empty($permissions)
1486
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1487
-							?>
1485
+                        } // !empty($permissions)
1486
+                        elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1487
+                            ?>
1488 1488
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1489 1489
 							<?php
1490 1490
 
1491
-						}
1492
-					}
1493
-					/* End Document Access Permissions *
1491
+                        }
1492
+                    }
1493
+                    /* End Document Access Permissions *
1494 1494
 					 ***********************************/
1495
-					?>
1495
+                    ?>
1496 1496
 
1497 1497
 					<input type="submit" name="save" style="display:none" />
1498 1498
 					<?php
1499 1499
 
1500
-					// invoke OnDocFormRender event
1501
-					$evtOut = $modx->invokeEvent('OnDocFormRender', array(
1502
-						'id' => $id,
1503
-						'template' => $content['template']
1504
-					));
1500
+                    // invoke OnDocFormRender event
1501
+                    $evtOut = $modx->invokeEvent('OnDocFormRender', array(
1502
+                        'id' => $id,
1503
+                        'template' => $content['template']
1504
+                    ));
1505 1505
 
1506
-					if(is_array($evtOut)) {
1507
-						echo implode('', $evtOut);
1508
-					}
1509
-					?>
1506
+                    if(is_array($evtOut)) {
1507
+                        echo implode('', $evtOut);
1508
+                    }
1509
+                    ?>
1510 1510
 				</div><!--div class="tab-pane" id="documentPane"-->
1511 1511
 			</div><!--div class="sectionBody"-->
1512 1512
 		</fieldset>
@@ -1517,63 +1517,63 @@  discard block
 block discarded – undo
1517 1517
 	</script>
1518 1518
 <?php
1519 1519
 if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1520
-	if(is_array($richtexteditorIds)) {
1521
-		foreach($richtexteditorIds as $editor => $elements) {
1522
-			// invoke OnRichTextEditorInit event
1523
-			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1524
-				'editor' => $editor,
1525
-				'elements' => $elements,
1526
-				'options' => $richtexteditorOptions[$editor]
1527
-			));
1528
-			if(is_array($evtOut)) {
1529
-				echo implode('', $evtOut);
1530
-			}
1531
-		}
1532
-	}
1520
+    if(is_array($richtexteditorIds)) {
1521
+        foreach($richtexteditorIds as $editor => $elements) {
1522
+            // invoke OnRichTextEditorInit event
1523
+            $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1524
+                'editor' => $editor,
1525
+                'elements' => $elements,
1526
+                'options' => $richtexteditorOptions[$editor]
1527
+            ));
1528
+            if(is_array($evtOut)) {
1529
+                echo implode('', $evtOut);
1530
+            }
1531
+        }
1532
+    }
1533 1533
 }
1534 1534
 
1535 1535
 /**
1536 1536
  * @return string
1537 1537
  */
1538 1538
 function getDefaultTemplate() {
1539
-	global $modx;
1539
+    global $modx;
1540 1540
 
1541 1541
     $default_template = '';
1542
-	switch($modx->config['auto_template_logic']) {
1543
-		case 'sibling':
1544
-			if(!isset($_GET['pid']) || empty($_GET['pid'])) {
1545
-				$site_start = $modx->config['site_start'];
1546
-				$where = "sc.isfolder=0 AND sc.id!='{$site_start}'";
1547
-				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1);
1548
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1549
-					$default_template = $sibl[0]['template'];
1550
-				}
1551
-			} else {
1552
-				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1553
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1554
-					$default_template = $sibl[0]['template'];
1555
-				} else {
1556
-					$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1557
-					if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1558
-						$default_template = $sibl[0]['template'];
1559
-					}
1560
-				}
1561
-			}
1562
-			if(isset($default_template)) {
1563
-				break;
1564
-			} // If $default_template could not be determined, fall back / through to "parent"-mode
1565
-		case 'parent':
1566
-			if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1567
-				$parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template');
1568
-				if(isset($parent['template'])) {
1569
-					$default_template = $parent['template'];
1570
-				}
1571
-			}
1572
-			break;
1573
-		case 'system':
1574
-		default: // default_template is already set
1575
-			$default_template = $modx->config['default_template'];
1576
-	}
1577
-
1578
-	return empty($default_template) ? $modx->config['default_template'] : $default_template;
1542
+    switch($modx->config['auto_template_logic']) {
1543
+        case 'sibling':
1544
+            if(!isset($_GET['pid']) || empty($_GET['pid'])) {
1545
+                $site_start = $modx->config['site_start'];
1546
+                $where = "sc.isfolder=0 AND sc.id!='{$site_start}'";
1547
+                $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1);
1548
+                if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1549
+                    $default_template = $sibl[0]['template'];
1550
+                }
1551
+            } else {
1552
+                $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1553
+                if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1554
+                    $default_template = $sibl[0]['template'];
1555
+                } else {
1556
+                    $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1557
+                    if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1558
+                        $default_template = $sibl[0]['template'];
1559
+                    }
1560
+                }
1561
+            }
1562
+            if(isset($default_template)) {
1563
+                break;
1564
+            } // If $default_template could not be determined, fall back / through to "parent"-mode
1565
+        case 'parent':
1566
+            if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1567
+                $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template');
1568
+                if(isset($parent['template'])) {
1569
+                    $default_template = $parent['template'];
1570
+                }
1571
+            }
1572
+            break;
1573
+        case 'system':
1574
+        default: // default_template is already set
1575
+            $default_template = $modx->config['default_template'];
1576
+    }
1577
+
1578
+    return empty($default_template) ? $modx->config['default_template'] : $default_template;
1579 1579
 }
Please login to merge, or discard this patch.
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 /********************/
7
-$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC';
8
-$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon';
9
-$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : '';
10
-$add_path = $sd . $sb . $pg;
7
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
8
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
9
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
10
+$add_path = $sd.$sb.$pg;
11 11
 /*******************/
12 12
 
13 13
 // check permissions
14
-switch($modx->manager->action) {
14
+switch ($modx->manager->action) {
15 15
 	case 27:
16
-		if(!$modx->hasPermission('edit_document')) {
16
+		if (!$modx->hasPermission('edit_document')) {
17 17
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 		}
19 19
 		break;
20 20
 	case 85:
21 21
 	case 72:
22 22
 	case 4:
23
-		if(!$modx->hasPermission('new_document')) {
23
+		if (!$modx->hasPermission('new_document')) {
24 24
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
-		} elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
25
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26 26
 			// check user has permissions for parent
27
-			include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
27
+			include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
28 28
 			$udperms = new udperms();
29 29
 			$udperms->user = $modx->getLoginUserID();
30 30
 			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
31 31
 			$udperms->role = $_SESSION['mgrRole'];
32
-			if(!$udperms->checkPermissions()) {
32
+			if (!$udperms->checkPermissions()) {
33 33
 				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34 34
 			}
35 35
 		}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
39 39
 }
40 40
 
41
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
41
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
42 42
 
43 43
 // Get table names (alphabetical)
44 44
 $tbl_categories = $modx->getFullTableName('categories');
@@ -53,22 +53,22 @@  discard block
 block discarded – undo
53 53
 $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates');
54 54
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
55 55
 
56
-if($modx->manager->action == 27) {
56
+if ($modx->manager->action == 27) {
57 57
 	//editing an existing document
58 58
 	// check permissions on the document
59
-	include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
59
+	include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
60 60
 	$udperms = new udperms();
61 61
 	$udperms->user = $modx->getLoginUserID();
62 62
 	$udperms->document = $id;
63 63
 	$udperms->role = $_SESSION['mgrRole'];
64 64
 
65
-	if(!$udperms->checkPermissions()) {
65
+	if (!$udperms->checkPermissions()) {
66 66
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
67 67
 	}
68 68
 }
69 69
 
70 70
 // check to see if resource isn't locked
71
-if($lockedEl = $modx->elementIsLocked(7, $id)) {
71
+if ($lockedEl = $modx->elementIsLocked(7, $id)) {
72 72
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
73 73
 }
74 74
 // end check for lock
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
 $modx->lockElement(7, $id);
78 78
 
79 79
 // get document groups for current user
80
-if($_SESSION['mgrDocgroups']) {
80
+if ($_SESSION['mgrDocgroups']) {
81 81
 	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
82 82
 }
83 83
 
84
-if(!empty ($id)) {
84
+if (!empty ($id)) {
85 85
 	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
86
-	if($docgrp) {
86
+	if ($docgrp) {
87 87
 		$access .= " OR dg.document_group IN ({$docgrp})";
88 88
 	}
89 89
 	$rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
90 90
 	$content = array();
91 91
 	$content = $modx->db->getRow($rs);
92 92
 	$modx->documentObject = &$content;
93
-	if(!$content) {
93
+	if (!$content) {
94 94
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
95 95
 	}
96 96
 	$_SESSION['itemname'] = $content['pagetitle'];
97 97
 } else {
98 98
 	$content = array();
99 99
 
100
-	if(isset($_REQUEST['newtemplate'])) {
100
+	if (isset($_REQUEST['newtemplate'])) {
101 101
 		$content['template'] = $_REQUEST['newtemplate'];
102 102
 	} else {
103 103
 		$content['template'] = getDefaultTemplate();
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 
109 109
 // restore saved form
110 110
 $formRestored = $modx->manager->loadFormValues();
111
-if(isset($_REQUEST['newtemplate'])) {
111
+if (isset($_REQUEST['newtemplate'])) {
112 112
 	$formRestored = true;
113 113
 }
114 114
 
115 115
 // retain form values if template was changed
116 116
 // edited to convert pub_date and unpub_date
117 117
 // sottwell 02-09-2006
118
-if($formRestored == true) {
118
+if ($formRestored == true) {
119 119
 	$content = array_merge($content, $_POST);
120 120
 	$content['content'] = $_POST['ta'];
121
-	if(empty ($content['pub_date'])) {
121
+	if (empty ($content['pub_date'])) {
122 122
 		unset ($content['pub_date']);
123 123
 	} else {
124 124
 		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
125 125
 	}
126
-	if(empty ($content['unpub_date'])) {
126
+	if (empty ($content['unpub_date'])) {
127 127
 		unset ($content['unpub_date']);
128 128
 	} else {
129 129
 		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 }
132 132
 
133 133
 // increase menu index if this is a new document
134
-if(!isset ($_REQUEST['id'])) {
135
-	if(!isset ($modx->config['auto_menuindex'])) {
134
+if (!isset ($_REQUEST['id'])) {
135
+	if (!isset ($modx->config['auto_menuindex'])) {
136 136
 		$modx->config['auto_menuindex'] = 1;
137 137
 	}
138
-	if($modx->config['auto_menuindex']) {
139
-		$pid = (int)$_REQUEST['pid'];
138
+	if ($modx->config['auto_menuindex']) {
139
+		$pid = (int) $_REQUEST['pid'];
140 140
 		$rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'");
141 141
 		$content['menuindex'] = $modx->db->getValue($rs);
142 142
 	} else {
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 }
146 146
 
147
-if(isset ($_POST['which_editor'])) {
147
+if (isset ($_POST['which_editor'])) {
148 148
 	$modx->config['which_editor'] = $_POST['which_editor'];
149 149
 }
150 150
 
151 151
 // Add lock-element JS-Script
152 152
 $lockElementId = $id;
153 153
 $lockElementType = 7;
154
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
154
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
155 155
 ?>
156 156
 	<script type="text/javascript">
157 157
 		/* <![CDATA[ */
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			},
182 182
 			cancel: function() {
183 183
 				documentDirty = false;
184
-				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>';
184
+				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>';
185 185
 			},
186 186
 			duplicate: function() {
187 187
 				if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 				}
190 190
 			},
191 191
 			view: function() {
192
-				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin');
192
+				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin');
193 193
 			}
194 194
 		};
195 195
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			'template' => $content['template']
552 552
 		));
553 553
 
554
-		if(is_array($evtOut)) {
554
+		if (is_array($evtOut)) {
555 555
 			echo implode('', $evtOut);
556 556
 		}
557 557
 
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 		<fieldset id="create_edit">
576 576
 
577 577
 			<h1>
578
-				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
579
-					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
578
+				<i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) {
579
+					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>';
580 580
 				} else {
581 581
 				    if ($modx->manager->action == '4') {
582 582
                         echo $_lang['add_resource'];
@@ -592,36 +592,36 @@  discard block
 block discarded – undo
592 592
 
593 593
 			<?php
594 594
 			// breadcrumbs
595
-			if($modx->config['use_breadcrumbs']) {
595
+			if ($modx->config['use_breadcrumbs']) {
596 596
 				$temp = array();
597 597
 				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
598 598
 
599
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
599
+				if (isset($_REQUEST['id']) && $content['parent'] != 0) {
600 600
 					$bID = (int) $_REQUEST['id'];
601 601
 					$temp = $modx->getParentIds($bID);
602
-				} else if(isset($_REQUEST['pid'])) {
602
+				} else if (isset($_REQUEST['pid'])) {
603 603
 					$bID = (int) $_REQUEST['pid'];
604 604
 					$temp = $modx->getParentIds($bID);
605 605
 					array_unshift($temp, $bID);
606 606
 				}
607 607
 
608
-				if($temp) {
608
+				if ($temp) {
609 609
 					$parents = implode(',', $temp);
610 610
 
611
-					if(!empty($parents)) {
611
+					if (!empty($parents)) {
612 612
 						$where = "FIND_IN_SET(id,'{$parents}') DESC";
613 613
 						$rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
614
-						while($row = $modx->db->getRow($rs)) {
614
+						while ($row = $modx->db->getRow($rs)) {
615 615
 							$out .= '<li class="breadcrumbs__li">
616
-                                <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
616
+                                <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a>
617 617
                                 <span class="breadcrumbs__sep">&gt;</span>
618 618
                             </li>';
619 619
 						}
620 620
 					}
621 621
 				}
622 622
 
623
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
624
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
+				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>';
624
+				echo '<ul class="breadcrumbs">'.$out.'</ul>';
625 625
 			}
626 626
 			?>
627 627
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
639 639
 						'id' => $id
640 640
 					));
641
-					if(is_array($evtOut)) {
641
+					if (is_array($evtOut)) {
642 642
 						echo implode('', $evtOut);
643 643
 					} else {
644 644
 						?>
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 									</td>
695 695
 								</tr>
696 696
 
697
-								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
697
+								<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
698 698
 
699 699
 									<tr>
700 700
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -730,17 +730,17 @@  discard block
 block discarded – undo
730 730
 											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
731 731
 											$rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC');
732 732
 											$currentCategory = '';
733
-											while($row = $modx->db->getRow($rs)) {
734
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
+											while ($row = $modx->db->getRow($rs)) {
734
+												if ($row['selectable'] != 1 && $row['id'] != $content['template']) {
735 735
 													continue;
736 736
 												};
737 737
 												// Skip if not selectable but show if selected!
738 738
 												$thisCategory = $row['category'];
739
-												if($thisCategory == null) {
739
+												if ($thisCategory == null) {
740 740
 													$thisCategory = $_lang["no_category"];
741 741
 												}
742
-												if($thisCategory != $currentCategory) {
743
-													if($closeOptGroup) {
742
+												if ($thisCategory != $currentCategory) {
743
+													if ($closeOptGroup) {
744 744
 														echo "\t\t\t\t\t</optgroup>\n";
745 745
 													}
746 746
 													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
@@ -749,10 +749,10 @@  discard block
 block discarded – undo
749 749
 
750 750
 												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
751 751
 
752
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
752
+												echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n";
753 753
 												$currentCategory = $thisCategory;
754 754
 											}
755
-											if($thisCategory != '') {
755
+											if ($thisCategory != '') {
756 756
 												echo "\t\t\t\t\t</optgroup>\n";
757 757
 											}
758 758
 											?>
@@ -796,20 +796,20 @@  discard block
 block discarded – undo
796 796
 									<td valign="top">
797 797
 										<?php
798 798
 										$parentlookup = false;
799
-										if(isset ($_REQUEST['id'])) {
800
-											if($content['parent'] == 0) {
799
+										if (isset ($_REQUEST['id'])) {
800
+											if ($content['parent'] == 0) {
801 801
 												$parentname = $site_name;
802 802
 											} else {
803 803
 												$parentlookup = $content['parent'];
804 804
 											}
805
-										} elseif(isset ($_REQUEST['pid'])) {
806
-											if($_REQUEST['pid'] == 0) {
805
+										} elseif (isset ($_REQUEST['pid'])) {
806
+											if ($_REQUEST['pid'] == 0) {
807 807
 												$parentname = $site_name;
808 808
 											} else {
809 809
 												$parentlookup = $_REQUEST['pid'];
810 810
 											}
811
-										} elseif(isset($_POST['parent'])) {
812
-											if($_POST['parent'] == 0) {
811
+										} elseif (isset($_POST['parent'])) {
812
+											if ($_POST['parent'] == 0) {
813 813
 												$parentname = $site_name;
814 814
 											} else {
815 815
 												$parentlookup = $_POST['parent'];
@@ -818,10 +818,10 @@  discard block
 block discarded – undo
818 818
 											$parentname = $site_name;
819 819
 											$content['parent'] = 0;
820 820
 										}
821
-										if($parentlookup !== false && is_numeric($parentlookup)) {
821
+										if ($parentlookup !== false && is_numeric($parentlookup)) {
822 822
 											$rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
823 823
 											$parentname = $modx->db->getValue($rs);
824
-											if(!$parentname) {
824
+											if (!$parentname) {
825 825
 												$modx->webAlertAndQuit($_lang["error_no_parent"]);
826 826
 											}
827 827
 										}
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 								}*/
864 864
 								?>
865 865
 
866
-								<?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?>
866
+								<?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?>
867 867
 									<tr>
868 868
 										<td colspan="2">
869 869
 											<hr>
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 														<?php
877 877
 														// invoke OnRichTextEditorRegister event
878 878
 														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
879
-														if(is_array($evtOut)) {
880
-															for($i = 0; $i < count($evtOut); $i++) {
879
+														if (is_array($evtOut)) {
880
+															for ($i = 0; $i < count($evtOut); $i++) {
881 881
 																$editor = $evtOut[$i];
882 882
 																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
883 883
 															}
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 											</div>
889 889
 											<div id="content_body">
890 890
 												<?php
891
-												if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
891
+												if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
892 892
 													$htmlContent = $content['content'];
893 893
 													?>
894 894
 													<div class="section-editor clearfix">
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
902 902
 													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
903 903
 												} else {
904
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
904
+													echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n";
905 905
 												}
906 906
 												?>
907 907
 											</div>
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 
918 918
                             if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) {
919 919
                                 $template = $default_template;
920
-                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs'];
920
+                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs'];
921 921
                                 if (isset ($_REQUEST['newtemplate'])) {
922 922
                                     $template = $_REQUEST['newtemplate'];
923 923
                                 } else {
@@ -945,10 +945,10 @@  discard block
 block discarded – undo
945 945
                                 );
946 946
                                 $sort = 'tvtpl.rank,tv.rank, tv.id';
947 947
                                 if ($group_tvs) {
948
-                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank';
948
+                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank';
949 949
                                     $from .= '
950
-                                    LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category';
951
-                                    $sort = 'cat.rank,cat.id,' . $sort;
950
+                                    LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category';
951
+                                    $sort = 'cat.rank,cat.id,'.$sort;
952 952
                                 }
953 953
                                 $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs);
954 954
                                 $rs = $modx->db->select($field, $from, $where, $sort);
@@ -957,37 +957,37 @@  discard block
 block discarded – undo
957 957
                         <!-- Template Variables -->' . "\n";
958 958
                                     if (!$group_tvs) {
959 959
                                         $templateVariables .= '
960
-                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div>
960
+                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div>
961 961
                                         <div class="sectionBody tmplvars">
962 962
                                             <table>';
963 963
                                     } else if ($group_tvs == 2) {
964 964
                                         $templateVariables .= '
965 965
                     <div class="tab-section">
966
-                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div>
966
+                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div>
967 967
                         <div class="tab-pane" id="paneTemplateVariables">
968 968
                             <script type="text/javascript">
969
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
969
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
970 970
                             </script>';
971 971
                                     } else if ($group_tvs == 3) {
972 972
                                         $templateVariables .= '
973 973
                         <div id="templateVariables" class="tab-page tmplvars">
974
-                            <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
974
+                            <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
975 975
                             <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>';
976 976
                                     } else if ($group_tvs == 4) {
977 977
                                         $templateVariables .= '
978 978
                     <div id="templateVariables" class="tab-page tmplvars">
979
-                        <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
979
+                        <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
980 980
                         <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>
981 981
                         
982 982
                         <div class="tab-pane" id="paneTemplateVariables">
983 983
                             <script type="text/javascript">
984
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
984
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
985 985
                             </script>';
986 986
                                     }
987 987
 
988 988
                                     $tvsArray = $modx->db->makeArray($rs, 'name');
989
-                                    require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php');
990
-                                    require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
989
+                                    require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php');
990
+                                    require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
991 991
                                     $i = 0;
992 992
                                     $tab = '';
993 993
                                     foreach ($tvsArray as $row) {
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
                                             if ($group_tvs == 1 || $group_tvs == 3) {
996 996
                                                 if ($i === 0) {
997 997
                                                     $templateVariables .= '
998
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
999
-                                <div class="tab-header">' . $row['category'] . '</div>
998
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
999
+                                <div class="tab-header">' . $row['category'].'</div>
1000 1000
                                 <div class="tab-body tmplvars">
1001 1001
                                     <table>' . "\n";
1002 1002
                                                 } else {
@@ -1005,17 +1005,17 @@  discard block
 block discarded – undo
1005 1005
                                 </div>
1006 1006
                             </div>
1007 1007
                             
1008
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
1009
-                                <div class="tab-header">' . $row['category'] . '</div>
1008
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
1009
+                                <div class="tab-header">' . $row['category'].'</div>
1010 1010
                                 <div class="tab-body tmplvars">
1011 1011
                                     <table>';
1012 1012
                                                 }
1013 1013
                                             } else if ($group_tvs == 2 || $group_tvs == 4) {
1014 1014
                                                 if ($i === 0) {
1015 1015
                                                     $templateVariables .= '
1016
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1017
-                                <h2 class="tab">' . $row['category'] . '</h2>
1018
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1016
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1017
+                                <h2 class="tab">' . $row['category'].'</h2>
1018
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1019 1019
                                 
1020 1020
                                 <div class="tab-body tmplvars">
1021 1021
                                     <table>';
@@ -1025,9 +1025,9 @@  discard block
 block discarded – undo
1025 1025
                                 </div>
1026 1026
                             </div>
1027 1027
                             
1028
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1029
-                                <h2 class="tab">' . $row['category'] . '</h2>
1030
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1028
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1029
+                                <h2 class="tab">' . $row['category'].'</h2>
1030
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1031 1031
                                 
1032 1032
                                 <div class="tab-body tmplvars">
1033 1033
                                     <table>';
@@ -1035,18 +1035,18 @@  discard block
 block discarded – undo
1035 1035
                                             } else if ($group_tvs == 5) {
1036 1036
                                                 if ($i === 0) {
1037 1037
                                                     $templateVariables .= '
1038
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1039
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1040
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1038
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1039
+                                    <h2 class="tab">' . $row['category'].'</h2>
1040
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1041 1041
                                     <table>';
1042 1042
                                                 } else {
1043 1043
                                                     $templateVariables .= '
1044 1044
                                     </table>
1045 1045
                                 </div>
1046 1046
                                 
1047
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1048
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1049
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1047
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1048
+                                    <h2 class="tab">' . $row['category'].'</h2>
1049
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1050 1050
                                     
1051 1051
                                     <table>';
1052 1052
                                                 }
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
                                                 $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor'];
1065 1065
                                             };
1066 1066
                                             // Add richtext editor to the list
1067
-                                            $richtexteditorIds[$editor][] = "tv" . $row['id'];
1068
-                                            $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions;
1067
+                                            $richtexteditorIds[$editor][] = "tv".$row['id'];
1068
+                                            $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions;
1069 1069
                                         }
1070 1070
                                         // splitter
1071 1071
                                         if ($group_tvs) {
@@ -1079,24 +1079,24 @@  discard block
 block discarded – undo
1079 1079
                                         }
1080 1080
 
1081 1081
                                         // post back value
1082
-                                        if (array_key_exists('tv' . $row['id'], $_POST)) {
1083
-                                            if (is_array($_POST['tv' . $row['id']])) {
1084
-                                                $tvPBV = implode('||', $_POST['tv' . $row['id']]);
1082
+                                        if (array_key_exists('tv'.$row['id'], $_POST)) {
1083
+                                            if (is_array($_POST['tv'.$row['id']])) {
1084
+                                                $tvPBV = implode('||', $_POST['tv'.$row['id']]);
1085 1085
                                             } else {
1086
-                                                $tvPBV = $_POST['tv' . $row['id']];
1086
+                                                $tvPBV = $_POST['tv'.$row['id']];
1087 1087
                                             }
1088 1088
                                         } else {
1089 1089
                                             $tvPBV = $row['value'];
1090 1090
                                         }
1091 1091
 
1092
-                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : '';
1093
-                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : '';
1094
-                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : '';
1092
+                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : '';
1093
+                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : '';
1094
+                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : '';
1095 1095
 
1096 1096
                                         $templateVariables .= '
1097 1097
                                         <tr>
1098
-                                            <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td>
1099
-                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td>
1098
+                                            <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td>
1099
+                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td>
1100 1100
                                         </tr>';
1101 1101
 
1102 1102
                                         $tab = $row['category_id'];
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 								<?php
1192 1192
 
1193
-								if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1193
+								if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1194 1194
 									?>
1195 1195
 									<tr>
1196 1196
 										<td>
@@ -1213,13 +1213,13 @@  discard block
 block discarded – undo
1213 1213
 										<td>
1214 1214
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1215 1215
 												<?php
1216
-												if(!$content['contentType']) {
1216
+												if (!$content['contentType']) {
1217 1217
 													$content['contentType'] = 'text/html';
1218 1218
 												}
1219 1219
 												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1220 1220
 												$ct = explode(",", $custom_contenttype);
1221
-												for($i = 0; $i < count($ct); $i++) {
1222
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1221
+												for ($i = 0; $i < count($ct); $i++) {
1222
+													echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n";
1223 1223
 												}
1224 1224
 												?>
1225 1225
 											</select>
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 									</tr>
1246 1246
 									<?php
1247 1247
 								} else {
1248
-									if($content['type'] != 'reference' && $modx->manager->action != '72') {
1248
+									if ($content['type'] != 'reference' && $modx->manager->action != '72') {
1249 1249
 										// non-admin managers creating or editing a document resource
1250 1250
 										?>
1251 1251
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
@@ -1345,15 +1345,15 @@  discard block
 block discarded – undo
1345 1345
 						<?php
1346 1346
 					/*******************************
1347 1347
 					 * Document Access Permissions */
1348
-					if($use_udperms == 1) {
1348
+					if ($use_udperms == 1) {
1349 1349
 						$groupsarray = array();
1350 1350
 						$sql = '';
1351 1351
 
1352 1352
 						$documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1353
-						if($documentId > 0) {
1353
+						if ($documentId > 0) {
1354 1354
 							// Load up, the permissions from the parent (if new document) or existing document
1355 1355
 							$rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1356
-							while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1356
+							while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id'];
1357 1357
 
1358 1358
 							// Load up the current permissions and names
1359 1359
 							$vs = array(
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 						}
1370 1370
 
1371 1371
 						// retain selected doc groups between post
1372
-						if(isset($_POST['docgroups'])) {
1372
+						if (isset($_POST['docgroups'])) {
1373 1373
 							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1374 1374
 						}
1375 1375
 
@@ -1388,26 +1388,26 @@  discard block
 block discarded – undo
1388 1388
 						$permissions_no = 0; // count permissions the current mgr user doesn't have
1389 1389
 
1390 1390
 						// Loop through the permissions list
1391
-						while($row = $modx->db->getRow($rs)) {
1391
+						while ($row = $modx->db->getRow($rs)) {
1392 1392
 
1393 1393
 							// Create an inputValue pair (group ID and group link (if it exists))
1394
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1395
-							$inputId = 'group-' . $row['id'];
1394
+							$inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new');
1395
+							$inputId = 'group-'.$row['id'];
1396 1396
 
1397 1397
 							$checked = in_array($inputValue, $groupsarray);
1398
-							if($checked) {
1398
+							if ($checked) {
1399 1399
 								$notPublic = true;
1400 1400
 							} // Mark as private access (either web or manager)
1401 1401
 
1402 1402
 							// Skip the access permission if the user doesn't have access...
1403
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1403
+							if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1404 1404
 								continue;
1405 1405
 							}
1406 1406
 
1407 1407
 							// Setup attributes for this Input box
1408 1408
 							$inputAttributes['id'] = $inputId;
1409 1409
 							$inputAttributes['value'] = $inputValue;
1410
-							if($checked) {
1410
+							if ($checked) {
1411 1411
 								$inputAttributes['checked'] = 'checked';
1412 1412
 							} else {
1413 1413
 								unset($inputAttributes['checked']);
@@ -1415,10 +1415,10 @@  discard block
 block discarded – undo
1415 1415
 
1416 1416
 							// Create attribute string list
1417 1417
 							$inputString = array();
1418
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1418
+							foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"';
1419 1419
 
1420 1420
 							// Make the <input> HTML
1421
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1421
+							$inputHTML = '<input '.implode(' ', $inputString).' />';
1422 1422
 
1423 1423
 							// does user have this permission?
1424 1424
 							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
@@ -1429,23 +1429,23 @@  discard block
 block discarded – undo
1429 1429
 							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1430 1430
 							$rsp = $modx->db->select('COUNT(mg.id)', $from, $where);
1431 1431
 							$count = $modx->db->getValue($rsp);
1432
-							if($count > 0) {
1432
+							if ($count > 0) {
1433 1433
 								++$permissions_yes;
1434 1434
 							} else {
1435 1435
 								++$permissions_no;
1436 1436
 							}
1437
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1437
+							$permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>';
1438 1438
 						}
1439 1439
 						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1440
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1440
+						if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1441 1441
 							$permissions = array();
1442 1442
 						}
1443 1443
 
1444 1444
 						// See if the Access Permissions section is worth displaying...
1445
-						if(!empty($permissions)) {
1445
+						if (!empty($permissions)) {
1446 1446
 							// Add the "All Document Groups" item if we have rights in both contexts
1447
-							if($isManager && $isWeb) {
1448
-								array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1447
+							if ($isManager && $isWeb) {
1448
+								array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>');
1449 1449
 							}
1450 1450
 							// Output the permissions list...
1451 1451
 							?>
@@ -1478,12 +1478,12 @@  discard block
 block discarded – undo
1478 1478
 								</script>
1479 1479
 								<p><?= $_lang['access_permissions_docs_message'] ?></p>
1480 1480
 								<ul>
1481
-									<?= implode("\n", $permissions) . "\n" ?>
1481
+									<?= implode("\n", $permissions)."\n" ?>
1482 1482
 								</ul>
1483 1483
 							</div><!--div class="tab-page" id="tabAccess"-->
1484 1484
 							<?php
1485 1485
 						} // !empty($permissions)
1486
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1486
+						elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1487 1487
 							?>
1488 1488
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1489 1489
 							<?php
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 						'template' => $content['template']
1504 1504
 					));
1505 1505
 
1506
-					if(is_array($evtOut)) {
1506
+					if (is_array($evtOut)) {
1507 1507
 						echo implode('', $evtOut);
1508 1508
 					}
1509 1509
 					?>
@@ -1516,16 +1516,16 @@  discard block
 block discarded – undo
1516 1516
 		storeCurTemplate();
1517 1517
 	</script>
1518 1518
 <?php
1519
-if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1520
-	if(is_array($richtexteditorIds)) {
1521
-		foreach($richtexteditorIds as $editor => $elements) {
1519
+if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1520
+	if (is_array($richtexteditorIds)) {
1521
+		foreach ($richtexteditorIds as $editor => $elements) {
1522 1522
 			// invoke OnRichTextEditorInit event
1523 1523
 			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1524 1524
 				'editor' => $editor,
1525 1525
 				'elements' => $elements,
1526 1526
 				'options' => $richtexteditorOptions[$editor]
1527 1527
 			));
1528
-			if(is_array($evtOut)) {
1528
+			if (is_array($evtOut)) {
1529 1529
 				echo implode('', $evtOut);
1530 1530
 			}
1531 1531
 		}
@@ -1535,37 +1535,37 @@  discard block
 block discarded – undo
1535 1535
 /**
1536 1536
  * @return string
1537 1537
  */
1538
-function getDefaultTemplate() {
1538
+function getDefaultTemplate(){
1539 1539
 	global $modx;
1540 1540
 
1541 1541
     $default_template = '';
1542
-	switch($modx->config['auto_template_logic']) {
1542
+	switch ($modx->config['auto_template_logic']) {
1543 1543
 		case 'sibling':
1544
-			if(!isset($_GET['pid']) || empty($_GET['pid'])) {
1544
+			if (!isset($_GET['pid']) || empty($_GET['pid'])) {
1545 1545
 				$site_start = $modx->config['site_start'];
1546 1546
 				$where = "sc.isfolder=0 AND sc.id!='{$site_start}'";
1547 1547
 				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1);
1548
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1548
+				if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1549 1549
 					$default_template = $sibl[0]['template'];
1550 1550
 				}
1551 1551
 			} else {
1552 1552
 				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1553
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1553
+				if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1554 1554
 					$default_template = $sibl[0]['template'];
1555 1555
 				} else {
1556 1556
 					$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1557
-					if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1557
+					if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1558 1558
 						$default_template = $sibl[0]['template'];
1559 1559
 					}
1560 1560
 				}
1561 1561
 			}
1562
-			if(isset($default_template)) {
1562
+			if (isset($default_template)) {
1563 1563
 				break;
1564 1564
 			} // If $default_template could not be determined, fall back / through to "parent"-mode
1565 1565
 		case 'parent':
1566
-			if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1566
+			if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1567 1567
 				$parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template');
1568
-				if(isset($parent['template'])) {
1568
+				if (isset($parent['template'])) {
1569 1569
 					$default_template = $parent['template'];
1570 1570
 				}
1571 1571
 			}
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -478,7 +478,8 @@  discard block
 block discarded – undo
478 478
 			return s;
479 479
 		}
480 480
 
481
-		<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
481
+		<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') {
482
+// Web Link specific ?>
482 483
 		var lastImageCtrl;
483 484
 		var lastFileCtrl;
484 485
 
@@ -694,7 +695,8 @@  discard block
 block discarded – undo
694 695
 									</td>
695 696
 								</tr>
696 697
 
697
-								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
698
+								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') {
699
+// Web Link specific ?>
698 700
 
699 701
 									<tr>
700 702
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -1353,7 +1355,9 @@  discard block
 block discarded – undo
1353 1355
 						if($documentId > 0) {
1354 1356
 							// Load up, the permissions from the parent (if new document) or existing document
1355 1357
 							$rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1356
-							while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1358
+							while($currentgroup = $modx->db->getRow($rs)) {
1359
+							    $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1360
+							}
1357 1361
 
1358 1362
 							// Load up the current permissions and names
1359 1363
 							$vs = array(
@@ -1415,7 +1419,9 @@  discard block
 block discarded – undo
1415 1419
 
1416 1420
 							// Create attribute string list
1417 1421
 							$inputString = array();
1418
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1422
+							foreach($inputAttributes as $k => $v) {
1423
+							    $inputString[] = $k . '="' . $v . '"';
1424
+							}
1419 1425
 
1420 1426
 							// Make the <input> HTML
1421 1427
 							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
@@ -1535,7 +1541,8 @@  discard block
 block discarded – undo
1535 1541
 /**
1536 1542
  * @return string
1537 1543
  */
1538
-function getDefaultTemplate() {
1544
+function getDefaultTemplate()
1545
+{
1539 1546
 	global $modx;
1540 1547
 
1541 1548
     $default_template = '';
Please login to merge, or discard this patch.
manager/actions/mutate_module.dynamic.php 3 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 switch($modx->manager->action) {
6
-	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
8
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9
-		}
10
-		break;
11
-	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
13
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14
-		}
15
-		break;
16
-	default:
17
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    case 107:
7
+        if(!$modx->hasPermission('new_module')) {
8
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
9
+        }
10
+        break;
11
+    case 108:
12
+        if(!$modx->hasPermission('edit_module')) {
13
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
14
+        }
15
+        break;
16
+    default:
17
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 }
19 19
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
20 20
 // Get table names (alphabetical)
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
  * @return string
35 35
  */
36 36
 function createGUID() {
37
-	srand((double) microtime() * 1000000);
38
-	$r = rand();
39
-	$u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1);
40
-	$m = md5($u);
41
-	return $m;
37
+    srand((double) microtime() * 1000000);
38
+    $r = rand();
39
+    $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1);
40
+    $m = md5($u);
41
+    return $m;
42 42
 }
43 43
 
44 44
 // check to see the module editor isn't locked
45 45
 if($lockedEl = $modx->elementIsLocked(6, $id)) {
46
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
46
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
47 47
 }
48 48
 // end check for lock
49 49
 
@@ -51,22 +51,22 @@  discard block
 block discarded – undo
51 51
 $modx->lockElement(6, $id);
52 52
 
53 53
 if(isset($_GET['id'])) {
54
-	$rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
55
-	$content = $modx->db->getRow($rs);
56
-	if(!$content) {
57
-		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
58
-	}
59
-	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
60
-	$_SESSION['itemname'] = $content['name'];
61
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
62
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
63
-	}
54
+    $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
55
+    $content = $modx->db->getRow($rs);
56
+    if(!$content) {
57
+        $modx->webAlertAndQuit("Module not found for id '{$id}'.");
58
+    }
59
+    $content['properties'] = str_replace("&", "&amp;", $content['properties']);
60
+    $_SESSION['itemname'] = $content['name'];
61
+    if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
62
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
63
+    }
64 64
 } else {
65
-	$_SESSION['itemname'] = $_lang["new_module"];
66
-	$content['wrap'] = '1';
65
+    $_SESSION['itemname'] = $_lang["new_module"];
66
+    $content['wrap'] = '1';
67 67
 }
68 68
 if($modx->manager->hasFormValues()) {
69
-	$modx->manager->loadFormValues();
69
+    $modx->manager->loadFormValues();
70 70
 }
71 71
 
72 72
 // Add lock-element JS-Script
@@ -437,18 +437,18 @@  discard block
 block discarded – undo
437 437
 
438 438
 <form name="mutate" id="mutate" class="module" method="post" action="index.php?a=109">
439 439
 	<?php
440
-	// invoke OnModFormPrerender event
441
-	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
442
-	if(is_array($evtOut)) {
443
-		echo implode('', $evtOut);
444
-	}
445
-
446
-	// Prepare internal params & info-tab via parseDocBlock
447
-	$modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : '';
448
-	$docBlock = $modx->parseDocBlockFromString($modulecode);
449
-	$docBlockList = $modx->convertDocBlockIntoList($docBlock);
450
-	$internal = array();
451
-	?>
440
+    // invoke OnModFormPrerender event
441
+    $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
442
+    if(is_array($evtOut)) {
443
+        echo implode('', $evtOut);
444
+    }
445
+
446
+    // Prepare internal params & info-tab via parseDocBlock
447
+    $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : '';
448
+    $docBlock = $modx->parseDocBlockFromString($modulecode);
449
+    $docBlockList = $modx->convertDocBlockIntoList($docBlock);
450
+    $internal = array();
451
+    ?>
452 452
 	<input type="hidden" name="id" value="<?= $content['id'] ?>">
453 453
 	<input type="hidden" name="mode" value="<?= $modx->manager->action ?>">
454 454
 
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
502 502
 								<option>&nbsp;</option>
503 503
 								<?php
504
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
505
-								foreach(getCategories() as $n => $v) {
506
-									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n";
507
-								}
508
-								?>
504
+                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
505
+                                foreach(getCategories() as $n => $v) {
506
+                                    echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n";
507
+                                }
508
+                                ?>
509 509
 							</select>
510 510
 						</div>
511 511
 					</div>
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 							<i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang['manage_depends'] ?></a>
613 613
 					</div>
614 614
 					<?php
615
-					$ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, 
615
+                    $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, 
616 616
 					CASE smd.type
617 617
 						WHEN 10 THEN 'Chunk'
618 618
 						WHEN 20 THEN 'Document'
@@ -628,17 +628,17 @@  discard block
 block discarded – undo
628 628
 						LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50
629 629
 						LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name');
630 630
 
631
-					include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
632
-					$grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
633
-					$grd->noRecordMsg = $_lang['no_records_found'];
634
-					$grd->cssClass = 'grid';
635
-					$grd->columnHeaderClass = 'gridHeader';
636
-					$grd->itemClass = 'gridItem';
637
-					$grd->altItemClass = 'gridAltItem';
638
-					$grd->columns = $_lang['element_name'] . " ," . $_lang['type'];
639
-					$grd->fields = "name,type";
640
-					echo $grd->render();
641
-					?>
631
+                    include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
632
+                    $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
633
+                    $grd->noRecordMsg = $_lang['no_records_found'];
634
+                    $grd->cssClass = 'grid';
635
+                    $grd->columnHeaderClass = 'gridHeader';
636
+                    $grd->itemClass = 'gridItem';
637
+                    $grd->altItemClass = 'gridAltItem';
638
+                    $grd->columns = $_lang['element_name'] . " ," . $_lang['type'];
639
+                    $grd->fields = "name,type";
640
+                    echo $grd->render();
641
+                    ?>
642 642
 				</div>
643 643
 			</div>
644 644
 		<?php endif; ?>
@@ -650,12 +650,12 @@  discard block
 block discarded – undo
650 650
 			<div class="container container-body">
651 651
 				<?php if($use_udperms == 1) : ?>
652 652
 					<?php
653
-					// fetch user access permissions for the module
654
-					$rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
655
-					$groupsarray = $modx->db->getColumn('usergroup', $rs);
653
+                    // fetch user access permissions for the module
654
+                    $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
655
+                    $groupsarray = $modx->db->getColumn('usergroup', $rs);
656 656
 
657
-					if($modx->hasPermission('access_permissions')) {
658
-						?>
657
+                    if($modx->hasPermission('access_permissions')) {
658
+                        ?>
659 659
 						<!-- User Group Access Permissions -->
660 660
 						<script type="text/javascript">
661 661
 							function makePublic(b) {
@@ -679,28 +679,28 @@  discard block
 block discarded – undo
679 679
 						</script>
680 680
 						<p><?= $_lang['module_group_access_msg'] ?></p>
681 681
 						<?php
682
-					}
683
-					$chk = '';
684
-					$rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
685
-					while($row = $modx->db->getRow($rs)) {
686
-						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
687
-						$checked = in_array($row['id'], $groupsarray);
688
-						if($modx->hasPermission('access_permissions')) {
689
-							if($checked) {
690
-								$notPublic = true;
691
-							}
692
-							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
693
-						} else {
694
-							if($checked) {
695
-								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
696
-							}
697
-						}
698
-					}
699
-					if($modx->hasPermission('access_permissions')) {
700
-						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
701
-					}
702
-					echo $chks;
703
-					?>
682
+                    }
683
+                    $chk = '';
684
+                    $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
685
+                    while($row = $modx->db->getRow($rs)) {
686
+                        $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
687
+                        $checked = in_array($row['id'], $groupsarray);
688
+                        if($modx->hasPermission('access_permissions')) {
689
+                            if($checked) {
690
+                                $notPublic = true;
691
+                            }
692
+                            $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
693
+                        } else {
694
+                            if($checked) {
695
+                                $chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
696
+                            }
697
+                        }
698
+                    }
699
+                    if($modx->hasPermission('access_permissions')) {
700
+                        $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
701
+                    }
702
+                    echo $chks;
703
+                    ?>
704 704
 				<?php endif; ?>
705 705
 			</div>
706 706
 		</div>
@@ -716,11 +716,11 @@  discard block
 block discarded – undo
716 716
 
717 717
 		<input type="submit" name="save" style="display:none;">
718 718
 		<?php
719
-		// invoke OnModFormRender event
720
-		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
721
-		if(is_array($evtOut)) {
722
-			echo implode('', $evtOut);
723
-		}
724
-		?>
719
+        // invoke OnModFormRender event
720
+        $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
721
+        if(is_array($evtOut)) {
722
+            echo implode('', $evtOut);
723
+        }
724
+        ?>
725 725
 </form>
726 726
 <script type="text/javascript">setTimeout('showParameters();', 10);</script>
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-switch($modx->manager->action) {
5
+switch ($modx->manager->action) {
6 6
 	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
7
+		if (!$modx->hasPermission('new_module')) {
8 8
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9 9
 		}
10 10
 		break;
11 11
 	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
12
+		if (!$modx->hasPermission('edit_module')) {
13 13
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14 14
 		}
15 15
 		break;
16 16
 	default:
17 17
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 }
19
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
19
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
20 20
 // Get table names (alphabetical)
21 21
 $tbl_membergroup_names = $modx->getFullTableName('membergroup_names');
22 22
 $tbl_site_content = $modx->getFullTableName('site_content');
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @return string
35 35
  */
36
-function createGUID() {
36
+function createGUID(){
37 37
 	srand((double) microtime() * 1000000);
38 38
 	$r = rand();
39
-	$u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1);
39
+	$u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1);
40 40
 	$m = md5($u);
41 41
 	return $m;
42 42
 }
43 43
 
44 44
 // check to see the module editor isn't locked
45
-if($lockedEl = $modx->elementIsLocked(6, $id)) {
45
+if ($lockedEl = $modx->elementIsLocked(6, $id)) {
46 46
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
47 47
 }
48 48
 // end check for lock
@@ -50,29 +50,29 @@  discard block
 block discarded – undo
50 50
 // Lock snippet for other users to edit
51 51
 $modx->lockElement(6, $id);
52 52
 
53
-if(isset($_GET['id'])) {
53
+if (isset($_GET['id'])) {
54 54
 	$rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
55 55
 	$content = $modx->db->getRow($rs);
56
-	if(!$content) {
56
+	if (!$content) {
57 57
 		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
58 58
 	}
59 59
 	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
60 60
 	$_SESSION['itemname'] = $content['name'];
61
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
61
+	if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
62 62
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
63 63
 	}
64 64
 } else {
65 65
 	$_SESSION['itemname'] = $_lang["new_module"];
66 66
 	$content['wrap'] = '1';
67 67
 }
68
-if($modx->manager->hasFormValues()) {
68
+if ($modx->manager->hasFormValues()) {
69 69
 	$modx->manager->loadFormValues();
70 70
 }
71 71
 
72 72
 // Add lock-element JS-Script
73 73
 $lockElementId = $id;
74 74
 $lockElementType = 6;
75
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
75
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
76 76
 ?>
77 77
 <script type="text/javascript">
78 78
 	function loadDependencies() {
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	function BrowseServer() {
420 420
 		var w = screen.width * 0.7;
421 421
 		var h = screen.height * 0.7;
422
-		OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h);
422
+		OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h);
423 423
 	}
424 424
 
425 425
 	function SetUrl(url, width, height, alt) {
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	<?php
440 440
 	// invoke OnModFormPrerender event
441 441
 	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
442
-	if(is_array($evtOut)) {
442
+	if (is_array($evtOut)) {
443 443
 		echo implode('', $evtOut);
444 444
 	}
445 445
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	<input type="hidden" name="mode" value="<?= $modx->manager->action ?>">
454 454
 
455 455
 	<h1>
456
-		<i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i>
456
+		<i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i>
457 457
 	</h1>
458 458
 
459 459
 	<?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 						<div class="col-md-9 col-lg-10">
479 479
 							<div class="form-control-name clearfix">
480 480
 								<input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
481
-								<?php if($modx->hasPermission('save_role')): ?>
482
-									<label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip>
481
+								<?php if ($modx->hasPermission('save_role')): ?>
482
+									<label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip>
483 483
 										<input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
484 484
 										<i class="fa fa-lock"></i>
485 485
 									</label>
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
502 502
 								<option>&nbsp;</option>
503 503
 								<?php
504
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
505
-								foreach(getCategories() as $n => $v) {
506
-									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n";
504
+								include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
505
+								foreach (getCategories() as $n => $v) {
506
+									echo "\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category'])."</option>\n";
507 507
 								}
508 508
 								?>
509 509
 							</select>
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 				<div class="form-group">
536 536
 					<div class="form-row">
537 537
 						<label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> />
538
-							<?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label>
538
+							<?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label>
539 539
 					</div>
540 540
 					<div class="form-row">
541 541
 						<label for="parse_docblock">
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 			</div>
601 601
 			<!-- HTML text editor end -->
602 602
 		</div>
603
-		<?php if($modx->manager->action == '108'): ?>
603
+		<?php if ($modx->manager->action == '108'): ?>
604 604
 			<!-- Dependencies -->
605 605
 			<div class="tab-page" id="tabDepend">
606 606
 				<h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2>
@@ -628,14 +628,14 @@  discard block
 block discarded – undo
628 628
 						LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50
629 629
 						LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name');
630 630
 
631
-					include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
631
+					include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
632 632
 					$grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
633 633
 					$grd->noRecordMsg = $_lang['no_records_found'];
634 634
 					$grd->cssClass = 'grid';
635 635
 					$grd->columnHeaderClass = 'gridHeader';
636 636
 					$grd->itemClass = 'gridItem';
637 637
 					$grd->altItemClass = 'gridAltItem';
638
-					$grd->columns = $_lang['element_name'] . " ," . $_lang['type'];
638
+					$grd->columns = $_lang['element_name']." ,".$_lang['type'];
639 639
 					$grd->fields = "name,type";
640 640
 					echo $grd->render();
641 641
 					?>
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
 			<h2 class="tab"><?= $_lang['access_permissions'] ?></h2>
649 649
 			<script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script>
650 650
 			<div class="container container-body">
651
-				<?php if($use_udperms == 1) : ?>
651
+				<?php if ($use_udperms == 1) : ?>
652 652
 					<?php
653 653
 					// fetch user access permissions for the module
654 654
 					$rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
655 655
 					$groupsarray = $modx->db->getColumn('usergroup', $rs);
656 656
 
657
-					if($modx->hasPermission('access_permissions')) {
657
+					if ($modx->hasPermission('access_permissions')) {
658 658
 						?>
659 659
 						<!-- User Group Access Permissions -->
660 660
 						<script type="text/javascript">
@@ -682,22 +682,22 @@  discard block
 block discarded – undo
682 682
 					}
683 683
 					$chk = '';
684 684
 					$rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
685
-					while($row = $modx->db->getRow($rs)) {
685
+					while ($row = $modx->db->getRow($rs)) {
686 686
 						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
687 687
 						$checked = in_array($row['id'], $groupsarray);
688
-						if($modx->hasPermission('access_permissions')) {
689
-							if($checked) {
688
+						if ($modx->hasPermission('access_permissions')) {
689
+							if ($checked) {
690 690
 								$notPublic = true;
691 691
 							}
692
-							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
692
+							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n";
693 693
 						} else {
694
-							if($checked) {
695
-								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
694
+							if ($checked) {
695
+								$chks = '<input type="hidden" name="usrgroups[]"  value="'.$row['id'].'" />'."\n".$chks;
696 696
 							}
697 697
 						}
698 698
 					}
699
-					if($modx->hasPermission('access_permissions')) {
700
-						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
699
+					if ($modx->hasPermission('access_permissions')) {
700
+						$chks = '<label><input type="checkbox" name="chkallgroups"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true)" /><span class="warning"> '.$_lang['all_usr_groups'].'</span></label><br />'."\n".$chks;
701 701
 					}
702 702
 					echo $chks;
703 703
 					?>
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		<?php
719 719
 		// invoke OnModFormRender event
720 720
 		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
721
-		if(is_array($evtOut)) {
721
+		if (is_array($evtOut)) {
722 722
 			echo implode('', $evtOut);
723 723
 		}
724 724
 		?>
Please login to merge, or discard this patch.
Braces   +22 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-switch($modx->manager->action) {
5
+switch($modx->manager->action) {
6 6
 	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
7
+		if(!$modx->hasPermission('new_module')) {
8 8
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9 9
 		}
10 10
 		break;
11 11
 	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
12
+		if(!$modx->hasPermission('edit_module')) {
13 13
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14 14
 		}
15 15
 		break;
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @return string
35 35
  */
36
-function createGUID() {
36
+function createGUID()
37
+{
37 38
 	srand((double) microtime() * 1000000);
38 39
 	$r = rand();
39 40
 	$u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1);
@@ -42,7 +43,7 @@  discard block
 block discarded – undo
42 43
 }
43 44
 
44 45
 // check to see the module editor isn't locked
45
-if($lockedEl = $modx->elementIsLocked(6, $id)) {
46
+if($lockedEl = $modx->elementIsLocked(6, $id)) {
46 47
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
47 48
 }
48 49
 // end check for lock
@@ -50,22 +51,22 @@  discard block
 block discarded – undo
50 51
 // Lock snippet for other users to edit
51 52
 $modx->lockElement(6, $id);
52 53
 
53
-if(isset($_GET['id'])) {
54
+if(isset($_GET['id'])) {
54 55
 	$rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
55 56
 	$content = $modx->db->getRow($rs);
56
-	if(!$content) {
57
+	if(!$content) {
57 58
 		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
58 59
 	}
59 60
 	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
60 61
 	$_SESSION['itemname'] = $content['name'];
61
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
62
+	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
62 63
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
63 64
 	}
64
-} else {
65
+} else {
65 66
 	$_SESSION['itemname'] = $_lang["new_module"];
66 67
 	$content['wrap'] = '1';
67 68
 }
68
-if($modx->manager->hasFormValues()) {
69
+if($modx->manager->hasFormValues()) {
69 70
 	$modx->manager->loadFormValues();
70 71
 }
71 72
 
@@ -439,7 +440,7 @@  discard block
 block discarded – undo
439 440
 	<?php
440 441
 	// invoke OnModFormPrerender event
441 442
 	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
442
-	if(is_array($evtOut)) {
443
+	if(is_array($evtOut)) {
443 444
 		echo implode('', $evtOut);
444 445
 	}
445 446
 
@@ -502,7 +503,7 @@  discard block
 block discarded – undo
502 503
 								<option>&nbsp;</option>
503 504
 								<?php
504 505
 								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
505
-								foreach(getCategories() as $n => $v) {
506
+								foreach(getCategories() as $n => $v) {
506 507
 									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n";
507 508
 								}
508 509
 								?>
@@ -654,7 +655,7 @@  discard block
 block discarded – undo
654 655
 					$rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
655 656
 					$groupsarray = $modx->db->getColumn('usergroup', $rs);
656 657
 
657
-					if($modx->hasPermission('access_permissions')) {
658
+					if($modx->hasPermission('access_permissions')) {
658 659
 						?>
659 660
 						<!-- User Group Access Permissions -->
660 661
 						<script type="text/javascript">
@@ -682,21 +683,21 @@  discard block
 block discarded – undo
682 683
 					}
683 684
 					$chk = '';
684 685
 					$rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
685
-					while($row = $modx->db->getRow($rs)) {
686
+					while($row = $modx->db->getRow($rs)) {
686 687
 						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
687 688
 						$checked = in_array($row['id'], $groupsarray);
688
-						if($modx->hasPermission('access_permissions')) {
689
-							if($checked) {
689
+						if($modx->hasPermission('access_permissions')) {
690
+							if($checked) {
690 691
 								$notPublic = true;
691 692
 							}
692 693
 							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
693
-						} else {
694
-							if($checked) {
694
+						} else {
695
+							if($checked) {
695 696
 								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
696 697
 							}
697 698
 						}
698 699
 					}
699
-					if($modx->hasPermission('access_permissions')) {
700
+					if($modx->hasPermission('access_permissions')) {
700 701
 						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
701 702
 					}
702 703
 					echo $chks;
@@ -718,7 +719,7 @@  discard block
 block discarded – undo
718 719
 		<?php
719 720
 		// invoke OnModFormRender event
720 721
 		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
721
-		if(is_array($evtOut)) {
722
+		if(is_array($evtOut)) {
722 723
 			echo implode('', $evtOut);
723 724
 		}
724 725
 		?>
Please login to merge, or discard this patch.
manager/actions/mutate_role.dynamic.php 3 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 switch((int) $modx->manager->action) {
7
-	case 35:
8
-		if(!$modx->hasPermission('edit_role')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 38:
13
-		if(!$modx->hasPermission('new_role')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    case 35:
8
+        if(!$modx->hasPermission('edit_role')) {
9
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+        }
11
+        break;
12
+    case 38:
13
+        if(!$modx->hasPermission('new_role')) {
14
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+        }
16
+        break;
17
+    default:
18
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 // check to see the snippet editor isn't locked
26 26
 if($lockedEl = $modx->elementIsLocked(8, $role)) {
27
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role']));
27
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role']));
28 28
 }
29 29
 // end check for lock
30 30
 
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
 $modx->lockElement(8, $role);
33 33
 
34 34
 if($modx->manager->action == '35') {
35
-	$rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'");
36
-	$roledata = $modx->db->getRow($rs);
37
-	if(!$roledata) {
38
-		$modx->webAlertAndQuit("No role returned!");
39
-	}
40
-	$_SESSION['itemname'] = $roledata['name'];
35
+    $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'");
36
+    $roledata = $modx->db->getRow($rs);
37
+    if(!$roledata) {
38
+        $modx->webAlertAndQuit("No role returned!");
39
+    }
40
+    $_SESSION['itemname'] = $roledata['name'];
41 41
 } else {
42
-	$roledata = 0;
43
-	$_SESSION['itemname'] = $_lang["new_role"];
42
+    $roledata = 0;
43
+    $_SESSION['itemname'] = $_lang["new_role"];
44 44
 }
45 45
 
46 46
 // Add lock-element JS-Script
@@ -107,63 +107,63 @@  discard block
 block discarded – undo
107 107
 							<div class="form-group">
108 108
 								<h3><?= $_lang['page_data_general'] ?></h3>
109 109
 								<?php
110
-								echo render_form('frames', $_lang['role_frames'], 'disabled');
111
-								echo render_form('home', $_lang['role_home'], 'disabled');
112
-								echo render_form('messages', $_lang['role_messages']);
113
-								echo render_form('logout', $_lang['role_logout'], 'disabled');
114
-								echo render_form('help', $_lang['role_help']);
115
-								echo render_form('action_ok', $_lang['role_actionok'], 'disabled');
116
-								echo render_form('error_dialog', $_lang['role_errors'], 'disabled');
117
-								echo render_form('about', $_lang['role_about'], 'disabled');
118
-								echo render_form('credits', $_lang['role_credits'], 'disabled');
119
-								echo render_form('change_password', $_lang['role_change_password']);
120
-								echo render_form('save_password', $_lang['role_save_password']);
121
-								?>
110
+                                echo render_form('frames', $_lang['role_frames'], 'disabled');
111
+                                echo render_form('home', $_lang['role_home'], 'disabled');
112
+                                echo render_form('messages', $_lang['role_messages']);
113
+                                echo render_form('logout', $_lang['role_logout'], 'disabled');
114
+                                echo render_form('help', $_lang['role_help']);
115
+                                echo render_form('action_ok', $_lang['role_actionok'], 'disabled');
116
+                                echo render_form('error_dialog', $_lang['role_errors'], 'disabled');
117
+                                echo render_form('about', $_lang['role_about'], 'disabled');
118
+                                echo render_form('credits', $_lang['role_credits'], 'disabled');
119
+                                echo render_form('change_password', $_lang['role_change_password']);
120
+                                echo render_form('save_password', $_lang['role_save_password']);
121
+                                ?>
122 122
 							</div>
123 123
 						</div>
124 124
 						<div class="col-sm-6 col-lg-3">
125 125
 							<div class="form-group">
126 126
 								<h3><?= $_lang['role_content_management'] ?></h3>
127 127
 								<?php
128
-								echo render_form('view_document', $_lang['role_view_docdata'], 'disabled');
129
-								echo render_form('new_document', $_lang['role_create_doc']);
130
-								echo render_form('edit_document', $_lang['role_edit_doc']);
131
-								echo render_form('change_resourcetype', $_lang['role_change_resourcetype']);
132
-								echo render_form('save_document', $_lang['role_save_doc']);
133
-								echo render_form('publish_document', $_lang['role_publish_doc']);
134
-								echo render_form('delete_document', $_lang['role_delete_doc']);
135
-								echo render_form('empty_trash', $_lang['role_empty_trash']);
136
-								echo render_form('empty_cache', $_lang['role_cache_refresh']);
137
-								echo render_form('view_unpublished', $_lang['role_view_unpublished']);
138
-								?>
128
+                                echo render_form('view_document', $_lang['role_view_docdata'], 'disabled');
129
+                                echo render_form('new_document', $_lang['role_create_doc']);
130
+                                echo render_form('edit_document', $_lang['role_edit_doc']);
131
+                                echo render_form('change_resourcetype', $_lang['role_change_resourcetype']);
132
+                                echo render_form('save_document', $_lang['role_save_doc']);
133
+                                echo render_form('publish_document', $_lang['role_publish_doc']);
134
+                                echo render_form('delete_document', $_lang['role_delete_doc']);
135
+                                echo render_form('empty_trash', $_lang['role_empty_trash']);
136
+                                echo render_form('empty_cache', $_lang['role_cache_refresh']);
137
+                                echo render_form('view_unpublished', $_lang['role_view_unpublished']);
138
+                                ?>
139 139
 							</div>
140 140
 						</div>
141 141
 						<div class="col-sm-6 col-lg-3 form-group">
142 142
 							<div class="form-group">
143 143
 								<h3><?= $_lang['role_file_management'] ?></h3>
144 144
 								<?php
145
-								echo render_form('file_manager', $_lang['role_file_manager']);
146
-								echo render_form('assets_files', $_lang['role_assets_files']);
147
-								echo render_form('assets_images', $_lang['role_assets_images']);
148
-								?>
145
+                                echo render_form('file_manager', $_lang['role_file_manager']);
146
+                                echo render_form('assets_files', $_lang['role_assets_files']);
147
+                                echo render_form('assets_images', $_lang['role_assets_images']);
148
+                                ?>
149 149
 							</div>
150 150
 							<div class="form-group">
151 151
 								<h3><?= $_lang['category_management'] ?></h3>
152 152
 								<?php
153
-								echo render_form('category_manager', $_lang['role_category_manager']);
154
-								?>
153
+                                echo render_form('category_manager', $_lang['role_category_manager']);
154
+                                ?>
155 155
 							</div>
156 156
 						</div>
157 157
 						<div class="col-sm-6 col-lg-3">
158 158
 							<div class="form-group">
159 159
 								<h3><?= $_lang['role_module_management'] ?></h3>
160 160
 								<?php
161
-								echo render_form('new_module', $_lang['role_new_module']);
162
-								echo render_form('edit_module', $_lang['role_edit_module']);
163
-								echo render_form('save_module', $_lang['role_save_module']);
164
-								echo render_form('delete_module', $_lang['role_delete_module']);
165
-								echo render_form('exec_module', $_lang['role_run_module']);
166
-								?>
161
+                                echo render_form('new_module', $_lang['role_new_module']);
162
+                                echo render_form('edit_module', $_lang['role_edit_module']);
163
+                                echo render_form('save_module', $_lang['role_save_module']);
164
+                                echo render_form('delete_module', $_lang['role_delete_module']);
165
+                                echo render_form('exec_module', $_lang['role_run_module']);
166
+                                ?>
167 167
 							</div>
168 168
 						</div>
169 169
 					</div>
@@ -173,44 +173,44 @@  discard block
 block discarded – undo
173 173
 							<div class="form-group">
174 174
 								<h3><?= $_lang['role_template_management'] ?></h3>
175 175
 								<?php
176
-								echo render_form('new_template', $_lang['role_create_template']);
177
-								echo render_form('edit_template', $_lang['role_edit_template']);
178
-								echo render_form('save_template', $_lang['role_save_template']);
179
-								echo render_form('delete_template', $_lang['role_delete_template']);
180
-								?>
176
+                                echo render_form('new_template', $_lang['role_create_template']);
177
+                                echo render_form('edit_template', $_lang['role_edit_template']);
178
+                                echo render_form('save_template', $_lang['role_save_template']);
179
+                                echo render_form('delete_template', $_lang['role_delete_template']);
180
+                                ?>
181 181
 							</div>
182 182
 						</div>
183 183
 						<div class="col-sm-6 col-lg-3">
184 184
 							<div class="form-group">
185 185
 								<h3><?= $_lang['role_snippet_management'] ?></h3>
186 186
 								<?php
187
-								echo render_form('new_snippet', $_lang['role_create_snippet']);
188
-								echo render_form('edit_snippet', $_lang['role_edit_snippet']);
189
-								echo render_form('save_snippet', $_lang['role_save_snippet']);
190
-								echo render_form('delete_snippet', $_lang['role_delete_snippet']);
191
-								?>
187
+                                echo render_form('new_snippet', $_lang['role_create_snippet']);
188
+                                echo render_form('edit_snippet', $_lang['role_edit_snippet']);
189
+                                echo render_form('save_snippet', $_lang['role_save_snippet']);
190
+                                echo render_form('delete_snippet', $_lang['role_delete_snippet']);
191
+                                ?>
192 192
 							</div>
193 193
 						</div>
194 194
 						<div class="col-sm-6 col-lg-3">
195 195
 							<div class="form-group">
196 196
 								<h3><?= $_lang['role_chunk_management'] ?></h3>
197 197
 								<?php
198
-								echo render_form('new_chunk', $_lang['role_create_chunk']);
199
-								echo render_form('edit_chunk', $_lang['role_edit_chunk']);
200
-								echo render_form('save_chunk', $_lang['role_save_chunk']);
201
-								echo render_form('delete_chunk', $_lang['role_delete_chunk']);
202
-								?>
198
+                                echo render_form('new_chunk', $_lang['role_create_chunk']);
199
+                                echo render_form('edit_chunk', $_lang['role_edit_chunk']);
200
+                                echo render_form('save_chunk', $_lang['role_save_chunk']);
201
+                                echo render_form('delete_chunk', $_lang['role_delete_chunk']);
202
+                                ?>
203 203
 							</div>
204 204
 						</div>
205 205
 						<div class="col-sm-6 col-lg-3">
206 206
 							<div class="form-group">
207 207
 								<h3><?= $_lang['role_plugin_management'] ?></h3>
208 208
 								<?php
209
-								echo render_form('new_plugin', $_lang['role_create_plugin']);
210
-								echo render_form('edit_plugin', $_lang['role_edit_plugin']);
211
-								echo render_form('save_plugin', $_lang['role_save_plugin']);
212
-								echo render_form('delete_plugin', $_lang['role_delete_plugin']);
213
-								?>
209
+                                echo render_form('new_plugin', $_lang['role_create_plugin']);
210
+                                echo render_form('edit_plugin', $_lang['role_edit_plugin']);
211
+                                echo render_form('save_plugin', $_lang['role_save_plugin']);
212
+                                echo render_form('delete_plugin', $_lang['role_delete_plugin']);
213
+                                ?>
214 214
 							</div>
215 215
 						</div>
216 216
 					</div>
@@ -220,42 +220,42 @@  discard block
 block discarded – undo
220 220
 							<div class="form-group">
221 221
 								<h3><?= $_lang['role_user_management'] ?></h3>
222 222
 								<?php
223
-								echo render_form('new_user', $_lang['role_new_user']);
224
-								echo render_form('edit_user', $_lang['role_edit_user']);
225
-								echo render_form('save_user', $_lang['role_save_user']);
226
-								echo render_form('delete_user', $_lang['role_delete_user']);
227
-								?>
223
+                                echo render_form('new_user', $_lang['role_new_user']);
224
+                                echo render_form('edit_user', $_lang['role_edit_user']);
225
+                                echo render_form('save_user', $_lang['role_save_user']);
226
+                                echo render_form('delete_user', $_lang['role_delete_user']);
227
+                                ?>
228 228
 							</div>
229 229
 						</div>
230 230
 						<div class="col-sm-6 col-lg-3">
231 231
 							<div class="form-group">
232 232
 								<h3><?= $_lang['role_web_user_management'] ?></h3>
233 233
 								<?php
234
-								echo render_form('new_web_user', $_lang['role_new_web_user']);
235
-								echo render_form('edit_web_user', $_lang['role_edit_web_user']);
236
-								echo render_form('save_web_user', $_lang['role_save_web_user']);
237
-								echo render_form('delete_web_user', $_lang['role_delete_web_user']);
238
-								?>
234
+                                echo render_form('new_web_user', $_lang['role_new_web_user']);
235
+                                echo render_form('edit_web_user', $_lang['role_edit_web_user']);
236
+                                echo render_form('save_web_user', $_lang['role_save_web_user']);
237
+                                echo render_form('delete_web_user', $_lang['role_delete_web_user']);
238
+                                ?>
239 239
 							</div>
240 240
 						</div>
241 241
 						<div class="col-sm-6 col-lg-3">
242 242
 							<div class="form-group">
243 243
 								<h3><?= $_lang['role_udperms'] ?></h3>
244 244
 								<?php
245
-								echo render_form('access_permissions', $_lang['role_access_persmissions']);
246
-								echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']);
247
-								?>
245
+                                echo render_form('access_permissions', $_lang['role_access_persmissions']);
246
+                                echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']);
247
+                                ?>
248 248
 							</div>
249 249
 						</div>
250 250
 						<div class="col-sm-6 col-lg-3">
251 251
 							<div class="form-group">
252 252
 								<h3><?= $_lang['role_role_management'] ?></h3>
253 253
 								<?php
254
-								echo render_form('new_role', $_lang['role_new_role']);
255
-								echo render_form('edit_role', $_lang['role_edit_role']);
256
-								echo render_form('save_role', $_lang['role_save_role']);
257
-								echo render_form('delete_role', $_lang['role_delete_role']);
258
-								?>
254
+                                echo render_form('new_role', $_lang['role_new_role']);
255
+                                echo render_form('edit_role', $_lang['role_edit_role']);
256
+                                echo render_form('save_role', $_lang['role_save_role']);
257
+                                echo render_form('delete_role', $_lang['role_delete_role']);
258
+                                ?>
259 259
 							</div>
260 260
 						</div>
261 261
 					</div>
@@ -265,23 +265,23 @@  discard block
 block discarded – undo
265 265
 							<div class="form-group">
266 266
 								<h3><?= $_lang['role_eventlog_management'] ?></h3>
267 267
 								<?php
268
-								echo render_form('view_eventlog', $_lang['role_view_eventlog']);
269
-								echo render_form('delete_eventlog', $_lang['role_delete_eventlog']);
270
-								?>
268
+                                echo render_form('view_eventlog', $_lang['role_view_eventlog']);
269
+                                echo render_form('delete_eventlog', $_lang['role_delete_eventlog']);
270
+                                ?>
271 271
 							</div>
272 272
 						</div>
273 273
 						<div class="col-sm-6 col-lg-3">
274 274
 							<div class="form-group">
275 275
 								<h3><?= $_lang['role_config_management'] ?></h3>
276 276
 								<?php
277
-								echo render_form('logs', $_lang['role_view_logs']);
278
-								echo render_form('settings', $_lang['role_edit_settings']);
279
-								echo render_form('bk_manager', $_lang['role_bk_manager']);
280
-								echo render_form('import_static', $_lang['role_import_static']);
281
-								echo render_form('export_static', $_lang['role_export_static']);
282
-								echo render_form('remove_locks', $_lang['role_remove_locks']);
283
-								echo render_form('display_locks', $_lang['role_display_locks']);
284
-								?>
277
+                                echo render_form('logs', $_lang['role_view_logs']);
278
+                                echo render_form('settings', $_lang['role_edit_settings']);
279
+                                echo render_form('bk_manager', $_lang['role_bk_manager']);
280
+                                echo render_form('import_static', $_lang['role_import_static']);
281
+                                echo render_form('export_static', $_lang['role_export_static']);
282
+                                echo render_form('remove_locks', $_lang['role_remove_locks']);
283
+                                echo render_form('display_locks', $_lang['role_display_locks']);
284
+                                ?>
285 285
 							</div>
286 286
 						</div>
287 287
 					</div>
@@ -300,32 +300,32 @@  discard block
 block discarded – undo
300 300
  * @return string
301 301
  */
302 302
 function render_form($name, $label, $status = '') {
303
-	global $modx, $roledata;
303
+    global $modx, $roledata;
304 304
 
305
-	$tpl = '<label class="d-block" for="[+name+]check">
305
+    $tpl = '<label class="d-block" for="[+name+]check">
306 306
 		<input name="[+name+]check" id="[+name+]check" class="click" type="checkbox" onchange="changestate(document.userform.[+name+])" [+checked+] [+status+]>
307 307
 		<input type="hidden" class="[+set+]" name="[+name+]" value="[+value+]">
308 308
 		[+label+]
309 309
 	</label>';
310 310
 
311
-	$checked = ($roledata[$name] == 1) ? 'checked' : '';
312
-	$value = ($roledata[$name] == 1) ? 1 : 0;
313
-	if($status == 'disabled') {
314
-		$checked = 'checked';
315
-		$value = 1;
316
-		$set = 'fix';
317
-	} else {
318
-		$set = 'set';
319
-	}
311
+    $checked = ($roledata[$name] == 1) ? 'checked' : '';
312
+    $value = ($roledata[$name] == 1) ? 1 : 0;
313
+    if($status == 'disabled') {
314
+        $checked = 'checked';
315
+        $value = 1;
316
+        $set = 'fix';
317
+    } else {
318
+        $set = 'set';
319
+    }
320 320
 
321
-	$ph = array(
322
-		'name' => $name,
323
-		'checked' => $checked,
324
-		'status' => $status,
325
-		'value' => $value,
326
-		'label' => $label,
327
-		'set' => $set
328
-	);
321
+    $ph = array(
322
+        'name' => $name,
323
+        'checked' => $checked,
324
+        'status' => $status,
325
+        'value' => $value,
326
+        'label' => $label,
327
+        'set' => $set
328
+    );
329 329
 
330
-	return $modx->parseText($tpl, $ph);
330
+    return $modx->parseText($tpl, $ph);
331 331
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-switch((int) $modx->manager->action) {
6
+switch ((int) $modx->manager->action) {
7 7
 	case 35:
8
-		if(!$modx->hasPermission('edit_role')) {
8
+		if (!$modx->hasPermission('edit_role')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 38:
13
-		if(!$modx->hasPermission('new_role')) {
13
+		if (!$modx->hasPermission('new_role')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$role = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_user_roles = $modx->getFullTableName('user_roles');
24 24
 
25 25
 // check to see the snippet editor isn't locked
26
-if($lockedEl = $modx->elementIsLocked(8, $role)) {
26
+if ($lockedEl = $modx->elementIsLocked(8, $role)) {
27 27
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role']));
28 28
 }
29 29
 // end check for lock
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 // Lock snippet for other users to edit
32 32
 $modx->lockElement(8, $role);
33 33
 
34
-if($modx->manager->action == '35') {
34
+if ($modx->manager->action == '35') {
35 35
 	$rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'");
36 36
 	$roledata = $modx->db->getRow($rs);
37
-	if(!$roledata) {
37
+	if (!$roledata) {
38 38
 		$modx->webAlertAndQuit("No role returned!");
39 39
 	}
40 40
 	$_SESSION['itemname'] = $roledata['name'];
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 // Add lock-element JS-Script
47 47
 $lockElementId = $role;
48 48
 $lockElementType = 8;
49
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
49
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
50 50
 ?>
51 51
 	<script type="text/javascript">
52 52
 		function changestate(element) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		<input type="hidden" name="id" value="<?= $_GET['id'] ?>">
83 83
 
84 84
 		<h1>
85
-            <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'] . '<small>(' . $roledata['id'] . ')</small>' : $_lang['role_title']) ?>
85
+            <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'].'<small>('.$roledata['id'].')</small>' : $_lang['role_title']) ?>
86 86
         </h1>
87 87
 
88 88
 		<?= $_style['actionbuttons']['dynamic']['savedelete'] ?>
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
  * @param string $status
300 300
  * @return string
301 301
  */
302
-function render_form($name, $label, $status = '') {
302
+function render_form($name, $label, $status = ''){
303 303
 	global $modx, $roledata;
304 304
 
305 305
 	$tpl = '<label class="d-block" for="[+name+]check">
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
 	$checked = ($roledata[$name] == 1) ? 'checked' : '';
312 312
 	$value = ($roledata[$name] == 1) ? 1 : 0;
313
-	if($status == 'disabled') {
313
+	if ($status == 'disabled') {
314 314
 		$checked = 'checked';
315 315
 		$value = 1;
316 316
 		$set = 'fix';
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -299,7 +299,8 @@
 block discarded – undo
299 299
  * @param string $status
300 300
  * @return string
301 301
  */
302
-function render_form($name, $label, $status = '') {
302
+function render_form($name, $label, $status = '')
303
+{
303 304
 	global $modx, $roledata;
304 305
 
305 306
 	$tpl = '<label class="d-block" for="[+name+]check">
Please login to merge, or discard this patch.
manager/actions/logging.static.php 1 patch
Braces   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if (!$modx->hasPermission('logs')) {
5
+if (!$modx->hasPermission('logs')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -11,17 +11,17 @@  discard block
 block discarded – undo
11 11
  * @param string $checkKey
12 12
  * @return array
13 13
  */
14
-function array_unique_multi($array, $checkKey)
15
-{
14
+function array_unique_multi($array, $checkKey)
15
+{
16 16
     // Use the builtin if we're not a multi-dimensional array
17
-    if (!is_array(current($array)) || empty($checkKey)) {
17
+    if (!is_array(current($array)) || empty($checkKey)) {
18 18
         return array_unique($array);
19 19
     }
20 20
 
21 21
     $ret = array();
22 22
     $checkValues = array(); // contains the unique key Values
23
-    foreach ($array as $key => $current) {
24
-        if (in_array($current[$checkKey], $checkValues)) {
23
+    foreach ($array as $key => $current) {
24
+        if (in_array($current[$checkKey], $checkValues)) {
25 25
             continue;
26 26
         } // duplicate
27 27
 
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
  * @param string $key
37 37
  * @return array
38 38
  */
39
-function record_sort($array, $key)
40
-{
39
+function record_sort($array, $key)
40
+{
41 41
     $hash = array();
42
-    foreach ($array as $k => $v) {
42
+    foreach ($array as $k => $v) {
43 43
         $hash[$k] = $v[$key];
44 44
     }
45 45
 
46 46
     natsort($hash);
47 47
 
48 48
     $records = array();
49
-    foreach ($hash as $k => $row) {
49
+    foreach ($hash as $k => $row) {
50 50
         $records[$k] = $array[$k];
51 51
     }
52 52
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                             <?php
74 74
                             // get all users currently in the log
75 75
                             $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username');
76
-                            foreach ($logs_user as $row) {
76
+                            foreach ($logs_user as $row) {
77 77
                                 $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : '';
78 78
                                 echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n";
79 79
                             }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
                             // get all available actions in the log
91 91
                             include_once "actionlist.inc.php";
92 92
                             $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action');
93
-                            foreach ($logs_actions as $row) {
93
+                            foreach ($logs_actions as $row) {
94 94
                                 $action = getAction($row['action']);
95
-                                if ($action == 'Idle') {
95
+                                if ($action == 'Idle') {
96 96
                                     continue;
97 97
                                 }
98 98
                                 $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                             <?php
111 111
                             // get all itemid currently in logging
112 112
                             $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid');
113
-                            foreach ($logs_items as $row) {
113
+                            foreach ($logs_items as $row) {
114 114
                                 $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : '';
115 115
                                 echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n";
116 116
                             }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                             <?php
127 127
                             // get all itemname currently in logging
128 128
                             $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname');
129
-                            foreach ($logs_names as $row) {
129
+                            foreach ($logs_names as $row) {
130 130
                                 $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : '';
131 131
                                 echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n";
132 132
                             }
@@ -182,36 +182,36 @@  discard block
 block discarded – undo
182 182
     <div class="container container-body">
183 183
 
184 184
 <?php
185
-if (isset($_REQUEST['log_submit'])) {
185
+if (isset($_REQUEST['log_submit'])) {
186 186
     // get the selections the user made.
187 187
     $sqladd = array();
188
-    if ($_REQUEST['searchuser'] != 0) {
188
+    if ($_REQUEST['searchuser'] != 0) {
189 189
         $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'";
190 190
     }
191
-    if ($_REQUEST['action'] != 0) {
191
+    if ($_REQUEST['action'] != 0) {
192 192
         $sqladd[] = "action=" . (int)$_REQUEST['action'];
193 193
     }
194
-    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
194
+    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
195 195
         $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'";
196 196
     }
197
-    if ($_REQUEST['itemname'] != '0') {
197
+    if ($_REQUEST['itemname'] != '0') {
198 198
         $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'";
199 199
     }
200
-    if ($_REQUEST['message'] != "") {
200
+    if ($_REQUEST['message'] != "") {
201 201
         $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'";
202 202
     }
203 203
     // date stuff
204
-    if ($_REQUEST['datefrom'] != "") {
204
+    if ($_REQUEST['datefrom'] != "") {
205 205
         $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']);
206 206
     }
207
-    if ($_REQUEST['dateto'] != "") {
207
+    if ($_REQUEST['dateto'] != "") {
208 208
         $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']);
209 209
     }
210 210
 
211 211
     // If current position is not set, set it to zero
212
-    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
212
+    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
213 213
         $int_cur_position = 0;
214
-    } else {
214
+    } else {
215 215
         $int_cur_position = $_REQUEST['int_cur_position'];
216 216
     }
217 217
 
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 
226 226
     $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
227 227
 
228
-if ($limit < 1) {
228
+if ($limit < 1) {
229 229
     echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>';
230
-} else {
230
+} else {
231 231
     echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>';
232 232
 
233 233
     include_once "paginate.inc.php";
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
     $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " ");
247 247
     $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " ");
248 248
     $pagesfound = sizeof($array_row_paging);
249
-    if ($pagesfound > 6) {
249
+    if ($pagesfound > 6) {
250 250
         $paging .= $array_row_paging[$current_row - 2]; // ."&nbsp;";
251 251
         $paging .= $array_row_paging[$current_row - 1]; // ."&nbsp;";
252 252
         $paging .= $array_row_paging[$current_row]; // ."&nbsp;";
253 253
         $paging .= $array_row_paging[$current_row + 1]; // ."&nbsp;";
254 254
         $paging .= $array_row_paging[$current_row + 2]; // ."&nbsp;";
255
-    } else {
256
-        for ($i = 0; $i < $pagesfound; $i++) {
255
+    } else {
256
+        for ($i = 0; $i < $pagesfound; $i++) {
257 257
             $paging .= $array_row_paging[$i] . "&nbsp;";
258 258
         }
259 259
     }
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
                 // grab the entire log file...
289 289
                 $logentries = array();
290 290
                 $i = 0;
291
-                while ($logentry = $modx->db->getRow($rs)) {
292
-                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
291
+                while ($logentry = $modx->db->getRow($rs)) {
292
+                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
293 293
                         $item = '<div style="text-align:center;">-</div>';
294
-                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
294
+                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
295 295
                         $item = '<a href="index.php?a=3&amp;id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>';
296
-                    } else {
296
+                    } else {
297 297
                         $item = $logentry['itemname'];
298 298
                     }
299 299
                     //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true'
@@ -328,6 +328,6 @@  discard block
 block discarded – undo
328 328
     // @see index.php @ 915
329 329
     global $action;
330 330
     $action = 1;
331
-} else {
331
+} else {
332 332
     echo $_lang["mgrlog_noquery"];
333 333
 }
Please login to merge, or discard this patch.
manager/actions/help/01About_EVO.php 3 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@  discard block
 block discarded – undo
4 4
 }
5 5
 $logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">';
6 6
 $downloadLinks = array(
7
-	0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'),
8
-	1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
-	2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
-	3=>array('title'=>$_lang["extras"],'link'=>array(
11
-		'http://extras.evolution-cms.com/',
12
-		'https://github.com/extras-evolution'
13
-	)),
7
+    0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'),
8
+    1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
+    2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
+    3=>array('title'=>$_lang["extras"],'link'=>array(
11
+        'http://extras.evolution-cms.com/',
12
+        'https://github.com/extras-evolution'
13
+    )),
14 14
 );
15 15
 
16 16
 $translationLinks = array(
17
-	0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
-	1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'),
17
+    0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
+    1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'),
19 19
 );
20 20
 
21 21
 /**
@@ -24,23 +24,23 @@  discard block
 block discarded – undo
24 24
  * @return string
25 25
  */
26 26
 function createList($sectionHeader, $linkArr) {
27
-	$output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28
-	$output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29
-	$links = '';
30
-	foreach($linkArr as $row) {
31
-		if (!is_array($row['link'])) $row['link'] = array($row['link']);
32
-		foreach ($row['link'] as $link) {
33
-			$links .= $links != '' ? '<br/>' : '';
34
-			$links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
35
-		}
36
-		$output .= '
27
+    $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28
+    $output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29
+    $links = '';
30
+    foreach($linkArr as $row) {
31
+        if (!is_array($row['link'])) $row['link'] = array($row['link']);
32
+        foreach ($row['link'] as $link) {
33
+            $links .= $links != '' ? '<br/>' : '';
34
+            $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
35
+        }
36
+        $output .= '
37 37
 		<tr>
38 38
 			<td align="left"><strong>' . $row["title"] . '</strong></td>
39 39
 			<td align="left">' . $links . '</td>
40 40
 		</tr>';
41
-		$links = '';
42
-	}
43
-	$output .= '</table></div>'."\n";
41
+        $links = '';
42
+    }
43
+    $output .= '</table></div>'."\n";
44 44
     return $output;
45 45
 }
46 46
 echo $logo;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-$logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">';
5
+$logo = '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">';
6 6
 $downloadLinks = array(
7
-	0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'),
8
-	1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
-	2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
-	3=>array('title'=>$_lang["extras"],'link'=>array(
7
+	0=>array('title'=>$_lang["information"], 'link'=>'https://evo.im/'),
8
+	1=>array('title'=>$_lang["download"], 'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
+	2=>array('title'=>$_lang["previous_releases"], 'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
+	3=>array('title'=>$_lang["extras"], 'link'=>array(
11 11
 		'http://extras.evolution-cms.com/',
12 12
 		'https://github.com/extras-evolution'
13 13
 	)),
14 14
 );
15 15
 
16 16
 $translationLinks = array(
17
-	0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
-	1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'),
17
+	0=>array('title'=>'Evolution CMS', 'link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
+	1=>array('title'=>$_lang["extras"], 'link'=>'https://www.transifex.com/evolutioncms/extras/'),
19 19
 );
20 20
 
21 21
 /**
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
  * @param array $linkArr
24 24
  * @return string
25 25
  */
26
-function createList($sectionHeader, $linkArr) {
26
+function createList($sectionHeader, $linkArr){
27 27
 	$output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28 28
 	$output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29 29
 	$links = '';
30
-	foreach($linkArr as $row) {
30
+	foreach ($linkArr as $row) {
31 31
 		if (!is_array($row['link'])) $row['link'] = array($row['link']);
32 32
 		foreach ($row['link'] as $link) {
33 33
 			$links .= $links != '' ? '<br/>' : '';
34
-			$links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
34
+			$links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>';
35 35
 		}
36 36
 		$output .= '
37 37
 		<tr>
38
-			<td align="left"><strong>' . $row["title"] . '</strong></td>
39
-			<td align="left">' . $links . '</td>
38
+			<td align="left"><strong>' . $row["title"].'</strong></td>
39
+			<td align="left">' . $links.'</td>
40 40
 		</tr>';
41 41
 		$links = '';
42 42
 	}
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,12 +23,15 @@
 block discarded – undo
23 23
  * @param array $linkArr
24 24
  * @return string
25 25
  */
26
-function createList($sectionHeader, $linkArr) {
26
+function createList($sectionHeader, $linkArr)
27
+{
27 28
 	$output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28 29
 	$output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29 30
 	$links = '';
30 31
 	foreach($linkArr as $row) {
31
-		if (!is_array($row['link'])) $row['link'] = array($row['link']);
32
+		if (!is_array($row['link'])) {
33
+		    $row['link'] = array($row['link']);
34
+		}
32 35
 		foreach ($row['link'] as $link) {
33 36
 			$links .= $links != '' ? '<br/>' : '';
34 37
 			$links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
Please login to merge, or discard this patch.
manager/actions/search.static.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     exit();
4 4
 }
5 5
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
                         <?php
42 42
                         $rs = $modx->db->select('*', $modx->getFullTableName('site_templates'));
43 43
                         $option[] = '<option value="">No selected</option>';
44
-                        $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : '';
44
+                        $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int) $_REQUEST['templateid'] : '';
45 45
                         $selected = $templateid === 0 ? ' selected="selected"' : '';
46
-                        $option[] = '<option value="0"' . $selected . '>(blank)</option>';
46
+                        $option[] = '<option value="0"'.$selected.'>(blank)</option>';
47 47
                         while ($row = $modx->db->getRow($rs)) {
48 48
                             $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']);
49 49
                             $selected = $row['id'] == $templateid ? ' selected="selected"' : '';
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, $modx_manager_charset);
87 87
     $searchlongtitle = $modx->db->escape(trim($_REQUEST['searchfields']));
88 88
     $search_alias = $modx->db->escape(trim($_REQUEST['searchfields']));
89
-    $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : '';
89
+    $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int) $_REQUEST['templateid'] : '';
90 90
     $searchcontent = $modx->db->escape($_REQUEST['content']);
91 91
 
92 92
     $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type';
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         $friendly_url_suffix = $modx->config['friendly_url_suffix'];
101 101
         $base_url = $modx->config['base_url'];
102 102
         $site_url = $modx->config['site_url'];
103
-        $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url);
103
+        $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url);
104 104
         if ($url[0] === '/') {
105
-            $url = preg_replace('@^' . $base_url . '@', '', $url);
105
+            $url = preg_replace('@^'.$base_url.'@', '', $url);
106 106
         }
107 107
         if (substr($url, 0, 4) === 'http') {
108
-            $url = preg_replace('@^' . $site_url . '@', '', $url);
108
+            $url = preg_replace('@^'.$site_url.'@', '', $url);
109 109
         }
110 110
         $idFromAlias = $modx->getIdFromAlias($url);
111 111
     }
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119 119
 		$articul_result = $modx->db->query($articul_query);
120 120
 		$articul_id_array = $modx->db->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
121
+		if (count($articul_id_array) > 0) {
122 122
 			$articul_id = '';
123 123
 			$i = 1;
124
-			foreach( $articul_id_array as $articul ) {
125
-				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
127
-					$articul_id.=',';
124
+			foreach ($articul_id_array as $articul) {
125
+				$articul_id .= $articul['contentid'];
126
+				if ($i !== count($articul_id_array)) {
127
+					$articul_id .= ',';
128 128
 				}
129 129
 				$i++;
130 130
 			}
131 131
 		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
132
+		} else {
133 133
 			$articul_id_query = '';
134 134
 		}
135 135
 		/*end search by TV*/
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if (ctype_digit($searchfields)) {
138 138
             $sqladd .= "sc.id='{$searchfields}'";
139 139
             if (strlen($searchfields) > 3) {
140
-				$sqladd .= $articul_id_query;//search by TV
140
+				$sqladd .= $articul_id_query; //search by TV
141 141
                 $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'";
142 142
             }
143 143
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'";
158 158
             $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'";
159 159
             $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'";
160
-			$sqladd .= $articul_id_query;//search by TV
160
+			$sqladd .= $articul_id_query; //search by TV
161 161
         }
162 162
     } else if ($idFromAlias) {
163 163
         $sqladd .= " sc.id='{$idFromAlias}'";
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
         $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
181 181
         $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0;
182 182
         $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : '';
183
-        $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess';
184
-        $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
183
+        $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess';
184
+        $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
185 185
     }
186 186
 
187 187
     if ($sqladd) {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     $where = $sqladd;
192 192
 
193 193
     if ($where) {
194
-        $rs = $modx->db->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id');
194
+        $rs = $modx->db->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id');
195 195
         $limit = $modx->db->getRecordCount($rs);
196 196
     } else {
197 197
         $limit = 0;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                 if ($limit < 1) {
211 211
                     echo $_lang['search_empty'];
212 212
                 } else {
213
-                    printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit);
213
+                    printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit);
214 214
                     ?>
215 215
                     <script type="text/javascript" src="media/script/tablesort.js"></script>
216 216
                     <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1">
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
                                 if (function_exists('mb_strlen') && function_exists('mb_substr')) {
271 271
                                     ?>
272 272
                                     <td<?= $tdClass ?>>
273
-                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a>
273
+                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a>
274 274
                                     </td>
275
-                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td>
275
+                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td>
276 276
                                     <?php
277 277
                                 } else {
278 278
                                     ?>
279
-                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td>
280
-                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td>
279
+                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td>
280
+                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td>
281 281
                                     <?php
282 282
                                 }
283 283
                                 ?>
@@ -297,115 +297,115 @@  discard block
 block discarded – undo
297 297
                 if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
298 298
                     $docscounts = $modx->db->getRecordCount($rs);
299 299
                     if ($docscounts > 0) {
300
-                        $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>';
300
+                        $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>';
301 301
                         while ($row = $modx->db->getRow($rs)) {
302
-                            $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
302
+                            $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
303 303
                         }
304 304
                     }
305 305
                 }
306 306
 
307 307
                 //templates
308 308
                 if ($modx->hasPermission('edit_template')) {
309
-                    $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' 
310
-					OR `templatename` like '%" . $searchfields . "%' 
311
-					OR `description` like '%" . $searchfields . "%' 
312
-					OR `content` like '%" . $searchfields . "%'");
309
+                    $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' 
310
+					OR `templatename` like '%" . $searchfields."%' 
311
+					OR `description` like '%" . $searchfields."%' 
312
+					OR `content` like '%" . $searchfields."%'");
313 313
                     $templatecounts = $modx->db->getRecordCount($rs);
314 314
                     if ($templatecounts > 0) {
315
-                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>';
315
+                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>';
316 316
                         while ($row = $modx->db->getRow($rs)) {
317
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
317
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
318 318
                         }
319 319
                     }
320 320
                 }
321 321
 
322 322
                 //tvs
323 323
                 if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
324
-                    $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' 
325
-					OR `name` like '%" . $searchfields . "%' 
326
-					OR `description` like '%" . $searchfields . "%' 
327
-					OR `type` like '%" . $searchfields . "%' 
328
-					OR `elements` like '%" . $searchfields . "%' 
329
-					OR `display` like '%" . $searchfields . "%' 
330
-					OR `display_params` like '%" . $searchfields . "%' 
331
-					OR `default_text` like '%" . $searchfields . "%'");
324
+                    $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' 
325
+					OR `name` like '%" . $searchfields."%' 
326
+					OR `description` like '%" . $searchfields."%' 
327
+					OR `type` like '%" . $searchfields."%' 
328
+					OR `elements` like '%" . $searchfields."%' 
329
+					OR `display` like '%" . $searchfields."%' 
330
+					OR `display_params` like '%" . $searchfields."%' 
331
+					OR `default_text` like '%" . $searchfields."%'");
332 332
                     $tvscounts = $modx->db->getRecordCount($rs);
333 333
                     if ($tvscounts > 0) {
334
-                        $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>';
334
+                        $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>';
335 335
                         while ($row = $modx->db->getRow($rs)) {
336
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
336
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
337 337
                         }
338 338
                     }
339 339
                 }
340 340
 
341 341
                 //Chunks
342 342
                 if ($modx->hasPermission('edit_chunk')) {
343
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' 
344
-					OR `name` like '%" . $searchfields . "%' 
345
-					OR `description` like '%" . $searchfields . "%'     
346
-					OR `snippet` like '%" . $searchfields . "%'");
343
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' 
344
+					OR `name` like '%" . $searchfields."%' 
345
+					OR `description` like '%" . $searchfields."%'     
346
+					OR `snippet` like '%" . $searchfields."%'");
347 347
                     $chunkscounts = $modx->db->getRecordCount($rs);
348 348
                     if ($chunkscounts > 0) {
349
-                        $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>';
349
+                        $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>';
350 350
                         while ($row = $modx->db->getRow($rs)) {
351
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
351
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
352 352
                         }
353 353
                     }
354 354
                 }
355 355
 
356 356
                 //Snippets
357 357
                 if ($modx->hasPermission('edit_snippet')) {
358
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' 
359
-					OR `name` like '%" . $searchfields . "%' 
360
-					OR `description` like '%" . $searchfields . "%' 
361
-					OR `snippet` like '%" . $searchfields . "%'  
362
-					OR `properties` like '%" . $searchfields . "%'      
363
-					OR `moduleguid` like '%" . $searchfields . "%'");
358
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' 
359
+					OR `name` like '%" . $searchfields."%' 
360
+					OR `description` like '%" . $searchfields."%' 
361
+					OR `snippet` like '%" . $searchfields."%'  
362
+					OR `properties` like '%" . $searchfields."%'      
363
+					OR `moduleguid` like '%" . $searchfields."%'");
364 364
                     $snippetscounts = $modx->db->getRecordCount($rs);
365 365
                     if ($snippetscounts > 0) {
366
-                        $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>';
366
+                        $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>';
367 367
                         while ($row = $modx->db->getRow($rs)) {
368
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
368
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
369 369
                         }
370 370
                     }
371 371
                 }
372 372
 
373 373
                 //plugins
374 374
                 if ($modx->hasPermission('edit_plugin')) {
375
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' 
376
-					OR `name` like '%" . $searchfields . "%' 
377
-					OR `description` like '%" . $searchfields . "%' 
378
-					OR `plugincode` like '%" . $searchfields . "%'  
379
-					OR `properties` like '%" . $searchfields . "%'      
380
-					OR `moduleguid` like '%" . $searchfields . "%'");
375
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' 
376
+					OR `name` like '%" . $searchfields."%' 
377
+					OR `description` like '%" . $searchfields."%' 
378
+					OR `plugincode` like '%" . $searchfields."%'  
379
+					OR `properties` like '%" . $searchfields."%'      
380
+					OR `moduleguid` like '%" . $searchfields."%'");
381 381
                     $pluginscounts = $modx->db->getRecordCount($rs);
382 382
                     if ($pluginscounts > 0) {
383
-                        $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>';
383
+                        $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>';
384 384
                         while ($row = $modx->db->getRow($rs)) {
385
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
385
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
386 386
                         }
387 387
                     }
388 388
                 }
389 389
 
390 390
                 //modules
391 391
                 if ($modx->hasPermission('edit_module')) {
392
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' 
393
-                    OR `name` like '%" . $searchfields . "%' 
394
-                    OR `description` like '%" . $searchfields . "%' 
395
-                    OR `modulecode` like '%" . $searchfields . "%'  
396
-                    OR `properties` like '%" . $searchfields . "%'  
397
-                    OR `guid` like '%" . $searchfields . "%'      
398
-                    OR `resourcefile` like '%" . $searchfields . "%'");
392
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' 
393
+                    OR `name` like '%" . $searchfields."%' 
394
+                    OR `description` like '%" . $searchfields."%' 
395
+                    OR `modulecode` like '%" . $searchfields."%'  
396
+                    OR `properties` like '%" . $searchfields."%'  
397
+                    OR `guid` like '%" . $searchfields."%'      
398
+                    OR `resourcefile` like '%" . $searchfields."%'");
399 399
                     $modulescounts = $modx->db->getRecordCount($rs);
400 400
                     if ($modulescounts > 0) {
401
-                        $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>';
401
+                        $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>';
402 402
                         while ($row = $modx->db->getRow($rs)) {
403
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
403
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
404 404
                         }
405 405
                     }
406 406
                 }
407 407
 
408
-                echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1';
408
+                echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1';
409 409
             }
410 410
 
411 411
             ?>
@@ -421,13 +421,13 @@  discard block
 block discarded – undo
421 421
  */
422 422
 function highlightingCoincidence($text, $search)
423 423
 {
424
-    $regexp = '!(' . str_replace(array(
424
+    $regexp = '!('.str_replace(array(
425 425
             '(',
426 426
             ')'
427 427
         ), array(
428 428
             '\(',
429 429
             '\)'
430
-        ), trim($search)) . ')!isu';
430
+        ), trim($search)).')!isu';
431 431
     return preg_replace($regexp, '<span class="text-danger">$1</span>', $text);
432 432
 }
433 433
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
         $class .= ' deleted';
451 451
     }
452 452
     if ($class) {
453
-        $class = ' class="' . trim($class) . '"';
453
+        $class = ' class="'.trim($class).'"';
454 454
     }
455 455
     return $class;
456 456
 }
Please login to merge, or discard this patch.
manager/actions/mutate_plugin.dynamic.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_site_plugins = $modx->getFullTableName('site_plugins');
24 24
 $tbl_site_plugin_events = $modx->getFullTableName('site_plugin_events');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     $content['properties'] = str_replace("&", "&amp;", $content['properties']);
47 47
 } else {
48 48
     $_SESSION['itemname'] = $_lang["new_plugin"];
49
-    $content['category'] = (int)$_REQUEST['catid'];
49
+    $content['category'] = (int) $_REQUEST['catid'];
50 50
 }
51 51
 
52 52
 if ($modx->manager->hasFormValues()) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 // Add lock-element JS-Script
57 57
 $lockElementId = $id;
58 58
 $lockElementType = 5;
59
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
59
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
60 60
 
61 61
 /**
62 62
  * @param bool $cond
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     <input type="hidden" name="mode" value="<?= $modx->manager->action ?>">
479 479
 
480 480
     <h1>
481
-        <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i>
481
+        <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i>
482 482
     </h1>
483 483
 
484 484
     <?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
                             <div class="form-control-name clearfix">
505 505
                                 <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
506 506
                                 <?php if ($modx->hasPermission('save_role')): ?>
507
-                                <label class="custom-control" title="<?= $_lang['lock_plugin'] . "\n" . $_lang['lock_plugin_msg'] ?>" tooltip>
507
+                                <label class="custom-control" title="<?= $_lang['lock_plugin']."\n".$_lang['lock_plugin_msg'] ?>" tooltip>
508 508
                                     <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
509 509
                                     <i class="fa fa-lock"></i>
510 510
                                 </label>
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
                             <select name="categoryid" class="form-control" onchange="documentDirty=true;">
529 529
                                 <option>&nbsp;</option>
530 530
                                 <?php
531
-                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
531
+                                include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
532 532
                                 foreach (getCategories() as $n => $v) {
533
-                                    echo '<option value="' . $v['id'] . '"' . ($content["category"] == $v["id"] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v["category"]) . "</option>";
533
+                                    echo '<option value="'.$v['id'].'"'.($content["category"] == $v["id"] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v["category"])."</option>";
534 534
                                 }
535 535
                                 ?>
536 536
                             </select>
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
                 <?php if ($modx->hasPermission('save_role')): ?>
547 547
                 <div class="form-group">
548 548
                     <div class="form-row">
549
-                        <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['plugin_disabled'] . "</span>" : $_lang['plugin_disabled']) ?></label>
549
+                        <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['plugin_disabled']."</span>" : $_lang['plugin_disabled']) ?></label>
550 550
                     </div>
551 551
                     <div class="form-row">
552 552
                         <label>
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
                             <select name="moduleguid" class="form-control" onchange="documentDirty=true;">
594 594
                                 <option>&nbsp;</option>
595 595
                                 <?php
596
-                                $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules") . " sm 
597
-								INNER JOIN " . $modx->getFullTableName("site_module_depobj") . " smd ON smd.module=sm.id AND smd.type=30
598
-								INNER JOIN " . $modx->getFullTableName("site_plugins") . " sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name');
596
+                                $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules")." sm 
597
+								INNER JOIN " . $modx->getFullTableName("site_module_depobj")." smd ON smd.module=sm.id AND smd.type=30
598
+								INNER JOIN " . $modx->getFullTableName("site_plugins")." sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name');
599 599
                                 while ($row = $modx->db->getRow($ds)) {
600
-                                    echo "<option value='" . $row['guid'] . "'" . ($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row["name"]) . "</option>";
600
+                                    echo "<option value='".$row['guid']."'".($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row["name"])."</option>";
601 601
                                 }
602 602
                                 ?>
603 603
                             </select>
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                                 echoEventRows($evtnames);
659 659
                             }
660 660
                             echo '<hr class="clear">';
661
-                            echo '<div class="form-group"><b>' . $services[$srv - 1] . '</b></div>';
661
+                            echo '<div class="form-group"><b>'.$services[$srv - 1].'</b></div>';
662 662
                         }
663 663
                         // display group name
664 664
                         if ($grp != $row['groupname']) {
@@ -667,9 +667,9 @@  discard block
 block discarded – undo
667 667
                                 echoEventRows($evtnames);
668 668
                             }
669 669
                             echo '<hr class="clear">';
670
-                            echo '<div class="form-group"><b>' . $row['groupname'] . '</b></div>';
670
+                            echo '<div class="form-group"><b>'.$row['groupname'].'</b></div>';
671 671
                         }
672
-                        $evtnames[] = '<input name="sysevents[]" id="' . $row['name'] . '" type="checkbox" ' . (in_array($row['id'], $evts) ? ' checked="checked" ' : '') . 'class="inputBox" value="' . $row['id'] . '" /> <label for="' . $row['name'] . '" ' . bold(in_array($row['id'], $evts)) . '> ' . $row['name'] . '</label>' . "\n";
672
+                        $evtnames[] = '<input name="sysevents[]" id="'.$row['name'].'" type="checkbox" '.(in_array($row['id'], $evts) ? ' checked="checked" ' : '').'class="inputBox" value="'.$row['id'].'" /> <label for="'.$row['name'].'" '.bold(in_array($row['id'], $evts)).'> '.$row['name'].'</label>'."\n";
673 673
                         if (count($evtnames) == 2) {
674 674
                             echoEventRows($evtnames);
675 675
                         }
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 
682 682
                 function echoEventRows(&$evtnames)
683 683
                 {
684
-                    echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">' . implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) . '</div></div>';
684
+                    echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">'.implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames).'</div></div>';
685 685
                     $evtnames = array();
686 686
                 }
687 687
 
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/Module_Categories_Manager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     die('Please use the MODx Backend.');
8 8
 }
9 9
 
10
-require_once realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Categories.php';
10
+require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php';
11 11
 
12 12
 class Module_Categories_Manager extends Categories
13 13
 {
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
     {
95 95
         global $_lang, $_style;
96 96
 
97
-        $filename = trim($view_name) . '.tpl.phtml';
98
-        $file = self::get('views_dir') . $filename;
97
+        $filename = trim($view_name).'.tpl.phtml';
98
+        $file = self::get('views_dir').$filename;
99 99
         $view = &$this;
100 100
 
101 101
         if (is_file($file)
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
     {
121 121
 
122 122
         $_update = array(
123
-            'id'       => (int)$element_id,
124
-            'category' => (int)$category_id
123
+            'id'       => (int) $element_id,
124
+            'category' => (int) $category_id
125 125
         );
126 126
 
127 127
         $this->db->update(
128 128
             $_update,
129 129
             $this->db_tbl[$element],
130
-            "`id` = '" . (int)$element_id . "'"
130
+            "`id` = '".(int) $element_id."'"
131 131
         );
132 132
 
133 133
         return $this->db->getAffectedRows() === 1;
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/Categories.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         $this->db_tbl['categories'] = $modx->getFullTableName('categories');
21 21
 
22 22
         foreach ($this->elements as $element) {
23
-            $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element);
23
+            $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element);
24 24
         }
25 25
     }
26 26
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             $this->db->select(
55 55
                 '*',
56 56
                 $this->db_tbl['categories'],
57
-                "`" . $where . "` = '" . $this->db->escape($search) . "'"
57
+                "`".$where."` = '".$this->db->escape($search)."'"
58 58
             )
59 59
         );
60 60
 
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $_value = $this->db->getValue(
73 73
             $this->db->select(
74
-                '`' . $value . '`',
74
+                '`'.$value.'`',
75 75
                 $this->db_tbl['categories'],
76
-                "`" . $where . "` = '" . $this->db->escape($search) . "'"
76
+                "`".$where."` = '".$this->db->escape($search)."'"
77 77
             )
78 78
         );
79 79
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 $this->db->select(
93 93
                     '*',
94 94
                     $this->db_tbl[$element],
95
-                    "`category` = '" . (int)$category_id . "'"
95
+                    "`category` = '".(int) $category_id."'"
96 96
                 )
97 97
             );
98 98
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
             $this->db->update(
136 136
                 $_update,
137 137
                 $this->db_tbl[$element],
138
-                "`category` = '" . (int)$category_id . "'"
138
+                "`category` = '".(int) $category_id."'"
139 139
             );
140 140
         }
141 141
 
142 142
         $this->db->delete(
143 143
             $this->db_tbl['categories'],
144
-            "`id` = '" . (int)$category_id . "'"
144
+            "`id` = '".(int) $category_id."'"
145 145
         );
146 146
 
147 147
         return $this->db->getAffectedRows() === 1;
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 
161 161
         $_update = array(
162 162
             'category' => $this->db->escape($data['category']),
163
-            'rank'     => (int)$data['rank']
163
+            'rank'     => (int) $data['rank']
164 164
         );
165 165
 
166 166
         $this->db->update(
167 167
             $_update,
168 168
             $this->db_tbl['categories'],
169
-            "`id` = '" . (int)$category_id . "'"
169
+            "`id` = '".(int) $category_id."'"
170 170
         );
171 171
 
172 172
         if ($this->db->getAffectedRows() === 1) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
         $_insert = array(
191 191
             'category' => $this->db->escape($category_name),
192
-            'rank'     => (int)$category_rank
192
+            'rank'     => (int) $category_rank
193 193
         );
194 194
 
195 195
         $this->db->insert(
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             $this->db->select(
217 217
                 '`id`',
218 218
                 $this->db_tbl['categories'],
219
-                "`category` = '" . $category . "'"
219
+                "`category` = '".$category."'"
220 220
             )
221 221
         );
222 222
 
Please login to merge, or discard this patch.