Completed
Push — develop ( cb7ecf...5e631f )
by Dmytro
17s
created
manager/includes/src/Legacy/DeprecatedCore.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
 class DeprecatedCore implements DeprecatedCoreInterface
6 6
 {
7 7
     /**
8
-    * @deprecated
9
-    *
10
-    * return @void
11
-    */
8
+     * @deprecated
9
+     *
10
+     * return @void
11
+     */
12 12
     public function dbConnect()
13 13
     {
14 14
         $modx = evolutionCMS();
Please login to merge, or discard this patch.
manager/includes/src/Support/DataGrid.php 1 patch
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class DataGrid implements DataGridInterface{
15 15
 
16
-	public $ds; // datasource
16
+    public $ds; // datasource
17 17
     public $id;
18 18
     public $pageSize;            // pager settings
19 19
     public $pageNumber;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public $colWraps;
38 38
     public $colColors;
39 39
     public $colTypes;            // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m
40
-	// data type: integer,float,currency,date
40
+    // data type: integer,float,currency,date
41 41
 
42 42
     public $header;
43 43
     public $footer;
@@ -76,236 +76,236 @@  discard block
 block discarded – undo
76 76
     public static $dataGridCnt;
77 77
 
78 78
     public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) {
79
-		// set id
80
-		self::$dataGridCnt++;
81
-		$this->id = $this->id ? empty($id) : "dg" . self::$dataGridCnt;
79
+        // set id
80
+        self::$dataGridCnt++;
81
+        $this->id = $this->id ? empty($id) : "dg" . self::$dataGridCnt;
82 82
 
83
-		// set datasource
84
-		$this->ds = $ds;
83
+        // set datasource
84
+        $this->ds = $ds;
85 85
 
86
-		// set pager
87
-		$this->pageSize = $pageSize;
88
-		$this->pageNumber = $pageNumber; // by setting pager to -1 will cause pager to load it's last page number
89
-		$this->pagerLocation = 'top-right';
90
-	}
86
+        // set pager
87
+        $this->pageSize = $pageSize;
88
+        $this->pageNumber = $pageNumber; // by setting pager to -1 will cause pager to load it's last page number
89
+        $this->pagerLocation = 'top-right';
90
+    }
91 91
 
92 92
     public function setDataSource($ds) {
93
-		$this->ds = $ds;
94
-	}
93
+        $this->ds = $ds;
94
+    }
95 95
 
96 96
     public function render() {
97 97
         $modx = evolutionCMS();
98
-		$columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : '';
99
-		$columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : "";
100
-		$cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : '';
101
-		$cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : '';
102
-
103
-		$pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : '';
104
-		$pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'";
105
-
106
-		$this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : '';
107
-		$this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : '';
108
-		$this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : '';
109
-		$this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : '';
110
-
111
-		$this->_alt = 0;
112
-		$this->_total = 0;
113
-
114
-		$this->_isDataset = $modx->getDatabase()->isResult($this->ds); // if not dataset then treat as array
115
-
116
-		if(!$cssStyle && !$cssClass) {
117
-			$cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'";
118
-		}
119
-		if(!$columnHeaderStyle && !$columnHeaderClass) {
120
-			$columnHeaderStyle = "style='color:black;background-color:silver'";
121
-		}
122
-		if(!$this->_itemStyle && !$this->_itemClass) {
123
-			$this->_itemStyle = "style='color:black;'";
124
-		}
125
-		if(!$this->_altItemStyle && !$this->_altItemClass) {
126
-			$this->_altItemStyle = "style='color:black;background-color:#eeeeee'";
127
-		}
128
-
129
-		if($this->_isDataset && !$this->columns) {
130
-			$cols = $modx->getDatabase()->numFields($this->ds);
131
-			for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->getDatabase()->fieldName($this->ds, $i);
132
-		}
133
-
134
-		// start grid
135
-		$tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>";
136
-		$tblEnd = "</table>";
137
-
138
-		// build column header
139
-		$this->_colnames = explode((strstr($this->columns, "||") !== false ? "||" : ","), $this->columns);
140
-		$this->_colwidths = explode((strstr($this->colWidths, "||") !== false ? "||" : ","), $this->colWidths);
141
-		$this->_colaligns = explode((strstr($this->colAligns, "||") !== false ? "||" : ","), $this->colAligns);
142
-		$this->_colwraps = explode((strstr($this->colWraps, "||") !== false ? "||" : ","), $this->colWraps);
143
-		$this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors);
144
-		$this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes);
145
-		$this->_colcount = count($this->_colnames);
146
-		if(!$this->_isDataset) {
147
-			$this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds);
148
-			$this->ds = array_chunk($this->ds, $this->_colcount);
149
-		}
150
-		$tblColHdr = "<thead><tr>";
151
-		for($c = 0; $c < $this->_colcount; $c++) {
152
-			$name = $this->_colnames[$c];
153
-			$width = $this->_colwidths[$c];
154
-			$tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>";
155
-		}
156
-		$tblColHdr .= "</tr></thead>\n";
157
-
158
-		// build rows
159
-		$rowcount = $this->_isDataset ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds);
160
-		$this->_fieldnames = explode(",", $this->fields);
161
-		if($rowcount == 0) {
162
-			$tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n";
163
-		} else {
164
-			// render grid items
165
-			if($this->pageSize <= 0) {
166
-				for($r = 0; $r < $rowcount; $r++) {
167
-					$row = $this->_isDataset ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$r];
168
-					$tblRows .= $this->RenderRowFnc($r + 1, $row);
169
-				}
170
-			} else {
171
-				if(!$this->pager) {
172
-					$this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber);
173
-					$this->pager->setRenderRowFnc($this); // pass this object
174
-					$this->pager->cssStyle = $pagerStyle;
175
-					$this->pager->cssClass = $pagerClass;
176
-				} else {
177
-					$this->pager->pageSize = $this->pageSize;
178
-					$this->pager->pageNumber = $this->pageNumber;
179
-				}
180
-
181
-				$this->pager->render();
182
-				$tblRows = $this->pager->getRenderedRows();
183
-				$tblPager = $this->pager->getRenderedPager();
184
-			}
185
-		}
186
-
187
-		// setup header,pager and footer
188
-		$o = $tblStart;
189
-		$ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both");
190
-		$pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both");
191
-		if($this->header) {
192
-			$o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>";
193
-		}
194
-		if($tblPager && $ptop) {
195
-			$o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . "&nbsp;</td></tr>";
196
-		}
197
-		$o .= $tblColHdr . $tblRows;
198
-		if($tblPager && $pbot) {
199
-			$o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . "&nbsp;</td></tr>";
200
-		}
201
-		if($this->footer) {
202
-			$o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>";
203
-		}
204
-		$o .= $tblEnd;
205
-		return $o;
206
-	}
207
-
208
-	// format column values
98
+        $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : '';
99
+        $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : "";
100
+        $cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : '';
101
+        $cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : '';
102
+
103
+        $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : '';
104
+        $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'";
105
+
106
+        $this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : '';
107
+        $this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : '';
108
+        $this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : '';
109
+        $this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : '';
110
+
111
+        $this->_alt = 0;
112
+        $this->_total = 0;
113
+
114
+        $this->_isDataset = $modx->getDatabase()->isResult($this->ds); // if not dataset then treat as array
115
+
116
+        if(!$cssStyle && !$cssClass) {
117
+            $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'";
118
+        }
119
+        if(!$columnHeaderStyle && !$columnHeaderClass) {
120
+            $columnHeaderStyle = "style='color:black;background-color:silver'";
121
+        }
122
+        if(!$this->_itemStyle && !$this->_itemClass) {
123
+            $this->_itemStyle = "style='color:black;'";
124
+        }
125
+        if(!$this->_altItemStyle && !$this->_altItemClass) {
126
+            $this->_altItemStyle = "style='color:black;background-color:#eeeeee'";
127
+        }
128
+
129
+        if($this->_isDataset && !$this->columns) {
130
+            $cols = $modx->getDatabase()->numFields($this->ds);
131
+            for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->getDatabase()->fieldName($this->ds, $i);
132
+        }
133
+
134
+        // start grid
135
+        $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>";
136
+        $tblEnd = "</table>";
137
+
138
+        // build column header
139
+        $this->_colnames = explode((strstr($this->columns, "||") !== false ? "||" : ","), $this->columns);
140
+        $this->_colwidths = explode((strstr($this->colWidths, "||") !== false ? "||" : ","), $this->colWidths);
141
+        $this->_colaligns = explode((strstr($this->colAligns, "||") !== false ? "||" : ","), $this->colAligns);
142
+        $this->_colwraps = explode((strstr($this->colWraps, "||") !== false ? "||" : ","), $this->colWraps);
143
+        $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors);
144
+        $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes);
145
+        $this->_colcount = count($this->_colnames);
146
+        if(!$this->_isDataset) {
147
+            $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds);
148
+            $this->ds = array_chunk($this->ds, $this->_colcount);
149
+        }
150
+        $tblColHdr = "<thead><tr>";
151
+        for($c = 0; $c < $this->_colcount; $c++) {
152
+            $name = $this->_colnames[$c];
153
+            $width = $this->_colwidths[$c];
154
+            $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>";
155
+        }
156
+        $tblColHdr .= "</tr></thead>\n";
157
+
158
+        // build rows
159
+        $rowcount = $this->_isDataset ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds);
160
+        $this->_fieldnames = explode(",", $this->fields);
161
+        if($rowcount == 0) {
162
+            $tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n";
163
+        } else {
164
+            // render grid items
165
+            if($this->pageSize <= 0) {
166
+                for($r = 0; $r < $rowcount; $r++) {
167
+                    $row = $this->_isDataset ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$r];
168
+                    $tblRows .= $this->RenderRowFnc($r + 1, $row);
169
+                }
170
+            } else {
171
+                if(!$this->pager) {
172
+                    $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber);
173
+                    $this->pager->setRenderRowFnc($this); // pass this object
174
+                    $this->pager->cssStyle = $pagerStyle;
175
+                    $this->pager->cssClass = $pagerClass;
176
+                } else {
177
+                    $this->pager->pageSize = $this->pageSize;
178
+                    $this->pager->pageNumber = $this->pageNumber;
179
+                }
180
+
181
+                $this->pager->render();
182
+                $tblRows = $this->pager->getRenderedRows();
183
+                $tblPager = $this->pager->getRenderedPager();
184
+            }
185
+        }
186
+
187
+        // setup header,pager and footer
188
+        $o = $tblStart;
189
+        $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both");
190
+        $pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both");
191
+        if($this->header) {
192
+            $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>";
193
+        }
194
+        if($tblPager && $ptop) {
195
+            $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . "&nbsp;</td></tr>";
196
+        }
197
+        $o .= $tblColHdr . $tblRows;
198
+        if($tblPager && $pbot) {
199
+            $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . "&nbsp;</td></tr>";
200
+        }
201
+        if($this->footer) {
202
+            $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>";
203
+        }
204
+        $o .= $tblEnd;
205
+        return $o;
206
+    }
207
+
208
+    // format column values
209 209
 
210 210
     public function RenderRowFnc($n, $row) {
211
-		if($this->_alt == 0) {
212
-			$Style = $this->_itemStyle;
213
-			$Class = $this->_itemClass;
214
-			$this->_alt = 1;
215
-		} else {
216
-			$Style = $this->_altItemStyle;
217
-			$Class = $this->_altItemClass;
218
-			$this->_alt = 0;
219
-		}
220
-		$o = "<tr>";
221
-		for($c = 0; $c < $this->_colcount; $c++) {
222
-			$colStyle = $Style;
223
-			$fld = trim($this->_fieldnames[$c]);
224
-			$width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null;
225
-			$align = isset($this->_colaligns[$c]) ? $this->_colaligns[$c] : null;
226
-			$color = isset($this->_colcolors[$c]) ? $this->_colcolors[$c] : null;
227
-			$type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null;
228
-			$nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null;
229
-			$value = $row[($this->_isDataset && $fld ? $fld : $c)];
230
-			if($color && $Style) {
231
-				$colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'";
232
-			}
233
-			$value = $this->formatColumnValue($row, $value, $type, $align);
234
-			$o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>";
235
-		}
236
-		$o .= "</tr>\n";
237
-		return $o;
238
-	}
211
+        if($this->_alt == 0) {
212
+            $Style = $this->_itemStyle;
213
+            $Class = $this->_itemClass;
214
+            $this->_alt = 1;
215
+        } else {
216
+            $Style = $this->_altItemStyle;
217
+            $Class = $this->_altItemClass;
218
+            $this->_alt = 0;
219
+        }
220
+        $o = "<tr>";
221
+        for($c = 0; $c < $this->_colcount; $c++) {
222
+            $colStyle = $Style;
223
+            $fld = trim($this->_fieldnames[$c]);
224
+            $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null;
225
+            $align = isset($this->_colaligns[$c]) ? $this->_colaligns[$c] : null;
226
+            $color = isset($this->_colcolors[$c]) ? $this->_colcolors[$c] : null;
227
+            $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null;
228
+            $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null;
229
+            $value = $row[($this->_isDataset && $fld ? $fld : $c)];
230
+            if($color && $Style) {
231
+                $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'";
232
+            }
233
+            $value = $this->formatColumnValue($row, $value, $type, $align);
234
+            $o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>";
235
+        }
236
+        $o .= "</tr>\n";
237
+        return $o;
238
+    }
239 239
 
