@@ -13,7 +13,7 @@ discard block |
||
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 |
||
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 |
||
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 . " </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 . " </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 . " </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 . " </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 = '•'; |
|
292 | - } else { |
|
293 | - $value = ' '; |
|
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 = '•'; |
|
292 | + } else { |
|
293 | + $value = ' '; |
|
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 | } |
@@ -13,18 +13,18 @@ discard block |
||
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 |
||
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 | } |
@@ -1,16 +1,16 @@ discard block |
||
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(isset($_REQUEST['id'])) { |
7 | - $id = (int) $_REQUEST['id']; |
|
7 | + $id = (int) $_REQUEST['id']; |
|
8 | 8 | } else { |
9 | - $id = 0; |
|
9 | + $id = 0; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | if(isset($_GET['opened'])) { |
13 | - $_SESSION['openedArray'] = $_GET['opened']; |
|
13 | + $_SESSION['openedArray'] = $_GET['opened']; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | $url = $modx->config['site_url']; |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | |
24 | 24 | // Get access permissions |
25 | 25 | if($_SESSION['mgrDocgroups']) { |
26 | - $docgrp = implode(",", $_SESSION['mgrDocgroups']); |
|
26 | + $docgrp = implode(",", $_SESSION['mgrDocgroups']); |
|
27 | 27 | } |
28 | 28 | $access = "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0" . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
29 | 29 | |
30 | 30 | // |
31 | 31 | if($_SESSION['tree_show_only_folders']) { |
32 | - $parent = $id ? ($modx->getDatabase()->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0; |
|
33 | - $isfolder = $modx->getDatabase()->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1"); |
|
34 | - if(!$isfolder && $parent != 0) { |
|
35 | - $id = $_REQUEST['id'] = $parent; |
|
36 | - } |
|
32 | + $parent = $id ? ($modx->getDatabase()->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0; |
|
33 | + $isfolder = $modx->getDatabase()->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1"); |
|
34 | + if(!$isfolder && $parent != 0) { |
|
35 | + $id = $_REQUEST['id'] = $parent; |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Get the document content |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | LEFT JOIN {$tbl_document_groups} AS dg ON dg.document = sc.id", "sc.id ='{$id}' AND ({$access})"); |
42 | 42 | $content = $modx->getDatabase()->getRow($rs); |
43 | 43 | if(!$content) { |
44 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
44 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -83,134 +83,134 @@ discard block |
||
83 | 83 | $filter_sort = ''; |
84 | 84 | $filter_dir = ''; |
85 | 85 | if($numRecords > 0) { |
86 | - $filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //******** resource_opt_is_published - // |
|
87 | - '<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********// |
|
88 | - '</select>'; |
|
89 | - $filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>'; |
|
90 | - $resource = $modx->getDatabase()->makeArray($rs); |
|
91 | - |
|
92 | - // CSS style for table |
|
93 | - // $tableClass = 'grid'; |
|
94 | - // $rowHeaderClass = 'gridHeader'; |
|
95 | - // $rowRegularClass = 'gridItem'; |
|
96 | - // $rowAlternateClass = 'gridAltItem'; |
|
97 | - $tableClass = 'table data nowrap'; |
|
98 | - $columnHeaderClass = array( |
|
99 | - 'text-center', |
|
100 | - 'text-left', |
|
101 | - 'text-center', |
|
102 | - 'text-center', |
|
103 | - 'text-center', |
|
104 | - 'text-center' |
|
105 | - ); |
|
106 | - |
|
107 | - |
|
108 | - $modx->getMakeTable()->setTableClass($tableClass); |
|
109 | - $modx->getMakeTable()->setColumnHeaderClass($columnHeaderClass); |
|
110 | - // $modx->getMakeTable()->setRowHeaderClass($rowHeaderClass); |
|
111 | - // $modx->getMakeTable()->setRowRegularClass($rowRegularClass); |
|
112 | - // $modx->getMakeTable()->setRowAlternateClass($rowAlternateClass); |
|
113 | - |
|
114 | - // Table header |
|
115 | - $listTableHeader = array( |
|
116 | - 'docid' => $_lang['id'], |
|
117 | - 'title' => $_lang['resource_title'], |
|
118 | - 'createdon' => $_lang['createdon'], |
|
119 | - 'pub_date' => $_lang['page_data_publishdate'], |
|
120 | - 'status' => $_lang['page_data_status'], |
|
121 | - 'edit' => $_lang['mgrlog_action'], |
|
122 | - ); |
|
123 | - $tbWidth = array( |
|
124 | - '1%', |
|
125 | - '', |
|
126 | - '1%', |
|
127 | - '1%', |
|
128 | - '1%', |
|
129 | - '1%' |
|
130 | - ); |
|
131 | - $modx->getMakeTable()->setColumnWidths($tbWidth); |
|
132 | - |
|
133 | - $sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
134 | - $sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
135 | - $pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
136 | - $add_path = $sd . $sb . $pg; |
|
137 | - |
|
138 | - $icons = array( |
|
139 | - 'text/html' => $_style['tree_page_html'], |
|
140 | - 'text/plain' => $_style['tree_page'], |
|
141 | - 'text/xml' => $_style['tree_page_xml'], |
|
142 | - 'text/css' => $_style['tree_page_css'], |
|
143 | - 'text/javascript' => $_style['tree_page_js'], |
|
144 | - 'application/rss+xml' => $_style['tree_page_rss'], |
|
145 | - 'application/pdf' => $_style['tree_page_pdf'], |
|
146 | - 'application/vnd.ms-word' => $_style['tree_page_word'], |
|
147 | - 'application/vnd.ms-excel' => $_style['tree_page_excel'], |
|
148 | - 'image/gif' => $_style['tree_page_gif'], |
|
149 | - 'image/jpg' => $_style['tree_page_jpg'], |
|
150 | - 'image/png' => $_style['tree_page_png'] |
|
151 | - ); |
|
152 | - |
|
153 | - $listDocs = array(); |
|
154 | - foreach($resource as $k => $children) { |
|
155 | - |
|
156 | - switch($children['id']) { |
|
157 | - case $modx->config['site_start'] : |
|
158 | - $icon = $_style['tree_page_home']; |
|
159 | - break; |
|
160 | - case $modx->config['error_page'] : |
|
161 | - $icon = $_style['tree_page_404']; |
|
162 | - break; |
|
163 | - case $modx->config['site_unavailable_page'] : |
|
164 | - $icon = $_style['tree_page_hourglass']; |
|
165 | - break; |
|
166 | - case $modx->config['unauthorized_page'] : |
|
167 | - $icon = $_style['tree_page_info']; |
|
168 | - break; |
|
169 | - default: |
|
170 | - if($children['isfolder']) { |
|
171 | - $icon = $_style['tree_folder_new']; |
|
172 | - } else { |
|
173 | - if(isset($icons[$children['contentType']])) { |
|
174 | - $icon = $icons[$children['contentType']]; |
|
175 | - } else { |
|
176 | - $icon = $_style['tree_page']; |
|
177 | - } |
|
178 | - } |
|
179 | - } |
|
180 | - |
|
181 | - $private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : ''); |
|
182 | - |
|
183 | - // дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь |
|
184 | - // для сохранения сортировки |
|
185 | - $class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish')); |
|
186 | - //$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary'); |
|
187 | - //$class .= ($children['isfolder'] ? ' font-weight-bold' : ''); |
|
188 | - if($modx->hasPermission('edit_document')) { |
|
189 | - $title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>'; |
|
190 | - } else { |
|
191 | - $title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>'; |
|
192 | - } |
|
193 | - |
|
194 | - $icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>'; |
|
195 | - |
|
196 | - $icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>'; |
|
197 | - |
|
198 | - $listDocs[] = array( |
|
199 | - 'docid' => '<div class="text-right">' . $children['id'] . '</div>', |
|
200 | - 'title' => $title, |
|
201 | - 'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>', |
|
202 | - 'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>', |
|
203 | - 'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>', |
|
204 | - 'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i |
|
86 | + $filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //******** resource_opt_is_published - // |
|
87 | + '<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********// |
|
88 | + '</select>'; |
|
89 | + $filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>'; |
|
90 | + $resource = $modx->getDatabase()->makeArray($rs); |
|
91 | + |
|
92 | + // CSS style for table |
|
93 | + // $tableClass = 'grid'; |
|
94 | + // $rowHeaderClass = 'gridHeader'; |
|
95 | + // $rowRegularClass = 'gridItem'; |
|
96 | + // $rowAlternateClass = 'gridAltItem'; |
|
97 | + $tableClass = 'table data nowrap'; |
|
98 | + $columnHeaderClass = array( |
|
99 | + 'text-center', |
|
100 | + 'text-left', |
|
101 | + 'text-center', |
|
102 | + 'text-center', |
|
103 | + 'text-center', |
|
104 | + 'text-center' |
|
105 | + ); |
|
106 | + |
|
107 | + |
|
108 | + $modx->getMakeTable()->setTableClass($tableClass); |
|
109 | + $modx->getMakeTable()->setColumnHeaderClass($columnHeaderClass); |
|
110 | + // $modx->getMakeTable()->setRowHeaderClass($rowHeaderClass); |
|
111 | + // $modx->getMakeTable()->setRowRegularClass($rowRegularClass); |
|
112 | + // $modx->getMakeTable()->setRowAlternateClass($rowAlternateClass); |
|
113 | + |
|
114 | + // Table header |
|
115 | + $listTableHeader = array( |
|
116 | + 'docid' => $_lang['id'], |
|
117 | + 'title' => $_lang['resource_title'], |
|
118 | + 'createdon' => $_lang['createdon'], |
|
119 | + 'pub_date' => $_lang['page_data_publishdate'], |
|
120 | + 'status' => $_lang['page_data_status'], |
|
121 | + 'edit' => $_lang['mgrlog_action'], |
|
122 | + ); |
|
123 | + $tbWidth = array( |
|
124 | + '1%', |
|
125 | + '', |
|
126 | + '1%', |
|
127 | + '1%', |
|
128 | + '1%', |
|
129 | + '1%' |
|
130 | + ); |
|
131 | + $modx->getMakeTable()->setColumnWidths($tbWidth); |
|
132 | + |
|
133 | + $sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
134 | + $sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
135 | + $pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
136 | + $add_path = $sd . $sb . $pg; |
|
137 | + |
|
138 | + $icons = array( |
|
139 | + 'text/html' => $_style['tree_page_html'], |
|
140 | + 'text/plain' => $_style['tree_page'], |
|
141 | + 'text/xml' => $_style['tree_page_xml'], |
|
142 | + 'text/css' => $_style['tree_page_css'], |
|
143 | + 'text/javascript' => $_style['tree_page_js'], |
|
144 | + 'application/rss+xml' => $_style['tree_page_rss'], |
|
145 | + 'application/pdf' => $_style['tree_page_pdf'], |
|
146 | + 'application/vnd.ms-word' => $_style['tree_page_word'], |
|
147 | + 'application/vnd.ms-excel' => $_style['tree_page_excel'], |
|
148 | + 'image/gif' => $_style['tree_page_gif'], |
|
149 | + 'image/jpg' => $_style['tree_page_jpg'], |
|
150 | + 'image/png' => $_style['tree_page_png'] |
|
151 | + ); |
|
152 | + |
|
153 | + $listDocs = array(); |
|
154 | + foreach($resource as $k => $children) { |
|
155 | + |
|
156 | + switch($children['id']) { |
|
157 | + case $modx->config['site_start'] : |
|
158 | + $icon = $_style['tree_page_home']; |
|
159 | + break; |
|
160 | + case $modx->config['error_page'] : |
|
161 | + $icon = $_style['tree_page_404']; |
|
162 | + break; |
|
163 | + case $modx->config['site_unavailable_page'] : |
|
164 | + $icon = $_style['tree_page_hourglass']; |
|
165 | + break; |
|
166 | + case $modx->config['unauthorized_page'] : |
|
167 | + $icon = $_style['tree_page_info']; |
|
168 | + break; |
|
169 | + default: |
|
170 | + if($children['isfolder']) { |
|
171 | + $icon = $_style['tree_folder_new']; |
|
172 | + } else { |
|
173 | + if(isset($icons[$children['contentType']])) { |
|
174 | + $icon = $icons[$children['contentType']]; |
|
175 | + } else { |
|
176 | + $icon = $_style['tree_page']; |
|
177 | + } |
|
178 | + } |
|
179 | + } |
|
180 | + |
|
181 | + $private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : ''); |
|
182 | + |
|
183 | + // дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь |
|
184 | + // для сохранения сортировки |
|
185 | + $class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish')); |
|
186 | + //$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary'); |
|
187 | + //$class .= ($children['isfolder'] ? ' font-weight-bold' : ''); |
|
188 | + if($modx->hasPermission('edit_document')) { |
|
189 | + $title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>'; |
|
190 | + } else { |
|
191 | + $title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>'; |
|
192 | + } |
|
193 | + |
|
194 | + $icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>'; |
|
195 | + |
|
196 | + $icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>'; |
|
197 | + |
|
198 | + $listDocs[] = array( |
|
199 | + 'docid' => '<div class="text-right">' . $children['id'] . '</div>', |
|
200 | + 'title' => $title, |
|
201 | + 'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>', |
|
202 | + 'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>', |
|
203 | + 'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>', |
|
204 | + 'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i |
|
205 | 205 | class="' . $_style["icons_move_document"] . '"></i></a>' . $icon_pub_unpub : '') . ($modx->hasPermission('delete_document') ? $icon_del_undel : '') . '</div>' |
206 | - ); |
|
207 | - } |
|
206 | + ); |
|
207 | + } |
|
208 | 208 | |
209 | - $modx->getMakeTable()->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort); |
|
210 | - $children_output = $modx->getMakeTable()->create($listDocs, $listTableHeader, 'index.php?a=3&id=' . $content['id']); |
|
209 | + $modx->getMakeTable()->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort); |
|
210 | + $children_output = $modx->getMakeTable()->create($listDocs, $listTableHeader, 'index.php?a=3&id=' . $content['id']); |
|
211 | 211 | } else { |
212 | - // No Child documents |
|
213 | - $children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>'; |
|
212 | + // No Child documents |
|
213 | + $children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>'; |
|
214 | 214 | } |
215 | 215 | ?> |
216 | 216 | <script type="text/javascript"> |
@@ -411,20 +411,20 @@ discard block |
||
411 | 411 | <h2 class="tab"><?= $_lang['page_data_source'] ?></h2> |
412 | 412 | <script type="text/javascript">docSettings.addTabPage(document.getElementById("tabSource"));</script> |
413 | 413 | <?php |
414 | - $buffer = ""; |
|
415 | - $filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php"; |
|
416 | - $handle = @fopen($filename, "r"); |
|
417 | - if(!$handle) { |
|
418 | - $buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>'; |
|
419 | - } else { |
|
420 | - while(!feof($handle)) { |
|
421 | - $buffer .= fgets($handle, 4096); |
|
422 | - } |
|
423 | - fclose($handle); |
|
424 | - $buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->getPhpCompat()->htmlspecialchars($buffer) . "</textarea></div>\n"; |
|
425 | - } |
|
426 | - echo $buffer; |
|
427 | - ?> |
|
414 | + $buffer = ""; |
|
415 | + $filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php"; |
|
416 | + $handle = @fopen($filename, "r"); |
|
417 | + if(!$handle) { |
|
418 | + $buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>'; |
|
419 | + } else { |
|
420 | + while(!feof($handle)) { |
|
421 | + $buffer .= fgets($handle, 4096); |
|
422 | + } |
|
423 | + fclose($handle); |
|
424 | + $buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->getPhpCompat()->htmlspecialchars($buffer) . "</textarea></div>\n"; |
|
425 | + } |
|
426 | + echo $buffer; |
|
427 | + ?> |
|
428 | 428 | </div><!-- end tab-page --> |
429 | 429 | <?php } ?> |
430 | 430 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | |
433 | 433 | <?php |
434 | 434 | if(isset($_GET['tab']) && is_numeric($_GET['tab'])) { |
435 | - echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
435 | + echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
436 | 436 | } |
437 | 437 | ?> |
438 | 438 |
@@ -1,9 +1,9 @@ discard block |
||
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('access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // Get table names (alphabetical) |
@@ -18,24 +18,24 @@ discard block |
||
18 | 18 | // find all document groups, for the select :) |
19 | 19 | $rs = $modx->getDatabase()->select('*', $tbl_documentgroup_names, '', 'name'); |
20 | 20 | if($modx->getDatabase()->getRecordCount($rs) < 1) { |
21 | - $docgroupselector = '[no groups to add]'; |
|
21 | + $docgroupselector = '[no groups to add]'; |
|
22 | 22 | } else { |
23 | - $docgroupselector = '<select name="docgroup">' . "\n"; |
|
24 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
25 | - $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
26 | - } |
|
27 | - $docgroupselector .= "</select>\n"; |
|
23 | + $docgroupselector = '<select name="docgroup">' . "\n"; |
|
24 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
25 | + $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
26 | + } |
|
27 | + $docgroupselector .= "</select>\n"; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $rs = $modx->getDatabase()->select('*', $tbl_membergroup_names, '', 'name'); |
31 | 31 | if($modx->getDatabase()->getRecordCount($rs) < 1) { |
32 | - $usrgroupselector = '[no user groups]'; |
|
32 | + $usrgroupselector = '[no user groups]'; |
|
33 | 33 | } else { |
34 | - $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
35 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
36 | - $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
37 | - } |
|
38 | - $usrgroupselector .= "</select>\n"; |
|
34 | + $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
35 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
36 | + $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
37 | + } |
|
38 | + $usrgroupselector .= "</select>\n"; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | ?> |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | </form> |
97 | 97 | </div> |
98 | 98 | <?php |
99 | - $rs = $modx->getDatabase()->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames |
|
99 | + $rs = $modx->getDatabase()->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames |
|
100 | 100 | LEFT JOIN ' . $tbl_member_groups . ' AS groups ON groups.user_group = groupnames.id |
101 | 101 | LEFT JOIN ' . $tbl_manager_users . ' AS users ON users.id = groups.member', '', 'groupnames.name, user_name'); |
102 | - if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
103 | - ?> |
|
102 | + if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
103 | + ?> |
|
104 | 104 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
105 | 105 | <?php |
106 | - } else { |
|
107 | - ?> |
|
106 | + } else { |
|
107 | + ?> |
|
108 | 108 | <div class="form-group"> |
109 | 109 | <?php |
110 | - $pid = ''; |
|
111 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
112 | - if($pid != $row['id']) { |
|
113 | - if($pid != '') { |
|
114 | - echo '</div><div class="form-group">'; |
|
115 | - } |
|
116 | - ?> |
|
110 | + $pid = ''; |
|
111 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
112 | + if($pid != $row['id']) { |
|
113 | + if($pid != '') { |
|
114 | + echo '</div><div class="form-group">'; |
|
115 | + } |
|
116 | + ?> |
|
117 | 117 | <form method="post" action="index.php" name="accesspermissions"> |
118 | 118 | <input type="hidden" name="a" value="41" /> |
119 | 119 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -128,21 +128,21 @@ discard block |
||
128 | 128 | </form> |
129 | 129 | <?= $_lang['access_permissions_users_in_group'] ?> |
130 | 130 | <?php |
131 | - } |
|
132 | - if(!$row['user_id']) { |
|
133 | - ?> |
|
131 | + } |
|
132 | + if(!$row['user_id']) { |
|
133 | + ?> |
|
134 | 134 | <i><?= $_lang['access_permissions_no_users_in_group'] ?></i> |
135 | 135 | <?php |
136 | - $pid = $row['id']; |
|
137 | - continue; |
|
138 | - } |
|
139 | - ?> |
|
136 | + $pid = $row['id']; |
|
137 | + continue; |
|
138 | + } |
|
139 | + ?> |
|
140 | 140 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=12&id=<?= $row['user_id'] ?>"><?= $row['user_name'] ?></a> |
141 | 141 | <?php |
142 | - $pid = $row['id']; |
|
143 | - } |
|
144 | - } |
|
145 | - ?> |
|
142 | + $pid = $row['id']; |
|
143 | + } |
|
144 | + } |
|
145 | + ?> |
|
146 | 146 | </div> |
147 | 147 | </div> |
148 | 148 | </div> |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | </form> |
168 | 168 | </div> |
169 | 169 | <?php |
170 | - $rs = $modx->getDatabase()->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames |
|
170 | + $rs = $modx->getDatabase()->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames |
|
171 | 171 | LEFT JOIN ' . $tbl_document_groups . ' AS dg ON dg.document_group = dgnames.id |
172 | 172 | LEFT JOIN ' . $tbl_site_content . ' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id'); |
173 | - if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
174 | - ?> |
|
173 | + if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
174 | + ?> |
|
175 | 175 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
176 | 176 | <?php |
177 | - } else { |
|
178 | - ?> |
|
177 | + } else { |
|
178 | + ?> |
|
179 | 179 | <div class="form-group"> |
180 | 180 | <?php |
181 | - $pid = ''; |
|
182 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
183 | - if($pid != $row['id']) { |
|
184 | - if($pid != '') { |
|
185 | - echo '</div><div class="form-group">'; |
|
186 | - } |
|
187 | - ?> |
|
181 | + $pid = ''; |
|
182 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
183 | + if($pid != $row['id']) { |
|
184 | + if($pid != '') { |
|
185 | + echo '</div><div class="form-group">'; |
|
186 | + } |
|
187 | + ?> |
|
188 | 188 | <form method="post" action="index.php" name="accesspermissions"> |
189 | 189 | <input type="hidden" name="a" value="41" /> |
190 | 190 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -199,21 +199,21 @@ discard block |
||
199 | 199 | </form> |
200 | 200 | <?= $_lang['access_permissions_resources_in_group'] ?> |
201 | 201 | <?php |
202 | - } |
|
203 | - if(!$row['doc_id']) { |
|
204 | - ?> |
|
202 | + } |
|
203 | + if(!$row['doc_id']) { |
|
204 | + ?> |
|
205 | 205 | <i><?= $_lang['access_permissions_no_resources_in_group'] ?></i> |
206 | 206 | <?php |
207 | - $pid = $row['id']; |
|
208 | - continue; |
|
209 | - } |
|
210 | - ?> |
|
207 | + $pid = $row['id']; |
|
208 | + continue; |
|
209 | + } |
|
210 | + ?> |
|
211 | 211 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=3&id=<?= $row['doc_id'] ?>" title="<?= $modx->getPhpCompat()->htmlspecialchars($row['doc_title']) ?>"><?= $row['doc_id'] ?></a> |
212 | 212 | <?php |
213 | - $pid = $row['id']; |
|
214 | - } |
|
215 | - } |
|
216 | - ?> |
|
213 | + $pid = $row['id']; |
|
214 | + } |
|
215 | + } |
|
216 | + ?> |
|
217 | 217 | </div> |
218 | 218 | </div> |
219 | 219 | </div> |
@@ -225,16 +225,16 @@ discard block |
||
225 | 225 | <div class="container container-body"> |
226 | 226 | <p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p> |
227 | 227 | <?php |
228 | - // User/Document Group Links |
|
229 | - $rs = $modx->getDatabase()->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames |
|
228 | + // User/Document Group Links |
|
229 | + $rs = $modx->getDatabase()->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames |
|
230 | 230 | LEFT JOIN ' . $tbl_membergroup_access . ' AS groupacc ON groupacc.membergroup = groupnames.id |
231 | 231 | LEFT JOIN ' . $tbl_documentgroup_names . ' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name'); |
232 | - if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
233 | - ?> |
|
232 | + if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
233 | + ?> |
|
234 | 234 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
235 | 235 | <?php |
236 | - } else { |
|
237 | - ?> |
|
236 | + } else { |
|
237 | + ?> |
|
238 | 238 | <div class="form-group"> |
239 | 239 | <b><?= $_lang["access_permissions_group_link"] ?></b> |
240 | 240 | <form method="post" action="index.php" name="accesspermissions"> |
@@ -250,38 +250,38 @@ discard block |
||
250 | 250 | <hr> |
251 | 251 | <ul> |
252 | 252 | <?php |
253 | - $pid = ''; |
|
254 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
255 | - if($row['id'] != $pid) { |
|
256 | - if($pid != '') { |
|
257 | - echo '</ul></li>'; |
|
258 | - } // close previous one |
|
259 | - ?> |
|
253 | + $pid = ''; |
|
254 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
255 | + if($row['id'] != $pid) { |
|
256 | + if($pid != '') { |
|
257 | + echo '</ul></li>'; |
|
258 | + } // close previous one |
|
259 | + ?> |
|
260 | 260 | <li><b><?= $row['name'] ?></b></li> |
261 | 261 | <?php |
262 | - if(!$row['dg_id']) { |
|
263 | - echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
264 | - $pid = ''; |
|
265 | - continue; |
|
266 | - } else { |
|
267 | - echo '<ul>'; |
|
268 | - } |
|
269 | - } |
|
270 | - if(!$row['dg_id']) { |
|
271 | - continue; |
|
272 | - } |
|
273 | - ?> |
|
262 | + if(!$row['dg_id']) { |
|
263 | + echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
264 | + $pid = ''; |
|
265 | + continue; |
|
266 | + } else { |
|
267 | + echo '<ul>'; |
|
268 | + } |
|
269 | + } |
|
270 | + if(!$row['dg_id']) { |
|
271 | + continue; |
|
272 | + } |
|
273 | + ?> |
|
274 | 274 | <li><?= $row['dg_name'] ?> |
275 | 275 | <small><i>(<a class="text-danger" href="index.php?a=41&coupling=<?= $row['link_id'] ?>&operation=remove_document_group_from_user_group"><?= $_lang['remove'] ?></a>)</i></small> |
276 | 276 | </li> |
277 | 277 | <?php |
278 | - $pid = $row['id']; |
|
279 | - } |
|
280 | - ?> |
|
278 | + $pid = $row['id']; |
|
279 | + } |
|
280 | + ?> |
|
281 | 281 | </ul> |
282 | 282 | <?php |
283 | - } |
|
284 | - ?> |
|
283 | + } |
|
284 | + ?> |
|
285 | 285 | </div> |
286 | 286 | </div> |
287 | 287 |
@@ -1,13 +1,13 @@ discard block |
||
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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
9 | - // seems to be a new install - send the user to the configuration page |
|
10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
9 | + // seems to be a new install - send the user to the configuration page |
|
10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // set placeholders |
@@ -17,93 +17,93 @@ discard block |
||
17 | 17 | |
18 | 18 | // setup message info |
19 | 19 | if($modx->hasPermission('messages')) { |
20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | - |
|
24 | - $msg = array(); |
|
25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | - $ph['MessageInfo'] = implode("\n", $msg); |
|
20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | + |
|
24 | + $msg = array(); |
|
25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | + $ph['MessageInfo'] = implode("\n", $msg); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $iconTpl = $modx->getChunk('manager#welcome\WrapIcon'); |
35 | 35 | // setup icons |
36 | 36 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
37 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
38 | - $ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75); |
|
37 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
38 | + $ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75); |
|
39 | 39 | } |
40 | 40 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
41 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
42 | - $ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99); |
|
41 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
42 | + $ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99); |
|
43 | 43 | } |
44 | 44 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
45 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
46 | - $ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106); |
|
45 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
46 | + $ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106); |
|
47 | 47 | } |
48 | 48 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
49 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
50 | - $ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76); |
|
49 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
50 | + $ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76); |
|
51 | 51 | } |
52 | 52 | if($modx->hasPermission('bk_manager')) { |
53 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
54 | - $ph['BackupIcon'] = sprintf($iconTpl,$icon, 93); |
|
53 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
54 | + $ph['BackupIcon'] = sprintf($iconTpl,$icon, 93); |
|
55 | 55 | } |
56 | 56 | if($modx->hasPermission('help')) { |
57 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
58 | - $ph['HelpIcon'] = sprintf($iconTpl,$icon, 9); |
|
57 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
58 | + $ph['HelpIcon'] = sprintf($iconTpl,$icon, 9); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | if($modx->hasPermission('new_document')) { |
62 | - $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]'; |
|
63 | - $ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4); |
|
64 | - $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]'; |
|
65 | - $ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72); |
|
62 | + $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]'; |
|
63 | + $ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4); |
|
64 | + $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]'; |
|
65 | + $ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72); |
|
66 | 66 | } |
67 | 67 | if($modx->hasPermission('assets_images')) { |
68 | - $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]'; |
|
69 | - $ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72); |
|
68 | + $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]'; |
|
69 | + $ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72); |
|
70 | 70 | } |
71 | 71 | if($modx->hasPermission('assets_files')) { |
72 | - $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]'; |
|
73 | - $ph['FilesIcon'] = sprintf($iconTpl,$icon, 72); |
|
72 | + $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]'; |
|
73 | + $ph['FilesIcon'] = sprintf($iconTpl,$icon, 72); |
|
74 | 74 | } |
75 | 75 | if($modx->hasPermission('change_password')) { |
76 | - $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]'; |
|
77 | - $ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28); |
|
76 | + $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]'; |
|
77 | + $ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28); |
|
78 | 78 | } |
79 | 79 | $icon = '<i class="[&icons_logout_large&]"></i>[%logout%]'; |
80 | 80 | $ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8); |
81 | 81 | |
82 | 82 | // do some config checks |
83 | 83 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
84 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
85 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
86 | - $ph['config_check_results'] = $config_check_results; |
|
87 | - $ph['config_display'] = 'block'; |
|
88 | - } else { |
|
89 | - $ph['config_display'] = 'none'; |
|
90 | - } |
|
84 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
85 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
86 | + $ph['config_check_results'] = $config_check_results; |
|
87 | + $ph['config_display'] = 'block'; |
|
88 | + } else { |
|
89 | + $ph['config_display'] = 'none'; |
|
90 | + } |
|
91 | 91 | } else { |
92 | - $ph['config_display'] = 'none'; |
|
92 | + $ph['config_display'] = 'none'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Check logout-reminder |
96 | 96 | if(isset($_SESSION['show_logout_reminder'])) { |
97 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
98 | - case 'logout_reminder': |
|
99 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
100 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
101 | - break; |
|
102 | - } |
|
103 | - $ph['show_logout_reminder'] = 'block'; |
|
104 | - unset($_SESSION['show_logout_reminder']); |
|
97 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
98 | + case 'logout_reminder': |
|
99 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
100 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
101 | + break; |
|
102 | + } |
|
103 | + $ph['show_logout_reminder'] = 'block'; |
|
104 | + unset($_SESSION['show_logout_reminder']); |
|
105 | 105 | } else { |
106 | - $ph['show_logout_reminder'] = 'none'; |
|
106 | + $ph['show_logout_reminder'] = 'none'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // Check multiple sessions |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
152 | 152 | |
153 | 153 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
154 | - 'username' => $modx->getLoginUserName(), |
|
155 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
156 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
157 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
158 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
154 | + 'username' => $modx->getLoginUserName(), |
|
155 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
156 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
157 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
158 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
159 | 159 | )); |
160 | 160 | |
161 | 161 | $from = array(); |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | $rs = $modx->getDatabase()->select('*', $from, '', 'username ASC, au.sid ASC'); |
165 | 165 | |
166 | 166 | if($modx->getDatabase()->getRecordCount($rs) < 1) { |
167 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
167 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
168 | 168 | } else { |
169 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
170 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
171 | - $ph['now'] = strftime('%H:%M:%S', $now); |
|
172 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
173 | - $html = ' |
|
169 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
170 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
171 | + $ph['now'] = strftime('%H:%M:%S', $now); |
|
172 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
173 | + $html = ' |
|
174 | 174 | <div class="card-body"> |
175 | 175 | [%onlineusers_message%] |
176 | 176 | <b>[+now+]</b>): |
@@ -188,33 +188,33 @@ discard block |
||
188 | 188 | </thead> |
189 | 189 | <tbody>'; |
190 | 190 | |
191 | - $userList = array(); |
|
192 | - $userCount = array(); |
|
193 | - // Create userlist with session-count first before output |
|
194 | - while($activeusers = $modx->getDatabase()->getRow($rs)) { |
|
195 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
196 | - |
|
197 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
198 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
199 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
200 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
201 | - $userList[] = array( |
|
202 | - $idle, |
|
203 | - '', |
|
204 | - $activeusers['username'], |
|
205 | - $webicon, |
|
206 | - abs($activeusers['internalKey']), |
|
207 | - $ip, |
|
208 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
209 | - $currentaction |
|
210 | - ); |
|
211 | - } |
|
212 | - foreach($userList as $params) { |
|
213 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
214 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
215 | - } |
|
216 | - |
|
217 | - $html .= ' |
|
191 | + $userList = array(); |
|
192 | + $userCount = array(); |
|
193 | + // Create userlist with session-count first before output |
|
194 | + while($activeusers = $modx->getDatabase()->getRow($rs)) { |
|
195 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
196 | + |
|
197 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
198 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
199 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
200 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
201 | + $userList[] = array( |
|
202 | + $idle, |
|
203 | + '', |
|
204 | + $activeusers['username'], |
|
205 | + $webicon, |
|
206 | + abs($activeusers['internalKey']), |
|
207 | + $ip, |
|
208 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
209 | + $currentaction |
|
210 | + ); |
|
211 | + } |
|
212 | + foreach($userList as $params) { |
|
213 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
214 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
215 | + } |
|
216 | + |
|
217 | + $html .= ' |
|
218 | 218 | </tbody> |
219 | 219 | </table> |
220 | 220 | </div> |
@@ -255,17 +255,17 @@ discard block |
||
255 | 255 | // invoke event OnManagerWelcomePrerender |
256 | 256 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
257 | 257 | if(is_array($evtOut)) { |
258 | - $output = implode('', $evtOut); |
|
259 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
258 | + $output = implode('', $evtOut); |
|
259 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | $widgets['welcome'] = array( |
263 | - 'menuindex' => '10', |
|
264 | - 'id' => 'welcome', |
|
265 | - 'cols' => 'col-lg-6', |
|
266 | - 'icon' => 'fa-home', |
|
267 | - 'title' => '[%welcome_title%]', |
|
268 | - 'body' => ' |
|
263 | + 'menuindex' => '10', |
|
264 | + 'id' => 'welcome', |
|
265 | + 'cols' => 'col-lg-6', |
|
266 | + 'icon' => 'fa-home', |
|
267 | + 'title' => '[%welcome_title%]', |
|
268 | + 'body' => ' |
|
269 | 269 | <div class="wm_buttons card-body"> |
270 | 270 | <!--@IF:[[#hasPermission?key=new_document]]--> |
271 | 271 | <span class="wm_button"> |
@@ -339,25 +339,25 @@ discard block |
||
339 | 339 | </table> |
340 | 340 | </div> |
341 | 341 | ', |
342 | - 'hide'=>'0' |
|
342 | + 'hide'=>'0' |
|
343 | 343 | ); |
344 | 344 | $widgets['onlineinfo'] = array( |
345 | - 'menuindex' => '20', |
|
346 | - 'id' => 'onlineinfo', |
|
347 | - 'cols' => 'col-lg-6', |
|
348 | - 'icon' => 'fa-user', |
|
349 | - 'title' => '[%onlineusers_title%]', |
|
350 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
351 | - 'hide'=>'0' |
|
345 | + 'menuindex' => '20', |
|
346 | + 'id' => 'onlineinfo', |
|
347 | + 'cols' => 'col-lg-6', |
|
348 | + 'icon' => 'fa-user', |
|
349 | + 'title' => '[%onlineusers_title%]', |
|
350 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
351 | + 'hide'=>'0' |
|
352 | 352 | ); |
353 | 353 | $widgets['recentinfo'] = array( |
354 | - 'menuindex' => '30', |
|
355 | - 'id' => 'modxrecent_widget', |
|
356 | - 'cols' => 'col-sm-12', |
|
357 | - 'icon' => 'fa-pencil-square-o', |
|
358 | - 'title' => '[%activity_title%]', |
|
359 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
360 | - 'hide'=>'0' |
|
354 | + 'menuindex' => '30', |
|
355 | + 'id' => 'modxrecent_widget', |
|
356 | + 'cols' => 'col-sm-12', |
|
357 | + 'icon' => 'fa-pencil-square-o', |
|
358 | + 'title' => '[%activity_title%]', |
|
359 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
360 | + 'hide'=>'0' |
|
361 | 361 | ); |
362 | 362 | if ($modx->config['rss_url_news']) { |
363 | 363 | $widgets['news'] = array( |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | // invoke OnManagerWelcomeHome event |
386 | 386 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
387 | 387 | if(is_array($sitewidgets)) { |
388 | - $newwidgets = array(); |
|
388 | + $newwidgets = array(); |
|
389 | 389 | foreach($sitewidgets as $widget){ |
390 | 390 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
391 | 391 | } |
@@ -393,21 +393,21 @@ discard block |
||
393 | 393 | } |
394 | 394 | |
395 | 395 | usort($widgets, function ($a, $b) { |
396 | - return $a['menuindex'] - $b['menuindex']; |
|
396 | + return $a['menuindex'] - $b['menuindex']; |
|
397 | 397 | }); |
398 | 398 | |
399 | 399 | $tpl = $modx->getChunk('manager#welcome\Widget'); |
400 | 400 | $output = ''; |
401 | 401 | foreach($widgets as $widget) { |
402 | - if ($widget['hide'] != '1'){ |
|
403 | - $output .= $modx->parseText($tpl, $widget); |
|
404 | - } |
|
402 | + if ($widget['hide'] != '1'){ |
|
403 | + $output .= $modx->parseText($tpl, $widget); |
|
404 | + } |
|
405 | 405 | } |
406 | 406 | $ph['widgets'] = $output; |
407 | 407 | |
408 | 408 | // load template |
409 | 409 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
410 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
410 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | $target = $modx->config['manager_welcome_tpl']; |
@@ -415,27 +415,27 @@ discard block |
||
415 | 415 | $target = $modx->mergeSettingsContent($target); |
416 | 416 | |
417 | 417 | if(substr($target, 0, 1) === '@') { |
418 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
419 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
420 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
421 | - $content = file_get_contents(trim(substr($target, 6))); |
|
422 | - } else { |
|
423 | - $content = ''; |
|
424 | - } |
|
418 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
419 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
420 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
421 | + $content = file_get_contents(trim(substr($target, 6))); |
|
422 | + } else { |
|
423 | + $content = ''; |
|
424 | + } |
|
425 | 425 | } else { |
426 | - $chunk = $modx->getChunk($target); |
|
427 | - if($chunk !== false && !empty($chunk)) { |
|
428 | - $content = $chunk; |
|
429 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
430 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
431 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
432 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
433 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
434 | - { |
|
435 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
436 | - } else { |
|
437 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
438 | - } |
|
426 | + $chunk = $modx->getChunk($target); |
|
427 | + if($chunk !== false && !empty($chunk)) { |
|
428 | + $content = $chunk; |
|
429 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
430 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
431 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
432 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
433 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
434 | + { |
|
435 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
436 | + } else { |
|
437 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
438 | + } |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | // merge placeholders |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | $content = $modx->mergeSettingsContent($content); |
444 | 444 | $content = $modx->parseText($content, $ph); |
445 | 445 | if(strpos($content, '[+') !== false) { |
446 | - $modx->toPlaceholders($ph); |
|
447 | - $content = $modx->mergePlaceholderContent($content); |
|
446 | + $modx->toPlaceholders($ph); |
|
447 | + $content = $modx->mergePlaceholderContent($content); |
|
448 | 448 | } |
449 | 449 | $content = $modx->parseDocumentSource($content); |
450 | 450 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $content = $modx->cleanUpMODXTags($content); //cleanup |
453 | 453 | |
454 | 454 | if($js = $modx->getRegisteredClientScripts()) { |
455 | - $content .= $js; |
|
455 | + $content .= $js; |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | echo $content; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('web_access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // web access group processor. |
@@ -20,111 +20,111 @@ discard block |
||
20 | 20 | $operation = $_REQUEST['operation']; |
21 | 21 | |
22 | 22 | switch ($operation) { |
23 | - case "add_user_group" : |
|
24 | - $newgroup = $_REQUEST['newusergroup']; |
|
25 | - if(empty($newgroup)) { |
|
26 | - $modx->webAlertAndQuit("No group name specified."); |
|
27 | - } else { |
|
28 | - $id = $modx->getDatabase()->insert(array('name'=>$modx->getDatabase()->escape($newgroup)), $tbl_webgroup_names); |
|
23 | + case "add_user_group" : |
|
24 | + $newgroup = $_REQUEST['newusergroup']; |
|
25 | + if(empty($newgroup)) { |
|
26 | + $modx->webAlertAndQuit("No group name specified."); |
|
27 | + } else { |
|
28 | + $id = $modx->getDatabase()->insert(array('name'=>$modx->getDatabase()->escape($newgroup)), $tbl_webgroup_names); |
|
29 | 29 | |
30 | - // invoke OnWebCreateGroup event |
|
31 | - $modx->invokeEvent('OnWebCreateGroup', array( |
|
32 | - 'groupid' => $id, |
|
33 | - 'groupname' => $newgroup, |
|
34 | - )); |
|
35 | - } |
|
36 | - break; |
|
37 | - case "add_document_group" : |
|
38 | - $newgroup = $_REQUEST['newdocgroup']; |
|
39 | - if(empty($newgroup)) { |
|
40 | - $modx->webAlertAndQuit("No group name specified."); |
|
41 | - } else { |
|
42 | - $id = $modx->getDatabase()->insert(array('name'=>$modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
30 | + // invoke OnWebCreateGroup event |
|
31 | + $modx->invokeEvent('OnWebCreateGroup', array( |
|
32 | + 'groupid' => $id, |
|
33 | + 'groupname' => $newgroup, |
|
34 | + )); |
|
35 | + } |
|
36 | + break; |
|
37 | + case "add_document_group" : |
|
38 | + $newgroup = $_REQUEST['newdocgroup']; |
|
39 | + if(empty($newgroup)) { |
|
40 | + $modx->webAlertAndQuit("No group name specified."); |
|
41 | + } else { |
|
42 | + $id = $modx->getDatabase()->insert(array('name'=>$modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
43 | 43 | |
44 | - // invoke OnCreateDocGroup event |
|
45 | - $modx->invokeEvent('OnCreateDocGroup', array( |
|
46 | - 'groupid' => $id, |
|
47 | - 'groupname' => $newgroup, |
|
48 | - )); |
|
49 | - } |
|
50 | - break; |
|
51 | - case "delete_user_group" : |
|
52 | - $updategroupaccess = true; |
|
53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | - if(empty($usergroup)) { |
|
55 | - $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
56 | - } else { |
|
57 | - $modx->getDatabase()->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
|
44 | + // invoke OnCreateDocGroup event |
|
45 | + $modx->invokeEvent('OnCreateDocGroup', array( |
|
46 | + 'groupid' => $id, |
|
47 | + 'groupname' => $newgroup, |
|
48 | + )); |
|
49 | + } |
|
50 | + break; |
|
51 | + case "delete_user_group" : |
|
52 | + $updategroupaccess = true; |
|
53 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | + if(empty($usergroup)) { |
|
55 | + $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
56 | + } else { |
|
57 | + $modx->getDatabase()->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
|
58 | 58 | |
59 | - $modx->getDatabase()->delete($tbl_webgroup_access, "webgroup='{$usergroup}'"); |
|
59 | + $modx->getDatabase()->delete($tbl_webgroup_access, "webgroup='{$usergroup}'"); |
|
60 | 60 | |
61 | - $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$usergroup}'"); |
|
62 | - } |
|
63 | - break; |
|
64 | - case "delete_document_group" : |
|
65 | - $group = (int)$_REQUEST['documentgroup']; |
|
66 | - if(empty($group)) { |
|
67 | - $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
68 | - } else { |
|
69 | - $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
61 | + $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$usergroup}'"); |
|
62 | + } |
|
63 | + break; |
|
64 | + case "delete_document_group" : |
|
65 | + $group = (int)$_REQUEST['documentgroup']; |
|
66 | + if(empty($group)) { |
|
67 | + $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
68 | + } else { |
|
69 | + $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
70 | 70 | |
71 | - $modx->getDatabase()->delete($tbl_webgroup_access, "documentgroup='{$group}'"); |
|
71 | + $modx->getDatabase()->delete($tbl_webgroup_access, "documentgroup='{$group}'"); |
|
72 | 72 | |
73 | - $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
74 | - } |
|
75 | - break; |
|
76 | - case "rename_user_group" : |
|
77 | - $newgroupname = $_REQUEST['newgroupname']; |
|
78 | - if(empty($newgroupname)) { |
|
79 | - $modx->webAlertAndQuit("No group name specified."); |
|
80 | - } |
|
81 | - $groupid = (int)$_REQUEST['groupid']; |
|
82 | - if(empty($groupid)) { |
|
83 | - $modx->webAlertAndQuit("No user group id specified for rename."); |
|
84 | - } |
|
85 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
|
86 | - break; |
|
87 | - case "rename_document_group" : |
|
88 | - $newgroupname = $_REQUEST['newgroupname']; |
|
89 | - if(empty($newgroupname)) { |
|
90 | - $modx->webAlertAndQuit("No group name specified."); |
|
91 | - } |
|
92 | - $groupid = (int)$_REQUEST['groupid']; |
|
93 | - if(empty($groupid)) { |
|
94 | - $modx->webAlertAndQuit("No document group id specified for rename."); |
|
95 | - } |
|
96 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
97 | - break; |
|
98 | - case "add_document_group_to_user_group" : |
|
99 | - $updategroupaccess = true; |
|
100 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
101 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
102 | - $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
103 | - $limit = $modx->getDatabase()->getValue($rs); |
|
104 | - if($limit<=0) { |
|
105 | - $modx->getDatabase()->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
|
106 | - } else { |
|
107 | - //alert user that coupling already exists? |
|
108 | - } |
|
109 | - break; |
|
110 | - case "remove_document_group_from_user_group" : |
|
111 | - $updategroupaccess = true; |
|
112 | - $coupling = (int)$_REQUEST['coupling']; |
|
113 | - $modx->getDatabase()->delete($tbl_webgroup_access, "id='{$coupling}'"); |
|
114 | - break; |
|
115 | - default : |
|
116 | - $modx->webAlertAndQuit("No operation set in request."); |
|
73 | + $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
74 | + } |
|
75 | + break; |
|
76 | + case "rename_user_group" : |
|
77 | + $newgroupname = $_REQUEST['newgroupname']; |
|
78 | + if(empty($newgroupname)) { |
|
79 | + $modx->webAlertAndQuit("No group name specified."); |
|
80 | + } |
|
81 | + $groupid = (int)$_REQUEST['groupid']; |
|
82 | + if(empty($groupid)) { |
|
83 | + $modx->webAlertAndQuit("No user group id specified for rename."); |
|
84 | + } |
|
85 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
|
86 | + break; |
|
87 | + case "rename_document_group" : |
|
88 | + $newgroupname = $_REQUEST['newgroupname']; |
|
89 | + if(empty($newgroupname)) { |
|
90 | + $modx->webAlertAndQuit("No group name specified."); |
|
91 | + } |
|
92 | + $groupid = (int)$_REQUEST['groupid']; |
|
93 | + if(empty($groupid)) { |
|
94 | + $modx->webAlertAndQuit("No document group id specified for rename."); |
|
95 | + } |
|
96 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
97 | + break; |
|
98 | + case "add_document_group_to_user_group" : |
|
99 | + $updategroupaccess = true; |
|
100 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
101 | + $docgroup = (int)$_REQUEST['docgroup']; |
|
102 | + $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
103 | + $limit = $modx->getDatabase()->getValue($rs); |
|
104 | + if($limit<=0) { |
|
105 | + $modx->getDatabase()->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
|
106 | + } else { |
|
107 | + //alert user that coupling already exists? |
|
108 | + } |
|
109 | + break; |
|
110 | + case "remove_document_group_from_user_group" : |
|
111 | + $updategroupaccess = true; |
|
112 | + $coupling = (int)$_REQUEST['coupling']; |
|
113 | + $modx->getDatabase()->delete($tbl_webgroup_access, "id='{$coupling}'"); |
|
114 | + break; |
|
115 | + default : |
|
116 | + $modx->webAlertAndQuit("No operation set in request."); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // secure web documents - flag as private |
120 | 120 | if($updategroupaccess==true){ |
121 | - include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
122 | - secureWebDocument(); |
|
121 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
122 | + secureWebDocument(); |
|
123 | 123 | |
124 | - // Update the private group column |
|
125 | - $modx->getDatabase()->update( |
|
126 | - 'dgn.private_webgroup = (wga.webgroup IS NOT NULL)', |
|
127 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id"); |
|
124 | + // Update the private group column |
|
125 | + $modx->getDatabase()->update( |
|
126 | + 'dgn.private_webgroup = (wga.webgroup IS NOT NULL)', |
|
127 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id"); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $header = "Location: index.php?a=91"; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('export_static')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $maxtime = (is_numeric($_POST['maxtime'])) ? $_POST['maxtime'] : 30; |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | $modx->getExportSite()->targetDir = $export_dir; |
16 | 16 | |
17 | 17 | if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) |
18 | - return $_lang['export_site.static.php6']; |
|
18 | + return $_lang['export_site.static.php6']; |
|
19 | 19 | elseif($modx->config['rb_base_dir'] === $export_dir . '/') |
20 | - return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']); |
|
20 | + return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']); |
|
21 | 21 | elseif(!is_writable($export_dir)) |
22 | - return $_lang['export_site_target_unwritable']; |
|
22 | + return $_lang['export_site_target_unwritable']; |
|
23 | 23 | |
24 | 24 | $modx->getExportSite()->generate_mode = $_POST['generate_mode']; |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ||$includenoncache!==$_POST['includenoncache'] |
36 | 36 | ||$repl_before!==$_POST['repl_before'] |
37 | 37 | ||$repl_after !==$_POST['repl_after']) { |
38 | - $modx->clearCache('full'); |
|
38 | + $modx->clearCache('full'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $total = $modx->getExportSite()->getTotal($_POST['ignore_ids'], $modx->config['export_includenoncache']); |
@@ -3,33 +3,33 @@ |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!($modx->hasPermission('settings') && ($modx->hasPermission('logs')||$modx->hasPermission('bk_manager')))) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | if (isset($_REQUEST['t'])) { |
10 | 10 | |
11 | - if (empty($_REQUEST['t'])) { |
|
12 | - $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
13 | - } |
|
11 | + if (empty($_REQUEST['t'])) { |
|
12 | + $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
13 | + } |
|
14 | 14 | |
15 | - // Set the item name for logger |
|
16 | - $_SESSION['itemname'] = $_REQUEST['t']; |
|
15 | + // Set the item name for logger |
|
16 | + $_SESSION['itemname'] = $_REQUEST['t']; |
|
17 | 17 | |
18 | - $modx->getDatabase()->optimize($_REQUEST['t']); |
|
18 | + $modx->getDatabase()->optimize($_REQUEST['t']); |
|
19 | 19 | |
20 | 20 | } elseif (isset($_REQUEST['u'])) { |
21 | 21 | |
22 | - if (empty($_REQUEST['u'])) { |
|
23 | - $modx->webAlertAndQuit($_lang["error_no_truncate_tablename"]); |
|
24 | - } |
|
22 | + if (empty($_REQUEST['u'])) { |
|
23 | + $modx->webAlertAndQuit($_lang["error_no_truncate_tablename"]); |
|
24 | + } |
|
25 | 25 | |
26 | - // Set the item name for logger |
|
27 | - $_SESSION['itemname'] = $_REQUEST['u']; |
|
26 | + // Set the item name for logger |
|
27 | + $_SESSION['itemname'] = $_REQUEST['u']; |
|
28 | 28 | |
29 | - $modx->getDatabase()->truncate($_REQUEST['u']); |
|
29 | + $modx->getDatabase()->truncate($_REQUEST['u']); |
|
30 | 30 | |
31 | 31 | } else { |
32 | - $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
32 | + $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $mode = (int)$_REQUEST['mode']; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // access group processor. |
@@ -20,113 +20,113 @@ discard block |
||
20 | 20 | $operation = $_REQUEST['operation']; |
21 | 21 | |
22 | 22 | switch ($operation) { |
23 | - case "add_user_group" : |
|
24 | - $newgroup = $_REQUEST['newusergroup']; |
|
25 | - if(empty($newgroup)) { |
|
26 | - $modx->webAlertAndQuit("No group name specified."); |
|
27 | - } else { |
|
28 | - $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
|
23 | + case "add_user_group" : |
|
24 | + $newgroup = $_REQUEST['newusergroup']; |
|
25 | + if(empty($newgroup)) { |
|
26 | + $modx->webAlertAndQuit("No group name specified."); |
|
27 | + } else { |
|
28 | + $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
|
29 | 29 | |
30 | - // invoke OnManagerCreateGroup event |
|
31 | - $modx->invokeEvent('OnManagerCreateGroup', array( |
|
32 | - 'groupid' => $id, |
|
33 | - 'groupname' => $newgroup, |
|
34 | - )); |
|
35 | - } |
|
36 | - break; |
|
37 | - case "add_document_group" : |
|
38 | - $newgroup = $_REQUEST['newdocgroup']; |
|
39 | - if(empty($newgroup)) { |
|
40 | - $modx->webAlertAndQuit("No group name specified."); |
|
41 | - } else { |
|
42 | - $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
30 | + // invoke OnManagerCreateGroup event |
|
31 | + $modx->invokeEvent('OnManagerCreateGroup', array( |
|
32 | + 'groupid' => $id, |
|
33 | + 'groupname' => $newgroup, |
|
34 | + )); |
|
35 | + } |
|
36 | + break; |
|
37 | + case "add_document_group" : |
|
38 | + $newgroup = $_REQUEST['newdocgroup']; |
|
39 | + if(empty($newgroup)) { |
|
40 | + $modx->webAlertAndQuit("No group name specified."); |
|
41 | + } else { |
|
42 | + $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
43 | 43 | |
44 | - // invoke OnCreateDocGroup event |
|
45 | - $modx->invokeEvent('OnCreateDocGroup', array( |
|
46 | - 'groupid' => $id, |
|
47 | - 'groupname' => $newgroup, |
|
48 | - )); |
|
49 | - } |
|
50 | - break; |
|
51 | - case "delete_user_group" : |
|
52 | - $updategroupaccess = true; |
|
53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | - if(empty($usergroup)) { |
|
55 | - $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
56 | - } else { |
|
57 | - $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
44 | + // invoke OnCreateDocGroup event |
|
45 | + $modx->invokeEvent('OnCreateDocGroup', array( |
|
46 | + 'groupid' => $id, |
|
47 | + 'groupname' => $newgroup, |
|
48 | + )); |
|
49 | + } |
|
50 | + break; |
|
51 | + case "delete_user_group" : |
|
52 | + $updategroupaccess = true; |
|
53 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | + if(empty($usergroup)) { |
|
55 | + $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
56 | + } else { |
|
57 | + $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
58 | 58 | |
59 | - $modx->getDatabase()->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
59 | + $modx->getDatabase()->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
60 | 60 | |
61 | - $modx->getDatabase()->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
62 | - } |
|
63 | - break; |
|
64 | - case "delete_document_group" : |
|
65 | - $group = (int)$_REQUEST['documentgroup']; |
|
66 | - if(empty($group)) { |
|
67 | - $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
68 | - } else { |
|
69 | - $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
61 | + $modx->getDatabase()->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
62 | + } |
|
63 | + break; |
|
64 | + case "delete_document_group" : |
|
65 | + $group = (int)$_REQUEST['documentgroup']; |
|
66 | + if(empty($group)) { |
|
67 | + $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
68 | + } else { |
|
69 | + $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
70 | 70 | |
71 | - $modx->getDatabase()->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
71 | + $modx->getDatabase()->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
72 | 72 | |
73 | - $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
74 | - } |
|
75 | - break; |
|
76 | - case "rename_user_group" : |
|
77 | - $newgroupname = $_REQUEST['newgroupname']; |
|
78 | - if(empty($newgroupname)) { |
|
79 | - $modx->webAlertAndQuit("No group name specified."); |
|
80 | - } |
|
81 | - $groupid = (int)$_REQUEST['groupid']; |
|
82 | - if(empty($groupid)) { |
|
83 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
84 | - } |
|
73 | + $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
74 | + } |
|
75 | + break; |
|
76 | + case "rename_user_group" : |
|
77 | + $newgroupname = $_REQUEST['newgroupname']; |
|
78 | + if(empty($newgroupname)) { |
|
79 | + $modx->webAlertAndQuit("No group name specified."); |
|
80 | + } |
|
81 | + $groupid = (int)$_REQUEST['groupid']; |
|
82 | + if(empty($groupid)) { |
|
83 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
84 | + } |
|
85 | 85 | |
86 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
87 | - break; |
|
88 | - case "rename_document_group" : |
|
89 | - $newgroupname = $_REQUEST['newgroupname']; |
|
90 | - if(empty($newgroupname)) { |
|
91 | - $modx->webAlertAndQuit("No group name specified."); |
|
92 | - } |
|
93 | - $groupid = (int)$_REQUEST['groupid']; |
|
94 | - if(empty($groupid)) { |
|
95 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
96 | - } |
|
86 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
87 | + break; |
|
88 | + case "rename_document_group" : |
|
89 | + $newgroupname = $_REQUEST['newgroupname']; |
|
90 | + if(empty($newgroupname)) { |
|
91 | + $modx->webAlertAndQuit("No group name specified."); |
|
92 | + } |
|
93 | + $groupid = (int)$_REQUEST['groupid']; |
|
94 | + if(empty($groupid)) { |
|
95 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
96 | + } |
|
97 | 97 | |
98 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
99 | - break; |
|
100 | - case "add_document_group_to_user_group" : |
|
101 | - $updategroupaccess = true; |
|
102 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
103 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
104 | - $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
105 | - $limit = $modx->getDatabase()->getValue($rs); |
|
106 | - if($limit<=0) { |
|
107 | - $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
108 | - } else { |
|
109 | - //alert user that coupling already exists? |
|
110 | - } |
|
111 | - break; |
|
112 | - case "remove_document_group_from_user_group" : |
|
113 | - $updategroupaccess = true; |
|
114 | - $coupling = (int)$_REQUEST['coupling']; |
|
115 | - $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
116 | - break; |
|
117 | - default : |
|
118 | - $modx->webAlertAndQuit("No operation set in request."); |
|
98 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
99 | + break; |
|
100 | + case "add_document_group_to_user_group" : |
|
101 | + $updategroupaccess = true; |
|
102 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
103 | + $docgroup = (int)$_REQUEST['docgroup']; |
|
104 | + $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
105 | + $limit = $modx->getDatabase()->getValue($rs); |
|
106 | + if($limit<=0) { |
|
107 | + $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
108 | + } else { |
|
109 | + //alert user that coupling already exists? |
|
110 | + } |
|
111 | + break; |
|
112 | + case "remove_document_group_from_user_group" : |
|
113 | + $updategroupaccess = true; |
|
114 | + $coupling = (int)$_REQUEST['coupling']; |
|
115 | + $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
116 | + break; |
|
117 | + default : |
|
118 | + $modx->webAlertAndQuit("No operation set in request."); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // secure manager documents - flag as private |
122 | 122 | if($updategroupaccess==true){ |
123 | - include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
124 | - secureMgrDocument(); |
|
123 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
124 | + secureMgrDocument(); |
|
125 | 125 | |
126 | - // Update the private group column |
|
127 | - $modx->getDatabase()->update( |
|
128 | - 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
129 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
126 | + // Update the private group column |
|
127 | + $modx->getDatabase()->update( |
|
128 | + 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
129 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $header = "Location: index.php?a=40"; |