@@ -1,21 +1,21 @@ 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 | switch($modx->getManagerApi()->action) { |
7 | - case 16: |
|
8 | - if(!$modx->hasPermission('edit_template')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 19: |
|
13 | - if(!$modx->hasPermission('new_template')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 16: |
|
8 | + if(!$modx->hasPermission('edit_template')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 19: |
|
13 | + if(!$modx->hasPermission('new_template')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | 26 | if($lockedEl = $modx->elementIsLocked(1, $id)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
@@ -33,23 +33,23 @@ discard block |
||
33 | 33 | |
34 | 34 | $content = array(); |
35 | 35 | if(!empty($id)) { |
36 | - $rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'"); |
|
37 | - $content = $modx->getDatabase()->getRow($rs); |
|
38 | - if(!$content) { |
|
39 | - $modx->webAlertAndQuit("No database record has been found for this template."); |
|
40 | - } |
|
41 | - |
|
42 | - $_SESSION['itemname'] = $content['templatename']; |
|
43 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
45 | - } |
|
36 | + $rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'"); |
|
37 | + $content = $modx->getDatabase()->getRow($rs); |
|
38 | + if(!$content) { |
|
39 | + $modx->webAlertAndQuit("No database record has been found for this template."); |
|
40 | + } |
|
41 | + |
|
42 | + $_SESSION['itemname'] = $content['templatename']; |
|
43 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
45 | + } |
|
46 | 46 | } else { |
47 | - $_SESSION['itemname'] = $_lang["new_template"]; |
|
48 | - $content['category'] = (int)$_REQUEST['catid']; |
|
47 | + $_SESSION['itemname'] = $_lang["new_template"]; |
|
48 | + $content['category'] = (int)$_REQUEST['catid']; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if($modx->getManagerApi()->hasFormValues()) { |
52 | - $modx->getManagerApi()->loadFormValues(); |
|
52 | + $modx->getManagerApi()->loadFormValues(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $content = array_merge($content, $_POST); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | |
99 | 99 | <form name="mutate" method="post" action="index.php"> |
100 | 100 | <?php |
101 | - // invoke OnTempFormPrerender event |
|
102 | - $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
103 | - if(is_array($evtOut)) { |
|
104 | - echo implode("", $evtOut); |
|
105 | - } |
|
106 | - ?> |
|
101 | + // invoke OnTempFormPrerender event |
|
102 | + $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
103 | + if(is_array($evtOut)) { |
|
104 | + echo implode("", $evtOut); |
|
105 | + } |
|
106 | + ?> |
|
107 | 107 | <input type="hidden" name="a" value="20"> |
108 | 108 | <input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>"> |
109 | 109 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>"> |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | <label class="col-md-3 col-lg-2"> |
134 | 134 | <?= $_lang['template_name'] ?> |
135 | 135 | <?php if($id == $modx->config['default_template']) { |
136 | - echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
137 | - } ?> |
|
136 | + echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
137 | + } ?> |
|
138 | 138 | </label> |
139 | 139 | <div class="col-md-9 col-lg-10"> |
140 | 140 | <div class="form-control-name clearfix"> |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
163 | 163 | <option> </option> |
164 | 164 | <?php |
165 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | - foreach(getCategories() as $n => $v) { |
|
167 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>"; |
|
168 | - } |
|
169 | - ?> |
|
165 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | + foreach(getCategories() as $n => $v) { |
|
167 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>"; |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | </select> |
171 | 171 | </div> |
172 | 172 | </div> |
@@ -197,38 +197,38 @@ discard block |
||
197 | 197 | <input type="submit" name="save" style="display:none"> |
198 | 198 | |
199 | 199 | <?php |
200 | - $selectedTvs = array(); |
|
201 | - if(!isset($_POST['assignedTv'])) { |
|
202 | - $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
200 | + $selectedTvs = array(); |
|
201 | + if(!isset($_POST['assignedTv'])) { |
|
202 | + $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
203 | 203 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
204 | 204 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC" // workaround for correct sort of none-existing ranks |
205 | - ); |
|
206 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
207 | - $selectedTvs[$row['tvid']] = $row; |
|
208 | - } |
|
209 | - $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | - } |
|
211 | - |
|
212 | - $unselectedTvs = array(); |
|
213 | - $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
205 | + ); |
|
206 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
207 | + $selectedTvs[$row['tvid']] = $row; |
|
208 | + } |
|
209 | + $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | + } |
|
211 | + |
|
212 | + $unselectedTvs = array(); |
|
213 | + $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
214 | 214 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
215 | 215 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "", "category, tvcaption"); |
216 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
217 | - $unselectedTvs[$row['tvid']] = $row; |
|
218 | - } |
|
219 | - |
|
220 | - // Catch checkboxes if form not validated |
|
221 | - if(isset($_POST['assignedTv'])) { |
|
222 | - $selectedTvs = array(); |
|
223 | - foreach($_POST['assignedTv'] as $tvid) { |
|
224 | - if(isset($unselectedTvs[$tvid])) { |
|
225 | - $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
226 | - } |
|
227 | - }; |
|
228 | - } |
|
229 | - |
|
230 | - $total = count($selectedTvs); |
|
231 | - ?> |
|
216 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
217 | + $unselectedTvs[$row['tvid']] = $row; |
|
218 | + } |
|
219 | + |
|
220 | + // Catch checkboxes if form not validated |
|
221 | + if(isset($_POST['assignedTv'])) { |
|
222 | + $selectedTvs = array(); |
|
223 | + foreach($_POST['assignedTv'] as $tvid) { |
|
224 | + if(isset($unselectedTvs[$tvid])) { |
|
225 | + $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
226 | + } |
|
227 | + }; |
|
228 | + } |
|
229 | + |
|
230 | + $total = count($selectedTvs); |
|
231 | + ?> |
|
232 | 232 | </div> |
233 | 233 | |
234 | 234 | <div class="tab-page" id="tabAssignedTVs"> |
@@ -238,65 +238,65 @@ discard block |
||
238 | 238 | |
239 | 239 | <div class="container container-body"> |
240 | 240 | <?php |
241 | - if($total > 0) { |
|
242 | - echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
243 | - } |
|
244 | - if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | - echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
246 | - } |
|
247 | - |
|
248 | - // Selected TVs |
|
249 | - $tvList = ''; |
|
250 | - if($total > 0) { |
|
251 | - $tvList .= '<ul>'; |
|
252 | - foreach($selectedTvs as $row) { |
|
253 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
255 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']); |
|
256 | - } |
|
257 | - $tvList .= '</ul>'; |
|
258 | - |
|
259 | - } else { |
|
260 | - echo $_lang['template_no_tv']; |
|
261 | - } |
|
262 | - echo $tvList; |
|
263 | - |
|
264 | - // Unselected TVs |
|
265 | - $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
266 | - $preCat = ''; |
|
267 | - $insideUl = 0; |
|
268 | - while($row = array_shift($unselectedTvs)) { |
|
269 | - if(isset($selectedTvs[$row['tvid']])) { |
|
270 | - continue; |
|
271 | - } // Skip selected |
|
272 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
273 | - if($preCat !== $row['category']) { |
|
274 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
275 | - $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
276 | - $insideUl = 1; |
|
277 | - } |
|
278 | - |
|
279 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
281 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']); |
|
282 | - $tvList .= '</li>'; |
|
283 | - |
|
284 | - $preCat = $row['category']; |
|
285 | - } |
|
286 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
287 | - $tvList .= '</ul>'; |
|
288 | - echo $tvList; |
|
289 | - |
|
290 | - ?> |
|
241 | + if($total > 0) { |
|
242 | + echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
243 | + } |
|
244 | + if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | + echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
246 | + } |
|
247 | + |
|
248 | + // Selected TVs |
|
249 | + $tvList = ''; |
|
250 | + if($total > 0) { |
|
251 | + $tvList .= '<ul>'; |
|
252 | + foreach($selectedTvs as $row) { |
|
253 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
255 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']); |
|
256 | + } |
|
257 | + $tvList .= '</ul>'; |
|
258 | + |
|
259 | + } else { |
|
260 | + echo $_lang['template_no_tv']; |
|
261 | + } |
|
262 | + echo $tvList; |
|
263 | + |
|
264 | + // Unselected TVs |
|
265 | + $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
266 | + $preCat = ''; |
|
267 | + $insideUl = 0; |
|
268 | + while($row = array_shift($unselectedTvs)) { |
|
269 | + if(isset($selectedTvs[$row['tvid']])) { |
|
270 | + continue; |
|
271 | + } // Skip selected |
|
272 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
273 | + if($preCat !== $row['category']) { |
|
274 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
275 | + $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
276 | + $insideUl = 1; |
|
277 | + } |
|
278 | + |
|
279 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
281 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']); |
|
282 | + $tvList .= '</li>'; |
|
283 | + |
|
284 | + $preCat = $row['category']; |
|
285 | + } |
|
286 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
287 | + $tvList .= '</ul>'; |
|
288 | + echo $tvList; |
|
289 | + |
|
290 | + ?> |
|
291 | 291 | </div> |
292 | 292 | </div> |
293 | 293 | |
294 | 294 | <?php |
295 | - // invoke OnTempFormRender event |
|
296 | - $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
297 | - if(is_array($evtOut)) { |
|
298 | - echo implode("", $evtOut); |
|
299 | - } |
|
300 | - ?> |
|
295 | + // invoke OnTempFormRender event |
|
296 | + $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
297 | + if(is_array($evtOut)) { |
|
298 | + echo implode("", $evtOut); |
|
299 | + } |
|
300 | + ?> |
|
301 | 301 | </div> |
302 | 302 | </form> |
@@ -1,21 +1,21 @@ 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 | switch($modx->getManagerApi()->action) { |
7 | - case 12: |
|
8 | - if(!$modx->hasPermission('edit_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 11: |
|
13 | - if(!$modx->hasPermission('new_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 12: |
|
8 | + if(!$modx->hasPermission('edit_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 11: |
|
13 | + if(!$modx->hasPermission('new_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -23,79 +23,79 @@ discard block |
||
23 | 23 | // check to see the snippet editor isn't locked |
24 | 24 | $rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
25 | 25 | if($username = $modx->getDatabase()->getValue($rs)) { |
26 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
26 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
27 | 27 | } |
28 | 28 | // end check for lock |
29 | 29 | |
30 | 30 | if($modx->getManagerApi()->action == '12') { |
31 | - // get user attribute |
|
32 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
|
33 | - $userdata = $modx->getDatabase()->getRow($rs); |
|
34 | - if(!$userdata) { |
|
35 | - $modx->webAlertAndQuit("No user returned!"); |
|
36 | - } |
|
31 | + // get user attribute |
|
32 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
|
33 | + $userdata = $modx->getDatabase()->getRow($rs); |
|
34 | + if(!$userdata) { |
|
35 | + $modx->webAlertAndQuit("No user returned!"); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | if($_SESSION['mgrRole'] != 1 && $userdata['role'] == 1) { |
39 | 39 | $modx->webAlertAndQuit('Illegal attempt to create/modify administrator by non-administrator!'); |
40 | 40 | } |
41 | 41 | |
42 | 42 | |
43 | - // get user settings |
|
44 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'"); |
|
45 | - $usersettings = array(); |
|
46 | - while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
47 | - // manually extract so that user display settings are not overwritten |
|
48 | - foreach($usersettings as $k => $v) { |
|
49 | - if($k != 'manager_language' && $k != 'manager_theme') { |
|
50 | - ${$k} = $v; |
|
51 | - } |
|
52 | - } |
|
43 | + // get user settings |
|
44 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'"); |
|
45 | + $usersettings = array(); |
|
46 | + while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
47 | + // manually extract so that user display settings are not overwritten |
|
48 | + foreach($usersettings as $k => $v) { |
|
49 | + if($k != 'manager_language' && $k != 'manager_theme') { |
|
50 | + ${$k} = $v; |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - // get user name |
|
55 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_users'), "id = '{$user}'"); |
|
56 | - $usernamedata = $modx->getDatabase()->getRow($rs); |
|
57 | - if(!$usernamedata) { |
|
58 | - $modx->webAlertAndQuit("No user returned while getting username!"); |
|
59 | - } |
|
60 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
54 | + // get user name |
|
55 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_users'), "id = '{$user}'"); |
|
56 | + $usernamedata = $modx->getDatabase()->getRow($rs); |
|
57 | + if(!$usernamedata) { |
|
58 | + $modx->webAlertAndQuit("No user returned while getting username!"); |
|
59 | + } |
|
60 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
61 | 61 | } else { |
62 | - $userdata = array(); |
|
63 | - $usersettings = array(); |
|
64 | - $usernamedata = array(); |
|
65 | - $_SESSION['itemname'] = $_lang["new_user"]; |
|
62 | + $userdata = array(); |
|
63 | + $usersettings = array(); |
|
64 | + $usernamedata = array(); |
|
65 | + $_SESSION['itemname'] = $_lang["new_user"]; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // avoid doubling htmlspecialchars (already encoded in DB) |
69 | 69 | foreach($userdata as $key => $val) { |
70 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
70 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
71 | 71 | }; |
72 | 72 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
73 | 73 | |
74 | 74 | // restore saved form |
75 | 75 | $formRestored = false; |
76 | 76 | if($modx->getManagerApi()->hasFormValues()) { |
77 | - $modx->getManagerApi()->loadFormValues(); |
|
78 | - // restore post values |
|
79 | - $userdata = array_merge($userdata, $_POST); |
|
80 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
81 | - $usernamedata['username'] = $userdata['newusername']; |
|
82 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
83 | - $usersettings = array_merge($usersettings, $userdata); |
|
84 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
85 | - extract($usersettings, EXTR_OVERWRITE); |
|
77 | + $modx->getManagerApi()->loadFormValues(); |
|
78 | + // restore post values |
|
79 | + $userdata = array_merge($userdata, $_POST); |
|
80 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
81 | + $usernamedata['username'] = $userdata['newusername']; |
|
82 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
83 | + $usersettings = array_merge($usersettings, $userdata); |
|
84 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
85 | + extract($usersettings, EXTR_OVERWRITE); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // include the country list language file |
89 | 89 | $_country_lang = array(); |
90 | 90 | include_once "lang/country/english_country.inc.php"; |
91 | 91 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
92 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
92 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
93 | 93 | } |
94 | 94 | asort($_country_lang); |
95 | 95 | |
96 | 96 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
97 | 97 | if($which_browser == 'default') { |
98 | - $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
98 | + $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
99 | 99 | } |
100 | 100 | ?> |
101 | 101 | <script type="text/javascript"> |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | <form action="index.php?a=32" method="post" name="userform"> |
206 | 206 | <?php |
207 | 207 | |
208 | - // invoke OnUserFormPrerender event |
|
209 | - $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
|
210 | - "id" => $user |
|
211 | - )); |
|
212 | - if(is_array($evtOut)) { |
|
213 | - echo implode("", $evtOut); |
|
214 | - } |
|
215 | - ?> |
|
208 | + // invoke OnUserFormPrerender event |
|
209 | + $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
|
210 | + "id" => $user |
|
211 | + )); |
|
212 | + if(is_array($evtOut)) { |
|
213 | + echo implode("", $evtOut); |
|
214 | + } |
|
215 | + ?> |
|
216 | 216 | <input type="hidden" name="mode" value="<?php echo $modx->getManagerApi()->action; ?>"> |
217 | 217 | <input type="hidden" name="id" value="<?php echo $user ?>"> |
218 | 218 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -305,25 +305,25 @@ discard block |
||
305 | 305 | <td> </td> |
306 | 306 | <td><?php |
307 | 307 | |
308 | - $rs = $modx->getDatabase()->select( |
|
309 | - 'name, id', |
|
308 | + $rs = $modx->getDatabase()->select( |
|
309 | + 'name, id', |
|
310 | 310 | $modx->getDatabase()->getFullTableName('user_roles'), |
311 | 311 | ($modx->hasPermission('save_role')) ? '' : 'id != 1' |
312 | 312 | ); |
313 | - ?> |
|
313 | + ?> |
|
314 | 314 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
315 | 315 | <?php |
316 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
317 | - if($modx->getManagerApi()->action == '11') { |
|
318 | - $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
319 | - } else { |
|
320 | - $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
321 | - } |
|
322 | - ?> |
|
316 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
317 | + if($modx->getManagerApi()->action == '11') { |
|
318 | + $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
319 | + } else { |
|
320 | + $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
321 | + } |
|
322 | + ?> |
|
323 | 323 | <option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option> |
324 | 324 | <?php |
325 | - } |
|
326 | - ?> |
|
325 | + } |
|
326 | + ?> |
|
327 | 327 | </select></td> |
328 | 328 | </tr> |
329 | 329 | <tr> |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
369 | 369 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
370 | 370 | <?php |
371 | - foreach($_country_lang as $key => $country) { |
|
372 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
373 | - } |
|
374 | - ?> |
|
371 | + foreach($_country_lang as $key => $country) { |
|
372 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
373 | + } |
|
374 | + ?> |
|
375 | 375 | </select></td> |
376 | 376 | </tr> |
377 | 377 | <tr> |
@@ -447,21 +447,21 @@ discard block |
||
447 | 447 | <td><select name="manager_language" class="inputBox" onChange="documentDirty=true"> |
448 | 448 | <option value=""></option> |
449 | 449 | <?php |
450 | - $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
451 | - $dir = dir("includes/lang"); |
|
452 | - while($file = $dir->read()) { |
|
453 | - if(strpos($file, ".inc.php") > 0) { |
|
454 | - $endpos = strpos($file, "."); |
|
455 | - $languagename = substr($file, 0, $endpos); |
|
456 | - $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
457 | - ?> |
|
450 | + $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
451 | + $dir = dir("includes/lang"); |
|
452 | + while($file = $dir->read()) { |
|
453 | + if(strpos($file, ".inc.php") > 0) { |
|
454 | + $endpos = strpos($file, "."); |
|
455 | + $languagename = substr($file, 0, $endpos); |
|
456 | + $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
457 | + ?> |
|
458 | 458 | <option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option> |
459 | 459 | <?php |
460 | 460 | |
461 | - } |
|
462 | - } |
|
463 | - $dir->close(); |
|
464 | - ?> |
|
461 | + } |
|
462 | + } |
|
463 | + $dir->close(); |
|
464 | + ?> |
|
465 | 465 | </select></td> |
466 | 466 | </tr> |
467 | 467 | <tr> |
@@ -536,22 +536,22 @@ discard block |
||
536 | 536 | <td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());"> |
537 | 537 | <option value=""></option> |
538 | 538 | <?php |
539 | - $dir = dir("media/style/"); |
|
540 | - while($file = $dir->read()) { |
|
541 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
542 | - $themename = $file; |
|
543 | - if($themename === 'common') { |
|
544 | - continue; |
|
545 | - } |
|
546 | - $attr = 'value="' . $themename . '" '; |
|
547 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
548 | - $attr .= 'selected="selected" '; |
|
549 | - } |
|
550 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
551 | - } |
|
552 | - } |
|
553 | - $dir->close(); |
|
554 | - ?> |
|
539 | + $dir = dir("media/style/"); |
|
540 | + while($file = $dir->read()) { |
|
541 | + if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
542 | + $themename = $file; |
|
543 | + if($themename === 'common') { |
|
544 | + continue; |
|
545 | + } |
|
546 | + $attr = 'value="' . $themename . '" '; |
|
547 | + if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
548 | + $attr .= 'selected="selected" '; |
|
549 | + } |
|
550 | + echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
551 | + } |
|
552 | + } |
|
553 | + $dir->close(); |
|
554 | + ?> |
|
555 | 555 | </select> |
556 | 556 | <input type="hidden" name="theme_refresher" value=""></td> |
557 | 557 | </tr> |
@@ -587,15 +587,15 @@ discard block |
||
587 | 587 | <th><?php echo $_lang["which_browser_title"] ?></th> |
588 | 588 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
589 | 589 | <?php |
590 | - $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
591 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
592 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
593 | - $dir = str_replace('\\', '/', $dir); |
|
594 | - $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
595 | - $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
596 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
597 | - } |
|
598 | - ?> |
|
590 | + $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
591 | + echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
592 | + foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
593 | + $dir = str_replace('\\', '/', $dir); |
|
594 | + $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
595 | + $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
596 | + echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
597 | + } |
|
598 | + ?> |
|
599 | 599 | </select></td> |
600 | 600 | </tr> |
601 | 601 | <tr> |
@@ -672,17 +672,17 @@ discard block |
||
672 | 672 | <option value=""></option> |
673 | 673 | <?php |
674 | 674 | |
675 | - $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
676 | - // invoke OnRichTextEditorRegister event |
|
677 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
678 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
679 | - if(is_array($evtOut)) { |
|
680 | - for($i = 0; $i < count($evtOut); $i++) { |
|
681 | - $editor = $evtOut[$i]; |
|
682 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
683 | - } |
|
684 | - } |
|
685 | - ?> |
|
675 | + $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
676 | + // invoke OnRichTextEditorRegister event |
|
677 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
678 | + echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
679 | + if(is_array($evtOut)) { |
|
680 | + for($i = 0; $i < count($evtOut); $i++) { |
|
681 | + $editor = $evtOut[$i]; |
|
682 | + echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
683 | + } |
|
684 | + } |
|
685 | + ?> |
|
686 | 686 | </select></td> |
687 | 687 | </tr> |
688 | 688 | <tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>"> |
@@ -715,12 +715,12 @@ discard block |
||
715 | 715 | </tr> |
716 | 716 | </table> |
717 | 717 | <?php |
718 | - // invoke OnInterfaceSettingsRender event |
|
719 | - $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
|
720 | - if(is_array($evtOut)) { |
|
721 | - echo implode("", $evtOut); |
|
722 | - } |
|
723 | - ?> |
|
718 | + // invoke OnInterfaceSettingsRender event |
|
719 | + $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
|
720 | + if(is_array($evtOut)) { |
|
721 | + echo implode("", $evtOut); |
|
722 | + } |
|
723 | + ?> |
|
724 | 724 | </div> |
725 | 725 | |
726 | 726 | <!-- Photo --> |
@@ -769,39 +769,39 @@ discard block |
||
769 | 769 | </div> |
770 | 770 | <?php if($use_udperms == 1) { |
771 | 771 | |
772 | - $groupsarray = array(); |
|
773 | - |
|
774 | - if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited |
|
775 | - $rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'"); |
|
776 | - $groupsarray = $modx->getDatabase()->getColumn('user_group', $rs); |
|
777 | - } |
|
778 | - // retain selected doc groups between post |
|
779 | - if(is_array($_POST['user_groups'])) { |
|
780 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
781 | - } |
|
782 | - ?> |
|
772 | + $groupsarray = array(); |
|
773 | + |
|
774 | + if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited |
|
775 | + $rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'"); |
|
776 | + $groupsarray = $modx->getDatabase()->getColumn('user_group', $rs); |
|
777 | + } |
|
778 | + // retain selected doc groups between post |
|
779 | + if(is_array($_POST['user_groups'])) { |
|
780 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
781 | + } |
|
782 | + ?> |
|
783 | 783 | <div class="tab-page" id="tabAccess"> |
784 | 784 | <h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2> |
785 | 785 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script> |
786 | 786 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
787 | 787 | <?php |
788 | - $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('membergroup_names'), '', 'name'); |
|
789 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
790 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
791 | - } |
|
792 | - } |
|
793 | - ?> |
|
788 | + $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('membergroup_names'), '', 'name'); |
|
789 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
790 | + echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
791 | + } |
|
792 | + } |
|
793 | + ?> |
|
794 | 794 | </div> |
795 | 795 | </div> |
796 | 796 | </div> |
797 | 797 | <input type="submit" name="save" style="display:none"> |
798 | 798 | <?php |
799 | - // invoke OnUserFormRender event |
|
800 | - $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
|
801 | - "id" => $user |
|
802 | - )); |
|
803 | - if(is_array($evtOut)) { |
|
804 | - echo implode("", $evtOut); |
|
805 | - } |
|
806 | - ?> |
|
799 | + // invoke OnUserFormRender event |
|
800 | + $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
|
801 | + "id" => $user |
|
802 | + )); |
|
803 | + if(is_array($evtOut)) { |
|
804 | + echo implode("", $evtOut); |
|
805 | + } |
|
806 | + ?> |
|
807 | 807 | </form> |
@@ -113,31 +113,31 @@ |
||
113 | 113 | // Handle Input "Search in main fields" |
114 | 114 | if ($searchfields != '') { |
115 | 115 | |
116 | - /*start search by TV. Added Rising13*/ |
|
117 | - $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | - $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | - $articul_result = $modx->getDatabase()->query($articul_query); |
|
120 | - $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
|
121 | - if(count($articul_id_array)>0){ |
|
122 | - $articul_id = ''; |
|
123 | - $i = 1; |
|
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
128 | - } |
|
129 | - $i++; |
|
130 | - } |
|
131 | - $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | - }else{ |
|
133 | - $articul_id_query = ''; |
|
134 | - } |
|
135 | - /*end search by TV*/ |
|
116 | + /*start search by TV. Added Rising13*/ |
|
117 | + $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | + $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | + $articul_result = $modx->getDatabase()->query($articul_query); |
|
120 | + $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
|
121 | + if(count($articul_id_array)>0){ |
|
122 | + $articul_id = ''; |
|
123 | + $i = 1; |
|
124 | + foreach( $articul_id_array as $articul ) { |
|
125 | + $articul_id.=$articul['contentid']; |
|
126 | + if($i !== count($articul_id_array)){ |
|
127 | + $articul_id.=','; |
|
128 | + } |
|
129 | + $i++; |
|
130 | + } |
|
131 | + $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | + }else{ |
|
133 | + $articul_id_query = ''; |
|
134 | + } |
|
135 | + /*end search by TV*/ |
|
136 | 136 | |
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query;//search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -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('edit_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // initialize page view state - the $_PAGE object |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | |
12 | 12 | // get and save search string |
13 | 13 | if($_REQUEST['op'] == 'reset') { |
14 | - $query = ''; |
|
15 | - $_PAGE['vs']['search'] = ''; |
|
14 | + $query = ''; |
|
15 | + $_PAGE['vs']['search'] = ''; |
|
16 | 16 | } else { |
17 | - $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
18 | - $sqlQuery = $modx->getDatabase()->escape($query); |
|
19 | - $_PAGE['vs']['search'] = $query; |
|
17 | + $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
18 | + $sqlQuery = $modx->getDatabase()->escape($query); |
|
19 | + $_PAGE['vs']['search'] = $query; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // get & save listmode |
@@ -119,54 +119,54 @@ discard block |
||
119 | 119 | <div class="row"> |
120 | 120 | <div class="table-responsive"> |
121 | 121 | <?php |
122 | - $where = ""; |
|
123 | - if(!$modx->hasPermission('save_role')) { |
|
124 | - $where .= (empty($where) ? "" : " AND ") . "mua.role != 1"; |
|
125 | - } |
|
126 | - if(!empty($sqlQuery)) { |
|
127 | - $where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))"; |
|
128 | - } |
|
129 | - $ds = $modx->getDatabase()->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getDatabase()->getFullTableName('manager_users') . " AS mu |
|
122 | + $where = ""; |
|
123 | + if(!$modx->hasPermission('save_role')) { |
|
124 | + $where .= (empty($where) ? "" : " AND ") . "mua.role != 1"; |
|
125 | + } |
|
126 | + if(!empty($sqlQuery)) { |
|
127 | + $where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))"; |
|
128 | + } |
|
129 | + $ds = $modx->getDatabase()->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getDatabase()->getFullTableName('manager_users') . " AS mu |
|
130 | 130 | INNER JOIN " . $modx->getDatabase()->getFullTableName('user_attributes') . " AS mua ON mua.internalKey=mu.id |
131 | 131 | LEFT JOIN " . $modx->getDatabase()->getFullTableName('user_roles') . " AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC'); |
132 | - $grd = new \EvolutionCMS\Support\DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items |
|
133 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
134 | - $grd->cssClass = "table data"; |
|
135 | - $grd->columnHeaderClass = "tableHeader"; |
|
136 | - $grd->itemClass = "tableItem"; |
|
137 | - $grd->altItemClass = "tableAltItem"; |
|
138 | - $grd->fields = "id,username,fullname,role,email,thislogin,logincount,blocked"; |
|
139 | - $grd->columns = implode(',', array( |
|
140 | - $_lang["icon"], |
|
141 | - $_lang["name"], |
|
142 | - $_lang["user_full_name"], |
|
143 | - $_lang['role'], |
|
144 | - $_lang["email"], |
|
145 | - $_lang["user_prevlogin"], |
|
146 | - $_lang["user_logincount"], |
|
147 | - $_lang["user_block"] |
|
148 | - )); |
|
149 | - $grd->colWidths = "1%,,,,,1%,1%,1%"; |
|
150 | - $grd->colAligns = "center,,,,,right' nowrap='nowrap,right,center"; |
|
151 | - $grd->colTypes = implode('||', array( |
|
152 | - 'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>', |
|
153 | - 'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>', |
|
154 | - 'template:[+fullname+]', |
|
155 | - 'template:[+role+]', |
|
156 | - 'template:[+email+]', |
|
157 | - 'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M', |
|
158 | - 'template:[+logincount+]', |
|
159 | - 'template:[+blocked+]' |
|
160 | - )); |
|
161 | - if($listmode == '1') { |
|
162 | - $grd->pageSize = 0; |
|
163 | - } |
|
164 | - if($_REQUEST['op'] == 'reset') { |
|
165 | - $grd->pageNumber = 1; |
|
166 | - } |
|
167 | - // render grid |
|
168 | - echo $grd->render(); |
|
169 | - ?> |
|
132 | + $grd = new \EvolutionCMS\Support\DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items |
|
133 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
134 | + $grd->cssClass = "table data"; |
|
135 | + $grd->columnHeaderClass = "tableHeader"; |
|
136 | + $grd->itemClass = "tableItem"; |
|
137 | + $grd->altItemClass = "tableAltItem"; |
|
138 | + $grd->fields = "id,username,fullname,role,email,thislogin,logincount,blocked"; |
|
139 | + $grd->columns = implode(',', array( |
|
140 | + $_lang["icon"], |
|
141 | + $_lang["name"], |
|
142 | + $_lang["user_full_name"], |
|
143 | + $_lang['role'], |
|
144 | + $_lang["email"], |
|
145 | + $_lang["user_prevlogin"], |
|
146 | + $_lang["user_logincount"], |
|
147 | + $_lang["user_block"] |
|
148 | + )); |
|
149 | + $grd->colWidths = "1%,,,,,1%,1%,1%"; |
|
150 | + $grd->colAligns = "center,,,,,right' nowrap='nowrap,right,center"; |
|
151 | + $grd->colTypes = implode('||', array( |
|
152 | + 'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>', |
|
153 | + 'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>', |
|
154 | + 'template:[+fullname+]', |
|
155 | + 'template:[+role+]', |
|
156 | + 'template:[+email+]', |
|
157 | + 'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M', |
|
158 | + 'template:[+logincount+]', |
|
159 | + 'template:[+blocked+]' |
|
160 | + )); |
|
161 | + if($listmode == '1') { |
|
162 | + $grd->pageSize = 0; |
|
163 | + } |
|
164 | + if($_REQUEST['op'] == 'reset') { |
|
165 | + $grd->pageNumber = 1; |
|
166 | + } |
|
167 | + // render grid |
|
168 | + echo $grd->render(); |
|
169 | + ?> |
|
170 | 170 | </div> |
171 | 171 | </div> |
172 | 172 | </div> |
@@ -72,8 +72,8 @@ |
||
72 | 72 | 'maxImageWidth' => $modx->config['maxImageWidth'], |
73 | 73 | 'maxImageHeight' => $modx->config['maxImageHeight'], |
74 | 74 | 'clientResize' => $modx->config['clientResize'] && $modx->config['maxImageWidth'] && $modx->config['maxImageHeight'] ? array('maxWidth' => $modx->config['maxImageWidth'], |
75 | - 'maxHeight' => $modx->config['maxImageHeight'], |
|
76 | - 'quality' => $modx->config['jpegQuality'] / 100 |
|
75 | + 'maxHeight' => $modx->config['maxImageHeight'], |
|
76 | + 'quality' => $modx->config['jpegQuality'] / 100 |
|
77 | 77 | ) : array(), |
78 | 78 | |
79 | 79 | 'thumbWidth' => $modx->config['thumbWidth'], |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc This file is included first, before each other |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - * |
|
14 | - * This file is the place you can put any code (at the end of the file), |
|
15 | - * which will be executed before any other. Suitable for: |
|
16 | - * 1. Set PHP ini settings using ini_set() |
|
17 | - * 2. Custom session save handler with session_set_save_handler() |
|
18 | - * 3. Any custom integration code. If you use any global variables |
|
19 | - * here, they can be accessed in config.php via $GLOBALS array. |
|
20 | - * It's recommended to use constants instead. |
|
21 | - */ |
|
4 | + * |
|
5 | + * @desc This file is included first, before each other |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + * |
|
14 | + * This file is the place you can put any code (at the end of the file), |
|
15 | + * which will be executed before any other. Suitable for: |
|
16 | + * 1. Set PHP ini settings using ini_set() |
|
17 | + * 2. Custom session save handler with session_set_save_handler() |
|
18 | + * 3. Any custom integration code. If you use any global variables |
|
19 | + * here, they can be accessed in config.php via $GLOBALS array. |
|
20 | + * It's recommended to use constants instead. |
|
21 | + */ |
|
22 | 22 | define('IN_MANAGER_MODE', true); |
23 | 23 | define('MODX_API_MODE', true); |
24 | 24 | include_once(__DIR__."/../../../../../index.php"); |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Uploader class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Uploader class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class uploader { |
16 | 16 | |
@@ -18,92 +18,92 @@ discard block |
||
18 | 18 | const VERSION = "2.54"; |
19 | 19 | |
20 | 20 | /** Config session-overrided settings |
21 | - * @var array */ |
|
21 | + * @var array */ |
|
22 | 22 | protected $config = array(); |
23 | 23 | |
24 | 24 | /** Default image driver |
25 | - * @var string */ |
|
25 | + * @var string */ |
|
26 | 26 | protected $imageDriver = "gd"; |
27 | 27 | |
28 | 28 | /** Opener applocation properties |
29 | - * $opener['name'] Got from $_GET['opener']; |
|
30 | - * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | - * $opener['TinyMCE'] Boolean |
|
32 | - * @var array */ |
|
29 | + * $opener['name'] Got from $_GET['opener']; |
|
30 | + * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | + * $opener['TinyMCE'] Boolean |
|
32 | + * @var array */ |
|
33 | 33 | protected $opener = array(); |
34 | 34 | |
35 | 35 | /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant |
36 | - * @var string */ |
|
36 | + * @var string */ |
|
37 | 37 | protected $type; |
38 | 38 | |
39 | 39 | /** Helper property. Local filesystem path to the Type Directory |
40 | - * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | - * @var string */ |
|
40 | + * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | + * @var string */ |
|
42 | 42 | protected $typeDir; |
43 | 43 | |
44 | 44 | /** Helper property. Web URL to the Type Directory |
45 | - * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | - * @var string */ |
|
45 | + * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | + * @var string */ |
|
47 | 47 | protected $typeURL; |
48 | 48 | |
49 | 49 | /** Linked to $config['types'] |
50 | - * @var array */ |
|
50 | + * @var array */ |
|
51 | 51 | protected $types = array(); |
52 | 52 | |
53 | 53 | /** Settings which can override default settings if exists as keys in $config['types'][$type] array |
54 | - * @var array */ |
|
54 | + * @var array */ |
|
55 | 55 | protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark'); |
56 | 56 | |
57 | 57 | /** Got from language file |
58 | - * @var string */ |
|
58 | + * @var string */ |
|
59 | 59 | protected $charset; |
60 | 60 | |
61 | 61 | /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property |
62 | - * @var string */ |
|
62 | + * @var string */ |
|
63 | 63 | protected $lang = 'en'; |
64 | 64 | |
65 | 65 | /** Possible language $_GET keys |
66 | - * @var array */ |
|
66 | + * @var array */ |
|
67 | 67 | protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code'); |
68 | 68 | |
69 | 69 | /** Uploaded file(s) info. Linked to first $_FILES element |
70 | - * @var array */ |
|
70 | + * @var array */ |
|
71 | 71 | protected $file; |
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | - * @var string */ |
|
74 | + * @var string */ |
|
75 | 75 | protected $dateTimeFull; // Currently not used |
76 | 76 | protected $dateTimeMid; // Currently not used |
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
80 | - * @var array */ |
|
80 | + * @var array */ |
|
81 | 81 | protected $labels = array(); |
82 | 82 | |
83 | 83 | /** Contain unprocessed $_GET array. Please use this instead of $_GET |
84 | - * @var array */ |
|
84 | + * @var array */ |
|
85 | 85 | protected $get; |
86 | 86 | |
87 | 87 | /** Contain unprocessed $_POST array. Please use this instead of $_POST |
88 | - * @var array */ |
|
88 | + * @var array */ |
|
89 | 89 | protected $post; |
90 | 90 | |
91 | 91 | /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE |
92 | - * @var array */ |
|
92 | + * @var array */ |
|
93 | 93 | protected $cookie; |
94 | 94 | |
95 | 95 | /** Session array. Please use this property instead of $_SESSION |
96 | - * @var array */ |
|
96 | + * @var array */ |
|
97 | 97 | protected $session; |
98 | 98 | |
99 | 99 | /** CMS integration attribute (got from $_GET['cms']) |
100 | - * @var string */ |
|
100 | + * @var string */ |
|
101 | 101 | protected $cms = ""; |
102 | 102 | |
103 | 103 | protected $modx = null; |
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | - * @param string $property |
|
106 | - * @return mixed */ |
|
105 | + * @param string $property |
|
106 | + * @return mixed */ |
|
107 | 107 | public function __get($property) { |
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ) |
137 | 137 | $this->cms = $this->get['cms']; |
138 | 138 | |
139 | - // LINKING UPLOADED FILE |
|
139 | + // LINKING UPLOADED FILE |
|
140 | 140 | if (count($_FILES)) |
141 | 141 | $this->file = &$_FILES[key($_FILES)]; |
142 | 142 | |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
218 | 218 | ? path::normalize($this->config['uploadDir']) |
219 | 219 | : path::url2fullPath("/$path"); |
220 | - $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
221 | - $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
220 | + $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
221 | + $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
222 | 222 | |
223 | 223 | // SITE ROOT |
224 | 224 | } elseif ($this->config['uploadURL'] == "/") { |
@@ -291,23 +291,23 @@ discard block |
||
291 | 291 | * @return array|bool|int|null|string|void |
292 | 292 | */ |
293 | 293 | protected function getTransaliasSettings() { |
294 | - $modx = evolutionCMS(); |
|
295 | - |
|
296 | - // Cleaning uploaded filename? |
|
297 | - $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
298 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
299 | - // Transalias plugin active? |
|
300 | - $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
301 | - if ($properties = $modx->getDatabase()->getValue($res)) { |
|
302 | - $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
303 | - } else { |
|
304 | - $properties = NULL; |
|
305 | - } |
|
306 | - } else { |
|
307 | - $properties = NULL; |
|
308 | - } |
|
309 | - return $properties; |
|
310 | - } |
|
294 | + $modx = evolutionCMS(); |
|
295 | + |
|
296 | + // Cleaning uploaded filename? |
|
297 | + $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
298 | + if ($modx->getDatabase()->getValue($setting)>0) { |
|
299 | + // Transalias plugin active? |
|
300 | + $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
301 | + if ($properties = $modx->getDatabase()->getValue($res)) { |
|
302 | + $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
303 | + } else { |
|
304 | + $properties = NULL; |
|
305 | + } |
|
306 | + } else { |
|
307 | + $properties = NULL; |
|
308 | + } |
|
309 | + return $properties; |
|
310 | + } |
|
311 | 311 | |
312 | 312 | |
313 | 313 | /** |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | * @return mixed|string |
316 | 316 | */ |
317 | 317 | protected function normalizeFilename($filename) { |
318 | - if ($this->getTransaliasSettings()) { |
|
319 | - $format = strrchr($filename, "."); |
|
320 | - $filename = str_replace($format, "", $filename); |
|
321 | - $filename = $this->modx->stripAlias($filename).$format; |
|
322 | - } |
|
323 | - return $filename; |
|
324 | - } |
|
318 | + if ($this->getTransaliasSettings()) { |
|
319 | + $format = strrchr($filename, "."); |
|
320 | + $filename = str_replace($format, "", $filename); |
|
321 | + $filename = $this->modx->stripAlias($filename).$format; |
|
322 | + } |
|
323 | + return $filename; |
|
324 | + } |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * @param $dirname |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | return $this->label("The image is too big and/or cannot be resized."); |
397 | 397 | |
398 | 398 | |
399 | - // CHECK FOR MODX MAX FILE SIZE |
|
400 | - $actualfilesize=filesize($file['tmp_name']); |
|
401 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
399 | + // CHECK FOR MODX MAX FILE SIZE |
|
400 | + $actualfilesize=filesize($file['tmp_name']); |
|
401 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
403 | 403 | |
404 | 404 | return true; |
405 | 405 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $top = isset($this->config['watermark']['top']) |
576 | 576 | ? $this->config['watermark']['top'] : false; |
577 | 577 | $img->watermark($this->config['watermark']['file'], $left, $top); |
578 | - } |
|
578 | + } |
|
579 | 579 | |
580 | 580 | $options = array( 'file' => $file ); |
581 | 581 |
@@ -1,45 +1,45 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Abstract image driver class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Abstract image driver class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | abstract class image { |
16 | 16 | const DEFAULT_JPEG_QUALITY = 75; |
17 | 17 | |
18 | 18 | /** Image resource or object |
19 | - * @var mixed */ |
|
19 | + * @var mixed */ |
|
20 | 20 | protected $image; |
21 | 21 | |
22 | 22 | /** Image width in pixels |
23 | - * @var integer */ |
|
23 | + * @var integer */ |
|
24 | 24 | protected $width; |
25 | 25 | |
26 | 26 | /** Image height in pixels |
27 | - * @var integer */ |
|
27 | + * @var integer */ |
|
28 | 28 | protected $height; |
29 | 29 | |
30 | 30 | /** Init error |
31 | - * @var bool */ |
|
31 | + * @var bool */ |
|
32 | 32 | protected $initError = false; |
33 | 33 | |
34 | 34 | /** Driver specific options |
35 | - * @var array */ |
|
35 | + * @var array */ |
|
36 | 36 | protected $options = array(); |
37 | 37 | |
38 | 38 | |
39 | 39 | /** Magic method which allows read-only access to all protected or private |
40 | - * class properties |
|
41 | - * @param string $property |
|
42 | - * @return mixed */ |
|
40 | + * class properties |
|
41 | + * @param string $property |
|
42 | + * @return mixed */ |
|
43 | 43 | |
44 | 44 | final public function __get($property) { |
45 | 45 | return property_exists($this, $property) ? $this->$property : null; |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | |
48 | 48 | |
49 | 49 | /** Constructor. Parameter $image should be: |
50 | - * 1. An instance of image driver class (copy instance). |
|
51 | - * 2. An image represented by the type of the $image property |
|
52 | - * (resource or object). |
|
53 | - * 3. An array with two elements. First - width, second - height. |
|
54 | - * Creates a blank image. |
|
55 | - * 4. A filename string. Get image form file. |
|
56 | - * Second parameter is used by pass some specific image driver options |
|
57 | - * @param mixed $image |
|
58 | - * @param array $options */ |
|
50 | + * 1. An instance of image driver class (copy instance). |
|
51 | + * 2. An image represented by the type of the $image property |
|
52 | + * (resource or object). |
|
53 | + * 3. An array with two elements. First - width, second - height. |
|
54 | + * Creates a blank image. |
|
55 | + * 4. A filename string. Get image form file. |
|
56 | + * Second parameter is used by pass some specific image driver options |
|
57 | + * @param mixed $image |
|
58 | + * @param array $options */ |
|
59 | 59 | |
60 | 60 | public function __construct($image, array $options=array()) { |
61 | 61 | $this->image = $this->width = $this->height = null; |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | |
71 | 71 | |
72 | 72 | /** Factory pattern to load selected driver. $image and $options are passed |
73 | - * to the constructor of the image driver |
|
74 | - * @param string $driver |
|
75 | - * @param mixed $image |
|
76 | - * @return object */ |
|
73 | + * to the constructor of the image driver |
|
74 | + * @param string $driver |
|
75 | + * @param mixed $image |
|
76 | + * @return object */ |
|
77 | 77 | |
78 | 78 | final static function factory($driver, $image, array $options=array()) { |
79 | 79 | $class = "image_$driver"; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | |
84 | 84 | /** Checks if the drivers in the array parameter could be used. Returns first |
85 | - * found one |
|
86 | - * @param array $drivers |
|
87 | - * @return string */ |
|
85 | + * found one |
|
86 | + * @param array $drivers |
|
87 | + * @return string */ |
|
88 | 88 | |
89 | 89 | final static function getDriver(array $drivers=array('gd')) { |
90 | 90 | foreach ($drivers as $driver) { |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | |
102 | 102 | |
103 | 103 | /** Returns an array. Element 0 - image resource. Element 1 - width. Element 2 - height. |
104 | - * Returns FALSE on failure. |
|
105 | - * @param mixed $image |
|
106 | - * @return array */ |
|
104 | + * Returns FALSE on failure. |
|
105 | + * @param mixed $image |
|
106 | + * @return array */ |
|
107 | 107 | |
108 | 108 | final protected function buildImage($image) { |
109 | 109 | $class = get_class($this); |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | /** Returns calculated proportional width from the given height |
129 | - * @param integer $resizedHeight |
|
130 | - * @return integer */ |
|
129 | + * @param integer $resizedHeight |
|
130 | + * @return integer */ |
|
131 | 131 | |
132 | 132 | final public function getPropWidth($resizedHeight) { |
133 | 133 | $width = round(($this->width * $resizedHeight) / $this->height); |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | |
138 | 138 | |
139 | 139 | /** Returns calculated proportional height from the given width |
140 | - * @param integer $resizedWidth |
|
141 | - * @return integer */ |
|
140 | + * @param integer $resizedWidth |
|
141 | + * @return integer */ |
|
142 | 142 | |
143 | 143 | final public function getPropHeight($resizedWidth) { |
144 | 144 | $height = round(($this->height * $resizedWidth) / $this->width); |
@@ -148,45 +148,45 @@ discard block |
||
148 | 148 | |
149 | 149 | |
150 | 150 | /** Checks if PHP needs some extra extensions to use the image driver. This |
151 | - * static method should be implemented into driver classes like abstract |
|
152 | - * methods |
|
153 | - * @return bool */ |
|
151 | + * static method should be implemented into driver classes like abstract |
|
152 | + * methods |
|
153 | + * @return bool */ |
|
154 | 154 | static function available() { return false; } |
155 | 155 | |
156 | 156 | /** Checks if file is an image. This static method should be implemented into |
157 | - * driver classes like abstract methods |
|
158 | - * @param string $file |
|
159 | - * @return bool */ |
|
157 | + * driver classes like abstract methods |
|
158 | + * @param string $file |
|
159 | + * @return bool */ |
|
160 | 160 | static function checkImage($file) { return false; } |
161 | 161 | |
162 | 162 | /** Resize image. Should return TRUE on success or FALSE on failure |
163 | - * @param integer $width |
|
164 | - * @param integer $height |
|
165 | - * @return bool */ |
|
163 | + * @param integer $width |
|
164 | + * @param integer $height |
|
165 | + * @return bool */ |
|
166 | 166 | abstract public function resize($width, $height); |
167 | 167 | |
168 | 168 | /** Resize image to fit in given resolution. Should returns TRUE on success |
169 | - * or FALSE on failure. If $background is set, the image size will be |
|
170 | - * $width x $height and the empty spaces (if any) will be filled with defined |
|
171 | - * color. Background color examples: "#5f5", "#ff67ca", array(255, 255, 255) |
|
172 | - * @param integer $width |
|
173 | - * @param integer $height |
|
174 | - * @param mixed $background |
|
175 | - * @return bool */ |
|
169 | + * or FALSE on failure. If $background is set, the image size will be |
|
170 | + * $width x $height and the empty spaces (if any) will be filled with defined |
|
171 | + * color. Background color examples: "#5f5", "#ff67ca", array(255, 255, 255) |
|
172 | + * @param integer $width |
|
173 | + * @param integer $height |
|
174 | + * @param mixed $background |
|
175 | + * @return bool */ |
|
176 | 176 | abstract public function resizeFit($width, $height, $background=false); |
177 | 177 | |
178 | 178 | /** Resize and crop the image to fit in given resolution. Returns TRUE on |
179 | - * success or FALSE on failure |
|
180 | - * @param mixed $src |
|
181 | - * @param integer $offset |
|
182 | - * @return bool */ |
|
179 | + * success or FALSE on failure |
|
180 | + * @param mixed $src |
|
181 | + * @param integer $offset |
|
182 | + * @return bool */ |
|
183 | 183 | abstract public function resizeCrop($width, $height, $offset=false); |
184 | 184 | |
185 | 185 | |
186 | 186 | /** Rotate image |
187 | - * @param integer $angle |
|
188 | - * @param string $background |
|
189 | - * @return bool */ |
|
187 | + * @param integer $angle |
|
188 | + * @param string $background |
|
189 | + * @return bool */ |
|
190 | 190 | abstract public function rotate($angle, $background="#000000"); |
191 | 191 | |
192 | 192 | abstract public function flipHorizontal(); |
@@ -194,44 +194,44 @@ discard block |
||
194 | 194 | abstract public function flipVertical(); |
195 | 195 | |
196 | 196 | /** Apply a PNG or GIF watermark to the image. $top and $left parameters sets |
197 | - * the offset of the watermark in pixels. Boolean and NULL values are possible |
|
198 | - * too. In default case (FALSE, FALSE) the watermark should be applyed to |
|
199 | - * the bottom right corner. NULL values means center aligning. If the |
|
200 | - * watermark is bigger than the image or it's partialy or fully outside the |
|
201 | - * image, it shoudn't be applied |
|
202 | - * @param string $file |
|
203 | - * @param mixed $top |
|
204 | - * @param mixed $left |
|
205 | - * @return bool */ |
|
197 | + * the offset of the watermark in pixels. Boolean and NULL values are possible |
|
198 | + * too. In default case (FALSE, FALSE) the watermark should be applyed to |
|
199 | + * the bottom right corner. NULL values means center aligning. If the |
|
200 | + * watermark is bigger than the image or it's partialy or fully outside the |
|
201 | + * image, it shoudn't be applied |
|
202 | + * @param string $file |
|
203 | + * @param mixed $top |
|
204 | + * @param mixed $left |
|
205 | + * @return bool */ |
|
206 | 206 | abstract public function watermark($file, $left=false, $top=false); |
207 | 207 | |
208 | 208 | /** Should output the image. Second parameter is used to pass some options like |
209 | - * 'file' - if is set, the output will be written to a file |
|
210 | - * 'quality' - compression quality |
|
211 | - * It's possible to use extra specific options required by image type ($type) |
|
212 | - * @param string $type |
|
213 | - * @param array $options |
|
214 | - * @return bool */ |
|
209 | + * 'file' - if is set, the output will be written to a file |
|
210 | + * 'quality' - compression quality |
|
211 | + * It's possible to use extra specific options required by image type ($type) |
|
212 | + * @param string $type |
|
213 | + * @param array $options |
|
214 | + * @return bool */ |
|
215 | 215 | abstract public function output($type='jpeg', array $options=array()); |
216 | 216 | |
217 | 217 | /** This method should create a blank image with selected size. Should returns |
218 | - * resource or object related to the created image, which will be passed to |
|
219 | - * $image property |
|
220 | - * @param integer $width |
|
221 | - * @param integer $height |
|
222 | - * @return mixed */ |
|
218 | + * resource or object related to the created image, which will be passed to |
|
219 | + * $image property |
|
220 | + * @param integer $width |
|
221 | + * @param integer $height |
|
222 | + * @return mixed */ |
|
223 | 223 | abstract protected function getBlankImage($width, $height); |
224 | 224 | |
225 | 225 | /** This method should create an image from source image. Only first parameter |
226 | - * ($image) is input. Its type should be filename string or a type of the |
|
227 | - * $image property. See the constructor reference for details. The |
|
228 | - * parametters $width and $height are output only. Should returns resource or |
|
229 | - * object related to the created image, which will be passed to $image |
|
230 | - * property |
|
231 | - * @param mixed $image |
|
232 | - * @param integer $width |
|
233 | - * @param integer $height |
|
234 | - * @return mixed */ |
|
226 | + * ($image) is input. Its type should be filename string or a type of the |
|
227 | + * $image property. See the constructor reference for details. The |
|
228 | + * parametters $width and $height are output only. Should returns resource or |
|
229 | + * object related to the created image, which will be passed to $image |
|
230 | + * property |
|
231 | + * @param mixed $image |
|
232 | + * @param integer $width |
|
233 | + * @param integer $height |
|
234 | + * @return mixed */ |
|
235 | 235 | abstract protected function getImage($image, &$width, &$height); |
236 | 236 | |
237 | 237 | } |
@@ -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('save_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $tbl_web_users = $modx->getDatabase()->getFullTableName('web_users'); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | $input = $_POST; |
14 | 14 | foreach($input as $k => $v) { |
15 | - if($k !== 'comment' && $k !=='user_groups') { |
|
16 | - $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
|
17 | - } |
|
18 | - $input[$k] = $v; |
|
15 | + if($k !== 'comment' && $k !=='user_groups') { |
|
16 | + $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
|
17 | + } |
|
18 | + $input[$k] = $v; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = (int)$input['id']; |
@@ -51,82 +51,82 @@ discard block |
||
51 | 51 | |
52 | 52 | // verify password |
53 | 53 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
54 | - webAlertAndQuit("Password typed is mismatched", 88); |
|
54 | + webAlertAndQuit("Password typed is mismatched", 88); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // verify email |
58 | 58 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
59 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
59 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | switch($input['mode']) { |
63 | - case '87' : // new user |
|
64 | - // check if this user name already exist |
|
65 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | - $limit = $modx->getDatabase()->getValue($rs); |
|
67 | - if($limit > 0) { |
|
68 | - webAlertAndQuit("User name is already in use!", 88); |
|
69 | - } |
|
70 | - |
|
71 | - // check if the email address already exist |
|
72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | - $limit = $modx->getDatabase()->getValue($rs); |
|
75 | - if($limit > 0) { |
|
76 | - webAlertAndQuit("Email is already in use!", 88); |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - // generate a new password for this user |
|
81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | - if(strlen($specifiedpassword) < 6) { |
|
83 | - webAlertAndQuit("Password is too short!", 88); |
|
84 | - } else { |
|
85 | - $newpassword = $specifiedpassword; |
|
86 | - } |
|
87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | - } elseif($passwordgenmethod == 'g') { |
|
90 | - $newpassword = generate_password(8); |
|
91 | - } else { |
|
92 | - webAlertAndQuit("No password generation method specified!", 88); |
|
93 | - } |
|
94 | - |
|
95 | - // invoke OnBeforeWUsrFormSave event |
|
96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | - "mode" => "new", |
|
98 | - )); |
|
99 | - |
|
100 | - // create the user account |
|
101 | - $field = array(); |
|
102 | - $field['username'] = $esc_newusername; |
|
103 | - $field['password'] = md5($newpassword); |
|
104 | - $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users); |
|
105 | - |
|
106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | - $field = $modx->getDatabase()->escape($field); |
|
108 | - $modx->getDatabase()->insert($field, $tbl_web_user_attributes); |
|
109 | - |
|
110 | - // Save User Settings |
|
63 | + case '87' : // new user |
|
64 | + // check if this user name already exist |
|
65 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | + $limit = $modx->getDatabase()->getValue($rs); |
|
67 | + if($limit > 0) { |
|
68 | + webAlertAndQuit("User name is already in use!", 88); |
|
69 | + } |
|
70 | + |
|
71 | + // check if the email address already exist |
|
72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | + $limit = $modx->getDatabase()->getValue($rs); |
|
75 | + if($limit > 0) { |
|
76 | + webAlertAndQuit("Email is already in use!", 88); |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + // generate a new password for this user |
|
81 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | + if(strlen($specifiedpassword) < 6) { |
|
83 | + webAlertAndQuit("Password is too short!", 88); |
|
84 | + } else { |
|
85 | + $newpassword = $specifiedpassword; |
|
86 | + } |
|
87 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | + } elseif($passwordgenmethod == 'g') { |
|
90 | + $newpassword = generate_password(8); |
|
91 | + } else { |
|
92 | + webAlertAndQuit("No password generation method specified!", 88); |
|
93 | + } |
|
94 | + |
|
95 | + // invoke OnBeforeWUsrFormSave event |
|
96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | + "mode" => "new", |
|
98 | + )); |
|
99 | + |
|
100 | + // create the user account |
|
101 | + $field = array(); |
|
102 | + $field['username'] = $esc_newusername; |
|
103 | + $field['password'] = md5($newpassword); |
|
104 | + $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users); |
|
105 | + |
|
106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | + $field = $modx->getDatabase()->escape($field); |
|
108 | + $modx->getDatabase()->insert($field, $tbl_web_user_attributes); |
|
109 | + |
|
110 | + // Save User Settings |
|
111 | 111 | saveWebUserSettings($internalKey); |
112 | 112 | |
113 | - // Set the item name for logger |
|
114 | - $_SESSION['itemname'] = $newusername; |
|
115 | - |
|
116 | - /*******************************************************************************/ |
|
117 | - // put the user in the user_groups he/ she should be in |
|
118 | - // first, check that up_perms are switched on! |
|
119 | - if($use_udperms == 1) { |
|
120 | - if(!empty($user_groups)) { |
|
121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
122 | - $f = array(); |
|
123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | - $f['webuser'] = $internalKey; |
|
125 | - $modx->getDatabase()->insert($f, $tbl_web_groups); |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
129 | - // end of user_groups stuff! |
|
113 | + // Set the item name for logger |
|
114 | + $_SESSION['itemname'] = $newusername; |
|
115 | + |
|
116 | + /*******************************************************************************/ |
|
117 | + // put the user in the user_groups he/ she should be in |
|
118 | + // first, check that up_perms are switched on! |
|
119 | + if($use_udperms == 1) { |
|
120 | + if(!empty($user_groups)) { |
|
121 | + for($i = 0; $i < count($user_groups); $i++) { |
|
122 | + $f = array(); |
|
123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | + $f['webuser'] = $internalKey; |
|
125 | + $modx->getDatabase()->insert($f, $tbl_web_groups); |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | + // end of user_groups stuff! |
|
130 | 130 | |
131 | 131 | // invoke OnWebSaveUser event |
132 | 132 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -144,26 +144,26 @@ discard block |
||
144 | 144 | "id" => $internalKey |
145 | 145 | )); |
146 | 146 | |
147 | - if($passwordnotifymethod == 'e') { |
|
147 | + if($passwordnotifymethod == 'e') { |
|
148 | 148 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
149 | - if($input['stay'] != '') { |
|
150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | - header($header); |
|
153 | - } else { |
|
154 | - $header = "Location: index.php?a=99&r=2"; |
|
155 | - header($header); |
|
156 | - } |
|
157 | - } else { |
|
158 | - if($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - } else { |
|
162 | - $stayUrl = "index.php?a=99&r=2"; |
|
163 | - } |
|
164 | - |
|
165 | - include_once "header.inc.php"; |
|
166 | - ?> |
|
149 | + if($input['stay'] != '') { |
|
150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | + header($header); |
|
153 | + } else { |
|
154 | + $header = "Location: index.php?a=99&r=2"; |
|
155 | + header($header); |
|
156 | + } |
|
157 | + } else { |
|
158 | + if($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + } else { |
|
162 | + $stayUrl = "index.php?a=99&r=2"; |
|
163 | + } |
|
164 | + |
|
165 | + include_once "header.inc.php"; |
|
166 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
169 | 169 | |
@@ -185,86 +185,86 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once "footer.inc.php"; |
|
189 | - } |
|
190 | - break; |
|
191 | - case '88' : // edit user |
|
192 | - // generate a new password for this user |
|
193 | - if($genpassword == 1) { |
|
194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | - if(strlen($specifiedpassword) < 6) { |
|
196 | - webAlertAndQuit("Password is too short!", 88); |
|
197 | - } else { |
|
198 | - $newpassword = $specifiedpassword; |
|
199 | - } |
|
200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | - } elseif($passwordgenmethod == 'g') { |
|
203 | - $newpassword = generate_password(8); |
|
204 | - } else { |
|
205 | - webAlertAndQuit("No password generation method specified!", 88); |
|
206 | - } |
|
207 | - } |
|
208 | - if($passwordnotifymethod == 'e') { |
|
188 | + include_once "footer.inc.php"; |
|
189 | + } |
|
190 | + break; |
|
191 | + case '88' : // edit user |
|
192 | + // generate a new password for this user |
|
193 | + if($genpassword == 1) { |
|
194 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | + if(strlen($specifiedpassword) < 6) { |
|
196 | + webAlertAndQuit("Password is too short!", 88); |
|
197 | + } else { |
|
198 | + $newpassword = $specifiedpassword; |
|
199 | + } |
|
200 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | + } elseif($passwordgenmethod == 'g') { |
|
203 | + $newpassword = generate_password(8); |
|
204 | + } else { |
|
205 | + webAlertAndQuit("No password generation method specified!", 88); |
|
206 | + } |
|
207 | + } |
|
208 | + if($passwordnotifymethod == 'e') { |
|
209 | 209 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
210 | - } |
|
211 | - |
|
212 | - // check if the username already exist |
|
213 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | - $limit = $modx->getDatabase()->getValue($rs); |
|
215 | - if($limit > 0) { |
|
216 | - webAlertAndQuit("User name is already in use!", 88); |
|
217 | - } |
|
218 | - |
|
219 | - // check if the email address already exists |
|
220 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | - $limit = $modx->getDatabase()->getValue($rs); |
|
223 | - if($limit > 0) { |
|
224 | - webAlertAndQuit("Email is already in use!", 88); |
|
225 | - } |
|
226 | - } |
|
227 | - |
|
228 | - // invoke OnBeforeWUsrFormSave event |
|
229 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | - "mode" => "upd", |
|
231 | - "id" => $id |
|
232 | - )); |
|
233 | - |
|
234 | - // update user name and password |
|
235 | - $field = array(); |
|
236 | - $field['username'] = $esc_newusername; |
|
237 | - if($genpassword == 1) { |
|
238 | - $field['password'] = md5($newpassword); |
|
239 | - } |
|
240 | - $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | - $field = $modx->getDatabase()->escape($field); |
|
243 | - $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | - |
|
245 | - // Save User Settings |
|
210 | + } |
|
211 | + |
|
212 | + // check if the username already exist |
|
213 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | + $limit = $modx->getDatabase()->getValue($rs); |
|
215 | + if($limit > 0) { |
|
216 | + webAlertAndQuit("User name is already in use!", 88); |
|
217 | + } |
|
218 | + |
|
219 | + // check if the email address already exists |
|
220 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | + $limit = $modx->getDatabase()->getValue($rs); |
|
223 | + if($limit > 0) { |
|
224 | + webAlertAndQuit("Email is already in use!", 88); |
|
225 | + } |
|
226 | + } |
|
227 | + |
|
228 | + // invoke OnBeforeWUsrFormSave event |
|
229 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | + "mode" => "upd", |
|
231 | + "id" => $id |
|
232 | + )); |
|
233 | + |
|
234 | + // update user name and password |
|
235 | + $field = array(); |
|
236 | + $field['username'] = $esc_newusername; |
|
237 | + if($genpassword == 1) { |
|
238 | + $field['password'] = md5($newpassword); |
|
239 | + } |
|
240 | + $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | + $field = $modx->getDatabase()->escape($field); |
|
243 | + $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | + |
|
245 | + // Save User Settings |
|
246 | 246 | saveWebUserSettings($id); |
247 | 247 | |
248 | - // Set the item name for logger |
|
249 | - $_SESSION['itemname'] = $newusername; |
|
250 | - |
|
251 | - /*******************************************************************************/ |
|
252 | - // put the user in the user_groups he/ she should be in |
|
253 | - // first, check that up_perms are switched on! |
|
254 | - if($use_udperms == 1) { |
|
255 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | - $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | - if(!empty($user_groups)) { |
|
258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
259 | - $field = array(); |
|
260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | - $field['webuser'] = $id; |
|
262 | - $modx->getDatabase()->insert($field, $tbl_web_groups); |
|
263 | - } |
|
264 | - } |
|
265 | - } |
|
266 | - // end of user_groups stuff! |
|
267 | - /*******************************************************************************/ |
|
248 | + // Set the item name for logger |
|
249 | + $_SESSION['itemname'] = $newusername; |
|
250 | + |
|
251 | + /*******************************************************************************/ |
|
252 | + // put the user in the user_groups he/ she should be in |
|
253 | + // first, check that up_perms are switched on! |
|
254 | + if($use_udperms == 1) { |
|
255 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | + $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | + if(!empty($user_groups)) { |
|
258 | + for($i = 0; $i < count($user_groups); $i++) { |
|
259 | + $field = array(); |
|
260 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | + $field['webuser'] = $id; |
|
262 | + $modx->getDatabase()->insert($field, $tbl_web_groups); |
|
263 | + } |
|
264 | + } |
|
265 | + } |
|
266 | + // end of user_groups stuff! |
|
267 | + /*******************************************************************************/ |
|
268 | 268 | |
269 | 269 | // invoke OnWebSaveUser event |
270 | 270 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -293,16 +293,16 @@ discard block |
||
293 | 293 | "id" => $id |
294 | 294 | )); |
295 | 295 | |
296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | - if($input['stay'] != '') { |
|
298 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | - } else { |
|
301 | - $stayUrl = "index.php?a=99&r=2"; |
|
302 | - } |
|
296 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | + if($input['stay'] != '') { |
|
298 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | + } else { |
|
301 | + $stayUrl = "index.php?a=99&r=2"; |
|
302 | + } |
|
303 | 303 | |
304 | - include_once "header.inc.php"; |
|
305 | - ?> |
|
304 | + include_once "header.inc.php"; |
|
305 | + ?> |
|
306 | 306 | |
307 | 307 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
308 | 308 | |
@@ -322,18 +322,18 @@ discard block |
||
322 | 322 | </div> |
323 | 323 | <?php |
324 | 324 | |
325 | - include_once "footer.inc.php"; |
|
326 | - } else { |
|
327 | - if($input['stay'] != '') { |
|
328 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | - header($header); |
|
331 | - } else { |
|
332 | - $header = "Location: index.php?a=99&r=2"; |
|
333 | - header($header); |
|
334 | - } |
|
335 | - } |
|
336 | - break; |
|
337 | - default : |
|
338 | - webAlertAndQuit("No operation set in request.", 88); |
|
325 | + include_once "footer.inc.php"; |
|
326 | + } else { |
|
327 | + if($input['stay'] != '') { |
|
328 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | + header($header); |
|
331 | + } else { |
|
332 | + $header = "Location: index.php?a=99&r=2"; |
|
333 | + header($header); |
|
334 | + } |
|
335 | + } |
|
336 | + break; |
|
337 | + default : |
|
338 | + webAlertAndQuit("No operation set in request.", 88); |
|
339 | 339 | } |