240 240
     public function formatColumnValue($row, $value, $type, &$align) {
241
-		if(strpos($type, ":") !== false) {
242
-			list($type, $type_format) = explode(":", $type, 2);
243
-		}
244
-		switch(strtolower($type)) {
245
-			case "integer":
246
-				if($align == "") {
247
-					$align = "right";
248
-				}
249
-				$value = number_format($value);
250
-				break;
251
-
252
-			case "float":
253
-				if($align == "") {
254
-					$align = "right";
255
-				}
256
-				if(!$type_format) {
257
-					$type_format = 2;
258
-				}
259
-				$value = number_format($value, $type_format);
260
-				break;
261
-
262
-			case "currency":
263
-				if($align == "") {
264
-					$align = "right";
265
-				}
266
-				if(!$type_format) {
267
-					$type_format = 2;
268
-				}
269
-				$value = "$" . number_format($value, $type_format);
270
-				break;
271
-
272
-			case "date":
273
-				if($align == "") {
274
-					$align = "right";
275
-				}
276
-				if(!is_numeric($value)) {
277
-					$value = strtotime($value);
278
-				}
279
-				if(!$type_format) {
280
-					$type_format = "%A %d, %B %Y";
281
-				}
282
-				$value = strftime($type_format, $value);
283
-				break;
284
-
285
-			case "boolean":
286
-				if($align == '') {
287
-					$align = "center";
288
-				}
289
-				$value = number_format($value);
290
-				if($value) {
291
-					$value = '&bull;';
292
-				} else {
293
-					$value = '&nbsp;';
294
-				}
295
-				break;
296
-
297
-			case "template":
298
-				// replace [+value+] first
299
-				$value = str_replace("[+value+]", $value, $type_format);
300
-				// replace other [+fields+]
301
-				if(strpos($value, "[+") !== false) {
302
-					foreach($row as $k => $v) {
303
-						$value = str_replace("[+$k+]", $v, $value);
304
-					}
305
-				}
306
-				break;
307
-
308
-		}
309
-		return $value;
310
-	}
241
+        if(strpos($type, ":") !== false) {
242
+            list($type, $type_format) = explode(":", $type, 2);
243
+        }
244
+        switch(strtolower($type)) {
245
+            case "integer":
246
+                if($align == "") {
247
+                    $align = "right";
248
+                }
249
+                $value = number_format($value);
250
+                break;
251
+
252
+            case "float":
253
+                if($align == "") {
254
+                    $align = "right";
255
+                }
256
+                if(!$type_format) {
257
+                    $type_format = 2;
258
+                }
259
+                $value = number_format($value, $type_format);
260
+                break;
261
+
262
+            case "currency":
263
+                if($align == "") {
264
+                    $align = "right";
265
+                }
266
+                if(!$type_format) {
267
+                    $type_format = 2;
268
+                }
269
+                $value = "$" . number_format($value, $type_format);
270
+                break;
271
+
272
+            case "date":
273
+                if($align == "") {
274
+                    $align = "right";
275
+                }
276
+                if(!is_numeric($value)) {
277
+                    $value = strtotime($value);
278
+                }
279
+                if(!$type_format) {
280
+                    $type_format = "%A %d, %B %Y";
281
+                }
282
+                $value = strftime($type_format, $value);
283
+                break;
284
+
285
+            case "boolean":
286
+                if($align == '') {
287
+                    $align = "center";
288
+                }
289
+                $value = number_format($value);
290
+                if($value) {
291
+                    $value = '&bull;';
292
+                } else {
293
+                    $value = '&nbsp;';
294
+                }
295
+                break;
296
+
297
+            case "template":
298
+                // replace [+value+] first
299
+                $value = str_replace("[+value+]", $value, $type_format);
300
+                // replace other [+fields+]
301
+                if(strpos($value, "[+") !== false) {
302
+                    foreach($row as $k => $v) {
303
+                        $value = str_replace("[+$k+]", $v, $value);
304
+                    }
305
+                }
306
+                break;
307
+
308
+        }
309
+        return $value;
310
+    }
311 311
 }
Please login to merge, or discard this patch.
manager/includes/src/Support/DataSetPager.php 1 patch
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 
14 14
 class DataSetPager implements DataSetPagerInterface{
15 15
 
16
-	public $ds; // datasource
16
+    public $ds; // datasource
17 17
     public $pageSize;
18 18
     public $pageNumber;
19 19
     public $rows;
20 20
     public $pager;
21 21
     public $id;
22 22
 
23
-	// normal page
23
+    // normal page
24 24
     public $pageStyle;
25 25
     public $pageClass;
26 26
 
27
-	// selected page
27
+    // selected page
28 28
     public $selPageStyle;
29 29
     public $selPageClass;
30 30
     public $renderRowFnc;
@@ -34,164 +34,164 @@  discard block
 block discarded – undo
34 34
     public static $dataSetPagerCnt;
35 35
 
36 36
     public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) {
37
-		global $_PAGE; // use view state object
38
-
39
-		// set id
40
-		self::$dataSetPagerCnt++;
41
-		$this->id = !empty($id) ? $id : "dsp" . self::$dataSetPagerCnt;
42
-
43
-		// get pagenumber
44
-		// by setting pager to -1 cause pager to load it's last page number
45
-		if($pageNumber == -1) {
46
-			$pageNumber = 1;
47
-			if(isset($_GET["dpgn" . $this->id])) {
48
-				$pageNumber = $_GET["dpgn" . $this->id];
49
-			} elseif(isset($_PAGE['vs'][$id . '_dpgn'])) {
50
-				$pageNumber = $_PAGE['vs'][$id . '_dpgn'];
51
-			}
52
-		}
53
-		if(!is_numeric($pageNumber)) {
54
-			$pageNumber = 1;
55
-		}
56
-
57
-		$this->ds = $ds; // datasource
58
-		$this->pageSize = $pageSize;
59
-		$this->pageNumber = $pageNumber;
60
-		$this->rows = '';
61
-		$this->pager = '';
62
-	}
37
+        global $_PAGE; // use view state object
38
+
39
+        // set id
40
+        self::$dataSetPagerCnt++;
41
+        $this->id = !empty($id) ? $id : "dsp" . self::$dataSetPagerCnt;
42
+
43
+        // get pagenumber
44
+        // by setting pager to -1 cause pager to load it's last page number
45
+        if($pageNumber == -1) {
46
+            $pageNumber = 1;
47
+            if(isset($_GET["dpgn" . $this->id])) {
48
+                $pageNumber = $_GET["dpgn" . $this->id];
49
+            } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) {
50
+                $pageNumber = $_PAGE['vs'][$id . '_dpgn'];
51
+            }
52
+        }
53
+        if(!is_numeric($pageNumber)) {
54
+            $pageNumber = 1;
55
+        }
56
+
57
+        $this->ds = $ds; // datasource
58
+        $this->pageSize = $pageSize;
59
+        $this->pageNumber = $pageNumber;
60
+        $this->rows = '';
61
+        $this->pager = '';
62
+    }
63 63
 
64 64
     public function getRenderedPager() {
65
-		return $this->pager;
66
-	}
65
+        return $this->pager;
66
+    }
67 67
 
68 68
     public function getRenderedRows() {
69
-		return $this->rows;
70
-	}
69
+        return $this->rows;
70
+    }
71 71
 
72 72
     public function setDataSource($ds) {
73
-		$this->ds = $ds;
74
-	}
73
+        $this->ds = $ds;
74
+    }
75 75
 
76 76
     public function setPageSize($ps) {
77
-		$this->pageSize = $ps;
78
-	}
77
+        $this->pageSize = $ps;
78
+    }
79 79
 
80 80
     public function setRenderRowFnc($fncName, $args = "") {
81
-		$this->renderRowFnc = &$fncName;
82
-		$this->renderRowFncArgs = $args;    // extra agruments
81
+        $this->renderRowFnc = &$fncName;
82
+        $this->renderRowFncArgs = $args;    // extra agruments
83 83
 
84 84
 
85
-	}
85
+    }
86 86
 
87 87
     public function setRenderPagerFnc($fncName, $args = "") {
88
-		$this->renderPagerFnc = $fncName;
89
-		$this->renderPagerFncArgs = $args;    // extra agruments
90
-	}
88
+        $this->renderPagerFnc = $fncName;
89
+        $this->renderPagerFncArgs = $args;    // extra agruments
90
+    }
91 91
 
