@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -switch($modx->manager->action) { |
|
5 | +switch ($modx->manager->action) { |
|
6 | 6 | case 107: |
7 | - if(!$modx->hasPermission('new_module')) { |
|
7 | + if (!$modx->hasPermission('new_module')) { |
|
8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
9 | 9 | } |
10 | 10 | break; |
11 | 11 | case 108: |
12 | - if(!$modx->hasPermission('edit_module')) { |
|
12 | + if (!$modx->hasPermission('edit_module')) { |
|
13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
14 | 14 | } |
15 | 15 | break; |
16 | 16 | default: |
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
19 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
20 | 20 | // Get table names (alphabetical) |
21 | 21 | $tbl_membergroup_names = $modx->getFullTableName('membergroup_names'); |
22 | 22 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string |
35 | 35 | */ |
36 | -function createGUID() { |
|
36 | +function createGUID(){ |
|
37 | 37 | srand((double) microtime() * 1000000); |
38 | 38 | $r = rand(); |
39 | - $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
39 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
40 | 40 | $m = md5($u); |
41 | 41 | return $m; |
42 | 42 | } |
43 | 43 | |
44 | 44 | // check to see the module editor isn't locked |
45 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
45 | +if ($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
46 | 46 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
47 | 47 | } |
48 | 48 | // end check for lock |
@@ -50,29 +50,29 @@ discard block |
||
50 | 50 | // Lock snippet for other users to edit |
51 | 51 | $modx->lockElement(6, $id); |
52 | 52 | |
53 | -if(isset($_GET['id'])) { |
|
53 | +if (isset($_GET['id'])) { |
|
54 | 54 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
55 | 55 | $content = $modx->db->getRow($rs); |
56 | - if(!$content) { |
|
56 | + if (!$content) { |
|
57 | 57 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
58 | 58 | } |
59 | 59 | $content['properties'] = str_replace("&", "&", $content['properties']); |
60 | 60 | $_SESSION['itemname'] = $content['name']; |
61 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
61 | + if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
62 | 62 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
63 | 63 | } |
64 | 64 | } else { |
65 | 65 | $_SESSION['itemname'] = $_lang["new_module"]; |
66 | 66 | $content['wrap'] = '1'; |
67 | 67 | } |
68 | -if($modx->manager->hasFormValues()) { |
|
68 | +if ($modx->manager->hasFormValues()) { |
|
69 | 69 | $modx->manager->loadFormValues(); |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Add lock-element JS-Script |
73 | 73 | $lockElementId = $id; |
74 | 74 | $lockElementType = 6; |
75 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
75 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
76 | 76 | ?> |
77 | 77 | <script type="text/javascript"> |
78 | 78 | function loadDependencies() { |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | function BrowseServer() { |
420 | 420 | var w = screen.width * 0.7; |
421 | 421 | var h = screen.height * 0.7; |
422 | - OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h); |
|
422 | + OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | function SetUrl(url, width, height, alt) { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | <?php |
440 | 440 | // invoke OnModFormPrerender event |
441 | 441 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
442 | - if(is_array($evtOut)) { |
|
442 | + if (is_array($evtOut)) { |
|
443 | 443 | echo implode('', $evtOut); |
444 | 444 | } |
445 | 445 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
454 | 454 | |
455 | 455 | <h1> |
456 | - <i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i> |
|
456 | + <i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i> |
|
457 | 457 | </h1> |
458 | 458 | |
459 | 459 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | <div class="col-md-9 col-lg-10"> |
479 | 479 | <div class="form-control-name clearfix"> |
480 | 480 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
481 | - <?php if($modx->hasPermission('save_role')): ?> |
|
482 | - <label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip> |
|
481 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
482 | + <label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip> |
|
483 | 483 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
484 | 484 | <i class="fa fa-lock"></i> |
485 | 485 | </label> |
@@ -501,9 +501,9 @@ discard block |
||
501 | 501 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
502 | 502 | <option> </option> |
503 | 503 | <?php |
504 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
505 | - foreach(getCategories() as $n => $v) { |
|
506 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
504 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
505 | + foreach (getCategories() as $n => $v) { |
|
506 | + echo "\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category'])."</option>\n"; |
|
507 | 507 | } |
508 | 508 | ?> |
509 | 509 | </select> |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | <div class="form-group"> |
536 | 536 | <div class="form-row"> |
537 | 537 | <label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> |
538 | - <?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label> |
|
538 | + <?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label> |
|
539 | 539 | </div> |
540 | 540 | <div class="form-row"> |
541 | 541 | <label for="parse_docblock"> |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | </div> |
601 | 601 | <!-- HTML text editor end --> |
602 | 602 | </div> |
603 | - <?php if($modx->manager->action == '108'): ?> |
|
603 | + <?php if ($modx->manager->action == '108'): ?> |
|
604 | 604 | <!-- Dependencies --> |
605 | 605 | <div class="tab-page" id="tabDepend"> |
606 | 606 | <h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2> |
@@ -628,14 +628,14 @@ discard block |
||
628 | 628 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50 |
629 | 629 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name'); |
630 | 630 | |
631 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
631 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
632 | 632 | $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
633 | 633 | $grd->noRecordMsg = $_lang['no_records_found']; |
634 | 634 | $grd->cssClass = 'grid'; |
635 | 635 | $grd->columnHeaderClass = 'gridHeader'; |
636 | 636 | $grd->itemClass = 'gridItem'; |
637 | 637 | $grd->altItemClass = 'gridAltItem'; |
638 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
638 | + $grd->columns = $_lang['element_name']." ,".$_lang['type']; |
|
639 | 639 | $grd->fields = "name,type"; |
640 | 640 | echo $grd->render(); |
641 | 641 | ?> |
@@ -648,13 +648,13 @@ discard block |
||
648 | 648 | <h2 class="tab"><?= $_lang['access_permissions'] ?></h2> |
649 | 649 | <script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script> |
650 | 650 | <div class="container container-body"> |
651 | - <?php if($use_udperms == 1) : ?> |
|
651 | + <?php if ($use_udperms == 1) : ?> |
|
652 | 652 | <?php |
653 | 653 | // fetch user access permissions for the module |
654 | 654 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
655 | 655 | $groupsarray = $modx->db->getColumn('usergroup', $rs); |
656 | 656 | |
657 | - if($modx->hasPermission('access_permissions')) { |
|
657 | + if ($modx->hasPermission('access_permissions')) { |
|
658 | 658 | ?> |
659 | 659 | <!-- User Group Access Permissions --> |
660 | 660 | <script type="text/javascript"> |
@@ -682,22 +682,22 @@ discard block |
||
682 | 682 | } |
683 | 683 | $chk = ''; |
684 | 684 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
685 | - while($row = $modx->db->getRow($rs)) { |
|
685 | + while ($row = $modx->db->getRow($rs)) { |
|
686 | 686 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
687 | 687 | $checked = in_array($row['id'], $groupsarray); |
688 | - if($modx->hasPermission('access_permissions')) { |
|
689 | - if($checked) { |
|
688 | + if ($modx->hasPermission('access_permissions')) { |
|
689 | + if ($checked) { |
|
690 | 690 | $notPublic = true; |
691 | 691 | } |
692 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
692 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n"; |
|
693 | 693 | } else { |
694 | - if($checked) { |
|
695 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
694 | + if ($checked) { |
|
695 | + $chks = '<input type="hidden" name="usrgroups[]" value="'.$row['id'].'" />'."\n".$chks; |
|
696 | 696 | } |
697 | 697 | } |
698 | 698 | } |
699 | - if($modx->hasPermission('access_permissions')) { |
|
700 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
699 | + if ($modx->hasPermission('access_permissions')) { |
|
700 | + $chks = '<label><input type="checkbox" name="chkallgroups"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true)" /><span class="warning"> '.$_lang['all_usr_groups'].'</span></label><br />'."\n".$chks; |
|
701 | 701 | } |
702 | 702 | echo $chks; |
703 | 703 | ?> |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | <?php |
719 | 719 | // invoke OnModFormRender event |
720 | 720 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
721 | - if(is_array($evtOut)) { |
|
721 | + if (is_array($evtOut)) { |
|
722 | 722 | echo implode('', $evtOut); |
723 | 723 | } |
724 | 724 | ?> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('import_static')) { |
|
5 | +if (!$modx->hasPermission('import_static')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | <div class="tab-page"> |
44 | 44 | <div class="container container-body"> |
45 | 45 | <?php |
46 | - if(!isset($_POST['import'])) { |
|
47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
46 | + if (!isset($_POST['import'])) { |
|
47 | + echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>"; |
|
48 | 48 | ?> |
49 | 49 | <form action="index.php" method="post" name="importFrm"> |
50 | 50 | <input type="hidden" name="import" value="import" /> |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function run() { |
|
107 | +function run(){ |
|
108 | 108 | global $modx, $_lang; |
109 | 109 | |
110 | 110 | $tbl_site_content = $modx->getFullTableName('site_content'); |
111 | 111 | $output = ''; |
112 | 112 | $maxtime = $_POST['maxtime']; |
113 | 113 | |
114 | - if(!is_numeric($maxtime)) { |
|
114 | + if (!is_numeric($maxtime)) { |
|
115 | 115 | $maxtime = 30; |
116 | 116 | } |
117 | 117 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | $mtime = $mtime[1] + $mtime[0]; |
123 | 123 | $importstart = $mtime; |
124 | 124 | |
125 | - if($_POST['reset'] == 'on') { |
|
125 | + if ($_POST['reset'] == 'on') { |
|
126 | 126 | $modx->db->truncate($tbl_site_content); |
127 | 127 | $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
128 | 128 | } |
129 | 129 | |
130 | - $parent = (int)$_POST['parent']; |
|
130 | + $parent = (int) $_POST['parent']; |
|
131 | 131 | |
132 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
133 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
134 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
135 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
132 | + if (is_dir(MODX_BASE_PATH.'temp/import')) { |
|
133 | + $filedir = MODX_BASE_PATH.'temp/import/'; |
|
134 | + } elseif (is_dir(MODX_BASE_PATH.'assets/import')) { |
|
135 | + $filedir = MODX_BASE_PATH.'assets/import/'; |
|
136 | 136 | } else { |
137 | 137 | $filedir = ''; |
138 | 138 | } |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | $files = pop_index($files); |
144 | 144 | |
145 | 145 | // no. of files to import |
146 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
146 | + $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound); |
|
147 | 147 | |
148 | 148 | // import files |
149 | - if(0 < count($files)) { |
|
149 | + if (0 < count($files)) { |
|
150 | 150 | $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
151 | 151 | importFiles($parent, $filedir, $files, 'root'); |
152 | 152 | } |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $mtime = $mtime[1] + $mtime[0]; |
157 | 157 | $importend = $mtime; |
158 | 158 | $totaltime = ($importend - $importstart); |
159 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
159 | + $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3)); |
|
160 | 160 | |
161 | - if($_POST['convert_link'] == 'on') { |
|
161 | + if ($_POST['convert_link'] == 'on') { |
|
162 | 162 | convertLink(); |
163 | 163 | } |
164 | 164 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param array $files |
172 | 172 | * @param string $mode |
173 | 173 | */ |
174 | -function importFiles($parent, $filedir, $files, $mode) { |
|
174 | +function importFiles($parent, $filedir, $files, $mode){ |
|
175 | 175 | global $modx; |
176 | 176 | global $_lang, $allowedfiles; |
177 | 177 | global $search_default, $cache_default, $publish_default; |
@@ -180,21 +180,21 @@ discard block |
||
180 | 180 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
181 | 181 | |
182 | 182 | $createdby = $modx->getLoginUserID(); |
183 | - if(!is_array($files)) { |
|
183 | + if (!is_array($files)) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | - if($_POST['object'] === 'all') { |
|
186 | + if ($_POST['object'] === 'all') { |
|
187 | 187 | $modx->config['default_template'] = '0'; |
188 | 188 | $richtext = '0'; |
189 | 189 | } else { |
190 | 190 | $richtext = '1'; |
191 | 191 | } |
192 | 192 | |
193 | - foreach($files as $id => $value) { |
|
194 | - if(is_array($value)) { |
|
193 | + foreach ($files as $id => $value) { |
|
194 | + if (is_array($value)) { |
|
195 | 195 | // create folder |
196 | 196 | $alias = $id; |
197 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
197 | + printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias); |
|
198 | 198 | $field = array(); |
199 | 199 | $field['type'] = 'document'; |
200 | 200 | $field['contentType'] = 'text/html'; |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | $field['isfolder'] = 1; |
210 | 210 | $field['menuindex'] = 1; |
211 | 211 | $find = false; |
212 | - foreach(array( |
|
212 | + foreach (array( |
|
213 | 213 | 'index.html', |
214 | 214 | 'index.htm' |
215 | 215 | ) as $filename) { |
216 | - $filepath = $filedir . $alias . '/' . $filename; |
|
217 | - if($find === false && file_exists($filepath)) { |
|
216 | + $filepath = $filedir.$alias.'/'.$filename; |
|
217 | + if ($find === false && file_exists($filepath)) { |
|
218 | 218 | $file = getFileContent($filepath); |
219 | 219 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
220 | 220 | |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | $field['createdon'] = $date; |
227 | 227 | $field['editedon'] = $date; |
228 | 228 | $newid = $modx->db->insert($field, $tbl_site_content); |
229 | - if($newid) { |
|
229 | + if ($newid) { |
|
230 | 230 | $find = true; |
231 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
232 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
231 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
232 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
233 | 233 | } else { |
234 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
234 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
235 | 235 | exit; |
236 | 236 | } |
237 | 237 | } |
238 | 238 | } |
239 | - if($find === false) { |
|
239 | + if ($find === false) { |
|
240 | 240 | $date = time(); |
241 | 241 | $field['pagetitle'] = '---'; |
242 | 242 | $field['content'] = ''; |
@@ -244,30 +244,30 @@ discard block |
||
244 | 244 | $field['editedon'] = $date; |
245 | 245 | $field['hidemenu'] = '1'; |
246 | 246 | $newid = $modx->db->insert($field, $tbl_site_content); |
247 | - if($newid) { |
|
247 | + if ($newid) { |
|
248 | 248 | $find = true; |
249 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
250 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
249 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
250 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
251 | 251 | } else { |
252 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
252 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
253 | 253 | exit; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } else { |
257 | 257 | // create document |
258 | - if($mode == 'sub' && $value == 'index.html') { |
|
258 | + if ($mode == 'sub' && $value == 'index.html') { |
|
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | $filename = $value; |
262 | 262 | $fparts = explode('.', $value); |
263 | 263 | $alias = $fparts[0]; |
264 | 264 | $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
265 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
265 | + printf("<span>".$_lang['import_site_importing_document']."</span>", $filename); |
|
266 | 266 | |
267 | - if(!in_array($ext, $allowedfiles)) { |
|
268 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
267 | + if (!in_array($ext, $allowedfiles)) { |
|
268 | + echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n"; |
|
269 | 269 | } else { |
270 | - $filepath = $filedir . $filename; |
|
270 | + $filepath = $filedir.$filename; |
|
271 | 271 | $file = getFileContent($filepath); |
272 | 272 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
273 | 273 | |
@@ -292,18 +292,18 @@ discard block |
||
292 | 292 | $field['isfolder'] = 0; |
293 | 293 | $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
294 | 294 | $newid = $modx->db->insert($field, $tbl_site_content); |
295 | - if($newid) { |
|
296 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
295 | + if ($newid) { |
|
296 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
297 | 297 | } else { |
298 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
298 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
299 | 299 | exit; |
300 | 300 | } |
301 | 301 | |
302 | 302 | $is_site_start = false; |
303 | - if($filename == 'index.html') { |
|
303 | + if ($filename == 'index.html') { |
|
304 | 304 | $is_site_start = true; |
305 | 305 | } |
306 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
306 | + if ($is_site_start == true && $_POST['reset'] == 'on') { |
|
307 | 307 | $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
308 | 308 | $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
309 | 309 | } |
@@ -318,26 +318,26 @@ discard block |
||
318 | 318 | * @param int $count |
319 | 319 | * @return array |
320 | 320 | */ |
321 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
321 | +function getFiles($directory, $listing = array(), $count = 0){ |
|
322 | 322 | global $_lang; |
323 | 323 | global $filesfound; |
324 | 324 | $dummy = $count; |
325 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
326 | - foreach($files as $file) { |
|
327 | - if($file == '.' || $file == '..') { |
|
325 | + if (!empty($directory) && $files = scandir($directory)) { |
|
326 | + foreach ($files as $file) { |
|
327 | + if ($file == '.' || $file == '..') { |
|
328 | 328 | continue; |
329 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
329 | + } elseif ($h = @opendir($directory.$file."/")) { |
|
330 | 330 | closedir($h); |
331 | 331 | $count = -1; |
332 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
333 | - } elseif(strpos($file, '.htm') !== false) { |
|
332 | + $listing[$file] = getFiles($directory.$file."/", array(), $count + 1); |
|
333 | + } elseif (strpos($file, '.htm') !== false) { |
|
334 | 334 | $listing[$dummy] = $file; |
335 | 335 | $dummy = $dummy + 1; |
336 | 336 | $filesfound++; |
337 | 337 | } |
338 | 338 | } |
339 | 339 | } else { |
340 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
340 | + echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>"; |
|
341 | 341 | } |
342 | 342 | return ($listing); |
343 | 343 | } |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | * @param string $filepath |
347 | 347 | * @return bool|string |
348 | 348 | */ |
349 | -function getFileContent($filepath) { |
|
349 | +function getFileContent($filepath){ |
|
350 | 350 | global $_lang; |
351 | 351 | // get the file |
352 | - if(!$buffer = file_get_contents($filepath)) { |
|
353 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
352 | + if (!$buffer = file_get_contents($filepath)) { |
|
353 | + echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>"; |
|
354 | 354 | } else { |
355 | 355 | return $buffer; |
356 | 356 | } |
@@ -360,17 +360,17 @@ discard block |
||
360 | 360 | * @param array $array |
361 | 361 | * @return array |
362 | 362 | */ |
363 | -function pop_index($array) { |
|
363 | +function pop_index($array){ |
|
364 | 364 | $new_array = array(); |
365 | - foreach($array as $k => $v) { |
|
366 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
365 | + foreach ($array as $k => $v) { |
|
366 | + if ($v !== 'index.html' && $v !== 'index.htm') { |
|
367 | 367 | $new_array[$k] = $v; |
368 | 368 | } else { |
369 | 369 | array_unshift($new_array, $v); |
370 | 370 | } |
371 | 371 | } |
372 | - foreach($array as $k => $v) { |
|
373 | - if(is_array($v)) { |
|
372 | + foreach ($array as $k => $v) { |
|
373 | + if (is_array($v)) { |
|
374 | 374 | $new_array[$k] = $v; |
375 | 375 | } |
376 | 376 | } |
@@ -383,34 +383,34 @@ discard block |
||
383 | 383 | * @param string $alias |
384 | 384 | * @return array |
385 | 385 | */ |
386 | -function treatContent($src, $filename, $alias) { |
|
386 | +function treatContent($src, $filename, $alias){ |
|
387 | 387 | global $modx; |
388 | 388 | |
389 | 389 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
390 | 390 | |
391 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
391 | + if (preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
392 | 392 | $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
393 | 393 | $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
394 | 394 | } else { |
395 | 395 | $pagetitle = $alias; |
396 | 396 | } |
397 | - if(!$pagetitle) { |
|
397 | + if (!$pagetitle) { |
|
398 | 398 | $pagetitle = $alias; |
399 | 399 | } |
400 | 400 | |
401 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
401 | + if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
402 | 402 | $description = ($matches[1] !== '') ? $matches[1] : $filename; |
403 | 403 | $description = str_replace('[*description*]', '', $description); |
404 | 404 | } else { |
405 | 405 | $description = ''; |
406 | 406 | } |
407 | 407 | |
408 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
408 | + if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
409 | 409 | $content = $matches[1]; |
410 | 410 | } else { |
411 | 411 | $content = $src; |
412 | 412 | $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
413 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
413 | + $r = '$1'.$modx->config['modx_charset'].'$2'; |
|
414 | 414 | $content = preg_replace($s, $r, $content); |
415 | 415 | $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
416 | 416 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | /** |
428 | 428 | * @return void |
429 | 429 | */ |
430 | -function convertLink() { |
|
430 | +function convertLink(){ |
|
431 | 431 | global $modx; |
432 | 432 | $tbl_site_content = $modx->getFullTableName('site_content'); |
433 | 433 | |
@@ -435,33 +435,33 @@ discard block |
||
435 | 435 | $p = array(); |
436 | 436 | $target = array(); |
437 | 437 | $dir = ''; |
438 | - while($row = $modx->db->getRow($rs)) { |
|
438 | + while ($row = $modx->db->getRow($rs)) { |
|
439 | 439 | $id = $row['id']; |
440 | 440 | $array = explode('<a href=', $row['content']); |
441 | 441 | $c = 0; |
442 | - foreach($array as $v) { |
|
443 | - if($v[0] === '"') { |
|
442 | + foreach ($array as $v) { |
|
443 | + if ($v[0] === '"') { |
|
444 | 444 | $v = substr($v, 1); |
445 | 445 | list($href, $v) = explode('"', $v, 2); |
446 | 446 | $_ = $href; |
447 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
448 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
447 | + if (strpos($_, $modx->config['site_url']) !== false) { |
|
448 | + $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_); |
|
449 | 449 | } |
450 | - if($_[0] === '/') { |
|
450 | + if ($_[0] === '/') { |
|
451 | 451 | $_ = substr($_, 1); |
452 | 452 | } |
453 | 453 | $_ = str_replace('/index.html', '.html', $_); |
454 | 454 | $level = substr_count($_, '../'); |
455 | - if(1 < $level) { |
|
456 | - if(!isset($p[$id])) { |
|
455 | + if (1 < $level) { |
|
456 | + if (!isset($p[$id])) { |
|
457 | 457 | $p[$id] = $modx->getParentIds($id); |
458 | 458 | } |
459 | 459 | $k = array_keys($p[$id]); |
460 | - while(0 < $level) { |
|
460 | + while (0 < $level) { |
|
461 | 461 | $dir = array_shift($k); |
462 | 462 | $level--; |
463 | 463 | } |
464 | - if($dir != '') { |
|
464 | + if ($dir != '') { |
|
465 | 465 | $dir .= '/'; |
466 | 466 | } |
467 | 467 | } else { |
@@ -469,18 +469,18 @@ discard block |
||
469 | 469 | } |
470 | 470 | |
471 | 471 | $_ = trim($_, './'); |
472 | - if(strpos($_, '/') !== false) { |
|
472 | + if (strpos($_, '/') !== false) { |
|
473 | 473 | $_ = substr($_, strrpos($_, '/')); |
474 | 474 | } |
475 | - $_ = $dir . str_replace('.html', '', $_); |
|
476 | - if(!isset($target[$_])) { |
|
475 | + $_ = $dir.str_replace('.html', '', $_); |
|
476 | + if (!isset($target[$_])) { |
|
477 | 477 | $target[$_] = $modx->getIdFromAlias($_); |
478 | 478 | } |
479 | 479 | $target[$_] = trim($target[$_]); |
480 | - if(!empty($target[$_])) { |
|
481 | - $href = '[~' . $target[$_] . '~]'; |
|
480 | + if (!empty($target[$_])) { |
|
481 | + $href = '[~'.$target[$_].'~]'; |
|
482 | 482 | } |
483 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
483 | + $array[$c] = '<a href="'.$href.'"'.$v; |
|
484 | 484 | } |
485 | 485 | $c++; |
486 | 486 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -switch((int) $modx->manager->action) { |
|
6 | +switch ((int) $modx->manager->action) { |
|
7 | 7 | case 35: |
8 | - if(!$modx->hasPermission('edit_role')) { |
|
8 | + if (!$modx->hasPermission('edit_role')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 38: |
13 | - if(!$modx->hasPermission('new_role')) { |
|
13 | + if (!$modx->hasPermission('new_role')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$role = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_user_roles = $modx->getFullTableName('user_roles'); |
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | -if($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
26 | +if ($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
28 | 28 | } |
29 | 29 | // end check for lock |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | // Lock snippet for other users to edit |
32 | 32 | $modx->lockElement(8, $role); |
33 | 33 | |
34 | -if($modx->manager->action == '35') { |
|
34 | +if ($modx->manager->action == '35') { |
|
35 | 35 | $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
36 | 36 | $roledata = $modx->db->getRow($rs); |
37 | - if(!$roledata) { |
|
37 | + if (!$roledata) { |
|
38 | 38 | $modx->webAlertAndQuit("No role returned!"); |
39 | 39 | } |
40 | 40 | $_SESSION['itemname'] = $roledata['name']; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Add lock-element JS-Script |
47 | 47 | $lockElementId = $role; |
48 | 48 | $lockElementType = 8; |
49 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
49 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
50 | 50 | ?> |
51 | 51 | <script type="text/javascript"> |
52 | 52 | function changestate(element) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <input type="hidden" name="id" value="<?= $_GET['id'] ?>"> |
83 | 83 | |
84 | 84 | <h1> |
85 | - <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'] . '<small>(' . $roledata['id'] . ')</small>' : $_lang['role_title']) ?> |
|
85 | + <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'].'<small>('.$roledata['id'].')</small>' : $_lang['role_title']) ?> |
|
86 | 86 | </h1> |
87 | 87 | |
88 | 88 | <?= $_style['actionbuttons']['dynamic']['savedelete'] ?> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param string $status |
300 | 300 | * @return string |
301 | 301 | */ |
302 | -function render_form($name, $label, $status = '') { |
|
302 | +function render_form($name, $label, $status = ''){ |
|
303 | 303 | global $modx, $roledata; |
304 | 304 | |
305 | 305 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
312 | 312 | $value = ($roledata[$name] == 1) ? 1 : 0; |
313 | - if($status == 'disabled') { |
|
313 | + if ($status == 'disabled') { |
|
314 | 314 | $checked = 'checked'; |
315 | 315 | $value = 1; |
316 | 316 | $set = 'fix'; |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -$logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
|
5 | +$logo = '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
|
6 | 6 | $downloadLinks = array( |
7 | - 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | - 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | - 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | - 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
7 | + 0=>array('title'=>$_lang["information"], 'link'=>'https://evo.im/'), |
|
8 | + 1=>array('title'=>$_lang["download"], 'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | + 2=>array('title'=>$_lang["previous_releases"], 'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | + 3=>array('title'=>$_lang["extras"], 'link'=>array( |
|
11 | 11 | 'http://extras.evolution-cms.com/', |
12 | 12 | 'https://github.com/extras-evolution' |
13 | 13 | )), |
14 | 14 | ); |
15 | 15 | |
16 | 16 | $translationLinks = array( |
17 | - 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | - 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
17 | + 0=>array('title'=>'Evolution CMS', 'link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | + 1=>array('title'=>$_lang["extras"], 'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | /** |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | * @param array $linkArr |
24 | 24 | * @return string |
25 | 25 | */ |
26 | -function createList($sectionHeader, $linkArr) { |
|
26 | +function createList($sectionHeader, $linkArr){ |
|
27 | 27 | $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
28 | 28 | $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
29 | 29 | $links = ''; |
30 | - foreach($linkArr as $row) { |
|
30 | + foreach ($linkArr as $row) { |
|
31 | 31 | if (!is_array($row['link'])) $row['link'] = array($row['link']); |
32 | 32 | foreach ($row['link'] as $link) { |
33 | 33 | $links .= $links != '' ? '<br/>' : ''; |
34 | - $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
34 | + $links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>'; |
|
35 | 35 | } |
36 | 36 | $output .= ' |
37 | 37 | <tr> |
38 | - <td align="left"><strong>' . $row["title"] . '</strong></td> |
|
39 | - <td align="left">' . $links . '</td> |
|
38 | + <td align="left"><strong>' . $row["title"].'</strong></td> |
|
39 | + <td align="left">' . $links.'</td> |
|
40 | 40 | </tr>'; |
41 | 41 | $links = ''; |
42 | 42 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | exit(); |
4 | 4 | } |
5 | 5 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | <?php |
42 | 42 | $rs = $modx->db->select('*', $modx->getFullTableName('site_templates')); |
43 | 43 | $option[] = '<option value="">No selected</option>'; |
44 | - $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : ''; |
|
44 | + $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int) $_REQUEST['templateid'] : ''; |
|
45 | 45 | $selected = $templateid === 0 ? ' selected="selected"' : ''; |
46 | - $option[] = '<option value="0"' . $selected . '>(blank)</option>'; |
|
46 | + $option[] = '<option value="0"'.$selected.'>(blank)</option>'; |
|
47 | 47 | while ($row = $modx->db->getRow($rs)) { |
48 | 48 | $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']); |
49 | 49 | $selected = $row['id'] == $templateid ? ' selected="selected"' : ''; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, $modx_manager_charset); |
87 | 87 | $searchlongtitle = $modx->db->escape(trim($_REQUEST['searchfields'])); |
88 | 88 | $search_alias = $modx->db->escape(trim($_REQUEST['searchfields'])); |
89 | - $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : ''; |
|
89 | + $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int) $_REQUEST['templateid'] : ''; |
|
90 | 90 | $searchcontent = $modx->db->escape($_REQUEST['content']); |
91 | 91 | |
92 | 92 | $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type'; |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $friendly_url_suffix = $modx->config['friendly_url_suffix']; |
101 | 101 | $base_url = $modx->config['base_url']; |
102 | 102 | $site_url = $modx->config['site_url']; |
103 | - $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url); |
|
103 | + $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url); |
|
104 | 104 | if ($url[0] === '/') { |
105 | - $url = preg_replace('@^' . $base_url . '@', '', $url); |
|
105 | + $url = preg_replace('@^'.$base_url.'@', '', $url); |
|
106 | 106 | } |
107 | 107 | if (substr($url, 0, 4) === 'http') { |
108 | - $url = preg_replace('@^' . $site_url . '@', '', $url); |
|
108 | + $url = preg_replace('@^'.$site_url.'@', '', $url); |
|
109 | 109 | } |
110 | 110 | $idFromAlias = $modx->getIdFromAlias($url); |
111 | 111 | } |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
119 | 119 | $articul_result = $modx->db->query($articul_query); |
120 | 120 | $articul_id_array = $modx->db->makeArray($articul_result); |
121 | - if(count($articul_id_array)>0){ |
|
121 | + if (count($articul_id_array) > 0) { |
|
122 | 122 | $articul_id = ''; |
123 | 123 | $i = 1; |
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
124 | + foreach ($articul_id_array as $articul) { |
|
125 | + $articul_id .= $articul['contentid']; |
|
126 | + if ($i !== count($articul_id_array)) { |
|
127 | + $articul_id .= ','; |
|
128 | 128 | } |
129 | 129 | $i++; |
130 | 130 | } |
131 | 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $articul_id_query = ''; |
134 | 134 | } |
135 | 135 | /*end search by TV*/ |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query; //search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
158 | 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
159 | 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
160 | - $sqladd .= $articul_id_query;//search by TV |
|
160 | + $sqladd .= $articul_id_query; //search by TV |
|
161 | 161 | } |
162 | 162 | } else if ($idFromAlias) { |
163 | 163 | $sqladd .= " sc.id='{$idFromAlias}'"; |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
181 | 181 | $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0; |
182 | 182 | $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : ''; |
183 | - $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess'; |
|
184 | - $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
183 | + $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess'; |
|
184 | + $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | if ($sqladd) { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $where = $sqladd; |
192 | 192 | |
193 | 193 | if ($where) { |
194 | - $rs = $modx->db->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
194 | + $rs = $modx->db->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
195 | 195 | $limit = $modx->db->getRecordCount($rs); |
196 | 196 | } else { |
197 | 197 | $limit = 0; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if ($limit < 1) { |
211 | 211 | echo $_lang['search_empty']; |
212 | 212 | } else { |
213 | - printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit); |
|
213 | + printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit); |
|
214 | 214 | ?> |
215 | 215 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
216 | 216 | <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1"> |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | if (function_exists('mb_strlen') && function_exists('mb_substr')) { |
271 | 271 | ?> |
272 | 272 | <td<?= $tdClass ?>> |
273 | - <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a> |
|
273 | + <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a> |
|
274 | 274 | </td> |
275 | - <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td> |
|
275 | + <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td> |
|
276 | 276 | <?php |
277 | 277 | } else { |
278 | 278 | ?> |
279 | - <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td> |
|
280 | - <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td> |
|
279 | + <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td> |
|
280 | + <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td> |
|
281 | 281 | <?php |
282 | 282 | } |
283 | 283 | ?> |
@@ -297,115 +297,115 @@ discard block |
||
297 | 297 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
298 | 298 | $docscounts = $modx->db->getRecordCount($rs); |
299 | 299 | if ($docscounts > 0) { |
300 | - $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>'; |
|
300 | + $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>'; |
|
301 | 301 | while ($row = $modx->db->getRow($rs)) { |
302 | - $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
302 | + $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | 307 | //templates |
308 | 308 | if ($modx->hasPermission('edit_template')) { |
309 | - $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' |
|
310 | - OR `templatename` like '%" . $searchfields . "%' |
|
311 | - OR `description` like '%" . $searchfields . "%' |
|
312 | - OR `content` like '%" . $searchfields . "%'"); |
|
309 | + $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' |
|
310 | + OR `templatename` like '%" . $searchfields."%' |
|
311 | + OR `description` like '%" . $searchfields."%' |
|
312 | + OR `content` like '%" . $searchfields."%'"); |
|
313 | 313 | $templatecounts = $modx->db->getRecordCount($rs); |
314 | 314 | if ($templatecounts > 0) { |
315 | - $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>'; |
|
315 | + $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>'; |
|
316 | 316 | while ($row = $modx->db->getRow($rs)) { |
317 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
317 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | 322 | //tvs |
323 | 323 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
324 | - $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' |
|
325 | - OR `name` like '%" . $searchfields . "%' |
|
326 | - OR `description` like '%" . $searchfields . "%' |
|
327 | - OR `type` like '%" . $searchfields . "%' |
|
328 | - OR `elements` like '%" . $searchfields . "%' |
|
329 | - OR `display` like '%" . $searchfields . "%' |
|
330 | - OR `display_params` like '%" . $searchfields . "%' |
|
331 | - OR `default_text` like '%" . $searchfields . "%'"); |
|
324 | + $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' |
|
325 | + OR `name` like '%" . $searchfields."%' |
|
326 | + OR `description` like '%" . $searchfields."%' |
|
327 | + OR `type` like '%" . $searchfields."%' |
|
328 | + OR `elements` like '%" . $searchfields."%' |
|
329 | + OR `display` like '%" . $searchfields."%' |
|
330 | + OR `display_params` like '%" . $searchfields."%' |
|
331 | + OR `default_text` like '%" . $searchfields."%'"); |
|
332 | 332 | $tvscounts = $modx->db->getRecordCount($rs); |
333 | 333 | if ($tvscounts > 0) { |
334 | - $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>'; |
|
334 | + $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>'; |
|
335 | 335 | while ($row = $modx->db->getRow($rs)) { |
336 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
336 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
341 | 341 | //Chunks |
342 | 342 | if ($modx->hasPermission('edit_chunk')) { |
343 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' |
|
344 | - OR `name` like '%" . $searchfields . "%' |
|
345 | - OR `description` like '%" . $searchfields . "%' |
|
346 | - OR `snippet` like '%" . $searchfields . "%'"); |
|
343 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' |
|
344 | + OR `name` like '%" . $searchfields."%' |
|
345 | + OR `description` like '%" . $searchfields."%' |
|
346 | + OR `snippet` like '%" . $searchfields."%'"); |
|
347 | 347 | $chunkscounts = $modx->db->getRecordCount($rs); |
348 | 348 | if ($chunkscounts > 0) { |
349 | - $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>'; |
|
349 | + $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>'; |
|
350 | 350 | while ($row = $modx->db->getRow($rs)) { |
351 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
351 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | 356 | //Snippets |
357 | 357 | if ($modx->hasPermission('edit_snippet')) { |
358 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' |
|
359 | - OR `name` like '%" . $searchfields . "%' |
|
360 | - OR `description` like '%" . $searchfields . "%' |
|
361 | - OR `snippet` like '%" . $searchfields . "%' |
|
362 | - OR `properties` like '%" . $searchfields . "%' |
|
363 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
358 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' |
|
359 | + OR `name` like '%" . $searchfields."%' |
|
360 | + OR `description` like '%" . $searchfields."%' |
|
361 | + OR `snippet` like '%" . $searchfields."%' |
|
362 | + OR `properties` like '%" . $searchfields."%' |
|
363 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
364 | 364 | $snippetscounts = $modx->db->getRecordCount($rs); |
365 | 365 | if ($snippetscounts > 0) { |
366 | - $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>'; |
|
366 | + $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>'; |
|
367 | 367 | while ($row = $modx->db->getRow($rs)) { |
368 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
368 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | //plugins |
374 | 374 | if ($modx->hasPermission('edit_plugin')) { |
375 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' |
|
376 | - OR `name` like '%" . $searchfields . "%' |
|
377 | - OR `description` like '%" . $searchfields . "%' |
|
378 | - OR `plugincode` like '%" . $searchfields . "%' |
|
379 | - OR `properties` like '%" . $searchfields . "%' |
|
380 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
375 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' |
|
376 | + OR `name` like '%" . $searchfields."%' |
|
377 | + OR `description` like '%" . $searchfields."%' |
|
378 | + OR `plugincode` like '%" . $searchfields."%' |
|
379 | + OR `properties` like '%" . $searchfields."%' |
|
380 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
381 | 381 | $pluginscounts = $modx->db->getRecordCount($rs); |
382 | 382 | if ($pluginscounts > 0) { |
383 | - $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>'; |
|
383 | + $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>'; |
|
384 | 384 | while ($row = $modx->db->getRow($rs)) { |
385 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
385 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
390 | 390 | //modules |
391 | 391 | if ($modx->hasPermission('edit_module')) { |
392 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' |
|
393 | - OR `name` like '%" . $searchfields . "%' |
|
394 | - OR `description` like '%" . $searchfields . "%' |
|
395 | - OR `modulecode` like '%" . $searchfields . "%' |
|
396 | - OR `properties` like '%" . $searchfields . "%' |
|
397 | - OR `guid` like '%" . $searchfields . "%' |
|
398 | - OR `resourcefile` like '%" . $searchfields . "%'"); |
|
392 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' |
|
393 | + OR `name` like '%" . $searchfields."%' |
|
394 | + OR `description` like '%" . $searchfields."%' |
|
395 | + OR `modulecode` like '%" . $searchfields."%' |
|
396 | + OR `properties` like '%" . $searchfields."%' |
|
397 | + OR `guid` like '%" . $searchfields."%' |
|
398 | + OR `resourcefile` like '%" . $searchfields."%'"); |
|
399 | 399 | $modulescounts = $modx->db->getRecordCount($rs); |
400 | 400 | if ($modulescounts > 0) { |
401 | - $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>'; |
|
401 | + $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>'; |
|
402 | 402 | while ($row = $modx->db->getRow($rs)) { |
403 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
403 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
408 | - echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1'; |
|
408 | + echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1'; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | ?> |
@@ -421,13 +421,13 @@ discard block |
||
421 | 421 | */ |
422 | 422 | function highlightingCoincidence($text, $search) |
423 | 423 | { |
424 | - $regexp = '!(' . str_replace(array( |
|
424 | + $regexp = '!('.str_replace(array( |
|
425 | 425 | '(', |
426 | 426 | ')' |
427 | 427 | ), array( |
428 | 428 | '\(', |
429 | 429 | '\)' |
430 | - ), trim($search)) . ')!isu'; |
|
430 | + ), trim($search)).')!isu'; |
|
431 | 431 | return preg_replace($regexp, '<span class="text-danger">$1</span>', $text); |
432 | 432 | } |
433 | 433 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $class .= ' deleted'; |
451 | 451 | } |
452 | 452 | if ($class) { |
453 | - $class = ' class="' . trim($class) . '"'; |
|
453 | + $class = ' class="'.trim($class).'"'; |
|
454 | 454 | } |
455 | 455 | return $class; |
456 | 456 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_site_plugins = $modx->getFullTableName('site_plugins'); |
24 | 24 | $tbl_site_plugin_events = $modx->getFullTableName('site_plugin_events'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $content['properties'] = str_replace("&", "&", $content['properties']); |
47 | 47 | } else { |
48 | 48 | $_SESSION['itemname'] = $_lang["new_plugin"]; |
49 | - $content['category'] = (int)$_REQUEST['catid']; |
|
49 | + $content['category'] = (int) $_REQUEST['catid']; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ($modx->manager->hasFormValues()) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // Add lock-element JS-Script |
57 | 57 | $lockElementId = $id; |
58 | 58 | $lockElementType = 5; |
59 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
59 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param bool $cond |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
479 | 479 | |
480 | 480 | <h1> |
481 | - <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i> |
|
481 | + <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i> |
|
482 | 482 | </h1> |
483 | 483 | |
484 | 484 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | <div class="form-control-name clearfix"> |
505 | 505 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
506 | 506 | <?php if ($modx->hasPermission('save_role')): ?> |
507 | - <label class="custom-control" title="<?= $_lang['lock_plugin'] . "\n" . $_lang['lock_plugin_msg'] ?>" tooltip> |
|
507 | + <label class="custom-control" title="<?= $_lang['lock_plugin']."\n".$_lang['lock_plugin_msg'] ?>" tooltip> |
|
508 | 508 | <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
509 | 509 | <i class="fa fa-lock"></i> |
510 | 510 | </label> |
@@ -528,9 +528,9 @@ discard block |
||
528 | 528 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
529 | 529 | <option> </option> |
530 | 530 | <?php |
531 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
531 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
532 | 532 | foreach (getCategories() as $n => $v) { |
533 | - echo '<option value="' . $v['id'] . '"' . ($content["category"] == $v["id"] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
533 | + echo '<option value="'.$v['id'].'"'.($content["category"] == $v["id"] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v["category"])."</option>"; |
|
534 | 534 | } |
535 | 535 | ?> |
536 | 536 | </select> |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | <?php if ($modx->hasPermission('save_role')): ?> |
547 | 547 | <div class="form-group"> |
548 | 548 | <div class="form-row"> |
549 | - <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['plugin_disabled'] . "</span>" : $_lang['plugin_disabled']) ?></label> |
|
549 | + <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['plugin_disabled']."</span>" : $_lang['plugin_disabled']) ?></label> |
|
550 | 550 | </div> |
551 | 551 | <div class="form-row"> |
552 | 552 | <label> |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | <select name="moduleguid" class="form-control" onchange="documentDirty=true;"> |
594 | 594 | <option> </option> |
595 | 595 | <?php |
596 | - $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules") . " sm |
|
597 | - INNER JOIN " . $modx->getFullTableName("site_module_depobj") . " smd ON smd.module=sm.id AND smd.type=30 |
|
598 | - INNER JOIN " . $modx->getFullTableName("site_plugins") . " sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name'); |
|
596 | + $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules")." sm |
|
597 | + INNER JOIN " . $modx->getFullTableName("site_module_depobj")." smd ON smd.module=sm.id AND smd.type=30 |
|
598 | + INNER JOIN " . $modx->getFullTableName("site_plugins")." sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name'); |
|
599 | 599 | while ($row = $modx->db->getRow($ds)) { |
600 | - echo "<option value='" . $row['guid'] . "'" . ($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row["name"]) . "</option>"; |
|
600 | + echo "<option value='".$row['guid']."'".($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row["name"])."</option>"; |
|
601 | 601 | } |
602 | 602 | ?> |
603 | 603 | </select> |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | echoEventRows($evtnames); |
659 | 659 | } |
660 | 660 | echo '<hr class="clear">'; |
661 | - echo '<div class="form-group"><b>' . $services[$srv - 1] . '</b></div>'; |
|
661 | + echo '<div class="form-group"><b>'.$services[$srv - 1].'</b></div>'; |
|
662 | 662 | } |
663 | 663 | // display group name |
664 | 664 | if ($grp != $row['groupname']) { |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | echoEventRows($evtnames); |
668 | 668 | } |
669 | 669 | echo '<hr class="clear">'; |
670 | - echo '<div class="form-group"><b>' . $row['groupname'] . '</b></div>'; |
|
670 | + echo '<div class="form-group"><b>'.$row['groupname'].'</b></div>'; |
|
671 | 671 | } |
672 | - $evtnames[] = '<input name="sysevents[]" id="' . $row['name'] . '" type="checkbox" ' . (in_array($row['id'], $evts) ? ' checked="checked" ' : '') . 'class="inputBox" value="' . $row['id'] . '" /> <label for="' . $row['name'] . '" ' . bold(in_array($row['id'], $evts)) . '> ' . $row['name'] . '</label>' . "\n"; |
|
672 | + $evtnames[] = '<input name="sysevents[]" id="'.$row['name'].'" type="checkbox" '.(in_array($row['id'], $evts) ? ' checked="checked" ' : '').'class="inputBox" value="'.$row['id'].'" /> <label for="'.$row['name'].'" '.bold(in_array($row['id'], $evts)).'> '.$row['name'].'</label>'."\n"; |
|
673 | 673 | if (count($evtnames) == 2) { |
674 | 674 | echoEventRows($evtnames); |
675 | 675 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | function echoEventRows(&$evtnames) |
683 | 683 | { |
684 | - echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">' . implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) . '</div></div>'; |
|
684 | + echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">'.implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames).'</div></div>'; |
|
685 | 685 | $evtnames = array(); |
686 | 686 | } |
687 | 687 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | die('Please use the MODx Backend.'); |
8 | 8 | } |
9 | 9 | |
10 | -require_once realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Categories.php'; |
|
10 | +require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php'; |
|
11 | 11 | |
12 | 12 | class Module_Categories_Manager extends Categories |
13 | 13 | { |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | global $_lang, $_style; |
96 | 96 | |
97 | - $filename = trim($view_name) . '.tpl.phtml'; |
|
98 | - $file = self::get('views_dir') . $filename; |
|
97 | + $filename = trim($view_name).'.tpl.phtml'; |
|
98 | + $file = self::get('views_dir').$filename; |
|
99 | 99 | $view = &$this; |
100 | 100 | |
101 | 101 | if (is_file($file) |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | { |
121 | 121 | |
122 | 122 | $_update = array( |
123 | - 'id' => (int)$element_id, |
|
124 | - 'category' => (int)$category_id |
|
123 | + 'id' => (int) $element_id, |
|
124 | + 'category' => (int) $category_id |
|
125 | 125 | ); |
126 | 126 | |
127 | 127 | $this->db->update( |
128 | 128 | $_update, |
129 | 129 | $this->db_tbl[$element], |
130 | - "`id` = '" . (int)$element_id . "'" |
|
130 | + "`id` = '".(int) $element_id."'" |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | return $this->db->getAffectedRows() === 1; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
21 | 21 | |
22 | 22 | foreach ($this->elements as $element) { |
23 | - $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element); |
|
23 | + $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->db->select( |
55 | 55 | '*', |
56 | 56 | $this->db_tbl['categories'], |
57 | - "`" . $where . "` = '" . $this->db->escape($search) . "'" |
|
57 | + "`".$where."` = '".$this->db->escape($search)."'" |
|
58 | 58 | ) |
59 | 59 | ); |
60 | 60 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | { |
72 | 72 | $_value = $this->db->getValue( |
73 | 73 | $this->db->select( |
74 | - '`' . $value . '`', |
|
74 | + '`'.$value.'`', |
|
75 | 75 | $this->db_tbl['categories'], |
76 | - "`" . $where . "` = '" . $this->db->escape($search) . "'" |
|
76 | + "`".$where."` = '".$this->db->escape($search)."'" |
|
77 | 77 | ) |
78 | 78 | ); |
79 | 79 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->db->select( |
93 | 93 | '*', |
94 | 94 | $this->db_tbl[$element], |
95 | - "`category` = '" . (int)$category_id . "'" |
|
95 | + "`category` = '".(int) $category_id."'" |
|
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | $this->db->update( |
136 | 136 | $_update, |
137 | 137 | $this->db_tbl[$element], |
138 | - "`category` = '" . (int)$category_id . "'" |
|
138 | + "`category` = '".(int) $category_id."'" |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | |
142 | 142 | $this->db->delete( |
143 | 143 | $this->db_tbl['categories'], |
144 | - "`id` = '" . (int)$category_id . "'" |
|
144 | + "`id` = '".(int) $category_id."'" |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | return $this->db->getAffectedRows() === 1; |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | |
161 | 161 | $_update = array( |
162 | 162 | 'category' => $this->db->escape($data['category']), |
163 | - 'rank' => (int)$data['rank'] |
|
163 | + 'rank' => (int) $data['rank'] |
|
164 | 164 | ); |
165 | 165 | |
166 | 166 | $this->db->update( |
167 | 167 | $_update, |
168 | 168 | $this->db_tbl['categories'], |
169 | - "`id` = '" . (int)$category_id . "'" |
|
169 | + "`id` = '".(int) $category_id."'" |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | if ($this->db->getAffectedRows() === 1) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $_insert = array( |
191 | 191 | 'category' => $this->db->escape($category_name), |
192 | - 'rank' => (int)$category_rank |
|
192 | + 'rank' => (int) $category_rank |
|
193 | 193 | ); |
194 | 194 | |
195 | 195 | $this->db->insert( |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $this->db->select( |
217 | 217 | '`id`', |
218 | 218 | $this->db_tbl['categories'], |
219 | - "`category` = '" . $category . "'" |
|
219 | + "`category` = '".$category."'" |
|
220 | 220 | ) |
221 | 221 | ); |
222 | 222 |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function __call($method_name, $arguments) |
207 | 207 | { |
208 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
208 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
209 | 209 | if (method_exists($this->old, $method_name)) { |
210 | 210 | $error_type = 1; |
211 | 211 | } else { |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | $info = debug_backtrace(); |
224 | 224 | $m[] = $msg; |
225 | 225 | if (!empty($this->currentSnippet)) { |
226 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
226 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
227 | 227 | } elseif (!empty($this->event->activePlugin)) { |
228 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
228 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
229 | 229 | } |
230 | 230 | $m[] = $this->decoded_request_uri; |
231 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
231 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
232 | 232 | $msg = implode('<br />', $m); |
233 | 233 | $this->logEvent(0, $error_type, $msg, $title); |
234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | $flag = false; |
247 | 247 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
248 | - $flag = (bool)$this->{$connector}->conn; |
|
248 | + $flag = (bool) $this->{$connector}->conn; |
|
249 | 249 | } |
250 | 250 | return $flag; |
251 | 251 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | if (!$out && $flag) { |
274 | 274 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
275 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
275 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
276 | 276 | $out = is_file($filename) ? include $filename : false; |
277 | 277 | } |
278 | 278 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | public function getMicroTime() |
290 | 290 | { |
291 | 291 | list ($usec, $sec) = explode(' ', microtime()); |
292 | - return ((float)$usec + (float)$sec); |
|
292 | + return ((float) $usec + (float) $sec); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | // append the redirect count string to the url |
314 | 314 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
315 | 315 | if ($currentNumberOfRedirects > 3) { |
316 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
316 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
317 | 317 | } else { |
318 | 318 | $currentNumberOfRedirects += 1; |
319 | 319 | if (strpos($url, "?") > 0) { |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | if ($type == 'REDIRECT_REFRESH') { |
327 | - $header = 'Refresh: 0;URL=' . $url; |
|
327 | + $header = 'Refresh: 0;URL='.$url; |
|
328 | 328 | } elseif ($type == 'REDIRECT_META') { |
329 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
329 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
330 | 330 | echo $header; |
331 | 331 | exit; |
332 | 332 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | global $base_url, $site_url; |
335 | 335 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
336 | 336 | // append $site_url to make it work with Location: |
337 | - $url = $site_url . substr($url, strlen($base_url)); |
|
337 | + $url = $site_url.substr($url, strlen($base_url)); |
|
338 | 338 | } |
339 | 339 | if (strpos($url, "\n") === false) { |
340 | - $header = 'Location: ' . $url; |
|
340 | + $header = 'Location: '.$url; |
|
341 | 341 | } else { |
342 | 342 | $this->messageQuit('No newline allowed in redirect url.'); |
343 | 343 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | header($responseCode); |
347 | 347 | } |
348 | 348 | |
349 | - if(!empty($header)) { |
|
349 | + if (!empty($header)) { |
|
350 | 350 | header($header); |
351 | 351 | } |
352 | 352 | |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | |
451 | 451 | private function recoverySiteCache() |
452 | 452 | { |
453 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
454 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
453 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
454 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
455 | 455 | |
456 | 456 | if (is_file($site_cache_path)) { |
457 | 457 | include($site_cache_path); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | return; |
461 | 461 | } |
462 | 462 | |
463 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
463 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
464 | 464 | $cache = new synccache(); |
465 | 465 | $cache->setCachepath($site_cache_dir); |
466 | 466 | $cache->setReport(false); |
@@ -512,8 +512,8 @@ discard block |
||
512 | 512 | $this->invokeEvent("OnBeforeManagerPageInit"); |
513 | 513 | } |
514 | 514 | |
515 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
516 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
515 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
516 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
517 | 517 | } else { |
518 | 518 | if ($usrType == 'web') { |
519 | 519 | $from = $tbl_web_user_settings; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
534 | 534 | } |
535 | 535 | if (isset ($usrType)) { |
536 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
536 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
537 | 537 | } // store user settings in session |
538 | 538 | } |
539 | 539 | } |
@@ -678,10 +678,10 @@ discard block |
||
678 | 678 | $suf = $this->config['friendly_url_suffix']; |
679 | 679 | $pre = preg_quote($pre, '/'); |
680 | 680 | $suf = preg_quote($suf, '/'); |
681 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
681 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
682 | 682 | $q = $_[1]; |
683 | 683 | } |
684 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
684 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
685 | 685 | $q = $_[1]; |
686 | 686 | } |
687 | 687 | |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
704 | 704 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
705 | 705 | if ($this->config['use_alias_path'] == 1) { |
706 | - if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
706 | + if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
707 | 707 | $this->documentMethod = 'id'; |
708 | 708 | return $q; |
709 | 709 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | */ |
738 | 738 | public function getHashFile($key) |
739 | 739 | { |
740 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
740 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | /** |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | $hash = $id; |
749 | 749 | $tmp = null; |
750 | 750 | $params = array(); |
751 | - if(!empty($this->systemCacheKey)){ |
|
751 | + if (!empty($this->systemCacheKey)) { |
|
752 | 752 | $hash = $this->systemCacheKey; |
753 | - }else { |
|
753 | + } else { |
|
754 | 754 | if (!empty($_GET)) { |
755 | 755 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
756 | 756 | $params = $_GET; |
@@ -758,8 +758,8 @@ discard block |
||
758 | 758 | $hash .= '_'.md5(http_build_query($params)); |
759 | 759 | } |
760 | 760 | } |
761 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
762 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
761 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
762 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
763 | 763 | $tmp = array_pop($evtOut); |
764 | 764 | } |
765 | 765 | return empty($tmp) ? $hash : $tmp; |
@@ -901,12 +901,12 @@ discard block |
||
901 | 901 | if ($js = $this->getRegisteredClientStartupScripts()) { |
902 | 902 | // change to just before closing </head> |
903 | 903 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
904 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
904 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | // Insert jscripts & html block into template - template must have a </body> tag |
908 | 908 | if ($js = $this->getRegisteredClientScripts()) { |
909 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
909 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
910 | 910 | } |
911 | 911 | // End fix by sirlancelot |
912 | 912 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | // send out content-type and content-disposition headers |
918 | 918 | if (IN_PARSER_MODE == "true") { |
919 | 919 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
920 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
920 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
921 | 921 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
922 | 922 | // header('HTTP/1.0 404 Not Found'); |
923 | 923 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | $name = preg_replace('|-+|', '-', $name); |
936 | 936 | $name = trim($name, '-'); |
937 | 937 | } |
938 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
938 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
939 | 939 | header($header); |
940 | 940 | } |
941 | 941 | } |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | |
944 | 944 | $stats = $this->getTimerStats($this->tstart); |
945 | 945 | |
946 | - $out =& $this->documentOutput; |
|
946 | + $out = & $this->documentOutput; |
|
947 | 947 | $out = str_replace("[^q^]", $stats['queries'], $out); |
948 | 948 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
949 | 949 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -982,17 +982,17 @@ discard block |
||
982 | 982 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
983 | 983 | $tt += $t; |
984 | 984 | } |
985 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
985 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
986 | 986 | echo $this->snippetsCode; |
987 | 987 | } |
988 | 988 | if ($this->dumpPlugins) { |
989 | 989 | $ps = ""; |
990 | 990 | $tt = 0; |
991 | 991 | foreach ($this->pluginsTime as $s => $t) { |
992 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
992 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
993 | 993 | $tt += $t; |
994 | 994 | } |
995 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
995 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
996 | 996 | echo $this->pluginsCode; |
997 | 997 | } |
998 | 998 | |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | $srcTags = explode(',', $tags); |
1019 | 1019 | $repTags = array(); |
1020 | 1020 | foreach ($srcTags as $tag) { |
1021 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1021 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1022 | 1022 | } |
1023 | 1023 | return array($srcTags, $repTags); |
1024 | 1024 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1041 | 1041 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1042 | 1042 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1043 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1043 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1044 | 1044 | |
1045 | 1045 | return $stats; |
1046 | 1046 | } |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | { |
1074 | 1074 | $cacheRefreshTime = 0; |
1075 | 1075 | $recent_update = 0; |
1076 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1076 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1077 | 1077 | $this->recentUpdate = $recent_update; |
1078 | 1078 | |
1079 | 1079 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1127,8 +1127,8 @@ discard block |
||
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | $docObjSerial = serialize($this->documentObject); |
1130 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1131 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1130 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1131 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1132 | 1132 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1133 | 1133 | } |
1134 | 1134 | } |
@@ -1170,16 +1170,16 @@ discard block |
||
1170 | 1170 | return array(); |
1171 | 1171 | } |
1172 | 1172 | $spacer = md5('<<<EVO>>>'); |
1173 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1174 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1175 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1176 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1173 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
1174 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
1175 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
1176 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
1177 | 1177 | |
1178 | 1178 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1179 | 1179 | $pos[']]>'] = strpos($content, ']]>'); |
1180 | 1180 | |
1181 | 1181 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1182 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1182 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | $lp = explode($left, $content); |
@@ -1243,8 +1243,8 @@ discard block |
||
1243 | 1243 | } |
1244 | 1244 | } |
1245 | 1245 | } |
1246 | - foreach($tags as $i=>$tag) { |
|
1247 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1246 | + foreach ($tags as $i=>$tag) { |
|
1247 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1248 | 1248 | } |
1249 | 1249 | return $tags; |
1250 | 1250 | } |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | foreach ($matches[1] as $i => $key) { |
1287 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1287 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1288 | 1288 | if (substr($key, 0, 1) == '#') { |
1289 | 1289 | $key = substr($key, 1); |
1290 | 1290 | } // remove # for QuickEdit format |
@@ -1304,8 +1304,8 @@ discard block |
||
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | if (is_array($value)) { |
1307 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1308 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1307 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1308 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1309 | 1309 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1310 | 1310 | } |
1311 | 1311 | |
@@ -1316,8 +1316,8 @@ discard block |
||
1316 | 1316 | |
1317 | 1317 | if (strpos($content, $s) !== false) { |
1318 | 1318 | $content = str_replace($s, $value, $content); |
1319 | - } elseif($this->debug) { |
|
1320 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1319 | + } elseif ($this->debug) { |
|
1320 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1321 | 1321 | } |
1322 | 1322 | } |
1323 | 1323 | |
@@ -1484,8 +1484,8 @@ discard block |
||
1484 | 1484 | $s = &$matches[0][$i]; |
1485 | 1485 | if (strpos($content, $s) !== false) { |
1486 | 1486 | $content = str_replace($s, $value, $content); |
1487 | - } elseif($this->debug) { |
|
1488 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1487 | + } elseif ($this->debug) { |
|
1488 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1489 | 1489 | } |
1490 | 1490 | } |
1491 | 1491 | return $content; |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | } |
1539 | 1539 | |
1540 | 1540 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1541 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1541 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1542 | 1542 | if ($this->config['enable_at_syntax']) { |
1543 | 1543 | $value = $this->mergeConditionalTagsContent($value); |
1544 | 1544 | } |
@@ -1553,8 +1553,8 @@ discard block |
||
1553 | 1553 | $s = &$matches[0][$i]; |
1554 | 1554 | if (strpos($content, $s) !== false) { |
1555 | 1555 | $content = str_replace($s, $value, $content); |
1556 | - } elseif($this->debug) { |
|
1557 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1556 | + } elseif ($this->debug) { |
|
1557 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1558 | 1558 | } |
1559 | 1559 | } |
1560 | 1560 | return $content; |
@@ -1612,8 +1612,8 @@ discard block |
||
1612 | 1612 | $s = &$matches[0][$i]; |
1613 | 1613 | if (strpos($content, $s) !== false) { |
1614 | 1614 | $content = str_replace($s, $value, $content); |
1615 | - } elseif($this->debug) { |
|
1616 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1615 | + } elseif ($this->debug) { |
|
1616 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1617 | 1617 | } |
1618 | 1618 | } |
1619 | 1619 | return $content; |
@@ -1637,7 +1637,7 @@ discard block |
||
1637 | 1637 | return $content; |
1638 | 1638 | } |
1639 | 1639 | |
1640 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1640 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1641 | 1641 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1642 | 1642 | |
1643 | 1643 | $pieces = explode('<@IF:', $content); |
@@ -1648,7 +1648,7 @@ discard block |
||
1648 | 1648 | } |
1649 | 1649 | list($cmd, $text) = explode('>', $split, 2); |
1650 | 1650 | $cmd = str_replace("'", "\'", $cmd); |
1651 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1651 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1652 | 1652 | $content .= $text; |
1653 | 1653 | } |
1654 | 1654 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1659,13 +1659,13 @@ discard block |
||
1659 | 1659 | } |
1660 | 1660 | list($cmd, $text) = explode('>', $split, 2); |
1661 | 1661 | $cmd = str_replace("'", "\'", $cmd); |
1662 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1662 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1663 | 1663 | $content .= $text; |
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1667 | 1667 | ob_start(); |
1668 | - $content = eval('?>' . $content); |
|
1668 | + $content = eval('?>'.$content); |
|
1669 | 1669 | $content = ob_get_clean(); |
1670 | 1670 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1671 | 1671 | |
@@ -1790,7 +1790,7 @@ discard block |
||
1790 | 1790 | $matches = $this->getTagsFromContent($content, $left, $right); |
1791 | 1791 | if (!empty($matches)) { |
1792 | 1792 | foreach ($matches[0] as $i => $v) { |
1793 | - $addBreakMatches[$i] = $v . "\n"; |
|
1793 | + $addBreakMatches[$i] = $v."\n"; |
|
1794 | 1794 | } |
1795 | 1795 | $content = str_replace($addBreakMatches, '', $content); |
1796 | 1796 | if (strpos($content, $left) !== false) { |
@@ -1823,8 +1823,8 @@ discard block |
||
1823 | 1823 | $s = &$matches[0][$i]; |
1824 | 1824 | if (strpos($content, $s) !== false) { |
1825 | 1825 | $content = str_replace($s, $v, $content); |
1826 | - } elseif($this->debug) { |
|
1827 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1826 | + } elseif ($this->debug) { |
|
1827 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1828 | 1828 | } |
1829 | 1829 | } |
1830 | 1830 | return $content; |
@@ -1888,7 +1888,7 @@ discard block |
||
1888 | 1888 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1889 | 1889 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1890 | 1890 | if ($this->isBackend()) { |
1891 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1891 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1892 | 1892 | } |
1893 | 1893 | } |
1894 | 1894 | } else { |
@@ -1934,7 +1934,7 @@ discard block |
||
1934 | 1934 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1935 | 1935 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1936 | 1936 | if ($this->isBackend()) { |
1937 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1937 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1938 | 1938 | } |
1939 | 1939 | } |
1940 | 1940 | } |
@@ -1942,7 +1942,7 @@ discard block |
||
1942 | 1942 | if (is_array($return) || is_object($return)) { |
1943 | 1943 | return $return; |
1944 | 1944 | } else { |
1945 | - return $echo . $return; |
|
1945 | + return $echo.$return; |
|
1946 | 1946 | } |
1947 | 1947 | } |
1948 | 1948 | |
@@ -1980,8 +1980,8 @@ discard block |
||
1980 | 1980 | } |
1981 | 1981 | if (strpos($content, $s) !== false) { |
1982 | 1982 | $content = str_replace($s, $value, $content); |
1983 | - } elseif($this->debug) { |
|
1984 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1983 | + } elseif ($this->debug) { |
|
1984 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1985 | 1985 | } |
1986 | 1986 | continue; |
1987 | 1987 | } |
@@ -1992,8 +1992,8 @@ discard block |
||
1992 | 1992 | |
1993 | 1993 | if (strpos($content, $s) !== false) { |
1994 | 1994 | $content = str_replace($s, $value, $content); |
1995 | - } elseif($this->debug) { |
|
1996 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1995 | + } elseif ($this->debug) { |
|
1996 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1997 | 1997 | } |
1998 | 1998 | } |
1999 | 1999 | |
@@ -2084,7 +2084,7 @@ discard block |
||
2084 | 2084 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2085 | 2085 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2086 | 2086 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2087 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2087 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2088 | 2088 | $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code); |
2089 | 2089 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2090 | 2090 | } |
@@ -2328,7 +2328,7 @@ discard block |
||
2328 | 2328 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2329 | 2329 | $count = $this->db->getRecordCount($rs); |
2330 | 2330 | if (1 < $count) { |
2331 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2331 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2332 | 2332 | } |
2333 | 2333 | if ($count) { |
2334 | 2334 | $row = $this->db->getRow($rs); |
@@ -2354,7 +2354,7 @@ discard block |
||
2354 | 2354 | public function toAlias($text) |
2355 | 2355 | { |
2356 | 2356 | $suff = $this->config['friendly_url_suffix']; |
2357 | - return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
2357 | + return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
2358 | 2358 | } |
2359 | 2359 | |
2360 | 2360 | /** |
@@ -2386,7 +2386,7 @@ discard block |
||
2386 | 2386 | $suff = '/'; |
2387 | 2387 | } |
2388 | 2388 | |
2389 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2389 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2390 | 2390 | } |
2391 | 2391 | |
2392 | 2392 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2424 | 2424 | $ids = implode(',', array_unique($match['1'])); |
2425 | 2425 | if ($ids) { |
2426 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2426 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2427 | 2427 | while ($row = $this->db->getRow($res)) { |
2428 | 2428 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2429 | 2429 | $parent = $row['parent']; |
@@ -2434,7 +2434,7 @@ discard block |
||
2434 | 2434 | $parent = $this->aliasListing[$parent]['parent']; |
2435 | 2435 | } |
2436 | 2436 | |
2437 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2437 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2438 | 2438 | } else { |
2439 | 2439 | $aliases[$row['id']] = $row['alias']; |
2440 | 2440 | } |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2447 | 2447 | $pref = $this->config['friendly_url_prefix']; |
2448 | 2448 | $suff = $this->config['friendly_url_suffix']; |
2449 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2449 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2450 | 2450 | global $modx; |
2451 | 2451 | $thealias = $aliases[$m[1]]; |
2452 | 2452 | $thefolder = $isfolder[$m[1]]; |
@@ -2462,7 +2462,7 @@ discard block |
||
2462 | 2462 | |
2463 | 2463 | } else { |
2464 | 2464 | $in = '!\[\~([0-9]+)\~\]!is'; |
2465 | - $out = "index.php?id=" . '\1'; |
|
2465 | + $out = "index.php?id=".'\1'; |
|
2466 | 2466 | $documentSource = preg_replace($in, $out, $documentSource); |
2467 | 2467 | } |
2468 | 2468 | |
@@ -2483,7 +2483,7 @@ discard block |
||
2483 | 2483 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2484 | 2484 | $len_base_url = strlen($this->config['base_url']); |
2485 | 2485 | |
2486 | - $url_path = $q;//LANG |
|
2486 | + $url_path = $q; //LANG |
|
2487 | 2487 | |
2488 | 2488 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2489 | 2489 | $url_path = substr($url_path, $len_base_url); |
@@ -2495,7 +2495,7 @@ discard block |
||
2495 | 2495 | $strictURL = substr($strictURL, $len_base_url); |
2496 | 2496 | } |
2497 | 2497 | $http_host = $_SERVER['HTTP_HOST']; |
2498 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2498 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2499 | 2499 | |
2500 | 2500 | $site_url = $this->config['site_url']; |
2501 | 2501 | |
@@ -2511,7 +2511,7 @@ discard block |
||
2511 | 2511 | } |
2512 | 2512 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2513 | 2513 | if (empty($_POST)) { |
2514 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2514 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2515 | 2515 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2516 | 2516 | exit(0); |
2517 | 2517 | } |
@@ -2574,7 +2574,7 @@ discard block |
||
2574 | 2574 | $docgrp = implode(",", $docgrp); |
2575 | 2575 | } |
2576 | 2576 | // get document |
2577 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2577 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2578 | 2578 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2579 | 2579 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2580 | 2580 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2610,9 +2610,9 @@ discard block |
||
2610 | 2610 | } |
2611 | 2611 | if ($documentObject['template']) { |
2612 | 2612 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2613 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2614 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2615 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2613 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2614 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2615 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2616 | 2616 | $tmplvars = array(); |
2617 | 2617 | while ($row = $this->db->getRow($rs)) { |
2618 | 2618 | $tmplvars[$row['name']] = array( |
@@ -2658,7 +2658,7 @@ discard block |
||
2658 | 2658 | $st = md5($source); |
2659 | 2659 | } |
2660 | 2660 | if ($this->dumpSnippets == 1) { |
2661 | - $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2661 | + $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2662 | 2662 | } |
2663 | 2663 | |
2664 | 2664 | // invoke OnParseDocument event |
@@ -2744,7 +2744,7 @@ discard block |
||
2744 | 2744 | |
2745 | 2745 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2746 | 2746 | if ($this->config['use_alias_path'] == 1) { |
2747 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2747 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2748 | 2748 | if (isset($this->documentListing[$alias])) { |
2749 | 2749 | $this->documentIdentifier = $this->documentListing[$alias]; |
2750 | 2750 | } else { |
@@ -2805,7 +2805,7 @@ discard block |
||
2805 | 2805 | } else { |
2806 | 2806 | $docAlias = $this->db->escape($this->documentIdentifier); |
2807 | 2807 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2808 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2808 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2809 | 2809 | } |
2810 | 2810 | } |
2811 | 2811 | $this->documentMethod = 'id'; |
@@ -2858,7 +2858,7 @@ discard block |
||
2858 | 2858 | $_REQUEST[$n] = $_GET[$n] = $v; |
2859 | 2859 | } |
2860 | 2860 | } |
2861 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2861 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2862 | 2862 | $this->q = $qp['path']; |
2863 | 2863 | return $qp['path']; |
2864 | 2864 | } |
@@ -2952,7 +2952,7 @@ discard block |
||
2952 | 2952 | $this->sendErrorPage(); |
2953 | 2953 | } else { |
2954 | 2954 | // Inculde the necessary files to check document permissions |
2955 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
2955 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
2956 | 2956 | $udperms = new udperms(); |
2957 | 2957 | $udperms->user = $this->getLoginUserID(); |
2958 | 2958 | $udperms->document = $this->documentIdentifier; |
@@ -3006,7 +3006,7 @@ discard block |
||
3006 | 3006 | while ($id && $height--) { |
3007 | 3007 | $thisid = $id; |
3008 | 3008 | if ($this->config['aliaslistingfolder'] == 1) { |
3009 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3009 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3010 | 3010 | if (!$id || $id == '0') { |
3011 | 3011 | break; |
3012 | 3012 | } |
@@ -3057,15 +3057,15 @@ discard block |
||
3057 | 3057 | |
3058 | 3058 | if ($this->config['aliaslistingfolder'] == 1) { |
3059 | 3059 | |
3060 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3060 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3061 | 3061 | $idx = array(); |
3062 | 3062 | while ($row = $this->db->getRow($res)) { |
3063 | 3063 | $pAlias = ''; |
3064 | 3064 | if (isset($this->aliasListing[$row['parent']])) { |
3065 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3066 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3065 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3066 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3067 | 3067 | }; |
3068 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3068 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3069 | 3069 | if ($row['isfolder'] == 1) { |
3070 | 3070 | $idx[] = $row['id']; |
3071 | 3071 | } |
@@ -3097,7 +3097,7 @@ discard block |
||
3097 | 3097 | $depth--; |
3098 | 3098 | |
3099 | 3099 | foreach ($documentMap_cache[$id] as $childId) { |
3100 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3100 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3101 | 3101 | if (!strlen($pkey)) { |
3102 | 3102 | $pkey = "{$childId}"; |
3103 | 3103 | } |
@@ -3126,7 +3126,7 @@ discard block |
||
3126 | 3126 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3127 | 3127 | $fnc = substr($url, 11); |
3128 | 3128 | } elseif ($url) { |
3129 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3129 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3130 | 3130 | } else { |
3131 | 3131 | $fnc = "history.back(-1);"; |
3132 | 3132 | } |
@@ -3135,7 +3135,7 @@ discard block |
||
3135 | 3135 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3136 | 3136 | <script> |
3137 | 3137 | function __alertQuit() { |
3138 | - alert('" . addslashes($msg) . "'); |
|
3138 | + alert('".addslashes($msg)."'); |
|
3139 | 3139 | {$fnc} |
3140 | 3140 | } |
3141 | 3141 | window.setTimeout('__alertQuit();',100); |
@@ -3159,7 +3159,7 @@ discard block |
||
3159 | 3159 | if ($pms) { |
3160 | 3160 | $state = ($pms[$pm] === 1); |
3161 | 3161 | } |
3162 | - return (int)$state; |
|
3162 | + return (int) $state; |
|
3163 | 3163 | } |
3164 | 3164 | |
3165 | 3165 | /** |
@@ -3172,8 +3172,8 @@ discard block |
||
3172 | 3172 | */ |
3173 | 3173 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3174 | 3174 | { |
3175 | - $id = (int)$id; |
|
3176 | - $type = (int)$type; |
|
3175 | + $id = (int) $id; |
|
3176 | + $type = (int) $type; |
|
3177 | 3177 | if (!$type || !$id) { |
3178 | 3178 | return null; |
3179 | 3179 | } |
@@ -3223,7 +3223,7 @@ discard block |
||
3223 | 3223 | return $lockedElements; |
3224 | 3224 | } |
3225 | 3225 | |
3226 | - $type = (int)$type; |
|
3226 | + $type = (int) $type; |
|
3227 | 3227 | if (isset($lockedElements[$type])) { |
3228 | 3228 | return $lockedElements[$type]; |
3229 | 3229 | } else { |
@@ -3240,7 +3240,7 @@ discard block |
||
3240 | 3240 | $this->lockedElements = array(); |
3241 | 3241 | $this->cleanupExpiredLocks(); |
3242 | 3242 | |
3243 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3243 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3244 | 3244 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3245 | 3245 | while ($row = $this->db->getRow($rs)) { |
3246 | 3246 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3263,7 +3263,7 @@ discard block |
||
3263 | 3263 | public function cleanupExpiredLocks() |
3264 | 3264 | { |
3265 | 3265 | // Clean-up active_user_sessions first |
3266 | - $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3266 | + $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3267 | 3267 | $validSessionTimeLimit = $this->time - $timeout; |
3268 | 3268 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3269 | 3269 | |
@@ -3276,7 +3276,7 @@ discard block |
||
3276 | 3276 | foreach ($rs as $row) { |
3277 | 3277 | $userSids[] = $row['sid']; |
3278 | 3278 | } |
3279 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3279 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3280 | 3280 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3281 | 3281 | } else { |
3282 | 3282 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3360,8 +3360,8 @@ discard block |
||
3360 | 3360 | public function lockElement($type, $id) |
3361 | 3361 | { |
3362 | 3362 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3363 | - $type = (int)$type; |
|
3364 | - $id = (int)$id; |
|
3363 | + $type = (int) $type; |
|
3364 | + $id = (int) $id; |
|
3365 | 3365 | if (!$type || !$id || !$userId) { |
3366 | 3366 | return false; |
3367 | 3367 | } |
@@ -3382,8 +3382,8 @@ discard block |
||
3382 | 3382 | public function unlockElement($type, $id, $includeAllUsers = false) |
3383 | 3383 | { |
3384 | 3384 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3385 | - $type = (int)$type; |
|
3386 | - $id = (int)$id; |
|
3385 | + $type = (int) $type; |
|
3386 | + $id = (int) $id; |
|
3387 | 3387 | if (!$type || !$id) { |
3388 | 3388 | return false; |
3389 | 3389 | } |
@@ -3450,8 +3450,8 @@ discard block |
||
3450 | 3450 | } |
3451 | 3451 | |
3452 | 3452 | $usertype = $this->isFrontend() ? 1 : 0; |
3453 | - $evtid = (int)$evtid; |
|
3454 | - $type = (int)$type; |
|
3453 | + $evtid = (int) $evtid; |
|
3454 | + $type = (int) $type; |
|
3455 | 3455 | |
3456 | 3456 | // Types: 1 = information, 2 = warning, 3 = error |
3457 | 3457 | if ($type < 1) { |
@@ -3473,8 +3473,8 @@ discard block |
||
3473 | 3473 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3474 | 3474 | if ($this->config['send_errormail'] <= $type) { |
3475 | 3475 | $this->sendmail(array( |
3476 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3477 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3476 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3477 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3478 | 3478 | 'type' => 'text' |
3479 | 3479 | )); |
3480 | 3480 | } |
@@ -3522,7 +3522,7 @@ discard block |
||
3522 | 3522 | $p['fromname'] = $userinfo['username']; |
3523 | 3523 | } |
3524 | 3524 | if ($msg === '' && !isset($p['body'])) { |
3525 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3525 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3526 | 3526 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3527 | 3527 | $p['body'] = $msg; |
3528 | 3528 | } |
@@ -3562,8 +3562,8 @@ discard block |
||
3562 | 3562 | $files = array(); |
3563 | 3563 | } |
3564 | 3564 | foreach ($files as $f) { |
3565 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3566 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3565 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3566 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3567 | 3567 | } |
3568 | 3568 | } |
3569 | 3569 | $rs = $this->mail->send(); |
@@ -3608,7 +3608,7 @@ discard block |
||
3608 | 3608 | */ |
3609 | 3609 | public function isFrontend() |
3610 | 3610 | { |
3611 | - return ! $this->isBackend(); |
|
3611 | + return !$this->isBackend(); |
|
3612 | 3612 | } |
3613 | 3613 | |
3614 | 3614 | /** |
@@ -3633,14 +3633,14 @@ discard block |
||
3633 | 3633 | $tblsc = $this->getFullTableName("site_content"); |
3634 | 3634 | $tbldg = $this->getFullTableName("document_groups"); |
3635 | 3635 | // modify field names to use sc. table reference |
3636 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3637 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3636 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3637 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3638 | 3638 | // get document groups for current user |
3639 | 3639 | if ($docgrp = $this->getUserDocGroups()) { |
3640 | 3640 | $docgrp = implode(",", $docgrp); |
3641 | 3641 | } |
3642 | 3642 | // build query |
3643 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3643 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3644 | 3644 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3645 | 3645 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3646 | 3646 | $resourceArray = $this->db->makeArray($result); |
@@ -3670,14 +3670,14 @@ discard block |
||
3670 | 3670 | $tbldg = $this->getFullTableName("document_groups"); |
3671 | 3671 | |
3672 | 3672 | // modify field names to use sc. table reference |
3673 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3674 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3673 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3674 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3675 | 3675 | // get document groups for current user |
3676 | 3676 | if ($docgrp = $this->getUserDocGroups()) { |
3677 | 3677 | $docgrp = implode(",", $docgrp); |
3678 | 3678 | } |
3679 | 3679 | // build query |
3680 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3680 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3681 | 3681 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3682 | 3682 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3683 | 3683 | $resourceArray = $this->db->makeArray($result); |
@@ -3712,16 +3712,16 @@ discard block |
||
3712 | 3712 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3713 | 3713 | } |
3714 | 3714 | |
3715 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3716 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3715 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3716 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3717 | 3717 | |
3718 | 3718 | if ($where != '') { |
3719 | - $where = 'AND ' . $where; |
|
3719 | + $where = 'AND '.$where; |
|
3720 | 3720 | } |
3721 | 3721 | |
3722 | 3722 | // modify field names to use sc. table reference |
3723 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3724 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3723 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3724 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3725 | 3725 | |
3726 | 3726 | // get document groups for current user |
3727 | 3727 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3729,7 +3729,7 @@ discard block |
||
3729 | 3729 | } |
3730 | 3730 | |
3731 | 3731 | // build query |
3732 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3732 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3733 | 3733 | |
3734 | 3734 | $tblsc = $this->getFullTableName('site_content'); |
3735 | 3735 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3781,10 +3781,10 @@ discard block |
||
3781 | 3781 | return false; |
3782 | 3782 | } else { |
3783 | 3783 | // modify field names to use sc. table reference |
3784 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3785 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3784 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3785 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3786 | 3786 | if ($where != '') { |
3787 | - $where = 'AND ' . $where; |
|
3787 | + $where = 'AND '.$where; |
|
3788 | 3788 | } |
3789 | 3789 | |
3790 | 3790 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3795,13 +3795,13 @@ discard block |
||
3795 | 3795 | $docgrp = implode(',', $docgrp); |
3796 | 3796 | } |
3797 | 3797 | |
3798 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3798 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3799 | 3799 | |
3800 | 3800 | $tblsc = $this->getFullTableName('site_content'); |
3801 | 3801 | $tbldg = $this->getFullTableName('document_groups'); |
3802 | 3802 | |
3803 | 3803 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3804 | - LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
3804 | + LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
3805 | 3805 | |
3806 | 3806 | $resourceArray = $this->db->makeArray($result); |
3807 | 3807 | |
@@ -3906,12 +3906,12 @@ discard block |
||
3906 | 3906 | $tbldg = $this->getFullTableName("document_groups"); |
3907 | 3907 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3908 | 3908 | // modify field names to use sc. table reference |
3909 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3909 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3910 | 3910 | // get document groups for current user |
3911 | 3911 | if ($docgrp = $this->getUserDocGroups()) { |
3912 | 3912 | $docgrp = implode(",", $docgrp); |
3913 | 3913 | } |
3914 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3914 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3915 | 3915 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3916 | 3916 | $pageInfo = $this->db->getRow($result); |
3917 | 3917 | |
@@ -3958,7 +3958,7 @@ discard block |
||
3958 | 3958 | { |
3959 | 3959 | if ($this->currentSnippet) { |
3960 | 3960 | $tbl = $this->getFullTableName("site_snippets"); |
3961 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
3961 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
3962 | 3962 | if ($snippetId = $this->db->getValue($rs)) { |
3963 | 3963 | return $snippetId; |
3964 | 3964 | } |
@@ -3985,23 +3985,23 @@ discard block |
||
3985 | 3985 | */ |
3986 | 3986 | public function clearCache($type = '', $report = false) |
3987 | 3987 | { |
3988 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
3988 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
3989 | 3989 | if (is_array($type)) { |
3990 | 3990 | foreach ($type as $_) { |
3991 | 3991 | $this->clearCache($_, $report); |
3992 | 3992 | } |
3993 | 3993 | } elseif ($type == 'full') { |
3994 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
3994 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
3995 | 3995 | $sync = new synccache(); |
3996 | 3996 | $sync->setCachepath($cache_dir); |
3997 | 3997 | $sync->setReport($report); |
3998 | 3998 | $sync->emptyCache(); |
3999 | 3999 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4000 | 4000 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4001 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4002 | - $cache_path = $cache_dir . $file_name; |
|
4001 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4002 | + $cache_path = $cache_dir.$file_name; |
|
4003 | 4003 | $files = glob($cache_path); |
4004 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4004 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4005 | 4005 | foreach ($files as $file) { |
4006 | 4006 | if (!is_file($file)) { |
4007 | 4007 | continue; |
@@ -4009,7 +4009,7 @@ discard block |
||
4009 | 4009 | unlink($file); |
4010 | 4010 | } |
4011 | 4011 | } else { |
4012 | - $files = glob($cache_dir . '*'); |
|
4012 | + $files = glob($cache_dir.'*'); |
|
4013 | 4013 | foreach ($files as $file) { |
4014 | 4014 | $name = basename($file); |
4015 | 4015 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4078,7 +4078,7 @@ discard block |
||
4078 | 4078 | $f_url_suffix = '/'; |
4079 | 4079 | } |
4080 | 4080 | |
4081 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4081 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4082 | 4082 | |
4083 | 4083 | if ($al && $al['alias']) { |
4084 | 4084 | $alias = $al['alias']; |
@@ -4086,7 +4086,7 @@ discard block |
||
4086 | 4086 | |
4087 | 4087 | } |
4088 | 4088 | |
4089 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4089 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4090 | 4090 | $url = "{$alias}{$args}"; |
4091 | 4091 | } else { |
4092 | 4092 | $url = "index.php?id={$id}{$args}"; |
@@ -4105,7 +4105,7 @@ discard block |
||
4105 | 4105 | } |
4106 | 4106 | |
4107 | 4107 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4108 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4108 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4109 | 4109 | } |
4110 | 4110 | |
4111 | 4111 | //fix strictUrl by Bumkaka |
@@ -4114,9 +4114,9 @@ discard block |
||
4114 | 4114 | } |
4115 | 4115 | |
4116 | 4116 | if ($this->config['xhtml_urls']) { |
4117 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4117 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4118 | 4118 | } else { |
4119 | - $url = $host . $virtualDir . $url; |
|
4119 | + $url = $host.$virtualDir.$url; |
|
4120 | 4120 | } |
4121 | 4121 | |
4122 | 4122 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4140,21 +4140,21 @@ discard block |
||
4140 | 4140 | if (isset($this->aliasListing[$id])) { |
4141 | 4141 | $out = $this->aliasListing[$id]; |
4142 | 4142 | } else { |
4143 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4143 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4144 | 4144 | if ($this->db->getRecordCount($q) == '1') { |
4145 | 4145 | $q = $this->db->getRow($q); |
4146 | 4146 | $this->aliasListing[$id] = array( |
4147 | - 'id' => (int)$q['id'], |
|
4147 | + 'id' => (int) $q['id'], |
|
4148 | 4148 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4149 | - 'parent' => (int)$q['parent'], |
|
4150 | - 'isfolder' => (int)$q['isfolder'], |
|
4149 | + 'parent' => (int) $q['parent'], |
|
4150 | + 'isfolder' => (int) $q['isfolder'], |
|
4151 | 4151 | ); |
4152 | 4152 | if ($this->aliasListing[$id]['parent'] > 0) { |
4153 | 4153 | //fix alias_path_usage |
4154 | 4154 | if ($this->config['use_alias_path'] == '1') { |
4155 | 4155 | //&& $tmp['path'] != '' - fix error slash with epty path |
4156 | 4156 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4157 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4157 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4158 | 4158 | } else { |
4159 | 4159 | $this->aliasListing[$id]['path'] = ''; |
4160 | 4160 | } |
@@ -4195,7 +4195,7 @@ discard block |
||
4195 | 4195 | $out = array(); |
4196 | 4196 | if (empty($this->version) || !is_array($this->version)) { |
4197 | 4197 | //include for compatibility modx version < 1.0.10 |
4198 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4198 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4199 | 4199 | $this->version = array(); |
4200 | 4200 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4201 | 4201 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4217,18 +4217,18 @@ discard block |
||
4217 | 4217 | { |
4218 | 4218 | if (isset ($this->snippetCache[$snippetName])) { |
4219 | 4219 | $snippet = $this->snippetCache[$snippetName]; |
4220 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4220 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4221 | 4221 | } else { // not in cache so let's check the db |
4222 | - $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
|
4222 | + $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."' AND ss.disabled=0;"; |
|
4223 | 4223 | $result = $this->db->query($sql); |
4224 | 4224 | if ($this->db->getRecordCount($result) == 1) { |
4225 | 4225 | $row = $this->db->getRow($result); |
4226 | 4226 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4227 | 4227 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4228 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4228 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4229 | 4229 | } else { |
4230 | 4230 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4231 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4231 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4232 | 4232 | } |
4233 | 4233 | } |
4234 | 4234 | // load default params/properties |
@@ -4328,8 +4328,8 @@ discard block |
||
4328 | 4328 | } |
4329 | 4329 | if (strpos($tpl, $s) !== false) { |
4330 | 4330 | $tpl = str_replace($s, $value, $tpl); |
4331 | - } elseif($this->debug) { |
|
4332 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4331 | + } elseif ($this->debug) { |
|
4332 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4333 | 4333 | } |
4334 | 4334 | } |
4335 | 4335 | |
@@ -4378,7 +4378,7 @@ discard block |
||
4378 | 4378 | case 'CODE': |
4379 | 4379 | break; |
4380 | 4380 | case 'FILE': |
4381 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4381 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4382 | 4382 | break; |
4383 | 4383 | case 'CHUNK': |
4384 | 4384 | $template = $this->getChunk($template); |
@@ -4411,7 +4411,7 @@ discard block |
||
4411 | 4411 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4412 | 4412 | return '-'; |
4413 | 4413 | } |
4414 | - $timestamp = (int)$timestamp; |
|
4414 | + $timestamp = (int) $timestamp; |
|
4415 | 4415 | |
4416 | 4416 | switch ($this->config['datetime_format']) { |
4417 | 4417 | case 'YYYY/mm/dd': |
@@ -4431,7 +4431,7 @@ discard block |
||
4431 | 4431 | } |
4432 | 4432 | |
4433 | 4433 | if (empty($mode)) { |
4434 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4434 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4435 | 4435 | } elseif ($mode == 'dateOnly') { |
4436 | 4436 | $strTime = strftime($dateFormat, $timestamp); |
4437 | 4437 | } elseif ($mode == 'formatOnly') { |
@@ -4485,7 +4485,7 @@ discard block |
||
4485 | 4485 | $S = 0; |
4486 | 4486 | } |
4487 | 4487 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4488 | - $timeStamp = (int)$timeStamp; |
|
4488 | + $timeStamp = (int) $timeStamp; |
|
4489 | 4489 | return $timeStamp; |
4490 | 4490 | } |
4491 | 4491 | |
@@ -4527,7 +4527,7 @@ discard block |
||
4527 | 4527 | if ($v === 'value') { |
4528 | 4528 | unset($_[$i]); |
4529 | 4529 | } else { |
4530 | - $_[$i] = 'tv.' . $v; |
|
4530 | + $_[$i] = 'tv.'.$v; |
|
4531 | 4531 | } |
4532 | 4532 | } |
4533 | 4533 | $fields = implode(',', $_); |
@@ -4536,12 +4536,12 @@ discard block |
||
4536 | 4536 | } |
4537 | 4537 | |
4538 | 4538 | if ($tvsort != '') { |
4539 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4539 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4540 | 4540 | } |
4541 | 4541 | if ($tvidnames == "*") { |
4542 | 4542 | $query = "tv.id<>0"; |
4543 | 4543 | } else { |
4544 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4544 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4545 | 4545 | } |
4546 | 4546 | |
4547 | 4547 | $this->getUserDocGroups(); |
@@ -4685,7 +4685,7 @@ discard block |
||
4685 | 4685 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
4686 | 4686 | } |
4687 | 4687 | |
4688 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
4688 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
4689 | 4689 | return false; |
4690 | 4690 | } else { |
4691 | 4691 | |
@@ -4703,23 +4703,23 @@ discard block |
||
4703 | 4703 | } |
4704 | 4704 | |
4705 | 4705 | // get user defined template variables |
4706 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4707 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4706 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4707 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4708 | 4708 | |
4709 | 4709 | if ($idnames == '*') { |
4710 | 4710 | $query = 'tv.id<>0'; |
4711 | 4711 | } else { |
4712 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4712 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4713 | 4713 | } |
4714 | 4714 | |
4715 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4716 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4717 | - LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4715 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4716 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4717 | + LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4718 | 4718 | |
4719 | 4719 | $result = $this->db->makeArray($rs); |
4720 | 4720 | |
4721 | 4721 | // get default/built-in template variables |
4722 | - if(is_array($docRow)){ |
|
4722 | + if (is_array($docRow)) { |
|
4723 | 4723 | ksort($docRow); |
4724 | 4724 | |
4725 | 4725 | foreach ($docRow as $key => $value) { |
@@ -4757,22 +4757,22 @@ discard block |
||
4757 | 4757 | */ |
4758 | 4758 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
4759 | 4759 | { |
4760 | - if (is_array($idnames) && empty($idnames) ) { |
|
4760 | + if (is_array($idnames) && empty($idnames)) { |
|
4761 | 4761 | return false; |
4762 | 4762 | } else { |
4763 | 4763 | $output = array(); |
4764 | 4764 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4765 | 4765 | |
4766 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4766 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4767 | 4767 | // remove sort for speed |
4768 | 4768 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4769 | 4769 | |
4770 | 4770 | if ($result == false) { |
4771 | 4771 | return false; |
4772 | 4772 | } else { |
4773 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4774 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4775 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4773 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4774 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4775 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4776 | 4776 | |
4777 | 4777 | for ($i = 0; $i < count($result); $i++) { |
4778 | 4778 | $row = $result[$i]; |
@@ -4797,7 +4797,7 @@ discard block |
||
4797 | 4797 | */ |
4798 | 4798 | public function getFullTableName($tbl) |
4799 | 4799 | { |
4800 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4800 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4801 | 4801 | } |
4802 | 4802 | |
4803 | 4803 | /** |
@@ -4876,7 +4876,7 @@ discard block |
||
4876 | 4876 | public function getCachePath() |
4877 | 4877 | { |
4878 | 4878 | global $base_url; |
4879 | - $pth = $base_url . $this->getCacheFolder(); |
|
4879 | + $pth = $base_url.$this->getCacheFolder(); |
|
4880 | 4880 | return $pth; |
4881 | 4881 | } |
4882 | 4882 | |
@@ -4928,8 +4928,8 @@ discard block |
||
4928 | 4928 | $out = false; |
4929 | 4929 | |
4930 | 4930 | if (!empty($context)) { |
4931 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4932 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4931 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4932 | + $out = $_SESSION[$context.'InternalKey']; |
|
4933 | 4933 | } |
4934 | 4934 | } else { |
4935 | 4935 | switch (true) { |
@@ -4957,8 +4957,8 @@ discard block |
||
4957 | 4957 | $out = false; |
4958 | 4958 | |
4959 | 4959 | if (!empty($context)) { |
4960 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4961 | - $out = $_SESSION[$context . 'Shortname']; |
|
4960 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4961 | + $out = $_SESSION[$context.'Shortname']; |
|
4962 | 4962 | } |
4963 | 4963 | } else { |
4964 | 4964 | switch (true) { |
@@ -5029,8 +5029,8 @@ discard block |
||
5029 | 5029 | */ |
5030 | 5030 | public function getWebUserInfo($uid) |
5031 | 5031 | { |
5032 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5033 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5032 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5033 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5034 | 5034 | if ($row = $this->db->getRow($rs)) { |
5035 | 5035 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5036 | 5036 | $row["usertype"] = "web"; |
@@ -5066,7 +5066,7 @@ discard block |
||
5066 | 5066 | } else if (is_array($dg)) { |
5067 | 5067 | // resolve ids to names |
5068 | 5068 | $dgn = array(); |
5069 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5069 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5070 | 5070 | while ($row = $this->db->getRow($ds)) { |
5071 | 5071 | $dgn[] = $row['name']; |
5072 | 5072 | } |
@@ -5094,7 +5094,7 @@ discard block |
||
5094 | 5094 | $rt = false; |
5095 | 5095 | if ($_SESSION["webValidated"] == 1) { |
5096 | 5096 | $tbl = $this->getFullTableName("web_users"); |
5097 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5097 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5098 | 5098 | if ($row = $this->db->getRow($ds)) { |
5099 | 5099 | if ($row["password"] == md5($oldPwd)) { |
5100 | 5100 | if (strlen($newPwd) < 6) { |
@@ -5104,7 +5104,7 @@ discard block |
||
5104 | 5104 | } else { |
5105 | 5105 | $this->db->update(array( |
5106 | 5106 | 'password' => $this->db->escape($newPwd), |
5107 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5107 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5108 | 5108 | // invoke OnWebChangePassword event |
5109 | 5109 | $this->invokeEvent("OnWebChangePassword", array( |
5110 | 5110 | "userid" => $row["id"], |
@@ -5135,8 +5135,8 @@ discard block |
||
5135 | 5135 | // check cache |
5136 | 5136 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5137 | 5137 | if (!is_array($grpNames)) { |
5138 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5139 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5138 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5139 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5140 | 5140 | $grpNames = $this->db->getColumn("name", $rs); |
5141 | 5141 | // save to cache |
5142 | 5142 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5169,7 +5169,7 @@ discard block |
||
5169 | 5169 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5170 | 5170 | $this->sjscripts[$nextpos] = $src; |
5171 | 5171 | } else { |
5172 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5172 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5173 | 5173 | } |
5174 | 5174 | } |
5175 | 5175 | |
@@ -5248,7 +5248,7 @@ discard block |
||
5248 | 5248 | } |
5249 | 5249 | |
5250 | 5250 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5251 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5251 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5252 | 5252 | } |
5253 | 5253 | if ($startup) { |
5254 | 5254 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5395,7 +5395,7 @@ discard block |
||
5395 | 5395 | $eventtime = $this->getMicroTime() - $eventtime; |
5396 | 5396 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5397 | 5397 | foreach ($parameter as $k => $v) { |
5398 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5398 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5399 | 5399 | } |
5400 | 5400 | $this->pluginsCode .= '</fieldset><br />'; |
5401 | 5401 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5423,13 +5423,13 @@ discard block |
||
5423 | 5423 | $plugin = array(); |
5424 | 5424 | if (isset ($this->pluginCache[$pluginName])) { |
5425 | 5425 | $pluginCode = $this->pluginCache[$pluginName]; |
5426 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5426 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5427 | 5427 | } else { |
5428 | 5428 | $pluginName = $this->db->escape($pluginName); |
5429 | 5429 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5430 | 5430 | if ($row = $this->db->getRow($result)) { |
5431 | 5431 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5432 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5432 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5433 | 5433 | } else { |
5434 | 5434 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5435 | 5435 | $pluginProperties = ''; |
@@ -5536,7 +5536,7 @@ discard block |
||
5536 | 5536 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5537 | 5537 | { |
5538 | 5538 | $params = array(); |
5539 | - $fullpath = $element_dir . '/' . $filename; |
|
5539 | + $fullpath = $element_dir.'/'.$filename; |
|
5540 | 5540 | if (is_readable($fullpath)) { |
5541 | 5541 | $tpl = @fopen($fullpath, "r"); |
5542 | 5542 | if ($tpl) { |
@@ -5703,8 +5703,8 @@ discard block |
||
5703 | 5703 | $ph = array('site_url' => MODX_SITE_URL); |
5704 | 5704 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5705 | 5705 | $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i'; |
5706 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5707 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5706 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5707 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5708 | 5708 | foreach ($parsed as $key => $val) { |
5709 | 5709 | if (is_array($val)) { |
5710 | 5710 | foreach ($val as $key2 => $val2) { |
@@ -5713,7 +5713,7 @@ discard block |
||
5713 | 5713 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5714 | 5714 | } |
5715 | 5715 | if (preg_match($regexEmail, $val2, $url)) { |
5716 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5716 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5717 | 5717 | } |
5718 | 5718 | $parsed[$key][$key2] = $val2; |
5719 | 5719 | } |
@@ -5723,7 +5723,7 @@ discard block |
||
5723 | 5723 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5724 | 5724 | } |
5725 | 5725 | if (preg_match($regexEmail, $val, $url)) { |
5726 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5726 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5727 | 5727 | } |
5728 | 5728 | $parsed[$key] = $val; |
5729 | 5729 | } |
@@ -5737,32 +5737,32 @@ discard block |
||
5737 | 5737 | ); |
5738 | 5738 | |
5739 | 5739 | $nl = "\n"; |
5740 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5741 | - $list .= '<p>' . $nl; |
|
5742 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5743 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5744 | - $list .= '</p><br/>' . $nl; |
|
5745 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5746 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5747 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5748 | - $list .= '<br/>' . $nl; |
|
5740 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5741 | + $list .= '<p>'.$nl; |
|
5742 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5743 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5744 | + $list .= '</p><br/>'.$nl; |
|
5745 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5746 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5747 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5748 | + $list .= '<br/>'.$nl; |
|
5749 | 5749 | $first = true; |
5750 | 5750 | foreach ($arrayParams as $param => $label) { |
5751 | 5751 | if (isset($parsed[$param])) { |
5752 | 5752 | if ($first) { |
5753 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5754 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5753 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5754 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5755 | 5755 | $first = false; |
5756 | 5756 | } |
5757 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5758 | - $list .= ' <ul>' . $nl; |
|
5757 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5758 | + $list .= ' <ul>'.$nl; |
|
5759 | 5759 | foreach ($parsed[$param] as $val) { |
5760 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5760 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5761 | 5761 | } |
5762 | - $list .= ' </ul></li>' . $nl; |
|
5762 | + $list .= ' </ul></li>'.$nl; |
|
5763 | 5763 | } |
5764 | 5764 | } |
5765 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5765 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5766 | 5766 | |
5767 | 5767 | return $list; |
5768 | 5768 | } |
@@ -5838,7 +5838,7 @@ discard block |
||
5838 | 5838 | */ |
5839 | 5839 | public function addSnippet($name, $phpCode) |
5840 | 5840 | { |
5841 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5841 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5842 | 5842 | } |
5843 | 5843 | |
5844 | 5844 | /** |
@@ -5847,7 +5847,7 @@ discard block |
||
5847 | 5847 | */ |
5848 | 5848 | public function addChunk($name, $text) |
5849 | 5849 | { |
5850 | - $this->chunkCache['#' . $name] = $text; |
|
5850 | + $this->chunkCache['#'.$name] = $text; |
|
5851 | 5851 | } |
5852 | 5852 | |
5853 | 5853 | /** |
@@ -5883,7 +5883,7 @@ discard block |
||
5883 | 5883 | } |
5884 | 5884 | |
5885 | 5885 | if (!$isSafe) { |
5886 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5886 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5887 | 5887 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5888 | 5888 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5889 | 5889 | return; |
@@ -5897,7 +5897,7 @@ discard block |
||
5897 | 5897 | return 'array()'; |
5898 | 5898 | } |
5899 | 5899 | |
5900 | - $output = $echo . $return; |
|
5900 | + $output = $echo.$return; |
|
5901 | 5901 | modx_sanitize_gpc($output); |
5902 | 5902 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5903 | 5903 | } |
@@ -5915,8 +5915,8 @@ discard block |
||
5915 | 5915 | |
5916 | 5916 | $safe = explode(',', $safe_functions); |
5917 | 5917 | |
5918 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5919 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5918 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5919 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5920 | 5920 | foreach ($tokens as $i => $token) { |
5921 | 5921 | if (!is_array($token)) { |
5922 | 5922 | continue; |
@@ -5952,7 +5952,7 @@ discard block |
||
5952 | 5952 | public function atBindFileContent($str = '') |
5953 | 5953 | { |
5954 | 5954 | |
5955 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5955 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5956 | 5956 | |
5957 | 5957 | if (stripos($str, '@FILE') !== 0) { |
5958 | 5958 | return $str; |
@@ -5975,7 +5975,7 @@ discard block |
||
5975 | 5975 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
5976 | 5976 | |
5977 | 5977 | foreach ($search_path as $path) { |
5978 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
5978 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
5979 | 5979 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
5980 | 5980 | return $errorMsg; |
5981 | 5981 | } elseif (is_file($file_path)) { |
@@ -5989,7 +5989,7 @@ discard block |
||
5989 | 5989 | return $errorMsg; |
5990 | 5990 | } |
5991 | 5991 | |
5992 | - $content = (string)file_get_contents($file_path); |
|
5992 | + $content = (string) file_get_contents($file_path); |
|
5993 | 5993 | if ($content === false) { |
5994 | 5994 | return $errorMsg; |
5995 | 5995 | } |
@@ -6102,22 +6102,22 @@ discard block |
||
6102 | 6102 | |
6103 | 6103 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6104 | 6104 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6105 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6105 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6106 | 6106 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6107 | 6107 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6108 | 6108 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6109 | 6109 | if ($is_error) { |
6110 | 6110 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6111 | 6111 | if ($msg != 'PHP Parse Error') { |
6112 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6112 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6113 | 6113 | } |
6114 | 6114 | } else { |
6115 | 6115 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6116 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6116 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6117 | 6117 | } |
6118 | 6118 | |
6119 | 6119 | if (!empty ($query)) { |
6120 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></div>'; |
|
6120 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></div>'; |
|
6121 | 6121 | } |
6122 | 6122 | |
6123 | 6123 | $errortype = array( |
@@ -6140,13 +6140,13 @@ discard block |
||
6140 | 6140 | |
6141 | 6141 | if (!empty($nr) || !empty($file)) { |
6142 | 6142 | if ($text != '') { |
6143 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6143 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6144 | 6144 | } |
6145 | 6145 | if ($output != '') { |
6146 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6146 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6147 | 6147 | } |
6148 | 6148 | if ($nr !== '') { |
6149 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6149 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6150 | 6150 | } |
6151 | 6151 | if ($file) { |
6152 | 6152 | $table[] = array('File', $file); |
@@ -6166,7 +6166,7 @@ discard block |
||
6166 | 6166 | } |
6167 | 6167 | |
6168 | 6168 | if (!empty($this->event->activePlugin)) { |
6169 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6169 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6170 | 6170 | } |
6171 | 6171 | |
6172 | 6172 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6176,17 +6176,17 @@ discard block |
||
6176 | 6176 | $table[] = array('REQUEST_URI', $request_uri); |
6177 | 6177 | |
6178 | 6178 | if ($this->manager->action) { |
6179 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6179 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6180 | 6180 | global $action_list; |
6181 | 6181 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6182 | 6182 | |
6183 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6183 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6184 | 6184 | } |
6185 | 6185 | |
6186 | 6186 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6187 | 6187 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6188 | 6188 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6189 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6189 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6190 | 6190 | } |
6191 | 6191 | $table[] = array('Referer', $referer); |
6192 | 6192 | $table[] = array('User Agent', $ua); |
@@ -6207,7 +6207,7 @@ discard block |
||
6207 | 6207 | |
6208 | 6208 | $mem = memory_get_peak_usage(true); |
6209 | 6209 | $total_mem = $mem - $this->mstart; |
6210 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6210 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6211 | 6211 | |
6212 | 6212 | $queryTime = $this->queryTime; |
6213 | 6213 | $phpTime = $totalTime - $queryTime; |
@@ -6228,18 +6228,18 @@ discard block |
||
6228 | 6228 | $str .= $this->get_backtrace(debug_backtrace()); |
6229 | 6229 | // Log error |
6230 | 6230 | if (!empty($this->currentSnippet)) { |
6231 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6231 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6232 | 6232 | } elseif (!empty($this->event->activePlugin)) { |
6233 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6233 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6234 | 6234 | } elseif ($source !== '') { |
6235 | - $source = 'Parser - ' . $source; |
|
6235 | + $source = 'Parser - '.$source; |
|
6236 | 6236 | } elseif ($query !== '') { |
6237 | 6237 | $source = 'SQL Query'; |
6238 | 6238 | } else { |
6239 | 6239 | $source = 'Parser'; |
6240 | 6240 | } |
6241 | 6241 | if ($msg) { |
6242 | - $source .= ' / ' . $msg; |
|
6242 | + $source .= ' / '.$msg; |
|
6243 | 6243 | } |
6244 | 6244 | if (isset($actionName) && !empty($actionName)) { |
6245 | 6245 | $source .= $actionName; |
@@ -6271,12 +6271,12 @@ discard block |
||
6271 | 6271 | |
6272 | 6272 | // Display error |
6273 | 6273 | if (isset($_SESSION['mgrValidated'])) { |
6274 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' » ' . $release_date . '</title> |
|
6274 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' » '.$release_date.'</title> |
|
6275 | 6275 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6276 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6276 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6277 | 6277 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6278 | 6278 | </head><body> |
6279 | - ' . $str . '</body></html>'; |
|
6279 | + ' . $str.'</body></html>'; |
|
6280 | 6280 | |
6281 | 6281 | } else { |
6282 | 6282 | echo 'Error'; |
@@ -6314,7 +6314,7 @@ discard block |
||
6314 | 6314 | switch ($val['type']) { |
6315 | 6315 | case '->': |
6316 | 6316 | case '::': |
6317 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6317 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6318 | 6318 | break; |
6319 | 6319 | default: |
6320 | 6320 | $functionName = $val['function']; |
@@ -6324,7 +6324,7 @@ discard block |
||
6324 | 6324 | $args = array_pad(array(), $_, '$var'); |
6325 | 6325 | $args = implode(", ", $args); |
6326 | 6326 | $modx = &$this; |
6327 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6327 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6328 | 6328 | $arg = $val['args'][$tmp - 1]; |
6329 | 6329 | switch (true) { |
6330 | 6330 | case is_null($arg): { |
@@ -6336,7 +6336,7 @@ discard block |
||
6336 | 6336 | break; |
6337 | 6337 | } |
6338 | 6338 | case is_scalar($arg): { |
6339 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6339 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6340 | 6340 | break; |
6341 | 6341 | } |
6342 | 6342 | case is_bool($arg): { |
@@ -6344,23 +6344,23 @@ discard block |
||
6344 | 6344 | break; |
6345 | 6345 | } |
6346 | 6346 | case is_array($arg): { |
6347 | - $out = 'array $var' . $tmp; |
|
6347 | + $out = 'array $var'.$tmp; |
|
6348 | 6348 | break; |
6349 | 6349 | } |
6350 | 6350 | case is_object($arg): { |
6351 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6351 | + $out = get_class($arg).' $var'.$tmp; |
|
6352 | 6352 | break; |
6353 | 6353 | } |
6354 | 6354 | default: { |
6355 | - $out = '$var' . $tmp; |
|
6355 | + $out = '$var'.$tmp; |
|
6356 | 6356 | } |
6357 | 6357 | } |
6358 | 6358 | $tmp++; |
6359 | 6359 | return $out; |
6360 | 6360 | }, $args); |
6361 | 6361 | $line = array( |
6362 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6363 | - $path . " on line " . $val['line'] |
|
6362 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6363 | + $path." on line ".$val['line'] |
|
6364 | 6364 | ); |
6365 | 6365 | $table[] = array(implode("<br />", $line)); |
6366 | 6366 | } |
@@ -6401,7 +6401,7 @@ discard block |
||
6401 | 6401 | $alias = strip_tags($alias); // strip HTML |
6402 | 6402 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6403 | 6403 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6404 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6404 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6405 | 6405 | $alias = trim($alias, '-'); // trim excess |
6406 | 6406 | return $alias; |
6407 | 6407 | } |
@@ -6417,7 +6417,7 @@ discard block |
||
6417 | 6417 | $precisions = count($sizes) - 1; |
6418 | 6418 | foreach ($sizes as $unit => $bytes) { |
6419 | 6419 | if ($size >= $bytes) { |
6420 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6420 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6421 | 6421 | } |
6422 | 6422 | $precisions--; |
6423 | 6423 | } |
@@ -6521,10 +6521,10 @@ discard block |
||
6521 | 6521 | |
6522 | 6522 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6523 | 6523 | return false; |
6524 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6525 | - $file_path = MODX_BASE_PATH . $str; |
|
6526 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6527 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6524 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6525 | + $file_path = MODX_BASE_PATH.$str; |
|
6526 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6527 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6528 | 6528 | } else { |
6529 | 6529 | return false; |
6530 | 6530 | } |
@@ -6650,7 +6650,7 @@ discard block |
||
6650 | 6650 | $title = 'no title'; |
6651 | 6651 | } |
6652 | 6652 | if (is_array($msg)) { |
6653 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6653 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6654 | 6654 | } elseif ($msg === '') { |
6655 | 6655 | $msg = $_SERVER['REQUEST_URI']; |
6656 | 6656 | } |
@@ -6695,7 +6695,7 @@ discard block |
||
6695 | 6695 | if (is_array($SystemAlertMsgQueque)) { |
6696 | 6696 | $title = ''; |
6697 | 6697 | if ($this->name && $this->activePlugin) { |
6698 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6698 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6699 | 6699 | } |
6700 | 6700 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6701 | 6701 | } |