@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /************webber ********/ |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | $udperms->role = $_SESSION['mgrRole']; |
34 | 34 | |
35 | 35 | if(!$udperms->checkPermissions()) { |
36 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
36 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // update the document |
40 | 40 | $modx->db->update( |
41 | - array( |
|
42 | - 'published' => 0, |
|
43 | - 'pub_date' => 0, |
|
44 | - 'unpub_date' => 0, |
|
45 | - 'editedby' => $modx->getLoginUserID(), |
|
46 | - 'editedon' => time(), |
|
47 | - 'publishedby' => 0, |
|
48 | - 'publishedon' => 0, |
|
49 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
41 | + array( |
|
42 | + 'published' => 0, |
|
43 | + 'pub_date' => 0, |
|
44 | + 'unpub_date' => 0, |
|
45 | + 'editedby' => $modx->getLoginUserID(), |
|
46 | + 'editedon' => time(), |
|
47 | + 'publishedby' => 0, |
|
48 | + 'publishedon' => 0, |
|
49 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
50 | 50 | |
51 | 51 | // invoke OnDocUnPublished event |
52 | 52 | $modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_module')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeModFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeModFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the module. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_modules'), "id='{$id}'"); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnModFormDelete event |
34 | 34 | $modx->invokeEvent("OnModFormDelete", |
35 | - array( |
|
36 | - "id" => $id |
|
37 | - )); |
|
35 | + array( |
|
36 | + "id" => $id |
|
37 | + )); |
|
38 | 38 | |
39 | 39 | // empty cache |
40 | 40 | $modx->clearCache('full'); |
@@ -170,70 +170,70 @@ |
||
170 | 170 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
171 | 171 | ); |
172 | 172 | } |
173 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
174 | - $dependencies = explode(',', $params['dependencies']); |
|
175 | - foreach ($dependencies as $dependency) { |
|
176 | - $dependency = explode(':', $dependency); |
|
177 | - switch (trim($dependency[0])) { |
|
178 | - case 'template': |
|
179 | - $mdp[] = array( |
|
180 | - 'module' => $params['name'], |
|
181 | - 'table' => 'templates', |
|
182 | - 'column' => 'templatename', |
|
183 | - 'type' => 50, |
|
184 | - 'name' => trim($dependency[1]) |
|
185 | - ); |
|
186 | - break; |
|
187 | - case 'tv': |
|
188 | - case 'tmplvar': |
|
189 | - $mdp[] = array( |
|
190 | - 'module' => $params['name'], |
|
191 | - 'table' => 'tmplvars', |
|
192 | - 'column' => 'name', |
|
193 | - 'type' => 60, |
|
194 | - 'name' => trim($dependency[1]) |
|
195 | - ); |
|
196 | - break; |
|
197 | - case 'chunk': |
|
198 | - case 'htmlsnippet': |
|
199 | - $mdp[] = array( |
|
200 | - 'module' => $params['name'], |
|
201 | - 'table' => 'htmlsnippets', |
|
202 | - 'column' => 'name', |
|
203 | - 'type' => 10, |
|
204 | - 'name' => trim($dependency[1]) |
|
205 | - ); |
|
206 | - break; |
|
207 | - case 'snippet': |
|
208 | - $mdp[] = array( |
|
209 | - 'module' => $params['name'], |
|
210 | - 'table' => 'snippets', |
|
211 | - 'column' => 'name', |
|
212 | - 'type' => 40, |
|
213 | - 'name' => trim($dependency[1]) |
|
214 | - ); |
|
215 | - break; |
|
216 | - case 'plugin': |
|
217 | - $mdp[] = array( |
|
218 | - 'module' => $params['name'], |
|
219 | - 'table' => 'plugins', |
|
220 | - 'column' => 'name', |
|
221 | - 'type' => 30, |
|
222 | - 'name' => trim($dependency[1]) |
|
223 | - ); |
|
224 | - break; |
|
225 | - case 'resource': |
|
226 | - $mdp[] = array( |
|
227 | - 'module' => $params['name'], |
|
228 | - 'table' => 'content', |
|
229 | - 'column' => 'pagetitle', |
|
230 | - 'type' => 20, |
|
231 | - 'name' => trim($dependency[1]) |
|
232 | - ); |
|
233 | - break; |
|
234 | - } |
|
235 | - } |
|
236 | - } |
|
173 | + if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
174 | + $dependencies = explode(',', $params['dependencies']); |
|
175 | + foreach ($dependencies as $dependency) { |
|
176 | + $dependency = explode(':', $dependency); |
|
177 | + switch (trim($dependency[0])) { |
|
178 | + case 'template': |
|
179 | + $mdp[] = array( |
|
180 | + 'module' => $params['name'], |
|
181 | + 'table' => 'templates', |
|
182 | + 'column' => 'templatename', |
|
183 | + 'type' => 50, |
|
184 | + 'name' => trim($dependency[1]) |
|
185 | + ); |
|
186 | + break; |
|
187 | + case 'tv': |
|
188 | + case 'tmplvar': |
|
189 | + $mdp[] = array( |
|
190 | + 'module' => $params['name'], |
|
191 | + 'table' => 'tmplvars', |
|
192 | + 'column' => 'name', |
|
193 | + 'type' => 60, |
|
194 | + 'name' => trim($dependency[1]) |
|
195 | + ); |
|
196 | + break; |
|
197 | + case 'chunk': |
|
198 | + case 'htmlsnippet': |
|
199 | + $mdp[] = array( |
|
200 | + 'module' => $params['name'], |
|
201 | + 'table' => 'htmlsnippets', |
|
202 | + 'column' => 'name', |
|
203 | + 'type' => 10, |
|
204 | + 'name' => trim($dependency[1]) |
|
205 | + ); |
|
206 | + break; |
|
207 | + case 'snippet': |
|
208 | + $mdp[] = array( |
|
209 | + 'module' => $params['name'], |
|
210 | + 'table' => 'snippets', |
|
211 | + 'column' => 'name', |
|
212 | + 'type' => 40, |
|
213 | + 'name' => trim($dependency[1]) |
|
214 | + ); |
|
215 | + break; |
|
216 | + case 'plugin': |
|
217 | + $mdp[] = array( |
|
218 | + 'module' => $params['name'], |
|
219 | + 'table' => 'plugins', |
|
220 | + 'column' => 'name', |
|
221 | + 'type' => 30, |
|
222 | + 'name' => trim($dependency[1]) |
|
223 | + ); |
|
224 | + break; |
|
225 | + case 'resource': |
|
226 | + $mdp[] = array( |
|
227 | + 'module' => $params['name'], |
|
228 | + 'table' => 'content', |
|
229 | + 'column' => 'pagetitle', |
|
230 | + 'type' => 20, |
|
231 | + 'name' => trim($dependency[1]) |
|
232 | + ); |
|
233 | + break; |
|
234 | + } |
|
235 | + } |
|
236 | + } |
|
237 | 237 | } |
238 | 238 | $d->close(); |
239 | 239 | } |
@@ -1,12 +1,12 @@ 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_template') && $modx->manager->action == '301') { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | if(!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // check to see the snippet editor isn't locked |
22 | 22 | if($lockedEl = $modx->elementIsLocked(2, $id)) { |
23 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
|
23 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
|
24 | 24 | } |
25 | 25 | // end check for lock |
26 | 26 | |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | global $content; |
31 | 31 | $content = array(); |
32 | 32 | if(isset($_GET['id'])) { |
33 | - $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
|
34 | - $content = $modx->db->getRow($rs); |
|
35 | - if(!$content) { |
|
36 | - header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
37 | - } |
|
38 | - |
|
39 | - $_SESSION['itemname'] = $content['caption']; |
|
40 | - if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
41 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
42 | - } |
|
33 | + $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
|
34 | + $content = $modx->db->getRow($rs); |
|
35 | + if(!$content) { |
|
36 | + header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
37 | + } |
|
38 | + |
|
39 | + $_SESSION['itemname'] = $content['caption']; |
|
40 | + if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
41 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
42 | + } |
|
43 | 43 | } else if(isset($_REQUEST['itemname'])) { |
44 | - $content['name'] = $_REQUEST['itemname']; |
|
44 | + $content['name'] = $_REQUEST['itemname']; |
|
45 | 45 | } else { |
46 | - $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
|
47 | - $content['category'] = (int)$_REQUEST['catid']; |
|
46 | + $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
|
47 | + $content['category'] = (int)$_REQUEST['catid']; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | if($modx->manager->hasFormValues()) { |
51 | - $modx->manager->loadFormValues(); |
|
51 | + $modx->manager->loadFormValues(); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $content = array_merge($content, $_POST); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $RTEditors = ''; |
63 | 63 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister', array('forfrontend' => 1)); |
64 | 64 | if(is_array($evtOut)) { |
65 | - $RTEditors = implode(',', $evtOut); |
|
65 | + $RTEditors = implode(',', $evtOut); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | ?> |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | |
278 | 278 | <form name="mutate" method="post" action="index.php" enctype="multipart/form-data"> |
279 | 279 | <?php |
280 | - // invoke OnTVFormPrerender event |
|
281 | - $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
|
282 | - if(is_array($evtOut)) { |
|
283 | - echo implode("", $evtOut); |
|
284 | - } |
|
285 | - ?> |
|
280 | + // invoke OnTVFormPrerender event |
|
281 | + $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
|
282 | + if(is_array($evtOut)) { |
|
283 | + echo implode("", $evtOut); |
|
284 | + } |
|
285 | + ?> |
|
286 | 286 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
287 | 287 | <input type="hidden" name="a" value="302"> |
288 | 288 | <input type="hidden" name="or" value="<?= $origin ?>"> |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | <select name="categoryid" class="form-control" onChange="documentDirty=true;"> |
344 | 344 | <option> </option> |
345 | 345 | <?php |
346 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
347 | - foreach(getCategories() as $n => $v) { |
|
348 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
349 | - } |
|
350 | - ?> |
|
346 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
347 | + foreach(getCategories() as $n => $v) { |
|
348 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
349 | + } |
|
350 | + ?> |
|
351 | 351 | </select> |
352 | 352 | </div> |
353 | 353 | </div> |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | <optgroup label="Custom Type"> |
384 | 384 | <option value="custom_tv" <?= ($content['type'] == 'custom_tv' ? "selected='selected'" : "") ?>>Custom Input</option> |
385 | 385 | <?php |
386 | - $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
387 | - foreach($custom_tvs as $ctv) { |
|
388 | - if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
389 | - $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
390 | - echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
391 | - } |
|
392 | - } |
|
393 | - ?> |
|
386 | + $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
387 | + foreach($custom_tvs as $ctv) { |
|
388 | + if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
389 | + $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
390 | + echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
391 | + } |
|
392 | + } |
|
393 | + ?> |
|
394 | 394 | </optgroup> |
395 | 395 | </select> |
396 | 396 | </div> |
@@ -455,63 +455,63 @@ discard block |
||
455 | 455 | <a class="btn btn-secondary btn-sm" href="javascript:;" onClick="check_toggle(); return false;"><?= $_lang['check_toggle'] ?></a> |
456 | 456 | </div> |
457 | 457 | <?php |
458 | - $rs = $modx->db->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl |
|
458 | + $rs = $modx->db->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl |
|
459 | 459 | LEFT JOIN %s as stt ON stt.templateid=tpl.id AND stt.tmplvarid='%s' |
460 | 460 | LEFT JOIN %s as cat ON tpl.category=cat.id", $modx->getFullTableName('site_templates'), $modx->getFullTableName('site_tmplvar_templates'), $id, $modx->getFullTableName('categories')), '', "category, templatename"); |
461 | 461 | |
462 | - $tplList = '<ul>'; |
|
463 | - $preCat = ''; |
|
464 | - $insideUl = 0; |
|
465 | - while($row = $modx->db->getRow($rs)) { |
|
466 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
467 | - if($preCat !== $row['category']) { |
|
468 | - $tplList .= $insideUl ? '</ul>' : ''; |
|
469 | - $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
470 | - $insideUl = 1; |
|
471 | - } |
|
472 | - |
|
473 | - if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
474 | - $checked = true; |
|
475 | - } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
476 | - $checked = true; |
|
477 | - } elseif($id == 0 && is_array($_POST['template'])) { |
|
478 | - $checked = in_array($row['id'], $_POST['template']); |
|
479 | - } else { |
|
480 | - $checked = $row['tmplvarid']; |
|
481 | - } |
|
482 | - $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
|
483 | - $checked = $checked ? ' checked="checked"' : ''; |
|
484 | - $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
485 | - $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
486 | - |
|
487 | - $tplInfo = array(); |
|
488 | - if($row['tpllocked']) { |
|
489 | - $tplInfo[] = $_lang['locked']; |
|
490 | - } |
|
491 | - if($row['id'] == $modx->config['default_template']) { |
|
492 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
493 | - } |
|
494 | - $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
495 | - |
|
496 | - $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
|
497 | - $tplList .= '</li>'; |
|
498 | - |
|
499 | - $preCat = $row['category']; |
|
500 | - } |
|
501 | - $tplList .= $insideUl ? '</ul>' : ''; |
|
502 | - $tplList .= '</ul>'; |
|
503 | - echo $tplList; |
|
504 | - |
|
505 | - ?> |
|
462 | + $tplList = '<ul>'; |
|
463 | + $preCat = ''; |
|
464 | + $insideUl = 0; |
|
465 | + while($row = $modx->db->getRow($rs)) { |
|
466 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
467 | + if($preCat !== $row['category']) { |
|
468 | + $tplList .= $insideUl ? '</ul>' : ''; |
|
469 | + $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
470 | + $insideUl = 1; |
|
471 | + } |
|
472 | + |
|
473 | + if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
474 | + $checked = true; |
|
475 | + } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
476 | + $checked = true; |
|
477 | + } elseif($id == 0 && is_array($_POST['template'])) { |
|
478 | + $checked = in_array($row['id'], $_POST['template']); |
|
479 | + } else { |
|
480 | + $checked = $row['tmplvarid']; |
|
481 | + } |
|
482 | + $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
|
483 | + $checked = $checked ? ' checked="checked"' : ''; |
|
484 | + $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
485 | + $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
486 | + |
|
487 | + $tplInfo = array(); |
|
488 | + if($row['tpllocked']) { |
|
489 | + $tplInfo[] = $_lang['locked']; |
|
490 | + } |
|
491 | + if($row['id'] == $modx->config['default_template']) { |
|
492 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
493 | + } |
|
494 | + $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
495 | + |
|
496 | + $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
|
497 | + $tplList .= '</li>'; |
|
498 | + |
|
499 | + $preCat = $row['category']; |
|
500 | + } |
|
501 | + $tplList .= $insideUl ? '</ul>' : ''; |
|
502 | + $tplList .= '</ul>'; |
|
503 | + echo $tplList; |
|
504 | + |
|
505 | + ?> |
|
506 | 506 | |
507 | 507 | <!-- Access Permissions --> |
508 | 508 | <?php |
509 | - if($use_udperms == 1) { |
|
510 | - // fetch permissions for the variable |
|
511 | - $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
|
512 | - $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
|
509 | + if($use_udperms == 1) { |
|
510 | + // fetch permissions for the variable |
|
511 | + $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
|
512 | + $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
|
513 | 513 | |
514 | - ?> |
|
514 | + ?> |
|
515 | 515 | <?php if($modx->hasPermission('access_permissions')) { ?> |
516 | 516 | <script type="text/javascript"> |
517 | 517 | function makePublic(b) { |
@@ -539,29 +539,29 @@ discard block |
||
539 | 539 | <!--<b><?php /*echo $_lang['access_permissions']; */ ?></b>--> |
540 | 540 | <p><?= $_lang['tmplvar_access_msg'] ?></p> |
541 | 541 | <?php |
542 | - $chk = ''; |
|
543 | - $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
|
544 | - if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
545 | - $groupsarray = $_POST['docgroups']; |
|
546 | - } |
|
547 | - while($row = $modx->db->getRow($rs)) { |
|
548 | - $checked = in_array($row['id'], $groupsarray); |
|
549 | - if($modx->hasPermission('access_permissions')) { |
|
550 | - if($checked) { |
|
551 | - $notPublic = true; |
|
552 | - } |
|
553 | - $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
554 | - } else { |
|
555 | - if($checked) { |
|
556 | - echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
557 | - } |
|
558 | - } |
|
559 | - } |
|
560 | - if($modx->hasPermission('access_permissions')) { |
|
561 | - $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
562 | - } |
|
563 | - echo '<ul>' . $chks . '</ul>'; |
|
564 | - ?> |
|
542 | + $chk = ''; |
|
543 | + $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
|
544 | + if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
545 | + $groupsarray = $_POST['docgroups']; |
|
546 | + } |
|
547 | + while($row = $modx->db->getRow($rs)) { |
|
548 | + $checked = in_array($row['id'], $groupsarray); |
|
549 | + if($modx->hasPermission('access_permissions')) { |
|
550 | + if($checked) { |
|
551 | + $notPublic = true; |
|
552 | + } |
|
553 | + $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
554 | + } else { |
|
555 | + if($checked) { |
|
556 | + echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
557 | + } |
|
558 | + } |
|
559 | + } |
|
560 | + if($modx->hasPermission('access_permissions')) { |
|
561 | + $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
562 | + } |
|
563 | + echo '<ul>' . $chks . '</ul>'; |
|
564 | + ?> |
|
565 | 565 | <?php } ?> |
566 | 566 | <?php } ?> |
567 | 567 | |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | <input type="submit" name="save" style="display:none"> |
572 | 572 | |
573 | 573 | <?php |
574 | - // invoke OnTVFormRender event |
|
575 | - $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
|
576 | - if(is_array($evtOut)) { |
|
577 | - echo implode('', $evtOut); |
|
578 | - } |
|
579 | - ?> |
|
574 | + // invoke OnTVFormRender event |
|
575 | + $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
|
576 | + if(is_array($evtOut)) { |
|
577 | + echo implode('', $evtOut); |
|
578 | + } |
|
579 | + ?> |
|
580 | 580 | </div> |
581 | 581 | </form> |
582 | 582 | <script type="text/javascript">setTimeout('showParameters()', 10);</script> |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | |
6 | 6 | // PROCESSOR FIRST |
7 | 7 | if($_SESSION['mgrRole'] == 1) { |
8 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
9 | - $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
10 | - if(!empty($current)) { |
|
11 | - $modx->manager->setSystemChecksum($current); |
|
12 | - $modx->clearCache('full'); |
|
13 | - $modx->config['sys_files_checksum'] = $current; |
|
14 | - }; |
|
15 | - } |
|
8 | + if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
9 | + $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
10 | + if(!empty($current)) { |
|
11 | + $modx->manager->setSystemChecksum($current); |
|
12 | + $modx->clearCache('full'); |
|
13 | + $modx->config['sys_files_checksum'] = $current; |
|
14 | + }; |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | // NOW CHECK CONFIG |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
22 | 22 | if ($sysfiles_check!=='0'){ |
23 | - $warningspresent = 1; |
|
24 | - $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
23 | + $warningspresent = 1; |
|
24 | + $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | if (is_writable("includes/config.inc.php")){ |
28 | 28 | // Warn if world writable |
29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
30 | - $warningspresent = 1; |
|
31 | - $warnings[] = array($_lang['configcheck_configinc']); |
|
30 | + $warningspresent = 1; |
|
31 | + $warnings[] = array($_lang['configcheck_configinc']); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | break; |
180 | 180 | case $_lang['configcheck_sysfiles_mod']: |
181 | 181 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
182 | - $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
183 | - if($modx->hasPermission('settings')) { |
|
184 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
185 | - } |
|
182 | + $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
183 | + if($modx->hasPermission('settings')) { |
|
184 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
185 | + } |
|
186 | 186 | if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
187 | 187 | break; |
188 | 188 | case $_lang['configcheck_lang_difference'] : |
@@ -5,133 +5,133 @@ discard block |
||
5 | 5 | |
6 | 6 | // action list |
7 | 7 | $GLOBALS['action_list'] = array( |
8 | - '1' => 'Loading a frame(set)', |
|
9 | - '2' => 'Viewing home page/ online users', |
|
10 | - '3' => 'Viewing data for resource', |
|
11 | - '4' => 'Creating a resource', |
|
12 | - '5' => 'Saving resource', |
|
13 | - '6' => 'Deleting resource', |
|
14 | - '7' => 'Waiting while MODX cleans up', |
|
15 | - '8' => 'Logged out', |
|
16 | - '9' => 'Viewing help', |
|
17 | - '10' => 'Viewing/ composing messages', |
|
18 | - '11' => 'Creating a user', |
|
19 | - '12' => 'Editing user', |
|
20 | - '13' => 'Viewing logging', |
|
21 | - '14' => 'Editing a parser', |
|
22 | - '15' => 'Saving a parser', |
|
23 | - '16' => 'Editing template', |
|
24 | - '17' => 'Editing settings', |
|
25 | - '18' => 'Viewing Credits :)', |
|
26 | - '19' => 'Creating a new template', |
|
27 | - '20' => 'Saving template', |
|
28 | - '21' => 'Deleting template', |
|
29 | - '22' => 'Editing Snippet', |
|
30 | - '23' => 'Creating a new Snippet', |
|
31 | - '24' => 'Saving Snippet', |
|
32 | - '25' => 'Deleting Snippet', |
|
33 | - '26' => 'Refreshing site', |
|
34 | - '27' => 'Editing resource', |
|
35 | - '28' => 'Changing password', |
|
36 | - '29' => 'Error', |
|
37 | - '30' => 'Saving settings', |
|
38 | - '31' => 'Using file manager', |
|
39 | - '32' => 'Saving user', |
|
40 | - '33' => 'Deleting user', |
|
41 | - '34' => 'Saving new password', |
|
42 | - '35' => 'Editing role', |
|
43 | - '36' => 'Saving role', |
|
44 | - '37' => 'Deleting role', |
|
45 | - '38' => 'Creating new role', |
|
46 | - '40' => 'Editing Access Permissions', |
|
47 | - '41' => 'Editing Access Permissions', |
|
48 | - '42' => 'Editing Access Permissions', |
|
49 | - '43' => 'Editing Access Permissions', |
|
50 | - '44' => 'Editing Access Permissions', |
|
51 | - '45' => 'Idle', |
|
52 | - '46' => 'Editing Access Permissions', |
|
53 | - '47' => 'Editing Access Permissions', |
|
54 | - '48' => 'Editing Access Permissions', |
|
55 | - '49' => 'Editing Access Permissions', |
|
56 | - '50' => 'Editing Access Permissions', |
|
57 | - '51' => 'Moving resource', |
|
58 | - '52' => 'Moved resource', |
|
59 | - '53' => 'Viewing system info', |
|
60 | - '54' => 'Optimizing a table', |
|
61 | - '55' => 'Empty logs', |
|
62 | - '56' => 'Refresh resource tree', |
|
63 | - '57' => 'Refresh menu', |
|
64 | - '58' => 'Logged in', |
|
65 | - '59' => 'About MODX', |
|
66 | - '60' => 'Emptying Recycle Bin', |
|
67 | - '61' => 'Publishing a resource', |
|
68 | - '62' => 'Un-publishing a resource', |
|
69 | - '63' => 'Un-deleting a resource', |
|
70 | - '64' => 'Removing deleted content', |
|
71 | - '65' => 'Deleting a message', |
|
72 | - '66' => 'Sending a message', |
|
73 | - '67' => 'Removing locks', |
|
74 | - '68' => 'Viewing site logging', |
|
75 | - '69' => 'Viewing online visitors', |
|
76 | - '70' => 'Viewing site schedule', |
|
77 | - '71' => 'Searching', |
|
78 | - '72' => 'Adding a weblink', |
|
79 | - '73' => 'Editing a weblink', |
|
80 | - //case "74" : return "Changing personal preferences"; break; |
|
81 | - '75' => 'User/ role management', |
|
82 | - '76' => 'Element management', |
|
83 | - '77' => 'Creating a new Chunk (HTML Snippet)', |
|
84 | - '78' => 'Editing Chunk (HTML Snippet)', |
|
85 | - '79' => 'Saving Chunk (HTML Snippet)', |
|
86 | - '80' => 'Deleting Chunk (HTML Snippet)', |
|
87 | - '83' => 'Exporting a resource to HTML', |
|
88 | - '84' => 'Load Element Selector', |
|
89 | - '85' => 'Create Folder', |
|
90 | - '86' => 'Role management', |
|
91 | - '87' => 'Create new web user', |
|
92 | - '88' => 'Editing web user', |
|
93 | - '89' => 'Saving web user', |
|
94 | - '90' => 'Deleting web user', |
|
95 | - '91' => 'Editing Web Access Permissions', |
|
96 | - '92' => 'Editing Access Permissions', |
|
97 | - '93' => 'Backup Manager', |
|
98 | - '94' => 'Duplicate resource', |
|
99 | - '95' => 'Importing resources from HTML', |
|
100 | - '96' => 'Duplicate Template', |
|
101 | - '97' => 'Duplicate Chunk (HTML Snippet)', |
|
102 | - '98' => 'Duplicate Snippet', |
|
103 | - '99' => 'Manage Web Users', |
|
104 | - '100' => 'Previewing resource', |
|
105 | - '101' => 'Create new plugin', |
|
106 | - '102' => 'Edit plugin', |
|
107 | - '103' => 'Saving plugin', |
|
108 | - '104' => 'Delete plugin', |
|
109 | - '105' => 'Duplicate plugin', |
|
110 | - '106' => 'Viewing Modules', |
|
111 | - '107' => 'Create new module', |
|
112 | - '108' => 'Edit module', |
|
113 | - '109' => 'Saving module', |
|
114 | - '110' => 'Delete module', |
|
115 | - '111' => 'Duplicate module', |
|
116 | - '112' => 'Execute module', |
|
117 | - '113' => 'Manage module dependencies', |
|
118 | - '114' => 'View event log', |
|
119 | - '115' => 'View event log details', |
|
120 | - '116' => 'Delete event log', |
|
121 | - '117' => 'Editing tv rank', |
|
122 | - '118' => 'Call settings ajax include', |
|
123 | - '119' => 'Login Fail (Temporary Block)', |
|
8 | + '1' => 'Loading a frame(set)', |
|
9 | + '2' => 'Viewing home page/ online users', |
|
10 | + '3' => 'Viewing data for resource', |
|
11 | + '4' => 'Creating a resource', |
|
12 | + '5' => 'Saving resource', |
|
13 | + '6' => 'Deleting resource', |
|
14 | + '7' => 'Waiting while MODX cleans up', |
|
15 | + '8' => 'Logged out', |
|
16 | + '9' => 'Viewing help', |
|
17 | + '10' => 'Viewing/ composing messages', |
|
18 | + '11' => 'Creating a user', |
|
19 | + '12' => 'Editing user', |
|
20 | + '13' => 'Viewing logging', |
|
21 | + '14' => 'Editing a parser', |
|
22 | + '15' => 'Saving a parser', |
|
23 | + '16' => 'Editing template', |
|
24 | + '17' => 'Editing settings', |
|
25 | + '18' => 'Viewing Credits :)', |
|
26 | + '19' => 'Creating a new template', |
|
27 | + '20' => 'Saving template', |
|
28 | + '21' => 'Deleting template', |
|
29 | + '22' => 'Editing Snippet', |
|
30 | + '23' => 'Creating a new Snippet', |
|
31 | + '24' => 'Saving Snippet', |
|
32 | + '25' => 'Deleting Snippet', |
|
33 | + '26' => 'Refreshing site', |
|
34 | + '27' => 'Editing resource', |
|
35 | + '28' => 'Changing password', |
|
36 | + '29' => 'Error', |
|
37 | + '30' => 'Saving settings', |
|
38 | + '31' => 'Using file manager', |
|
39 | + '32' => 'Saving user', |
|
40 | + '33' => 'Deleting user', |
|
41 | + '34' => 'Saving new password', |
|
42 | + '35' => 'Editing role', |
|
43 | + '36' => 'Saving role', |
|
44 | + '37' => 'Deleting role', |
|
45 | + '38' => 'Creating new role', |
|
46 | + '40' => 'Editing Access Permissions', |
|
47 | + '41' => 'Editing Access Permissions', |
|
48 | + '42' => 'Editing Access Permissions', |
|
49 | + '43' => 'Editing Access Permissions', |
|
50 | + '44' => 'Editing Access Permissions', |
|
51 | + '45' => 'Idle', |
|
52 | + '46' => 'Editing Access Permissions', |
|
53 | + '47' => 'Editing Access Permissions', |
|
54 | + '48' => 'Editing Access Permissions', |
|
55 | + '49' => 'Editing Access Permissions', |
|
56 | + '50' => 'Editing Access Permissions', |
|
57 | + '51' => 'Moving resource', |
|
58 | + '52' => 'Moved resource', |
|
59 | + '53' => 'Viewing system info', |
|
60 | + '54' => 'Optimizing a table', |
|
61 | + '55' => 'Empty logs', |
|
62 | + '56' => 'Refresh resource tree', |
|
63 | + '57' => 'Refresh menu', |
|
64 | + '58' => 'Logged in', |
|
65 | + '59' => 'About MODX', |
|
66 | + '60' => 'Emptying Recycle Bin', |
|
67 | + '61' => 'Publishing a resource', |
|
68 | + '62' => 'Un-publishing a resource', |
|
69 | + '63' => 'Un-deleting a resource', |
|
70 | + '64' => 'Removing deleted content', |
|
71 | + '65' => 'Deleting a message', |
|
72 | + '66' => 'Sending a message', |
|
73 | + '67' => 'Removing locks', |
|
74 | + '68' => 'Viewing site logging', |
|
75 | + '69' => 'Viewing online visitors', |
|
76 | + '70' => 'Viewing site schedule', |
|
77 | + '71' => 'Searching', |
|
78 | + '72' => 'Adding a weblink', |
|
79 | + '73' => 'Editing a weblink', |
|
80 | + //case "74" : return "Changing personal preferences"; break; |
|
81 | + '75' => 'User/ role management', |
|
82 | + '76' => 'Element management', |
|
83 | + '77' => 'Creating a new Chunk (HTML Snippet)', |
|
84 | + '78' => 'Editing Chunk (HTML Snippet)', |
|
85 | + '79' => 'Saving Chunk (HTML Snippet)', |
|
86 | + '80' => 'Deleting Chunk (HTML Snippet)', |
|
87 | + '83' => 'Exporting a resource to HTML', |
|
88 | + '84' => 'Load Element Selector', |
|
89 | + '85' => 'Create Folder', |
|
90 | + '86' => 'Role management', |
|
91 | + '87' => 'Create new web user', |
|
92 | + '88' => 'Editing web user', |
|
93 | + '89' => 'Saving web user', |
|
94 | + '90' => 'Deleting web user', |
|
95 | + '91' => 'Editing Web Access Permissions', |
|
96 | + '92' => 'Editing Access Permissions', |
|
97 | + '93' => 'Backup Manager', |
|
98 | + '94' => 'Duplicate resource', |
|
99 | + '95' => 'Importing resources from HTML', |
|
100 | + '96' => 'Duplicate Template', |
|
101 | + '97' => 'Duplicate Chunk (HTML Snippet)', |
|
102 | + '98' => 'Duplicate Snippet', |
|
103 | + '99' => 'Manage Web Users', |
|
104 | + '100' => 'Previewing resource', |
|
105 | + '101' => 'Create new plugin', |
|
106 | + '102' => 'Edit plugin', |
|
107 | + '103' => 'Saving plugin', |
|
108 | + '104' => 'Delete plugin', |
|
109 | + '105' => 'Duplicate plugin', |
|
110 | + '106' => 'Viewing Modules', |
|
111 | + '107' => 'Create new module', |
|
112 | + '108' => 'Edit module', |
|
113 | + '109' => 'Saving module', |
|
114 | + '110' => 'Delete module', |
|
115 | + '111' => 'Duplicate module', |
|
116 | + '112' => 'Execute module', |
|
117 | + '113' => 'Manage module dependencies', |
|
118 | + '114' => 'View event log', |
|
119 | + '115' => 'View event log details', |
|
120 | + '116' => 'Delete event log', |
|
121 | + '117' => 'Editing tv rank', |
|
122 | + '118' => 'Call settings ajax include', |
|
123 | + '119' => 'Login Fail (Temporary Block)', |
|
124 | 124 | |
125 | - '300' => 'Create Template Variable', |
|
126 | - '301' => 'Edit Template Variable', |
|
127 | - '302' => 'Save Template Variable', |
|
128 | - '303' => 'Delete Template Variable', |
|
129 | - '304' => 'Duplicate Template Variable', |
|
125 | + '300' => 'Create Template Variable', |
|
126 | + '301' => 'Edit Template Variable', |
|
127 | + '302' => 'Save Template Variable', |
|
128 | + '303' => 'Delete Template Variable', |
|
129 | + '304' => 'Duplicate Template Variable', |
|
130 | 130 | |
131 | - '200' => 'Viewing phpInfo()', |
|
132 | - '501' => 'Delete category', |
|
133 | - '998' => 'Viewing web page', |
|
134 | - '999' => 'Viewing test page', |
|
131 | + '200' => 'Viewing phpInfo()', |
|
132 | + '501' => 'Delete category', |
|
133 | + '998' => 'Viewing web page', |
|
134 | + '999' => 'Viewing test page', |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | /** |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function getAction($actionId, $itemid='') { |
143 | - global $action_list; |
|
143 | + global $action_list; |
|
144 | 144 | |
145 | - $ret = sprintf($action_list[$actionId], $itemid); |
|
146 | - if (!$ret) $ret = "Idle (unknown)"; |
|
145 | + $ret = sprintf($action_list[$actionId], $itemid); |
|
146 | + if (!$ret) $ret = "Idle (unknown)"; |
|
147 | 147 | |
148 | - return $ret; |
|
148 | + return $ret; |
|
149 | 149 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
10 | 10 | if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
11 | - $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
|
11 | + $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
|
12 | 12 | return $modx->mergeSettingsContent($load_script); |
13 | 13 | } |
14 | 14 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $autoloader = __DIR__.'/vendor/autoload.php'; |
49 | 49 | if (file_exists($autoloader) && is_readable($autoloader)) { |
50 | - include_once($autoloader); |
|
50 | + include_once($autoloader); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | if(is_file($base_path . 'assets/cache/siteManager.php')) |
57 | 57 | include_once($base_path . 'assets/cache/siteManager.php'); |
58 | 58 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
59 | - define('MGR_DIR', 'manager'); |
|
59 | + define('MGR_DIR', 'manager'); |
|
60 | 60 | if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
61 | 61 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
62 | 62 | if(!defined('MODX_SITE_HOSTNAMES')) |
63 | - define('MODX_SITE_HOSTNAMES', ''); |
|
63 | + define('MODX_SITE_HOSTNAMES', ''); |
|
64 | 64 | |
65 | 65 | // get start time |
66 | 66 | $mstart = memory_get_usage(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | define('IN_PARSER_MODE', true); |
86 | 86 | if ( ! defined('IN_MANAGER_MODE')) { |
87 | - define('IN_MANAGER_MODE', false); |
|
87 | + define('IN_MANAGER_MODE', false); |
|
88 | 88 | } |
89 | 89 | if (!defined('MODX_API_MODE')) { |
90 | 90 | define('MODX_API_MODE', false); |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | |
93 | 93 | // get the required includes |
94 | 94 | if(!isset($database_user) || $database_user=="") { |
95 | - $rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php'); |
|
96 | - // Be sure config.inc.php is there and that it contains some important values |
|
97 | - if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) { |
|
98 | - readfile('install/not_installed.tpl'); |
|
99 | - exit; |
|
100 | - } |
|
95 | + $rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php'); |
|
96 | + // Be sure config.inc.php is there and that it contains some important values |
|
97 | + if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) { |
|
98 | + readfile('install/not_installed.tpl'); |
|
99 | + exit; |
|
100 | + } |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // start session |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | |
106 | 106 | // initiate a new document parser |
107 | 107 | if (isset($coreClass) && class_exists($coreClass)) { |
108 | - $modx = new $coreClass; |
|
108 | + $modx = new $coreClass; |
|
109 | 109 | } |
110 | 110 | if (!isset($modx) || !($modx instanceof \DocumentParser)) { |
111 | - include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
112 | - $modx = DocumentParser::getInstance(); |
|
111 | + include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
112 | + $modx = DocumentParser::getInstance(); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // set some parser options |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | class DataGrid { |
14 | 14 | |
15 | - public $ds; // datasource |
|
15 | + public $ds; // datasource |
|
16 | 16 | public $id; |
17 | 17 | public $pageSize; // pager settings |
18 | 18 | public $pageNumber; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public $colWraps; |
37 | 37 | public $colColors; |
38 | 38 | public $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
39 | - // data type: integer,float,currency,date |
|
39 | + // data type: integer,float,currency,date |
|
40 | 40 | |
41 | 41 | public $header; |
42 | 42 | public $footer; |
@@ -73,239 +73,239 @@ discard block |
||
73 | 73 | public $cdelim; |
74 | 74 | |
75 | 75 | public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
76 | - global $__DataGridCnt; |
|
76 | + global $__DataGridCnt; |
|
77 | 77 | |
78 | - // set id |
|
79 | - $__DataGridCnt++; |
|
80 | - $this->id = $this->id ? empty($id) : "dg" . $__DataGridCnt; |
|
78 | + // set id |
|
79 | + $__DataGridCnt++; |
|
80 | + $this->id = $this->id ? empty($id) : "dg" . $__DataGridCnt; |
|
81 | 81 | |
82 | - // set datasource |
|
83 | - $this->ds = $ds; |
|
82 | + // set datasource |
|
83 | + $this->ds = $ds; |
|
84 | 84 | |
85 | - // set pager |
|
86 | - $this->pageSize = $pageSize; |
|
87 | - $this->pageNumber = $pageNumber; // by setting pager to -1 will cause pager to load it's last page number |
|
88 | - $this->pagerLocation = 'top-right'; |
|
89 | - } |
|
85 | + // set pager |
|
86 | + $this->pageSize = $pageSize; |
|
87 | + $this->pageNumber = $pageNumber; // by setting pager to -1 will cause pager to load it's last page number |
|
88 | + $this->pagerLocation = 'top-right'; |
|
89 | + } |
|
90 | 90 | |
91 | 91 | public function setDataSource($ds) { |
92 | - $this->ds = $ds; |
|
93 | - } |
|
92 | + $this->ds = $ds; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | public function render() { |
96 | 96 | $modx = evolutionCMS(); |
97 | - $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
|
98 | - $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
|
99 | - $cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : ''; |
|
100 | - $cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : ''; |
|
101 | - |
|
102 | - $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : ''; |
|
103 | - $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'"; |
|
104 | - |
|
105 | - $this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : ''; |
|
106 | - $this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : ''; |
|
107 | - $this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : ''; |
|
108 | - $this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : ''; |
|
109 | - |
|
110 | - $this->_alt = 0; |
|
111 | - $this->_total = 0; |
|
112 | - |
|
113 | - $this->_isDataset = $modx->db->isResult($this->ds); // if not dataset then treat as array |
|
114 | - |
|
115 | - if(!$cssStyle && !$cssClass) { |
|
116 | - $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'"; |
|
117 | - } |
|
118 | - if(!$columnHeaderStyle && !$columnHeaderClass) { |
|
119 | - $columnHeaderStyle = "style='color:black;background-color:silver'"; |
|
120 | - } |
|
121 | - if(!$this->_itemStyle && !$this->_itemClass) { |
|
122 | - $this->_itemStyle = "style='color:black;'"; |
|
123 | - } |
|
124 | - if(!$this->_altItemStyle && !$this->_altItemClass) { |
|
125 | - $this->_altItemStyle = "style='color:black;background-color:#eeeeee'"; |
|
126 | - } |
|
127 | - |
|
128 | - if($this->_isDataset && !$this->columns) { |
|
129 | - $cols = $modx->db->numFields($this->ds); |
|
130 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
131 | - } |
|
132 | - |
|
133 | - // start grid |
|
134 | - $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>"; |
|
135 | - $tblEnd = "</table>"; |
|
136 | - |
|
137 | - // build column header |
|
138 | - $this->_colnames = explode((strstr($this->columns, "||") !== false ? "||" : ","), $this->columns); |
|
139 | - $this->_colwidths = explode((strstr($this->colWidths, "||") !== false ? "||" : ","), $this->colWidths); |
|
140 | - $this->_colaligns = explode((strstr($this->colAligns, "||") !== false ? "||" : ","), $this->colAligns); |
|
141 | - $this->_colwraps = explode((strstr($this->colWraps, "||") !== false ? "||" : ","), $this->colWraps); |
|
142 | - $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors); |
|
143 | - $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes); |
|
144 | - $this->_colcount = count($this->_colnames); |
|
145 | - if(!$this->_isDataset) { |
|
146 | - $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds); |
|
147 | - $this->ds = array_chunk($this->ds, $this->_colcount); |
|
148 | - } |
|
149 | - $tblColHdr = "<thead><tr>"; |
|
150 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
151 | - $name = $this->_colnames[$c]; |
|
152 | - $width = $this->_colwidths[$c]; |
|
153 | - $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>"; |
|
154 | - } |
|
155 | - $tblColHdr .= "</tr></thead>\n"; |
|
156 | - |
|
157 | - // build rows |
|
158 | - $rowcount = $this->_isDataset ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
|
159 | - $this->_fieldnames = explode(",", $this->fields); |
|
160 | - if($rowcount == 0) { |
|
161 | - $tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n"; |
|
162 | - } else { |
|
163 | - // render grid items |
|
164 | - if($this->pageSize <= 0) { |
|
165 | - for($r = 0; $r < $rowcount; $r++) { |
|
166 | - $row = $this->_isDataset ? $modx->db->getRow($this->ds) : $this->ds[$r]; |
|
167 | - $tblRows .= $this->RenderRowFnc($r + 1, $row); |
|
168 | - } |
|
169 | - } else { |
|
170 | - if(!$this->pager) { |
|
171 | - include_once dirname(__FILE__) . "/datasetpager.class.php"; |
|
172 | - $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber); |
|
173 | - $this->pager->setRenderRowFnc($this); // pass this object |
|
174 | - $this->pager->cssStyle = $pagerStyle; |
|
175 | - $this->pager->cssClass = $pagerClass; |
|
176 | - } else { |
|
177 | - $this->pager->pageSize = $this->pageSize; |
|
178 | - $this->pager->pageNumber = $this->pageNumber; |
|
179 | - } |
|
180 | - |
|
181 | - $this->pager->render(); |
|
182 | - $tblRows = $this->pager->getRenderedRows(); |
|
183 | - $tblPager = $this->pager->getRenderedPager(); |
|
184 | - } |
|
185 | - } |
|
186 | - |
|
187 | - // setup header,pager and footer |
|
188 | - $o = $tblStart; |
|
189 | - $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both"); |
|
190 | - $pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both"); |
|
191 | - if($this->header) { |
|
192 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>"; |
|
193 | - } |
|
194 | - if($tblPager && $ptop) { |
|
195 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
196 | - } |
|
197 | - $o .= $tblColHdr . $tblRows; |
|
198 | - if($tblPager && $pbot) { |
|
199 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
200 | - } |
|
201 | - if($this->footer) { |
|
202 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>"; |
|
203 | - } |
|
204 | - $o .= $tblEnd; |
|
205 | - return $o; |
|
206 | - } |
|
207 | - |
|
208 | - // format column values |
|
97 | + $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
|
98 | + $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
|
99 | + $cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : ''; |
|
100 | + $cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : ''; |
|
101 | + |
|
102 | + $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : ''; |
|
103 | + $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'"; |
|
104 | + |
|
105 | + $this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : ''; |
|
106 | + $this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : ''; |
|
107 | + $this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : ''; |
|
108 | + $this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : ''; |
|
109 | + |
|
110 | + $this->_alt = 0; |
|
111 | + $this->_total = 0; |
|
112 | + |
|
113 | + $this->_isDataset = $modx->db->isResult($this->ds); // if not dataset then treat as array |
|
114 | + |
|
115 | + if(!$cssStyle && !$cssClass) { |
|
116 | + $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'"; |
|
117 | + } |
|
118 | + if(!$columnHeaderStyle && !$columnHeaderClass) { |
|
119 | + $columnHeaderStyle = "style='color:black;background-color:silver'"; |
|
120 | + } |
|
121 | + if(!$this->_itemStyle && !$this->_itemClass) { |
|
122 | + $this->_itemStyle = "style='color:black;'"; |
|
123 | + } |
|
124 | + if(!$this->_altItemStyle && !$this->_altItemClass) { |
|
125 | + $this->_altItemStyle = "style='color:black;background-color:#eeeeee'"; |
|
126 | + } |
|
127 | + |
|
128 | + if($this->_isDataset && !$this->columns) { |
|
129 | + $cols = $modx->db->numFields($this->ds); |
|
130 | + for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
131 | + } |
|
132 | + |
|
133 | + // start grid |
|
134 | + $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>"; |
|
135 | + $tblEnd = "</table>"; |
|
136 | + |
|
137 | + // build column header |
|
138 | + $this->_colnames = explode((strstr($this->columns, "||") !== false ? "||" : ","), $this->columns); |
|
139 | + $this->_colwidths = explode((strstr($this->colWidths, "||") !== false ? "||" : ","), $this->colWidths); |
|
140 | + $this->_colaligns = explode((strstr($this->colAligns, "||") !== false ? "||" : ","), $this->colAligns); |
|
141 | + $this->_colwraps = explode((strstr($this->colWraps, "||") !== false ? "||" : ","), $this->colWraps); |
|
142 | + $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors); |
|
143 | + $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes); |
|
144 | + $this->_colcount = count($this->_colnames); |
|
145 | + if(!$this->_isDataset) { |
|
146 | + $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds); |
|
147 | + $this->ds = array_chunk($this->ds, $this->_colcount); |
|
148 | + } |
|
149 | + $tblColHdr = "<thead><tr>"; |
|
150 | + for($c = 0; $c < $this->_colcount; $c++) { |
|
151 | + $name = $this->_colnames[$c]; |
|
152 | + $width = $this->_colwidths[$c]; |
|
153 | + $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>"; |
|
154 | + } |
|
155 | + $tblColHdr .= "</tr></thead>\n"; |
|
156 | + |
|
157 | + // build rows |
|
158 | + $rowcount = $this->_isDataset ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
|
159 | + $this->_fieldnames = explode(",", $this->fields); |
|
160 | + if($rowcount == 0) { |
|
161 | + $tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n"; |
|
162 | + } else { |
|
163 | + // render grid items |
|
164 | + if($this->pageSize <= 0) { |
|
165 | + for($r = 0; $r < $rowcount; $r++) { |
|
166 | + $row = $this->_isDataset ? $modx->db->getRow($this->ds) : $this->ds[$r]; |
|
167 | + $tblRows .= $this->RenderRowFnc($r + 1, $row); |
|
168 | + } |
|
169 | + } else { |
|
170 | + if(!$this->pager) { |
|
171 | + include_once dirname(__FILE__) . "/datasetpager.class.php"; |
|
172 | + $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber); |
|
173 | + $this->pager->setRenderRowFnc($this); // pass this object |
|
174 | + $this->pager->cssStyle = $pagerStyle; |
|
175 | + $this->pager->cssClass = $pagerClass; |
|
176 | + } else { |
|
177 | + $this->pager->pageSize = $this->pageSize; |
|
178 | + $this->pager->pageNumber = $this->pageNumber; |
|
179 | + } |
|
180 | + |
|
181 | + $this->pager->render(); |
|
182 | + $tblRows = $this->pager->getRenderedRows(); |
|
183 | + $tblPager = $this->pager->getRenderedPager(); |
|
184 | + } |
|
185 | + } |
|
186 | + |
|
187 | + // setup header,pager and footer |
|
188 | + $o = $tblStart; |
|
189 | + $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both"); |
|
190 | + $pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both"); |
|
191 | + if($this->header) { |
|
192 | + $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>"; |
|
193 | + } |
|
194 | + if($tblPager && $ptop) { |
|
195 | + $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
196 | + } |
|
197 | + $o .= $tblColHdr . $tblRows; |
|
198 | + if($tblPager && $pbot) { |
|
199 | + $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
200 | + } |
|
201 | + if($this->footer) { |
|
202 | + $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>"; |
|
203 | + } |
|
204 | + $o .= $tblEnd; |
|
205 | + return $o; |
|
206 | + } |
|
207 | + |
|
208 | + // format column values |
|
209 | 209 | |
210 | 210 | public function RenderRowFnc($n, $row) { |
211 | - if($this->_alt == 0) { |
|
212 | - $Style = $this->_itemStyle; |
|
213 | - $Class = $this->_itemClass; |
|
214 | - $this->_alt = 1; |
|
215 | - } else { |
|
216 | - $Style = $this->_altItemStyle; |
|
217 | - $Class = $this->_altItemClass; |
|
218 | - $this->_alt = 0; |
|
219 | - } |
|
220 | - $o = "<tr>"; |
|
221 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
222 | - $colStyle = $Style; |
|
223 | - $fld = trim($this->_fieldnames[$c]); |
|
224 | - $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null; |
|
225 | - $align = isset($this->_colaligns[$c]) ? $this->_colaligns[$c] : null; |
|
226 | - $color = isset($this->_colcolors[$c]) ? $this->_colcolors[$c] : null; |
|
227 | - $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null; |
|
228 | - $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null; |
|
229 | - $value = $row[($this->_isDataset && $fld ? $fld : $c)]; |
|
230 | - if($color && $Style) { |
|
231 | - $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'"; |
|
232 | - } |
|
233 | - $value = $this->formatColumnValue($row, $value, $type, $align); |
|
234 | - $o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>"; |
|
235 | - } |
|
236 | - $o .= "</tr>\n"; |
|
237 | - return $o; |
|
238 | - } |
|
211 | + if($this->_alt == 0) { |
|
212 | + $Style = $this->_itemStyle; |
|
213 | + $Class = $this->_itemClass; |
|
214 | + $this->_alt = 1; |
|
215 | + } else { |
|
216 | + $Style = $this->_altItemStyle; |
|
217 | + $Class = $this->_altItemClass; |
|
218 | + $this->_alt = 0; |
|
219 | + } |
|
220 | + $o = "<tr>"; |
|
221 | + for($c = 0; $c < $this->_colcount; $c++) { |
|
222 | + $colStyle = $Style; |
|
223 | + $fld = trim($this->_fieldnames[$c]); |
|
224 | + $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null; |
|
225 | + $align = isset($this->_colaligns[$c]) ? $this->_colaligns[$c] : null; |
|
226 | + $color = isset($this->_colcolors[$c]) ? $this->_colcolors[$c] : null; |
|
227 | + $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null; |
|
228 | + $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null; |
|
229 | + $value = $row[($this->_isDataset && $fld ? $fld : $c)]; |
|
230 | + if($color && $Style) { |
|
231 | + $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'"; |
|
232 | + } |
|
233 | + $value = $this->formatColumnValue($row, $value, $type, $align); |
|
234 | + $o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>"; |
|
235 | + } |
|
236 | + $o .= "</tr>\n"; |
|
237 | + return $o; |
|
238 | + } |
|
239 | 239 | |
240 | 240 | public function formatColumnValue($row, $value, $type, &$align) { |
241 | - if(strpos($type, ":") !== false) { |
|
242 | - list($type, $type_format) = explode(":", $type, 2); |
|
243 | - } |
|
244 | - switch(strtolower($type)) { |
|
245 | - case "integer": |
|
246 | - if($align == "") { |
|
247 | - $align = "right"; |
|
248 | - } |
|
249 | - $value = number_format($value); |
|
250 | - break; |
|
251 | - |
|
252 | - case "float": |
|
253 | - if($align == "") { |
|
254 | - $align = "right"; |
|
255 | - } |
|
256 | - if(!$type_format) { |
|
257 | - $type_format = 2; |
|
258 | - } |
|
259 | - $value = number_format($value, $type_format); |
|
260 | - break; |
|
261 | - |
|
262 | - case "currency": |
|
263 | - if($align == "") { |
|
264 | - $align = "right"; |
|
265 | - } |
|
266 | - if(!$type_format) { |
|
267 | - $type_format = 2; |
|
268 | - } |
|
269 | - $value = "$" . number_format($value, $type_format); |
|
270 | - break; |
|
271 | - |
|
272 | - case "date": |
|
273 | - if($align == "") { |
|
274 | - $align = "right"; |
|
275 | - } |
|
276 | - if(!is_numeric($value)) { |
|
277 | - $value = strtotime($value); |
|
278 | - } |
|
279 | - if(!$type_format) { |
|
280 | - $type_format = "%A %d, %B %Y"; |
|
281 | - } |
|
282 | - $value = strftime($type_format, $value); |
|
283 | - break; |
|
284 | - |
|
285 | - case "boolean": |
|
286 | - if($align == '') { |
|
287 | - $align = "center"; |
|
288 | - } |
|
289 | - $value = number_format($value); |
|
290 | - if($value) { |
|
291 | - $value = '•'; |
|
292 | - } else { |
|
293 | - $value = ' '; |
|
294 | - } |
|
295 | - break; |
|
296 | - |
|
297 | - case "template": |
|
298 | - // replace [+value+] first |
|
299 | - $value = str_replace("[+value+]", $value, $type_format); |
|
300 | - // replace other [+fields+] |
|
301 | - if(strpos($value, "[+") !== false) { |
|
302 | - foreach($row as $k => $v) { |
|
303 | - $value = str_replace("[+$k+]", $v, $value); |
|
304 | - } |
|
305 | - } |
|
306 | - break; |
|
307 | - |
|
308 | - } |
|
309 | - return $value; |
|
310 | - } |
|
241 | + if(strpos($type, ":") !== false) { |
|
242 | + list($type, $type_format) = explode(":", $type, 2); |
|
243 | + } |
|
244 | + switch(strtolower($type)) { |
|
245 | + case "integer": |
|
246 | + if($align == "") { |
|
247 | + $align = "right"; |
|
248 | + } |
|
249 | + $value = number_format($value); |
|
250 | + break; |
|
251 | + |
|
252 | + case "float": |
|
253 | + if($align == "") { |
|
254 | + $align = "right"; |
|
255 | + } |
|
256 | + if(!$type_format) { |
|
257 | + $type_format = 2; |
|
258 | + } |
|
259 | + $value = number_format($value, $type_format); |
|
260 | + break; |
|
261 | + |
|
262 | + case "currency": |
|
263 | + if($align == "") { |
|
264 | + $align = "right"; |
|
265 | + } |
|
266 | + if(!$type_format) { |
|
267 | + $type_format = 2; |
|
268 | + } |
|
269 | + $value = "$" . number_format($value, $type_format); |
|
270 | + break; |
|
271 | + |
|
272 | + case "date": |
|
273 | + if($align == "") { |
|
274 | + $align = "right"; |
|
275 | + } |
|
276 | + if(!is_numeric($value)) { |
|
277 | + $value = strtotime($value); |
|
278 | + } |
|
279 | + if(!$type_format) { |
|
280 | + $type_format = "%A %d, %B %Y"; |
|
281 | + } |
|
282 | + $value = strftime($type_format, $value); |
|
283 | + break; |
|
284 | + |
|
285 | + case "boolean": |
|
286 | + if($align == '') { |
|
287 | + $align = "center"; |
|
288 | + } |
|
289 | + $value = number_format($value); |
|
290 | + if($value) { |
|
291 | + $value = '•'; |
|
292 | + } else { |
|
293 | + $value = ' '; |
|
294 | + } |
|
295 | + break; |
|
296 | + |
|
297 | + case "template": |
|
298 | + // replace [+value+] first |
|
299 | + $value = str_replace("[+value+]", $value, $type_format); |
|
300 | + // replace other [+fields+] |
|
301 | + if(strpos($value, "[+") !== false) { |
|
302 | + foreach($row as $k => $v) { |
|
303 | + $value = str_replace("[+$k+]", $v, $value); |
|
304 | + } |
|
305 | + } |
|
306 | + break; |
|
307 | + |
|
308 | + } |
|
309 | + return $value; |
|
310 | + } |
|
311 | 311 | } |