92 92
     public function render() {
93
-		$modx = evolutionCMS(); global $_PAGE;
94
-
95
-		$isDataset = $modx->getDatabase()->isResult($this->ds);
96
-
97
-		if(!$this->selPageStyle) {
98
-			$this->selPageStyle = "font-weight:bold";
99
-		}
100
-
101
-		// get total number of rows
102
-		$tnr = ($isDataset) ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds);
103
-
104
-		// render: no records found
105
-		if($tnr <= 0) {
106
-			$fnc = $this->renderRowFnc;
107
-			$args = $this->renderRowFncArgs;
108
-			if(isset($fnc)) {
109
-				if($args != "") {
110
-					$this->rows .= $fnc(0, null, $args);
111
-				} // if agrs was specified then we will pass three params
112
-				else {
113
-					$this->rows .= $fnc(0, null);
114
-				}                 // otherwise two will be passed
115
-			}
116
-			return;
117
-		}
118
-
119
-		// get total pages
120
-		$tp = ceil($tnr / $this->pageSize);
121
-		if($this->pageNumber > $tp) {
122
-			$this->pageNumber = 1;
123
-		}
124
-
125
-		// get page number
126
-		$p = $this->pageNumber;
127
-
128
-		// save page number to view state if available
129
-		if(isset($_PAGE['vs'])) {
130
-			$_PAGE['vs'][$this->id . '_dpgn'] = $p;
131
-		}
132
-
133
-		// render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments="");
134
-		if($tp > 1) {
135
-		    $url = '';
136
-			$fnc = $this->renderPagerFnc;
137
-			$args = $this->renderPagerFncArgs;
138
-			if(!isset($fnc)) {
139
-				if($modx->isFrontend()) {
140
-					$url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?';
141
-				} else {
142
-					$url = $_SERVER['PHP_SELF'] . '?';
143
-				}
144
-				$i = 0;
145
-				foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) {
146
-					$i++;
147
-					$url .= (($i > 1) ? "&" : "") . "$n=$v";
148
-				}
149
-				if($i >= 1) {
150
-					$url .= "&";
151
-				}
152
-			}
153
-			for($i = 1; $i <= $tp; $i++) {
154
-				if(isset($fnc)) {
155
-					if($args != "") {
156
-						$this->pager .= $fnc($p, $i, $args);
157
-					} else {
158
-						$this->pager .= $fnc($p, $i);
159
-					}
160
-				} else {
161
-					$this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> ";
162
-				}
163
-			}
164
-		}
165
-
166
-		// render row : renderRowFnc($rowNumber,$row,$arguments="")
167
-		$fnc = $this->renderRowFnc;
168
-		$args = $this->renderRowFncArgs;
169
-
170
-		if(isset($fnc)) {
171
-			$i = 1;
172
-			$fncObject = is_object($fnc);
173
-			$minitems = (($p - 1) * $this->pageSize) + 1;
174
-			$maxitems = (($p - 1) * $this->pageSize) + $this->pageSize;
175
-			while($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) {
176
-				if($i >= $minitems && $i <= $maxitems) {
177
-					if($fncObject) {
178
-						if($args != "") {
179
-							$this->rows .= $fnc->RenderRowFnc($i, $row, $args);
180
-						} else {
181
-							$this->rows .= $fnc->RenderRowFnc($i, $row);
182
-						}
183
-					} else {
184
-						if($args != "") {
185
-							$this->rows .= $fnc($i, $row, $args);
186
-						} // if agrs was specified then we wil pass three params
187
-						else {
188
-							$this->rows .= $fnc($i, $row);
189
-						}                 // otherwise two will be passed
190
-					}
191
-
192
-				}
193
-				$i++;
194
-			}
195
-		}
196
-	}
93
+        $modx = evolutionCMS(); global $_PAGE;
94
+
95
+        $isDataset = $modx->getDatabase()->isResult($this->ds);
96
+
97
+        if(!$this->selPageStyle) {
98
+            $this->selPageStyle = "font-weight:bold";
99
+        }
100
+
101
+        // get total number of rows
102
+        $tnr = ($isDataset) ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds);
103
+
104
+        // render: no records found
105
+        if($tnr <= 0) {
106
+            $fnc = $this->renderRowFnc;
107
+            $args = $this->renderRowFncArgs;
108
+            if(isset($fnc)) {
109
+                if($args != "") {
110
+                    $this->rows .= $fnc(0, null, $args);
111
+                } // if agrs was specified then we will pass three params
112
+                else {
113
+                    $this->rows .= $fnc(0, null);
114
+                }                 // otherwise two will be passed
115
+            }
116
+            return;
117
+        }
118
+
119
+        // get total pages
120
+        $tp = ceil($tnr / $this->pageSize);
121
+        if($this->pageNumber > $tp) {
122
+            $this->pageNumber = 1;
123
+        }
124
+
125
+        // get page number
126
+        $p = $this->pageNumber;
127
+
128
+        // save page number to view state if available
129
+        if(isset($_PAGE['vs'])) {
130
+            $_PAGE['vs'][$this->id . '_dpgn'] = $p;
131
+        }
132
+
133
+        // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments="");
134
+        if($tp > 1) {
135
+            $url = '';
136
+            $fnc = $this->renderPagerFnc;
137
+            $args = $this->renderPagerFncArgs;
138
+            if(!isset($fnc)) {
139
+                if($modx->isFrontend()) {
140
+                    $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?';
141
+                } else {
142
+                    $url = $_SERVER['PHP_SELF'] . '?';
143
+                }
144
+                $i = 0;
145
+                foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) {
146
+                    $i++;
147
+                    $url .= (($i > 1) ? "&" : "") . "$n=$v";
148
+                }
149
+                if($i >= 1) {
150
+                    $url .= "&";
151
+                }
152
+            }
153
+            for($i = 1; $i <= $tp; $i++) {
154
+                if(isset($fnc)) {
155
+                    if($args != "") {
156
+                        $this->pager .= $fnc($p, $i, $args);
157
+                    } else {
158
+                        $this->pager .= $fnc($p, $i);
159
+                    }
160
+                } else {
161
+                    $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> ";
162
+                }
163
+            }
164
+        }
165
+
166
+        // render row : renderRowFnc($rowNumber,$row,$arguments="")
167
+        $fnc = $this->renderRowFnc;
168
+        $args = $this->renderRowFncArgs;
169
+
170
+        if(isset($fnc)) {
171
+            $i = 1;
172
+            $fncObject = is_object($fnc);
173
+            $minitems = (($p - 1) * $this->pageSize) + 1;
174
+            $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize;
175
+            while($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) {
176
+                if($i >= $minitems && $i <= $maxitems) {
177
+                    if($fncObject) {
178
+                        if($args != "") {
179
+                            $this->rows .= $fnc->RenderRowFnc($i, $row, $args);
180
+                        } else {
181
+                            $this->rows .= $fnc->RenderRowFnc($i, $row);
182
+                        }
183
+                    } else {
184
+                        if($args != "") {
185
+                            $this->rows .= $fnc($i, $row, $args);
186
+                        } // if agrs was specified then we wil pass three params
187
+                        else {
188
+                            $this->rows .= $fnc($i, $row);
189
+                        }                 // otherwise two will be passed
190
+                    }
191
+
192
+                }
193
+                $i++;
194
+            }
195
+        }
196
+    }
197 197
 }
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/core/uploader.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Uploader class
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Uploader class
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 class uploader {
16 16
 
@@ -18,92 +18,92 @@  discard block
 block discarded – undo
18 18
     const VERSION = "2.54";
19 19
 
20 20
 /** Config session-overrided settings
21
-  * @var array */
21
+ * @var array */
22 22
     protected $config = array();
23 23
 
24 24
 /** Default image driver
25
-  * @var string */
25
+ * @var string */
26 26
     protected $imageDriver = "gd";
27 27
 
28 28
 /** Opener applocation properties
29
-  *   $opener['name']                 Got from $_GET['opener'];
30
-  *   $opener['CKEditor']['funcNum']  CKEditor function number (got from $_GET)
31
-  *   $opener['TinyMCE']              Boolean
32
-  * @var array */
29
+ *   $opener['name']                 Got from $_GET['opener'];
30
+ *   $opener['CKEditor']['funcNum']  CKEditor function number (got from $_GET)
31
+ *   $opener['TinyMCE']              Boolean
32
+ * @var array */
33 33
     protected $opener = array();
34 34
 
35 35
 /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant
36
-  * @var string */
36
+ * @var string */
37 37
     protected $type;
38 38
 
39 39
 /** Helper property. Local filesystem path to the Type Directory
40
-  * Equivalent: $config['uploadDir'] . "/" . $type
41
-  * @var string */
40
+ * Equivalent: $config['uploadDir'] . "/" . $type
41
+ * @var string */
42 42
     protected $typeDir;
43 43
 
44 44
 /** Helper property. Web URL to the Type Directory
45
-  * Equivalent: $config['uploadURL'] . "/" . $type
46
-  * @var string */
45
+ * Equivalent: $config['uploadURL'] . "/" . $type
46
+ * @var string */
47 47
     protected $typeURL;
48 48
 
49 49
 /** Linked to $config['types']
50
-  * @var array */
50
+ * @var array */
51 51
     protected $types = array();
52 52
 
53 53
 /** Settings which can override default settings if exists as keys in $config['types'][$type] array
54
-  * @var array */
54
+ * @var array */
55 55
     protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark');
56 56
 
57 57
 /** Got from language file
58
-  * @var string */
58
+ * @var string */
59 59
     protected $charset;
60 60
 
61 61
 /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property
62
-  * @var string */
62
+ * @var string */
63 63
     protected $lang = 'en';
64 64
 
65 65
 /** Possible language $_GET keys
66
-  * @var array */
66
+ * @var array */
67 67
     protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code');
68 68
 
69 69
 /** Uploaded file(s) info. Linked to first $_FILES element
70
-  * @var array */
70
+ * @var array */
71 71
     protected $file;
72 72
 
73 73
 /** Next three properties are got from the current language file
74
-  * @var string */
74
+ * @var string */
75 75
     protected $dateTimeFull;   // Currently not used
76 76
     protected $dateTimeMid;    // Currently not used
77 77
     protected $dateTimeSmall;
78 78
 
79 79
 /** Contain Specified language labels
80
-  * @var array */
80
+ * @var array */
81 81
     protected $labels = array();
82 82
 
83 83
 /** Contain unprocessed $_GET array. Please use this instead of $_GET
84
-  * @var array */
84
+ * @var array */
85 85
     protected $get;
86 86
 
87 87
 /** Contain unprocessed $_POST array. Please use this instead of $_POST
88
-  * @var array */
88
+ * @var array */
89 89
     protected $post;
90 90
 
91 91
 /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE
92
-  * @var array */
92
+ * @var array */
93 93
     protected $cookie;
94 94
 
95 95
 /** Session array. Please use this property instead of $_SESSION
96
-  * @var array */
96
+ * @var array */
97 97
     protected $session;
98 98
 
99 99
 /** CMS integration attribute (got from $_GET['cms'])
100
-  * @var string */
100
+ * @var string */
101 101
     protected $cms = "";
102 102
 
103 103
     protected $modx = null;
104 104
 /** Magic method which allows read-only access to protected or private class properties
105
-  * @param string $property
106
-  * @return mixed */
105
+     * @param string $property
106
+     * @return mixed */
107 107
     public function __get($property) {
108 108
         return property_exists($this, $property) ? $this->$property : null;
109 109
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         )
133 133
             $this->cms = $this->get['cms'];
134 134
 
135
-		// LINKING UPLOADED FILE
135
+        // LINKING UPLOADED FILE
136 136
         if (count($_FILES))
137 137
             $this->file = &$_FILES[key($_FILES)];
138 138
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
             $this->config['uploadDir'] = strlen($this->config['uploadDir'])
229 229
                 ? path::normalize($this->config['uploadDir'])
230 230
                 : path::url2fullPath("/$path");
231
-         $this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
232
-         $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}";
231
+            $this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
232
+            $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}";
233 233
 
234 234
         // SITE ROOT
235 235
         } elseif ($this->config['uploadURL'] == "/") {
@@ -365,36 +365,36 @@  discard block
 block discarded – undo
365 365
     }
366 366
 
367 367
 
368
-	protected function getTransaliasSettings() {
369
-		$modx = evolutionCMS();
370
-
371
-		// Cleaning uploaded filename?
372
-		$setting = $modx->getDatabase()->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1');
373
-		if ($modx->getDatabase()->getValue($setting)>0) {
374
-			// Transalias plugin active?
375
-			$res = $modx->getDatabase()->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0');
376
-			if ($properties = $modx->getDatabase()->getValue($res)) {
377
-				$properties = $modx->parseProperties($properties, 'TransAlias', 'plugin');
378
-			} else {
379
-				$properties = NULL;
380
-			}
381
-		} else {
382
-			$properties = NULL;
383
-		}
384
-		return $properties;
385
-	}
386
-
387
-
388
-	protected function normalizeFilename($filename) {
389
-		if ($this->getTransaliasSettings()) {
390
-        		$format = strrchr($filename, ".");
391
-        		$filename = str_replace($format, "", $filename);
392
-            		$filename = $this->modx->stripAlias($filename).$format;
393
-        	}
394
-        	return $filename;
395
-	}
396
-
397
-	protected function normalizeDirname($dirname) {
368
+    protected function getTransaliasSettings() {
369
+        $modx = evolutionCMS();
370
+
371
+        // Cleaning uploaded filename?
372
+        $setting = $modx->getDatabase()->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1');
373
+        if ($modx->getDatabase()->getValue($setting)>0) {
374
+            // Transalias plugin active?
375
+            $res = $modx->getDatabase()->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0');
376
+            if ($properties = $modx->getDatabase()->getValue($res)) {
377
+                $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin');
378
+            } else {
379
+                $properties = NULL;
380
+            }
381
+        } else {
382
+            $properties = NULL;
383
+        }
384
+        return $properties;
385
+    }
386
+
387
+
388
+    protected function normalizeFilename($filename) {
389
+        if ($this->getTransaliasSettings()) {
390
+                $format = strrchr($filename, ".");
391
+                $filename = str_replace($format, "", $filename);
392
+                    $filename = $this->modx->stripAlias($filename).$format;
393
+            }
394
+            return $filename;
395
+    }
396
+
397
+    protected function normalizeDirname($dirname) {
398 398
         return $this->modx->stripAlias($dirname);
399 399
     }
400 400
 
@@ -472,10 +472,10 @@  discard block
 block discarded – undo
472 472
             return $this->label("The image is too big and/or cannot be resized.");
473 473
 
474 474
 
475
-	// CHECK FOR MODX MAX FILE SIZE
476
-	$actualfilesize=filesize($file['tmp_name']);
477
-	if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize'])
478
-	    return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
475
+    // CHECK FOR MODX MAX FILE SIZE
476
+    $actualfilesize=filesize($file['tmp_name']);
477
+    if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize'])
478
+        return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
479 479
 
480 480
         return true;
481 481
     }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
             $top = isset($this->config['watermark']['top'])
628 628
                 ? $this->config['watermark']['top'] : false;
629 629
             $img->watermark($this->config['watermark']['file'], $left, $top);
630
-		}
630
+        }
631 631
 
632 632
         $options = array( 'file' => $file );
633 633
 
Please login to merge, or discard this patch.
manager/frames/tree.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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
 // invoke OnManagerTreeInit event
7 7
 $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST);
8 8
 if(is_array($evtOut)) {
9
-	echo implode("\n", $evtOut);
9
+    echo implode("\n", $evtOut);
10 10
 }
11 11
 ?>
12 12
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 
53 53
 	<div id="treeHolder">
54 54
 		<?php
55
-		// invoke OnManagerTreePrerender event
56
-		$evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
57
-		if(is_array($evtOut)) {
58
-			echo implode("\n", $evtOut);
59
-		}
60
-		?>
55
+        // invoke OnManagerTreePrerender event
56
+        $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
57
+        if(is_array($evtOut)) {
58
+            echo implode("\n", $evtOut);
59
+        }
60
+        ?>
61 61
 		<div id="node0" class="rootNode"><a class="node" onclick="modx.tree.treeAction(event, 0)" data-id="0" data-title-esc="<?php $site_name = htmlspecialchars($site_name, ENT_QUOTES, $modx->config['modx_charset']);
62
-			echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a>
62
+            echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a>
63 63
 			<div id="treeloader"><i class="fa fa-cog fa-spin fa-3x fa-fw"></i></div>
64 64
 		</div>
65 65
 		<div id="treeRoot"></div>
66 66
 		<?php
67
-		// invoke OnManagerTreeRender event
68
-		$evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
69
-		if(is_array($evtOut)) {
70
-			echo implode("\n", $evtOut);
71
-		}
72
-		?>
67
+        // invoke OnManagerTreeRender event
68
+        $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
69
+        if(is_array($evtOut)) {
70
+            echo implode("\n", $evtOut);
71
+        }
72
+        ?>
73 73
 	</div>
74 74
 </div>
Please login to merge, or discard this patch.
manager/frames/mainmenu.php 1 patch
Indentation   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -4,237 +4,237 @@  discard block
 block discarded – undo
4 4
 */
5 5
 
6 6
 $sitemenu['bars'] = array(
7
-	'bars',
8
-	'main',
9
-	'<i class="fa fa-bars"></i>',
10
-	'javascript:;',
11
-	$_lang['home'],
12
-	'modx.resizer.toggle(); return false;',
13
-	' return false;',
14
-	'',
15
-	0,
16
-	10,
17
-	''
7
+    'bars',
8
+    'main',
9
+    '<i class="fa fa-bars"></i>',
10
+    'javascript:;',
11
+    $_lang['home'],
12
+    'modx.resizer.toggle(); return false;',
13
+    ' return false;',
14
+    '',
15
+    0,
16
+    10,
17
+    ''
18 18
 );
19 19
 
20 20
 //mainMenu
21 21
 $sitemenu['site'] = array(
22
-	'site',
23
-	'main',
24
-	'<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>',
25
-	'index.php?a=2',
26
-	$_lang['home'],
27
-	'',
28
-	'',
29
-	'main',
30
-	0,
31
-	10,
32
-	'active'
22
+    'site',
23
+    'main',
24
+    '<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>',
25
+    'index.php?a=2',
26
+    $_lang['home'],
27
+    '',
28
+    '',
29
+    'main',
30
+    0,
31
+    10,
32
+    'active'
33 33
 );
34 34
 
35 35
 if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
36
-	$sitemenu['elements'] = array(
37
-		'elements',
38
-		'main',
39
-		'<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>',
40
-		'javascript:;',
41
-		$_lang['elements'],
42
-		' return false;',
43
-		'',
44
-		'',
45
-		0,
46
-		20,
47
-		''
48
-	);
36
+    $sitemenu['elements'] = array(
37
+        'elements',
38
+        'main',
39
+        '<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>',
40
+        'javascript:;',
41
+        $_lang['elements'],
42
+        ' return false;',
43
+        '',
44
+        '',
45
+        0,
46
+        20,
47
+        ''
48
+    );
49 49
 }
50 50
 
51 51
 if($modx->hasPermission('exec_module')) {
52
-	$sitemenu['modules'] = array(
53
-		'modules',
54
-		'main',
55
-		'<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>',
56
-		'javascript:;',
57
-		$_lang['modules'],
58
-		' return false;',
59
-		'',
60
-		'',
61
-		0,
62
-		30,
63
-		''
64
-	);
52
+    $sitemenu['modules'] = array(
53
+        'modules',
54
+        'main',
55
+        '<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>',
56
+        'javascript:;',
57
+        $_lang['modules'],
58
+        ' return false;',
59
+        '',
60
+        '',
61
+        0,
62
+        30,
63
+        ''
64
+    );
65 65
 }
66 66
 
67 67
 if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
68
-	$sitemenu['users'] = array(
69
-		'users',
70
-		'main',
71
-		'<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>',
72
-		'javascript:;',
73
-		$_lang['users'],
74
-		' return false;',
75
-		'edit_user',
76
-		'',
77
-		0,
78
-		40,
79
-		''
80
-	);
68
+    $sitemenu['users'] = array(
69
+        'users',
70
+        'main',
71
+        '<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>',
72
+        'javascript:;',
73
+        $_lang['users'],
74
+        ' return false;',
75
+        'edit_user',
76
+        '',
77
+        0,
78
+        40,
79
+        ''
80
+    );
81 81
 }
82 82
 
83 83
 if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
84
-	$sitemenu['tools'] = array(
85
-		'tools',
86
-		'main',
87
-		'<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>',
88
-		'javascript:;',
89
-		$_lang['tools'],
90
-		' return false;',
91
-		'',
92
-		'',
93
-		0,
94
-		50,
95
-		''
96
-	);
84
+    $sitemenu['tools'] = array(
85
+        'tools',
86
+        'main',
87
+        '<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>',
88
+        'javascript:;',
89
+        $_lang['tools'],
90
+        ' return false;',
91
+        '',
92
+        '',
93
+        0,
94
+        50,
95
+        ''
96
+    );
97 97
 }
98 98
 
99 99
 $tab = 0;
100 100
 if($modx->hasPermission('edit_template')) {
101
-	$sitemenu['element_templates'] = array(
102
-		'element_templates',
103
-		'elements',
104
-		'<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>',
105
-		'index.php?a=76&tab=' . $tab++,
106
-		$_lang['manage_templates'],
107
-		'',
108
-		'new_template,edit_template',
109
-		'main',
110
-		0,
111
-		10,
112
-		'dropdown-toggle'
113
-	);
101
+    $sitemenu['element_templates'] = array(
102
+        'element_templates',
103
+        'elements',
104
+        '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>',
105
+        'index.php?a=76&tab=' . $tab++,
106
+        $_lang['manage_templates'],
107
+        '',
108
+        'new_template,edit_template',
109
+        'main',
110
+        0,
111
+        10,
112
+        'dropdown-toggle'
113
+    );
114 114
 }
115 115
 if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
116
-	$sitemenu['element_tplvars'] = array(
117
-		'element_tplvars',
118
-		'elements',
119
-		'<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>',
120
-		'index.php?a=76&tab=' . $tab++,
121
-		$_lang['tmplvars'],
122
-		'',
123
-		'new_template,edit_template',
124
-		'main',
125
-		0,
126
-		20,
127
-		'dropdown-toggle'
128
-	);
116
+    $sitemenu['element_tplvars'] = array(
117
+        'element_tplvars',
118
+        'elements',
119
+        '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>',
120
+        'index.php?a=76&tab=' . $tab++,
121
+        $_lang['tmplvars'],
122
+        '',
123
+        'new_template,edit_template',
124
+        'main',
125
+        0,
126
+        20,
127
+        'dropdown-toggle'
128
+    );
129 129
 }
130 130
 if($modx->hasPermission('edit_chunk')) {
131
-	$sitemenu['element_htmlsnippets'] = array(
132
-		'element_htmlsnippets',
133
-		'elements',
134
-		'<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>',
135
-		'index.php?a=76&tab=' . $tab++,
136
-		$_lang['manage_htmlsnippets'],
137
-		'',
138
-		'new_chunk,edit_chunk',
139
-		'main',
140
-		0,
141
-		30,
142
-		'dropdown-toggle'
143
-	);
131
+    $sitemenu['element_htmlsnippets'] = array(
132
+        'element_htmlsnippets',
133
+        'elements',
134
+        '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>',
135
+        'index.php?a=76&tab=' . $tab++,
136
+        $_lang['manage_htmlsnippets'],
137
+        '',
138
+        'new_chunk,edit_chunk',
139
+        'main',
140
+        0,
141
+        30,
142
+        'dropdown-toggle'
143
+    );
144 144
 }
145 145
 if($modx->hasPermission('edit_snippet')) {
146
-	$sitemenu['element_snippets'] = array(
147
-		'element_snippets',
148
-		'elements',
149
-		'<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>',
150
-		'index.php?a=76&tab=' . $tab++,
151
-		$_lang['manage_snippets'],
152
-		'',
153
-		'new_snippet,edit_snippet',
154
-		'main',
155
-		0,
156
-		40,
157
-		'dropdown-toggle'
158
-	);
146
+    $sitemenu['element_snippets'] = array(
147
+        'element_snippets',
148
+        'elements',
149
+        '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>',
150
+        'index.php?a=76&tab=' . $tab++,
151
+        $_lang['manage_snippets'],
152
+        '',
153
+        'new_snippet,edit_snippet',
154
+        'main',
155
+        0,
156
+        40,
157
+        'dropdown-toggle'
158
+    );
159 159
 }
160 160
 if($modx->hasPermission('edit_plugin')) {
161
-	$sitemenu['element_plugins'] = array(
162
-		'element_plugins',
163
-		'elements',
164
-		'<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>',
165
-		'index.php?a=76&tab=' . $tab++,
166
-		$_lang['manage_plugins'],
167
-		'',
168
-		'new_plugin,edit_plugin',
169
-		'main',
170
-		0,
171
-		50,
172
-		'dropdown-toggle'
173
-	);
161
+    $sitemenu['element_plugins'] = array(
162
+        'element_plugins',
163
+        'elements',
164
+        '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>',
165
+        'index.php?a=76&tab=' . $tab++,
166
+        $_lang['manage_plugins'],
167
+        '',
168
+        'new_plugin,edit_plugin',
169
+        'main',
170
+        0,
171
+        50,
172
+        'dropdown-toggle'
173
+    );
174 174
 }
175 175
 //$sitemenu['element_categories']     = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,'');
176 176
 
177 177
 if($modx->hasPermission('file_manager')) {
178
-	$sitemenu['manage_files'] = array(
179
-		'manage_files',
180
-		'elements',
181
-		'<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'],
182
-		'index.php?a=31',
183
-		$_lang['manage_files'],
184
-		'',
185
-		'file_manager',
186
-		'main',
187
-		0,
188
-		80,
189
-		''
190
-	);
178
+    $sitemenu['manage_files'] = array(
179
+        'manage_files',
180
+        'elements',
181
+        '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'],
182
+        'index.php?a=31',
183
+        $_lang['manage_files'],
184
+        '',
185
+        'file_manager',
186
+        'main',
187
+        0,
188
+        80,
189
+        ''
190
+    );
191 191
 }
192 192
 if($modx->hasPermission('category_manager')) {
193
-	$sitemenu['manage_categories'] = array(
194
-		'manage_categories',
195
-		'elements',
196
-		'<i class="fa fa-object-group"></i>' . $_lang['manage_categories'],
197
-		'index.php?a=120',
198
-		$_lang['manage_categories'],
199
-		'',
200
-		'category_manager',
201
-		'main',
202
-		0,
203
-		70,
204
-		''
205
-	);
193
+    $sitemenu['manage_categories'] = array(
194
+        'manage_categories',
195
+        'elements',
196
+        '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'],
197
+        'index.php?a=120',
198
+        $_lang['manage_categories'],
199
+        '',
200
+        'category_manager',
201
+        'main',
202
+        0,
203
+        70,
204
+        ''
205
+    );
206 206
 }
207 207
 
208 208
 // Modules Menu Items
209 209
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
210
-	$sitemenu['new_module'] = array(
211
-		'new_module',
212
-		'modules',
213
-		'<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'],
214
-		'index.php?a=106',
215
-		$_lang['module_management'],
216
-		'',
217
-		'new_module,edit_module',
218
-		'main',
219
-		1,
220
-		0,
221
-		''
222
-	);
210
+    $sitemenu['new_module'] = array(
211
+        'new_module',
212
+        'modules',
213
+        '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'],
214
+        'index.php?a=106',
215
+        $_lang['module_management'],
216
+        '',
217
+        'new_module,edit_module',
218
+        'main',
219
+        1,
220
+        0,
221
+        ''
222
+    );
223 223
 }
224 224
 
225 225
 if($modx->hasPermission('exec_module')) {
226
-	if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
227
-		$rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
226
+    if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
227
+        $rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
228 228
 				FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
229 229
 				LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
230 230
 				LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
231 231
                 WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
232 232
                 ORDER BY sm.name');
233
-	} else {
234
-		$rs = $modx->getDatabase()->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
235
-	}
236
-	if($modx->getDatabase()->getRecordCount($rs)) {
237
-	    while ($row = $modx->getDatabase()->getRow($rs)) {
233
+    } else {
234
+        $rs = $modx->getDatabase()->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
235
+    }
236
+    if($modx->getDatabase()->getRecordCount($rs)) {
237
+        while ($row = $modx->getDatabase()->getRow($rs)) {
238 238
             $sitemenu['module' . $row['id']] = array(
239 239
                 'module' . $row['id'],
240 240
                 'modules',
@@ -255,83 +255,83 @@  discard block
 block discarded – undo
255 255
 // security menu items (users)
256 256
 
257 257
 if($modx->hasPermission('edit_user')) {
258
-	$sitemenu['user_management_title'] = array(
259
-		'user_management_title',
260
-		'users',
261
-		'<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
262
-		'index.php?a=75',
263
-		$_lang['user_management_title'],
264
-		'',
265
-		'edit_user',
266
-		'main',
267
-		0,
268
-		10,
269
-		'dropdown-toggle'
270
-	);
258
+    $sitemenu['user_management_title'] = array(
259
+        'user_management_title',
260
+        'users',
261
+        '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
262
+        'index.php?a=75',
263
+        $_lang['user_management_title'],
264
+        '',
265
+        'edit_user',
266
+        'main',
267
+        0,
268
+        10,
269
+        'dropdown-toggle'
270
+    );
271 271
 }
272 272
 
273 273
 if($modx->hasPermission('edit_web_user')) {
274
-	$sitemenu['web_user_management_title'] = array(
275
-		'web_user_management_title',
276
-		'users',
277
-		'<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
278
-		'index.php?a=99',
279
-		$_lang['web_user_management_title'],
280
-		'',
281
-		'edit_web_user',
282
-		'main',
283
-		0,
284
-		20,
285
-		'dropdown-toggle'
286
-	);
274
+    $sitemenu['web_user_management_title'] = array(
275
+        'web_user_management_title',
276
+        'users',
277
+        '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
278
+        'index.php?a=99',
279
+        $_lang['web_user_management_title'],
280
+        '',
281
+        'edit_web_user',
282
+        'main',
283
+        0,
284
+        20,
285
+        'dropdown-toggle'
286
+    );
287 287
 }
288 288
 
289 289
 if($modx->hasPermission('edit_role')) {
290
-	$sitemenu['role_management_title'] = array(
291
-		'role_management_title',
292
-		'users',
293
-		'<i class="fa fa-legal"></i>' . $_lang['role_management_title'],
294
-		'index.php?a=86',
295
-		$_lang['role_management_title'],
296
-		'',
297
-		'new_role,edit_role,delete_role',
298
-		'main',
299
-		0,
300
-		30,
301
-		''
302
-	);
290
+    $sitemenu['role_management_title'] = array(
291
+        'role_management_title',
292
+        'users',
293
+        '<i class="fa fa-legal"></i>' . $_lang['role_management_title'],
294
+        'index.php?a=86',
295
+        $_lang['role_management_title'],
296
+        '',
297
+        'new_role,edit_role,delete_role',
298
+        'main',
299
+        0,
300
+        30,
301
+        ''
302
+    );
303 303
 }
304 304
 
305 305
 if($modx->hasPermission('access_permissions')) {
306
-	$sitemenu['manager_permissions'] = array(
307
-		'manager_permissions',
308
-		'users',
309
-		'<i class="fa fa-male"></i>' . $_lang['manager_permissions'],
310
-		'index.php?a=40',
311
-		$_lang['manager_permissions'],
312
-		'',
313
-		'access_permissions',
314
-		'main',
315
-		0,
316
-		40,
317
-		''
318
-	);
306
+    $sitemenu['manager_permissions'] = array(
307
+        'manager_permissions',
308
+        'users',
309
+        '<i class="fa fa-male"></i>' . $_lang['manager_permissions'],
310
+        'index.php?a=40',
311
+        $_lang['manager_permissions'],
312
+        '',
313
+        'access_permissions',
314
+        'main',
315
+        0,
316
+        40,
317
+        ''
318
+    );
319 319
 }
320 320
 
321 321
 if($modx->hasPermission('web_access_permissions')) {
322
-	$sitemenu['web_permissions'] = array(
323
-		'web_permissions',
324
-		'users',
325
-		'<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'],
326
-		'index.php?a=91',
327
-		$_lang['web_permissions'],
328
-		'',
329
-		'web_access_permissions',
330
-		'main',
331
-		0,
332
-		50,
333
-		''
334
-	);
322
+    $sitemenu['web_permissions'] = array(
323
+        'web_permissions',
324
+        'users',
325
+        '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'],
326
+        'index.php?a=91',
327
+        $_lang['web_permissions'],
328
+        '',
329
+        'web_access_permissions',
330
+        'main',
331
+        0,
332
+        50,
333
+        ''
334
+    );
335 335
 }
336 336
 
337 337
 // Tools Menu
@@ -361,104 +361,104 @@  discard block
 block discarded – undo
361 361
 );
362 362
 
363 363
 $sitemenu['search'] = array(
364
-	'search',
365
-	'tools',
366
-	'<i class="fa fa-search"></i>' . $_lang['search'],
367
-	'index.php?a=71',
368
-	$_lang['search'],
369
-	'',
370
-	'',
371
-	'main',
372
-	1,
373
-	9,
374
-	''
364
+    'search',
365
+    'tools',
366
+    '<i class="fa fa-search"></i>' . $_lang['search'],
367
+    'index.php?a=71',
368
+    $_lang['search'],
369
+    '',
370
+    '',
371
+    'main',
372
+    1,
373
+    9,
374
+    ''
375 375
 );
376 376
 
377 377
 if($modx->hasPermission('bk_manager')) {
378
-	$sitemenu['bk_manager'] = array(
379
-		'bk_manager',
380
-		'tools',
381
-		'<i class="fa fa-database"></i>' . $_lang['bk_manager'],
382
-		'index.php?a=93',
383
-		$_lang['bk_manager'],
384
-		'',
385
-		'bk_manager',
386
-		'main',
387
-		0,
388
-		10,
389
-		''
390
-	);
378
+    $sitemenu['bk_manager'] = array(
379
+        'bk_manager',
380
+        'tools',
381
+        '<i class="fa fa-database"></i>' . $_lang['bk_manager'],
382
+        'index.php?a=93',
383
+        $_lang['bk_manager'],
384
+        '',
385
+        'bk_manager',
386
+        'main',
387
+        0,
388
+        10,
389
+        ''
390
+    );
391 391
 }
392 392
 
393 393
 if($modx->hasPermission('remove_locks')) {
394
-	$sitemenu['remove_locks'] = array(
395
-		'remove_locks',
396
-		'tools',
397
-		'<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'],
398
-		'javascript:modx.removeLocks();',
399
-		$_lang['remove_locks'],
400
-		'',
401
-		'remove_locks',
402
-		'',
403
-		0,
404
-		20,
405
-		''
406
-	);
394
+    $sitemenu['remove_locks'] = array(
395
+        'remove_locks',
396
+        'tools',
397
+        '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'],
398
+        'javascript:modx.removeLocks();',
399
+        $_lang['remove_locks'],
400
+        '',
401
+        'remove_locks',
402
+        '',
403
+        0,
404
+        20,
405
+        ''
406
+    );
407 407
 }
408 408
 
409 409
 if($modx->hasPermission('import_static')) {
410
-	$sitemenu['import_site'] = array(
411
-		'import_site',
412
-		'tools',
413
-		'<i class="fa fa-upload"></i>' . $_lang['import_site'],
414
-		'index.php?a=95',
415
-		$_lang['import_site'],
416
-		'',
417
-		'import_static',
418
-		'main',
419
-		0,
420
-		30,
421
-		''
422
-	);
410
+    $sitemenu['import_site'] = array(
411
+        'import_site',
412
+        'tools',
413
+        '<i class="fa fa-upload"></i>' . $_lang['import_site'],
414
+        'index.php?a=95',
415
+        $_lang['import_site'],
416
+        '',
417
+        'import_static',
418
+        'main',
419
+        0,
420
+        30,
421
+        ''
422
+    );
423 423
 }
424 424
 
425 425
 if($modx->hasPermission('export_static')) {
426
-	$sitemenu['export_site'] = array(
427
-		'export_site',
428
-		'tools',
429
-		'<i class="fa fa-download"></i>' . $_lang['export_site'],
430
-		'index.php?a=83',
431
-		$_lang['export_site'],
432
-		'',
433
-		'export_static',
434
-		'main',
435
-		1,
436
-		40,
437
-		''
438
-	);
426
+    $sitemenu['export_site'] = array(
427
+        'export_site',
428
+        'tools',
429
+        '<i class="fa fa-download"></i>' . $_lang['export_site'],
430
+        'index.php?a=83',
431
+        $_lang['export_site'],
432
+        '',
433
+        'export_static',
434
+        'main',
435
+        1,
436
+        40,
437
+        ''
438
+    );
439 439
 }
440 440
 
441 441
 $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu));
442 442
 if(is_array($menu)) {
443
-	$newmenu = array();
444
-	foreach($menu as $item){
445
-		if(is_array(unserialize($item))){
446
-			$newmenu = array_merge($newmenu, unserialize($item));
447
-		}
448
-	}
449
-	if(count($newmenu)> 0) $sitemenu = $newmenu;
443
+    $newmenu = array();
444
+    foreach($menu as $item){
445
+        if(is_array(unserialize($item))){
446
+            $newmenu = array_merge($newmenu, unserialize($item));
447
+        }
448
+    }
449
+    if(count($newmenu)> 0) $sitemenu = $newmenu;
450 450
 }
451 451
 
452 452
 if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) {
453
-	include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php');
453
+    include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php');
454 454
 } else {
455
-	include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php');
455
+    include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php');
456 456
 }
457 457
 $menu = new EVOmenu();
458 458
 $menu->Build($sitemenu, array(
459
-	'outerClass' => 'nav',
460
-	'innerClass' => 'dropdown-menu',
461
-	'parentClass' => 'dropdown',
459
+    'outerClass' => 'nav',
460
+    'innerClass' => 'dropdown-menu',
461
+    'parentClass' => 'dropdown',
462 462
     'parentLinkClass' => 'dropdown-toggle',
463 463
     'parentLinkAttr' => '',
464 464
     'parentLinkIn' => ''
Please login to merge, or discard this patch.
manager/actions/mutate_content.dynamic.php 1 patch
Indentation   +371 added lines, -371 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,29 +12,29 @@  discard block
 block discarded – undo
12 12
 
13 13
 // check permissions
14 14
 switch($modx->getManagerApi()->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
-			$udperms = new EvolutionCMS\Legacy\Permissions();
28
-			$udperms->user = $modx->getLoginUserID();
29
-			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
30
-			$udperms->role = $_SESSION['mgrRole'];
31
-			if(!$udperms->checkPermissions()) {
32
-				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
33
-			}
34
-		}
35
-		break;
36
-	default:
37
-		$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
+            $udperms = new EvolutionCMS\Legacy\Permissions();
28
+            $udperms->user = $modx->getLoginUserID();
29
+            $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
30
+            $udperms->role = $_SESSION['mgrRole'];
31
+            if(!$udperms->checkPermissions()) {
32
+                $modx->webAlertAndQuit($_lang["access_permission_denied"]);
33
+            }
34
+        }
35
+        break;
36
+    default:
37
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
38 38
 }
39 39
 
40 40
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
54 54
 
55 55
 if($modx->getManagerApi()->action == 27) {
56
-	//editing an existing document
57
-	// check permissions on the document
58
-	$udperms = new EvolutionCMS\Legacy\Permissions();
59
-	$udperms->user = $modx->getLoginUserID();
60
-	$udperms->document = $id;
61
-	$udperms->role = $_SESSION['mgrRole'];
62
-
63
-	if(!$udperms->checkPermissions()) {
64
-		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
65
-	}
56
+    //editing an existing document
57
+    // check permissions on the document
58
+    $udperms = new EvolutionCMS\Legacy\Permissions();
59
+    $udperms->user = $modx->getLoginUserID();
60
+    $udperms->document = $id;
61
+    $udperms->role = $_SESSION['mgrRole'];
62
+
63
+    if(!$udperms->checkPermissions()) {
64
+        $modx->webAlertAndQuit($_lang["access_permission_denied"]);
65
+    }
66 66
 }
67 67
 
68 68
 // check to see if resource isn't locked
69 69
 if($lockedEl = $modx->elementIsLocked(7, $id)) {
70
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
70
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
71 71
 }
72 72
 // end check for lock
73 73
 
@@ -76,74 +76,74 @@  discard block
 block discarded – undo
76 76
 
77 77
 // get document groups for current user
78 78
 if($_SESSION['mgrDocgroups']) {
79
-	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
79
+    $docgrp = implode(',', $_SESSION['mgrDocgroups']);
80 80
 }
81 81
 
82 82
 if(!empty ($id)) {
83
-	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
84
-	if($docgrp) {
85
-		$access .= " OR dg.document_group IN ({$docgrp})";
86
-	}
87
-	$rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
88
-	$content = array();
89
-	$content = $modx->getDatabase()->getRow($rs);
90
-	$modx->documentObject = &$content;
91
-	if(!$content) {
92
-		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
93
-	}
94
-	$_SESSION['itemname'] = $content['pagetitle'];
83
+    $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
84
+    if($docgrp) {
85
+        $access .= " OR dg.document_group IN ({$docgrp})";
86
+    }
87
+    $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
88
+    $content = array();
89
+    $content = $modx->getDatabase()->getRow($rs);
90
+    $modx->documentObject = &$content;
91
+    if(!$content) {
92
+        $modx->webAlertAndQuit($_lang["access_permission_denied"]);
93
+    }
94
+    $_SESSION['itemname'] = $content['pagetitle'];
95 95
 } else {
96
-	$content = array();
96
+    $content = array();
97 97
 
98
-	if(isset($_REQUEST['newtemplate'])) {
99
-		$content['template'] = $_REQUEST['newtemplate'];
100
-	} else {
101
-		$content['template'] = getDefaultTemplate();
102
-	}
98
+    if(isset($_REQUEST['newtemplate'])) {
99
+        $content['template'] = $_REQUEST['newtemplate'];
100
+    } else {
101
+        $content['template'] = getDefaultTemplate();
102
+    }
103 103
 
104
-	$_SESSION['itemname'] = $_lang["new_resource"];
104
+    $_SESSION['itemname'] = $_lang["new_resource"];
105 105
 }
106 106
 
107 107
 // restore saved form
108 108
 $formRestored = $modx->getManagerApi()->loadFormValues();
109 109
 if(isset($_REQUEST['newtemplate'])) {
110
-	$formRestored = true;
110
+    $formRestored = true;
111 111
 }
112 112
 
113 113
 // retain form values if template was changed
114 114
 // edited to convert pub_date and unpub_date
115 115
 // sottwell 02-09-2006
116 116
 if($formRestored == true) {
117
-	$content = array_merge($content, $_POST);
118
-	$content['content'] = $_POST['ta'];
119
-	if(empty ($content['pub_date'])) {
120
-		unset ($content['pub_date']);
121
-	} else {
122
-		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
123
-	}
124
-	if(empty ($content['unpub_date'])) {
125
-		unset ($content['unpub_date']);
126
-	} else {
127
-		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
128
-	}
117
+    $content = array_merge($content, $_POST);
118
+    $content['content'] = $_POST['ta'];
119
+    if(empty ($content['pub_date'])) {
120
+        unset ($content['pub_date']);
121
+    } else {
122
+        $content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
123
+    }
124
+    if(empty ($content['unpub_date'])) {
125
+        unset ($content['unpub_date']);
126
+    } else {
127
+        $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
128
+    }
129 129
 }
130 130
 
131 131
 // increase menu index if this is a new document
132 132
 if(!isset ($_REQUEST['id'])) {
133
-	if(!isset ($modx->config['auto_menuindex'])) {
134
-		$modx->config['auto_menuindex'] = 1;
135
-	}
136
-	if($modx->config['auto_menuindex']) {
137
-		$pid = (int)$_REQUEST['pid'];
138
-		$rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'");
139
-		$content['menuindex'] = $modx->getDatabase()->getValue($rs);
140
-	} else {
141
-		$content['menuindex'] = 0;
142
-	}
133
+    if(!isset ($modx->config['auto_menuindex'])) {
134
+        $modx->config['auto_menuindex'] = 1;
135
+    }
136
+    if($modx->config['auto_menuindex']) {
137
+        $pid = (int)$_REQUEST['pid'];
138
+        $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'");
139
+        $content['menuindex'] = $modx->getDatabase()->getValue($rs);
140
+    } else {
141
+        $content['menuindex'] = 0;
142
+    }
143 143
 }
144 144
 
145 145
 if(isset ($_POST['which_editor'])) {
146
-	$modx->config['which_editor'] = $_POST['which_editor'];
146
+    $modx->config['which_editor'] = $_POST['which_editor'];
147 147
 }
148 148
 
149 149
 // Add lock-element JS-Script
@@ -543,23 +543,23 @@  discard block
 block discarded – undo
543 543
 
544 544
 	<form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;">
545 545
 		<?php
546
-		// invoke OnDocFormPrerender event
547
-		$evtOut = $modx->invokeEvent('OnDocFormPrerender', array(
548
-			'id' => $id,
549
-			'template' => $content['template']
550
-		));
551
-
552
-		if(is_array($evtOut)) {
553
-			echo implode('', $evtOut);
554
-		}
555
-
556
-		/*************************/
557
-		$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
558
-		$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
559
-		$page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : '';
560
-		/*************************/
561
-
562
-		?>
546
+        // invoke OnDocFormPrerender event
547
+        $evtOut = $modx->invokeEvent('OnDocFormPrerender', array(
548
+            'id' => $id,
549
+            'template' => $content['template']
550
+        ));
551
+
552
+        if(is_array($evtOut)) {
553
+            echo implode('', $evtOut);
554
+        }
555
+
556
+        /*************************/
557
+        $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
558
+        $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
559
+        $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : '';
560
+        /*************************/
561
+
562
+        ?>
563 563
 		<input type="hidden" name="a" value="5" />
564 564
 		<input type="hidden" name="id" value="<?= $content['id'] ?>" />
565 565
 		<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>" />
@@ -574,54 +574,54 @@  discard block
 block discarded – undo
574 574
 
575 575
 			<h1>
576 576
 				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
577
-					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
-				} else {
579
-				    if ($modx->getManagerApi()->action == '4') {
577
+                    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
+                } else {
579
+                    if ($modx->getManagerApi()->action == '4') {
580 580
                         echo $_lang['add_resource'];
581 581
                     } else if ($modx->getManagerApi()->action == '72') {
582 582
                         echo $_lang['add_weblink'];
583 583
                     } else {
584 584
                         echo $_lang['create_resource_title'];
585 585
                     }
586
-				} ?>
586
+                } ?>
587 587
 			</h1>
588 588
 
589 589
 			<?= $_style['actionbuttons']['dynamic']['document'] ?>
590 590
 
591 591
 			<?php
592
-			// breadcrumbs
593
-			if($modx->config['use_breadcrumbs']) {
594
-				$temp = array();
595
-				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
596
-
597
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
598
-					$bID = (int) $_REQUEST['id'];
599
-					$temp = $modx->getParentIds($bID);
600
-				} else if(isset($_REQUEST['pid'])) {
601
-					$bID = (int) $_REQUEST['pid'];
602
-					$temp = $modx->getParentIds($bID);
603
-					array_unshift($temp, $bID);
604
-				}
605
-
606
-				if($temp) {
607
-					$parents = implode(',', $temp);
608
-
609
-					if(!empty($parents)) {
610
-						$where = "FIND_IN_SET(id,'{$parents}') DESC";
611
-						$rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
612
-						while($row = $modx->getDatabase()->getRow($rs)) {
613
-							$out .= '<li class="breadcrumbs__li">
592
+            // breadcrumbs
593
+            if($modx->config['use_breadcrumbs']) {
594
+                $temp = array();
595
+                $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
596
+
597
+                if(isset($_REQUEST['id']) && $content['parent'] != 0) {
598
+                    $bID = (int) $_REQUEST['id'];
599
+                    $temp = $modx->getParentIds($bID);
600
+                } else if(isset($_REQUEST['pid'])) {
601
+                    $bID = (int) $_REQUEST['pid'];
602
+                    $temp = $modx->getParentIds($bID);
603
+                    array_unshift($temp, $bID);
604
+                }
605
+
606
+                if($temp) {
607
+                    $parents = implode(',', $temp);
608
+
609
+                    if(!empty($parents)) {
610
+                        $where = "FIND_IN_SET(id,'{$parents}') DESC";
611
+                        $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
612
+                        while($row = $modx->getDatabase()->getRow($rs)) {
613
+                            $out .= '<li class="breadcrumbs__li">
614 614
                                 <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
615 615
                                 <span class="breadcrumbs__sep">&gt;</span>
616 616
                             </li>';
617
-						}
618
-					}
619
-				}
617
+                        }
618
+                    }
619
+                }
620 620
 
621
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
622
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
-			}
624
-			?>
621
+                $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
622
+                echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
+            }
624
+            ?>
625 625
 
626 626
 			<!-- start main wrapper -->
627 627
 			<div class="sectionBody">
@@ -633,13 +633,13 @@  discard block
 block discarded – undo
633 633
 
634 634
 					<!-- General -->
635 635
 					<?php
636
-					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
637
-						'id' => $id
638
-					));
639
-					if(is_array($evtOut)) {
640
-						echo implode('', $evtOut);
641
-					} else {
642
-						?>
636
+                    $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
637
+                        'id' => $id
638
+                    ));
639
+                    if(is_array($evtOut)) {
640
+                        echo implode('', $evtOut);
641
+                    } else {
642
+                        ?>
643 643
 						<div class="tab-page" id="tabGeneral">
644 644
 							<h2 class="tab"><?= $_lang['settings_general'] ?></h2>
645 645
 							<script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script>
@@ -724,36 +724,36 @@  discard block
 block discarded – undo
724 724
 										<select id="template" name="template" class="inputBox" onchange="templateWarning();">
725 725
 											<option value="0">(blank)</option>
726 726
 											<?php
727
-											$field = "t.templatename, t.selectable, t.id, c.category";
728
-											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
729
-											$rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC');
730
-											$currentCategory = '';
731
-											while($row = $modx->getDatabase()->getRow($rs)) {
732
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
-													continue;
734
-												};
735
-												// Skip if not selectable but show if selected!
736
-												$thisCategory = $row['category'];
737
-												if($thisCategory == null) {
738
-													$thisCategory = $_lang["no_category"];
739
-												}
740
-												if($thisCategory != $currentCategory) {
741
-													if($closeOptGroup) {
742
-														echo "\t\t\t\t\t</optgroup>\n";
743
-													}
744
-													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
745
-													$closeOptGroup = true;
746
-												}
727
+                                            $field = "t.templatename, t.selectable, t.id, c.category";
728
+                                            $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
729
+                                            $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC');
730
+                                            $currentCategory = '';
731
+                                            while($row = $modx->getDatabase()->getRow($rs)) {
732
+                                                if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
+                                                    continue;
734
+                                                };
735
+                                                // Skip if not selectable but show if selected!
736
+                                                $thisCategory = $row['category'];
737
+                                                if($thisCategory == null) {
738
+                                                    $thisCategory = $_lang["no_category"];
739
+                                                }
740
+                                                if($thisCategory != $currentCategory) {
741
+                                                    if($closeOptGroup) {
742
+                                                        echo "\t\t\t\t\t</optgroup>\n";
743
+                                                    }
744
+                                                    echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
745
+                                                    $closeOptGroup = true;
746
+                                                }
747 747
 
748
-												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
748
+                                                $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
749 749
 
750
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
751
-												$currentCategory = $thisCategory;
752
-											}
753
-											if($thisCategory != '') {
754
-												echo "\t\t\t\t\t</optgroup>\n";
755
-											}
756
-											?>
750
+                                                echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
751
+                                                $currentCategory = $thisCategory;
752
+                                            }
753
+                                            if($thisCategory != '') {
754
+                                                echo "\t\t\t\t\t</optgroup>\n";
755
+                                            }
756
+                                            ?>
757 757
 										</select>
758 758
 									</td>
759 759
 								</tr>
@@ -793,37 +793,37 @@  discard block
 block discarded – undo
793 793
 									</td>
794 794
 									<td valign="top">
795 795
 										<?php
796
-										$parentlookup = false;
797
-										if(isset ($_REQUEST['id'])) {
798
-											if($content['parent'] == 0) {
799
-												$parentname = $site_name;
800
-											} else {
801
-												$parentlookup = $content['parent'];
802
-											}
803
-										} elseif(isset ($_REQUEST['pid'])) {
804
-											if($_REQUEST['pid'] == 0) {
805
-												$parentname = $site_name;
806
-											} else {
807
-												$parentlookup = $_REQUEST['pid'];
808
-											}
809
-										} elseif(isset($_POST['parent'])) {
810
-											if($_POST['parent'] == 0) {
811
-												$parentname = $site_name;
812
-											} else {
813
-												$parentlookup = $_POST['parent'];
814
-											}
815
-										} else {
816
-											$parentname = $site_name;
817
-											$content['parent'] = 0;
818
-										}
819
-										if($parentlookup !== false && is_numeric($parentlookup)) {
820
-											$rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
821
-											$parentname = $modx->getDatabase()->getValue($rs);
822
-											if(!$parentname) {
823
-												$modx->webAlertAndQuit($_lang["error_no_parent"]);
824
-											}
825
-										}
826
-										?>
796
+                                        $parentlookup = false;
797
+                                        if(isset ($_REQUEST['id'])) {
798
+                                            if($content['parent'] == 0) {
799
+                                                $parentname = $site_name;
800
+                                            } else {
801
+                                                $parentlookup = $content['parent'];
802
+                                            }
803
+                                        } elseif(isset ($_REQUEST['pid'])) {
804
+                                            if($_REQUEST['pid'] == 0) {
805
+                                                $parentname = $site_name;
806
+                                            } else {
807
+                                                $parentlookup = $_REQUEST['pid'];
808
+                                            }
809
+                                        } elseif(isset($_POST['parent'])) {
810
+                                            if($_POST['parent'] == 0) {
811
+                                                $parentname = $site_name;
812
+                                            } else {
813
+                                                $parentlookup = $_POST['parent'];
814
+                                            }
815
+                                        } else {
816
+                                            $parentname = $site_name;
817
+                                            $content['parent'] = 0;
818
+                                        }
819
+                                        if($parentlookup !== false && is_numeric($parentlookup)) {
820
+                                            $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
821
+                                            $parentname = $modx->getDatabase()->getValue($rs);
822
+                                            if(!$parentname) {
823
+                                                $modx->webAlertAndQuit($_lang["error_no_parent"]);
824
+                                            }
825
+                                        }
826
+                                        ?>
827 827
 										<i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i>
828 828
 										<b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b>
829 829
 										<input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" />
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 								</tr>
832 832
 								<tr></tr>
833 833
 								<?php
834
-								/*
834
+                                /*
835 835
 								if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') {
836 836
 									?>
837 837
 									<tr>
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 									</tr>
860 860
 									<?php
861 861
 								}*/
862
-								?>
862
+                                ?>
863 863
 
864 864
 								<?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?>
865 865
 									<tr>
@@ -872,36 +872,36 @@  discard block
 block discarded – undo
872 872
 													<select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();">
873 873
 													<option value="none"><?= $_lang['none'] ?></option>
874 874
 														<?php
875
-														// invoke OnRichTextEditorRegister event
876
-														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
877
-														if(is_array($evtOut)) {
878
-															for($i = 0; $i < count($evtOut); $i++) {
879
-																$editor = $evtOut[$i];
880
-																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
881
-															}
882
-														}
883
-														?>
875
+                                                        // invoke OnRichTextEditorRegister event
876
+                                                        $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
877
+                                                        if(is_array($evtOut)) {
878
+                                                            for($i = 0; $i < count($evtOut); $i++) {
879
+                                                                $editor = $evtOut[$i];
880
+                                                                echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
881
+                                                            }
882
+                                                        }
883
+                                                        ?>
884 884
 													</select>
885 885
 												</label>
886 886
 											</div>
887 887
 											<div id="content_body">
888 888
 												<?php
889
-												if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
890
-													$htmlContent = $content['content'];
891
-													?>
889
+                                                if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
890
+                                                    $htmlContent = $content['content'];
891
+                                                    ?>
892 892
 													<div class="section-editor clearfix">
893 893
 														<textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->getPhpCompat()->htmlspecialchars($htmlContent) ?></textarea>
894 894
 													</div>
895 895
 													<?php
896
-													// Richtext-[*content*]
897
-													$richtexteditorIds = array();
898
-													$richtexteditorOptions = array();
899
-													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
900
-													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
901
-												} else {
902
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
903
-												}
904
-												?>
896
+                                                    // Richtext-[*content*]
897
+                                                    $richtexteditorIds = array();
898
+                                                    $richtexteditorOptions = array();
899
+                                                    $richtexteditorIds[$modx->config['which_editor']][] = 'ta';
900
+                                                    $richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
901
+                                                } else {
902
+                                                    echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
903
+                                                }
904
+                                                ?>
905 905
 											</div>
906 906
 										</td>
907 907
 									</tr>
@@ -1207,8 +1207,8 @@  discard block
 block discarded – undo
1207 1207
 
1208 1208
 								<?php
1209 1209
 
1210
-								if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1211
-									?>
1210
+                                if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1211
+                                    ?>
1212 1212
 									<tr>
1213 1213
 										<td>
1214 1214
 											<span class="warning"><?= $_lang['resource_type'] ?></span>
@@ -1230,15 +1230,15 @@  discard block
 block discarded – undo
1230 1230
 										<td>
1231 1231
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1232 1232
 												<?php
1233
-												if(!$content['contentType']) {
1234
-													$content['contentType'] = 'text/html';
1235
-												}
1236
-												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1237
-												$ct = explode(",", $custom_contenttype);
1238
-												for($i = 0; $i < count($ct); $i++) {
1239
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1240
-												}
1241
-												?>
1233
+                                                if(!$content['contentType']) {
1234
+                                                    $content['contentType'] = 'text/html';
1235
+                                                }
1236
+                                                $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1237
+                                                $ct = explode(",", $custom_contenttype);
1238
+                                                for($i = 0; $i < count($ct); $i++) {
1239
+                                                    echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1240
+                                                }
1241
+                                                ?>
1242 1242
 											</select>
1243 1243
 										</td>
1244 1244
 									</tr>
@@ -1261,23 +1261,23 @@  discard block
 block discarded – undo
1261 1261
 										</td>
1262 1262
 									</tr>
1263 1263
 									<?php
1264
-								} else {
1265
-									if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1266
-										// non-admin managers creating or editing a document resource
1267
-										?>
1264
+                                } else {
1265
+                                    if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1266
+                                        // non-admin managers creating or editing a document resource
1267
+                                        ?>
1268 1268
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
1269 1269
 										<input type="hidden" name="type" value="document" />
1270 1270
 										<input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" />
1271 1271
 										<?php
1272
-									} else {
1273
-										// non-admin managers creating or editing a reference (weblink) resource
1274
-										?>
1272
+                                    } else {
1273
+                                        // non-admin managers creating or editing a reference (weblink) resource
1274
+                                        ?>
1275 1275
 										<input type="hidden" name="type" value="reference" />
1276 1276
 										<input type="hidden" name="contentType" value="text/html" />
1277 1277
 										<?php
1278
-									}
1279
-								}//if mgrRole
1280
-								?>
1278
+                                    }
1279
+                                }//if mgrRole
1280
+                                ?>
1281 1281
 
1282 1282
 								<tr>
1283 1283
 									<td>
@@ -1360,112 +1360,112 @@  discard block
 block discarded – undo
1360 1360
                     ?>
1361 1361
 
1362 1362
 						<?php
1363
-					/*******************************
1363
+                    /*******************************
1364 1364
 					 * Document Access Permissions */
1365
-					if($use_udperms == 1) {
1366
-						$groupsarray = array();
1367
-						$sql = '';
1368
-
1369
-						$documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1370
-						if($documentId > 0) {
1371
-							// Load up, the permissions from the parent (if new document) or existing document
1372
-							$rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1373
-							while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1374
-
1375
-							// Load up the current permissions and names
1376
-							$vs = array(
1377
-								$tbl_document_group_names,
1378
-								$tbl_document_groups,
1379
-								$documentId
1380
-							);
1381
-							$from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs);
1382
-							$rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name');
1383
-						} else {
1384
-							// Just load up the names, we're starting clean
1385
-							$rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name');
1386
-						}
1387
-
1388
-						// retain selected doc groups between post
1389
-						if(isset($_POST['docgroups'])) {
1390
-							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1391
-						}
1365
+                    if($use_udperms == 1) {
1366
+                        $groupsarray = array();
1367
+                        $sql = '';
1368
+
1369
+                        $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1370
+                        if($documentId > 0) {
1371
+                            // Load up, the permissions from the parent (if new document) or existing document
1372
+                            $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1373
+                            while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1374
+
1375
+                            // Load up the current permissions and names
1376
+                            $vs = array(
1377
+                                $tbl_document_group_names,
1378
+                                $tbl_document_groups,
1379
+                                $documentId
1380
+                            );
1381
+                            $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs);
1382
+                            $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name');
1383
+                        } else {
1384
+                            // Just load up the names, we're starting clean
1385
+                            $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name');
1386
+                        }
1387
+
1388
+                        // retain selected doc groups between post
1389
+                        if(isset($_POST['docgroups'])) {
1390
+                            $groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1391
+                        }
1392
+
1393
+                        $isManager = $modx->hasPermission('access_permissions');
1394
+                        $isWeb = $modx->hasPermission('web_access_permissions');
1395
+
1396
+                        // Setup Basic attributes for each Input box
1397
+                        $inputAttributes = array(
1398
+                            'type' => 'checkbox',
1399
+                            'class' => 'checkbox',
1400
+                            'name' => 'docgroups[]',
1401
+                            'onclick' => 'makePublic(false);',
1402
+                        );
1403
+                        $permissions = array(); // New Permissions array list (this contains the HTML)
1404
+                        $permissions_yes = 0; // count permissions the current mgr user has
1405
+                        $permissions_no = 0; // count permissions the current mgr user doesn't have
1406
+
1407
+                        // Loop through the permissions list
1408
+                        while($row = $modx->getDatabase()->getRow($rs)) {
1409
+
1410
+                            // Create an inputValue pair (group ID and group link (if it exists))
1411
+                            $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1412
+                            $inputId = 'group-' . $row['id'];
1413
+
1414
+                            $checked = in_array($inputValue, $groupsarray);
1415
+                            if($checked) {
1416
+                                $notPublic = true;
1417
+                            } // Mark as private access (either web or manager)
1418
+
1419
+                            // Skip the access permission if the user doesn't have access...
1420
+                            if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1421
+                                continue;
1422
+                            }
1392 1423
 
1393
-						$isManager = $modx->hasPermission('access_permissions');
1394
-						$isWeb = $modx->hasPermission('web_access_permissions');
1395
-
1396
-						// Setup Basic attributes for each Input box
1397
-						$inputAttributes = array(
1398
-							'type' => 'checkbox',
1399
-							'class' => 'checkbox',
1400
-							'name' => 'docgroups[]',
1401
-							'onclick' => 'makePublic(false);',
1402
-						);
1403
-						$permissions = array(); // New Permissions array list (this contains the HTML)
1404
-						$permissions_yes = 0; // count permissions the current mgr user has
1405
-						$permissions_no = 0; // count permissions the current mgr user doesn't have
1406
-
1407
-						// Loop through the permissions list
1408
-						while($row = $modx->getDatabase()->getRow($rs)) {
1409
-
1410
-							// Create an inputValue pair (group ID and group link (if it exists))
1411
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1412
-							$inputId = 'group-' . $row['id'];
1413
-
1414
-							$checked = in_array($inputValue, $groupsarray);
1415
-							if($checked) {
1416
-								$notPublic = true;
1417
-							} // Mark as private access (either web or manager)
1418
-
1419
-							// Skip the access permission if the user doesn't have access...
1420
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1421
-								continue;
1422
-							}
1423
-
1424
-							// Setup attributes for this Input box
1425
-							$inputAttributes['id'] = $inputId;
1426
-							$inputAttributes['value'] = $inputValue;
1427
-							if($checked) {
1428
-								$inputAttributes['checked'] = 'checked';
1429
-							} else {
1430
-								unset($inputAttributes['checked']);
1431
-							}
1432
-
1433
-							// Create attribute string list
1434
-							$inputString = array();
1435
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1436
-
1437
-							// Make the <input> HTML
1438
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1439
-
1440
-							// does user have this permission?
1441
-							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
1442
-							$vs = array(
1443
-								$row['id'],
1444
-								$_SESSION['mgrInternalKey']
1445
-							);
1446
-							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1447
-							$rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where);
1448
-							$count = $modx->getDatabase()->getValue($rsp);
1449
-							if($count > 0) {
1450
-								++$permissions_yes;
1451
-							} else {
1452
-								++$permissions_no;
1453
-							}
1454
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1455
-						}
1456
-						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1457
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1458
-							$permissions = array();
1459
-						}
1424
+                            // Setup attributes for this Input box
1425
+                            $inputAttributes['id'] = $inputId;
1426
+                            $inputAttributes['value'] = $inputValue;
1427
+                            if($checked) {
1428
+                                $inputAttributes['checked'] = 'checked';
1429
+                            } else {
1430
+                                unset($inputAttributes['checked']);
1431
+                            }
1460 1432
 
1461
-						// See if the Access Permissions section is worth displaying...
1462
-						if(!empty($permissions)) {
1463
-							// Add the "All Document Groups" item if we have rights in both contexts
1464
-							if($isManager && $isWeb) {
1465
-								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>');
1466
-							}
1467
-							// Output the permissions list...
1468
-							?>
1433
+                            // Create attribute string list
1434
+                            $inputString = array();
1435
+                            foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1436
+
1437
+                            // Make the <input> HTML
1438
+                            $inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1439
+
1440
+                            // does user have this permission?
1441
+                            $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
1442
+                            $vs = array(
1443
+                                $row['id'],
1444
+                                $_SESSION['mgrInternalKey']
1445
+                            );
1446
+                            $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1447
+                            $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where);
1448
+                            $count = $modx->getDatabase()->getValue($rsp);
1449
+                            if($count > 0) {
1450
+                                ++$permissions_yes;
1451
+                            } else {
1452
+                                ++$permissions_no;
1453
+                            }
1454
+                            $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1455
+                        }
1456
+                        // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1457
+                        if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1458
+                            $permissions = array();
1459
+                        }
1460
+
1461
+                        // See if the Access Permissions section is worth displaying...
1462
+                        if(!empty($permissions)) {
1463
+                            // Add the "All Document Groups" item if we have rights in both contexts
1464
+                            if($isManager && $isWeb) {
1465
+                                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>');
1466
+                            }
1467
+                            // Output the permissions list...
1468
+                            ?>
1469 1469
 							<!-- Access Permissions -->
1470 1470
 							<div class="tab-page" id="tabAccess">
1471 1471
 								<h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2>
@@ -1499,31 +1499,31 @@  discard block
 block discarded – undo
1499 1499
 								</ul>
1500 1500
 							</div><!--div class="tab-page" id="tabAccess"-->
1501 1501
 							<?php
1502
-						} // !empty($permissions)
1503
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1504
-							?>
1502
+                        } // !empty($permissions)
1503
+                        elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1504
+                            ?>
1505 1505
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1506 1506
 							<?php
1507 1507
 
1508
-						}
1509
-					}
1510
-					/* End Document Access Permissions *
1508
+                        }
1509
+                    }
1510
+                    /* End Document Access Permissions *
1511 1511
 					 ***********************************/
1512
-					?>
1512
+                    ?>
1513 1513
 
1514 1514
 					<input type="submit" name="save" style="display:none" />
1515 1515
 					<?php
1516 1516
 
1517
-					// invoke OnDocFormRender event
1518
-					$evtOut = $modx->invokeEvent('OnDocFormRender', array(
1519
-						'id' => $id,
1520
-						'template' => $content['template']
1521
-					));
1517
+                    // invoke OnDocFormRender event
1518
+                    $evtOut = $modx->invokeEvent('OnDocFormRender', array(
1519
+                        'id' => $id,
1520
+                        'template' => $content['template']
1521
+                    ));
1522 1522
 
1523
-					if(is_array($evtOut)) {
1524
-						echo implode('', $evtOut);
1525
-					}
1526
-					?>
1523
+                    if(is_array($evtOut)) {
1524
+                        echo implode('', $evtOut);
1525
+                    }
1526
+                    ?>
1527 1527
 				</div><!--div class="tab-pane" id="documentPane"-->
1528 1528
 			</div><!--div class="sectionBody"-->
1529 1529
 		</fieldset>
@@ -1534,17 +1534,17 @@  discard block
 block discarded – undo
1534 1534
 	</script>
1535 1535
 <?php
1536 1536
 if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) {
1537
-	if(is_array($richtexteditorIds)) {
1538
-		foreach($richtexteditorIds as $editor => $elements) {
1539
-			// invoke OnRichTextEditorInit event
1540
-			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1541
-				'editor' => $editor,
1542
-				'elements' => $elements,
1543
-				'options' => $richtexteditorOptions[$editor]
1544
-			));
1545
-			if(is_array($evtOut)) {
1546
-				echo implode('', $evtOut);
1547
-			}
1548
-		}
1549
-	}
1537
+    if(is_array($richtexteditorIds)) {
1538
+        foreach($richtexteditorIds as $editor => $elements) {
1539
+            // invoke OnRichTextEditorInit event
1540
+            $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1541
+                'editor' => $editor,
1542
+                'elements' => $elements,
1543
+                'options' => $richtexteditorOptions[$editor]
1544
+            ));
1545
+            if(is_array($evtOut)) {
1546
+                echo implode('', $evtOut);
1547
+            }
1548
+        }
1549
+    }
1550 1550
 }
Please login to merge, or discard this patch.
manager/actions/role_management.static.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  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
 if(!$modx->hasPermission('edit_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 ?>
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 		<div class="form-group"><?= $_lang['role_management_msg'] ?> <a class="btn btn-secondary btn-sm" href="index.php?a=38"><i class="<?= $_style["actions_new"] ?> hide4desktop"></i> <?= $_lang['new_role'] ?></a></div>
19 19
 		<div class="form-group">
20 20
 			<?php
21
-			$rs = $modx->getDatabase()->select('name, id, description', $modx->getFullTableName('user_roles'), '', 'name');
22
-			$limit = $modx->getDatabase()->getRecordCount($rs);
23
-			if($limit < 1) {
24
-				?>
21
+            $rs = $modx->getDatabase()->select('name, id, description', $modx->getFullTableName('user_roles'), '', 'name');
22
+            $limit = $modx->getDatabase()->getRecordCount($rs);
23
+            if($limit < 1) {
24
+                ?>
25 25
 				<p><?= $_lang["no_records_found"] ?></p>
26 26
 				<?php
27
-			} else {
28
-				?>
27
+            } else {
28
+                ?>
29 29
 				<div class="row">
30 30
 					<div class="table-responsive">
31 31
 						<table class="table data">
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 							</thead>
38 38
 							<tbody>
39 39
 							<?php
40
-							while($row = $modx->getDatabase()->getRow($rs)) {
41
-								if($row['id'] == 1) {
42
-									?>
40
+                            while($row = $modx->getDatabase()->getRow($rs)) {
41
+                                if($row['id'] == 1) {
42
+                                    ?>
43 43
 									<tr class="text-muted disabled">
44 44
 										<td><b><?= $row['name'] ?></b></td>
45 45
 										<td><span><?= $_lang['administrator_role_message'] ?></span></td>
46 46
 									</tr>
47 47
 									<?php
48
-								} else {
49
-									?>
48
+                                } else {
49
+                                    ?>
50 50
 									<tr>
51 51
 										<td><a class="text-primary" href="index.php?id=<?= $row['id'] ?>&a=35"><?= $row['name'] ?></a></td>
52 52
 										<td><?= $row['description'] ?></td>
53 53
 									</tr>
54 54
 									<?php
55
-								}
56
-							}
57
-							?>
55
+                                }
56
+                            }
57
+                            ?>
58 58
 							</tbody>
59 59
 						</table>
60 60
 					</div>
Please login to merge, or discard this patch.
manager/actions/mutate_module_resources.dynamic.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  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
 if(!$modx->hasPermission('edit_module')) {
7
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
8 8
 }
9 9
 
10 10
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -26,91 +26,91 @@  discard block
 block discarded – undo
26 26
 // check to see the  editor isn't locked
27 27
 $rs = $modx->getDatabase()->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'");
28 28
 if($username = $modx->getDatabase()->getValue($rs)) {
29
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module'));
29
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module'));
30 30
 }
31 31
 // end check for lock
32 32
 
33 33
 // take action
34 34
 switch($_REQUEST['op']) {
35
-	case 'add':
36
-		// convert ids to numbers
37
-		$opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids'])));
38
-
39
-		if(count($opids) > 0) {
40
-			// 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs
41
-			$rt = strtolower($_REQUEST["rt"]);
42
-			if($rt == 'chunk') {
43
-				$type = 10;
44
-			}
45
-			if($rt == 'doc') {
46
-				$type = 20;
47
-			}
48
-			if($rt == 'plug') {
49
-				$type = 30;
50
-			}
51
-			if($rt == 'snip') {
52
-				$type = 40;
53
-			}
54
-			if($rt == 'tpl') {
55
-				$type = 50;
56
-			}
57
-			if($rt == 'tv') {
58
-				$type = 60;
59
-			}
60
-			$modx->getDatabase()->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'");
61
-			foreach($opids as $opid) {
62
-				$modx->getDatabase()->insert(array(
63
-					'module' => $id,
64
-					'resource' => $opid,
65
-					'type' => $type,
66
-				), $tbl_site_module_depobj);
67
-			}
68
-		}
69
-		break;
70
-	case 'del':
71
-		// convert ids to numbers
72
-		$opids = array_filter(array_map('intval', $_REQUEST['depid']));
73
-
74
-		// get resources that needs to be removed
75
-		$ds = $modx->getDatabase()->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")");
76
-		// loop through resources and look for plugins and snippets
77
-		$plids = array();
78
-		$snid = array();
79
-		while($row = $modx->getDatabase()->getRow($ds)) {
80
-			if($row['type'] == '30') {
81
-				$plids[$i] = $row['resource'];
82
-			}
83
-			if($row['type'] == '40') {
84
-				$snids[$i] = $row['resource'];
85
-			}
86
-		}
87
-		// get guid
88
-		$ds = $modx->getDatabase()->select('guid', $tbl_site_modules, "id='{$id}'");
89
-		$guid = $modx->getDatabase()->getValue($ds);
90
-		// reset moduleguid for deleted resources
91
-		if(($cp = count($plids)) || ($cs = count($snids))) {
92
-			if($cp) {
93
-				$modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'");
94
-			}
95
-			if($cs) {
96
-				$modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'");
97
-			}
98
-			// reset cache
99
-			$modx->clearCache('full');
100
-		}
101
-		$modx->getDatabase()->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")");
102
-		break;
35
+    case 'add':
36
+        // convert ids to numbers
37
+        $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids'])));
38
+
39
+        if(count($opids) > 0) {
40
+            // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs
41
+            $rt = strtolower($_REQUEST["rt"]);
42
+            if($rt == 'chunk') {
43
+                $type = 10;
44
+            }
45
+            if($rt == 'doc') {
46
+                $type = 20;
47
+            }
48
+            if($rt == 'plug') {
49
+                $type = 30;
50
+            }
51
+            if($rt == 'snip') {
52
+                $type = 40;
53
+            }
54
+            if($rt == 'tpl') {
55
+                $type = 50;
56
+            }
57
+            if($rt == 'tv') {
58
+                $type = 60;
59
+            }
60
+            $modx->getDatabase()->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'");
61
+            foreach($opids as $opid) {
62
+                $modx->getDatabase()->insert(array(
63
+                    'module' => $id,
64
+                    'resource' => $opid,
65
+                    'type' => $type,
66
+                ), $tbl_site_module_depobj);
67
+            }
68
+        }
69
+        break;
70
+    case 'del':
71
+        // convert ids to numbers
72
+        $opids = array_filter(array_map('intval', $_REQUEST['depid']));
73
+
74
+        // get resources that needs to be removed
75
+        $ds = $modx->getDatabase()->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")");
76
+        // loop through resources and look for plugins and snippets
77
+        $plids = array();
78
+        $snid = array();
79
+        while($row = $modx->getDatabase()->getRow($ds)) {
80
+            if($row['type'] == '30') {
81
+                $plids[$i] = $row['resource'];
82
+            }
83
+            if($row['type'] == '40') {
84
+                $snids[$i] = $row['resource'];
85
+            }
86
+        }
87
+        // get guid
88
+        $ds = $modx->getDatabase()->select('guid', $tbl_site_modules, "id='{$id}'");
89
+        $guid = $modx->getDatabase()->getValue($ds);
90
+        // reset moduleguid for deleted resources
91
+        if(($cp = count($plids)) || ($cs = count($snids))) {
92
+            if($cp) {
93
+                $modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'");
94
+            }
95
+            if($cs) {
96
+                $modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'");
97
+            }
98
+            // reset cache
99
+            $modx->clearCache('full');
100
+        }
101
+        $modx->getDatabase()->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")");
102
+        break;
103 103
 }
104 104
 
105 105
 // load record
106 106
 $rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id = '{$id}'");
107 107
 $content = $modx->getDatabase()->getRow($rs);
108 108
 if(!$content) {
109
-	$modx->webAlertAndQuit("Module not found for id '{$id}'.");
109
+    $modx->webAlertAndQuit("Module not found for id '{$id}'.");
110 110
 }
111 111
 $_SESSION['itemname'] = $content['name'];
112 112
 if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
113
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
113
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
114 114
 }
115 115
 
116 116
 ?>
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 				<tr>
204 204
 					<td valign="top" align="left">
205 205
 						<?php
206
-						$ds = $modx->getDatabase()->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name,
206
+                        $ds = $modx->getDatabase()->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name,
207 207
 				CASE smd.type
208 208
 					WHEN 10 THEN 'Chunk'
209 209
 					WHEN 20 THEN 'Document'
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 					LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40'
219 219
 					LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50'
220 220
 					LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name");
221
-						include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
222
-						$grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
223
-						$grd->noRecordMsg = $_lang["no_records_found"];
224
-						$grd->cssClass = "grid";
225
-						$grd->columnHeaderClass = "gridHeader";
226
-						$grd->itemClass = "gridItem";
227
-						$grd->altItemClass = "gridAltItem";
228
-						$grd->columns = $_lang["element_name"] . " ," . $_lang["type"];
229
-						$grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]";
230
-						$grd->fields = "name,type";
231
-						echo $grd->render();
232
-						?>
221
+                        include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
222
+                        $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
223
+                        $grd->noRecordMsg = $_lang["no_records_found"];
224
+                        $grd->cssClass = "grid";
225
+                        $grd->columnHeaderClass = "gridHeader";
226
+                        $grd->itemClass = "gridItem";
227
+                        $grd->altItemClass = "gridAltItem";
228
+                        $grd->columns = $_lang["element_name"] . " ," . $_lang["type"];
229
+                        $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]";
230
+                        $grd->fields = "name,type";
231
+                        echo $grd->render();
232
+                        ?>
233 233
 					</td>
234 234
 					<td valign="top" style="width: 150px;">
235 235
 						<a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a>
Please login to merge, or discard this patch.