@@ -1,15 +1,15 @@ 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; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | // check to see the module editor isn't locked |
| 34 | -if($lockedEl = $modx->elementIsLocked(6, $id)) {
|
|
| 34 | +if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
| 35 | 35 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
| 36 | 36 | } |
| 37 | 37 | // end check for lock |
@@ -39,22 +39,22 @@ discard block |
||
| 39 | 39 | // Lock snippet for other users to edit |
| 40 | 40 | $modx->lockElement(6, $id); |
| 41 | 41 | |
| 42 | -if(isset($_GET['id'])) {
|
|
| 42 | +if(isset($_GET['id'])) { |
|
| 43 | 43 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
|
| 44 | 44 | $content = $modx->db->getRow($rs); |
| 45 | - if(!$content) {
|
|
| 45 | + if(!$content) { |
|
| 46 | 46 | $modx->webAlertAndQuit("Module not found for id '{$id}'.");
|
| 47 | 47 | } |
| 48 | 48 | $content['properties'] = str_replace("&", "&", $content['properties']);
|
| 49 | 49 | $_SESSION['itemname'] = $content['name']; |
| 50 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
|
|
| 50 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 51 | 51 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 52 | 52 | } |
| 53 | -} else {
|
|
| 53 | +} else { |
|
| 54 | 54 | $_SESSION['itemname'] = $_lang["new_module"]; |
| 55 | 55 | $content['wrap'] = '1'; |
| 56 | 56 | } |
| 57 | -if($modx->manager->hasFormValues()) {
|
|
| 57 | +if($modx->manager->hasFormValues()) { |
|
| 58 | 58 | $modx->manager->loadFormValues(); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | <?php |
| 429 | 429 | // invoke OnModFormPrerender event |
| 430 | 430 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
|
| 431 | - if(is_array($evtOut)) {
|
|
| 431 | + if(is_array($evtOut)) { |
|
| 432 | 432 | echo implode('', $evtOut);
|
| 433 | 433 | } |
| 434 | 434 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | <option> </option> |
| 492 | 492 | <?php |
| 493 | 493 | include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
| 494 | - foreach(getCategories() as $n => $v) {
|
|
| 494 | + foreach(getCategories() as $n => $v) { |
|
| 495 | 495 | echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
| 496 | 496 | } |
| 497 | 497 | ?> |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
|
| 644 | 644 | $groupsarray = $modx->db->getColumn('usergroup', $rs);
|
| 645 | 645 | |
| 646 | - if($modx->hasPermission('access_permissions')) {
|
|
| 646 | + if($modx->hasPermission('access_permissions')) { |
|
| 647 | 647 | ?> |
| 648 | 648 | <!-- User Group Access Permissions --> |
| 649 | 649 | <script type="text/javascript"> |
@@ -671,21 +671,21 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | $chk = ''; |
| 673 | 673 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
|
| 674 | - while($row = $modx->db->getRow($rs)) {
|
|
| 674 | + while($row = $modx->db->getRow($rs)) { |
|
| 675 | 675 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
| 676 | 676 | $checked = in_array($row['id'], $groupsarray); |
| 677 | - if($modx->hasPermission('access_permissions')) {
|
|
| 678 | - if($checked) {
|
|
| 677 | + if($modx->hasPermission('access_permissions')) { |
|
| 678 | + if($checked) { |
|
| 679 | 679 | $notPublic = true; |
| 680 | 680 | } |
| 681 | 681 | $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
| 682 | - } else {
|
|
| 683 | - if($checked) {
|
|
| 682 | + } else { |
|
| 683 | + if($checked) { |
|
| 684 | 684 | $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | } |
| 688 | - if($modx->hasPermission('access_permissions')) {
|
|
| 688 | + if($modx->hasPermission('access_permissions')) { |
|
| 689 | 689 | $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; |
| 690 | 690 | } |
| 691 | 691 | echo $chks; |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | <?php |
| 708 | 708 | // invoke OnModFormRender event |
| 709 | 709 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
|
| 710 | - if(is_array($evtOut)) {
|
|
| 710 | + if(is_array($evtOut)) { |
|
| 711 | 711 | echo implode('', $evtOut);
|
| 712 | 712 | } |
| 713 | 713 | ?> |
@@ -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('logs')) {
|
|
| 5 | +if (!$modx->hasPermission('logs')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | <?php |
| 27 | 27 | // get all users currently in the log |
| 28 | 28 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
| 29 | - foreach ($logs_user as $row) {
|
|
| 29 | + foreach ($logs_user as $row) { |
|
| 30 | 30 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
| 31 | 31 | echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
| 32 | 32 | } |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | // get all available actions in the log |
| 44 | 44 | include_once "actionlist.inc.php"; |
| 45 | 45 | $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action'); |
| 46 | - foreach ($logs_actions as $row) {
|
|
| 46 | + foreach ($logs_actions as $row) { |
|
| 47 | 47 | $action = getAction($row['action']); |
| 48 | - if ($action == 'Idle') {
|
|
| 48 | + if ($action == 'Idle') { |
|
| 49 | 49 | continue; |
| 50 | 50 | } |
| 51 | 51 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | <?php |
| 64 | 64 | // get all itemid currently in logging |
| 65 | 65 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
| 66 | - foreach ($logs_items as $row) {
|
|
| 66 | + foreach ($logs_items as $row) { |
|
| 67 | 67 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
| 68 | 68 | echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
| 69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | <?php |
| 80 | 80 | // get all itemname currently in logging |
| 81 | 81 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
| 82 | - foreach ($logs_names as $row) {
|
|
| 82 | + foreach ($logs_names as $row) { |
|
| 83 | 83 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
| 84 | 84 | echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
| 85 | 85 | } |
@@ -135,36 +135,36 @@ discard block |
||
| 135 | 135 | <div class="container container-body"> |
| 136 | 136 | |
| 137 | 137 | <?php |
| 138 | -if (isset($_REQUEST['log_submit'])) {
|
|
| 138 | +if (isset($_REQUEST['log_submit'])) { |
|
| 139 | 139 | // get the selections the user made. |
| 140 | 140 | $sqladd = array(); |
| 141 | - if ($_REQUEST['searchuser'] != 0) {
|
|
| 141 | + if ($_REQUEST['searchuser'] != 0) { |
|
| 142 | 142 | $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'"; |
| 143 | 143 | } |
| 144 | - if ($_REQUEST['action'] != 0) {
|
|
| 144 | + if ($_REQUEST['action'] != 0) { |
|
| 145 | 145 | $sqladd[] = "action=" . (int)$_REQUEST['action']; |
| 146 | 146 | } |
| 147 | - if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
|
|
| 147 | + if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
| 148 | 148 | $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
| 149 | 149 | } |
| 150 | - if ($_REQUEST['itemname'] != '0') {
|
|
| 150 | + if ($_REQUEST['itemname'] != '0') { |
|
| 151 | 151 | $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
| 152 | 152 | } |
| 153 | - if ($_REQUEST['message'] != "") {
|
|
| 153 | + if ($_REQUEST['message'] != "") { |
|
| 154 | 154 | $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
| 155 | 155 | } |
| 156 | 156 | // date stuff |
| 157 | - if ($_REQUEST['datefrom'] != "") {
|
|
| 157 | + if ($_REQUEST['datefrom'] != "") { |
|
| 158 | 158 | $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
| 159 | 159 | } |
| 160 | - if ($_REQUEST['dateto'] != "") {
|
|
| 160 | + if ($_REQUEST['dateto'] != "") { |
|
| 161 | 161 | $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // If current position is not set, set it to zero |
| 165 | - if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
|
|
| 165 | + if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
| 166 | 166 | $int_cur_position = 0; |
| 167 | - } else {
|
|
| 167 | + } else { |
|
| 168 | 168 | $int_cur_position = $_REQUEST['int_cur_position']; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
|
| 180 | 180 | |
| 181 | -if ($limit < 1) {
|
|
| 181 | +if ($limit < 1) { |
|
| 182 | 182 | echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
| 183 | -} else {
|
|
| 183 | +} else { |
|
| 184 | 184 | echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
| 185 | 185 | |
| 186 | 186 | // New instance of the Paging class, you can modify the color and the width of the html table |
@@ -198,14 +198,14 @@ discard block |
||
| 198 | 198 | $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
| 199 | 199 | $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
| 200 | 200 | $pagesfound = sizeof($array_row_paging); |
| 201 | - if ($pagesfound > 6) {
|
|
| 201 | + if ($pagesfound > 6) { |
|
| 202 | 202 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
| 203 | 203 | $paging .= $array_row_paging[$current_row - 1]; // ." "; |
| 204 | 204 | $paging .= $array_row_paging[$current_row]; // ." "; |
| 205 | 205 | $paging .= $array_row_paging[$current_row + 1]; // ." "; |
| 206 | 206 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
| 207 | - } else {
|
|
| 208 | - for ($i = 0; $i < $pagesfound; $i++) {
|
|
| 207 | + } else { |
|
| 208 | + for ($i = 0; $i < $pagesfound; $i++) { |
|
| 209 | 209 | $paging .= $array_row_paging[$i] . " "; |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -242,12 +242,12 @@ discard block |
||
| 242 | 242 | // grab the entire log file... |
| 243 | 243 | $logentries = array(); |
| 244 | 244 | $i = 0; |
| 245 | - while ($logentry = $modx->db->getRow($rs)) {
|
|
| 246 | - if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
|
|
| 245 | + while ($logentry = $modx->db->getRow($rs)) { |
|
| 246 | + if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
| 247 | 247 | $item = '<div style="text-align:center;">-</div>'; |
| 248 | - } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
|
|
| 248 | + } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
| 249 | 249 | $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
| 250 | - } else {
|
|
| 250 | + } else { |
|
| 251 | 251 | $item = $logentry['itemname']; |
| 252 | 252 | } |
| 253 | 253 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
@@ -284,6 +284,6 @@ discard block |
||
| 284 | 284 | // @see index.php @ 915 |
| 285 | 285 | global $action; |
| 286 | 286 | $action = 1; |
| 287 | -} else {
|
|
| 287 | +} else { |
|
| 288 | 288 | echo $_lang["mgrlog_noquery"]; |
| 289 | 289 | } |
@@ -491,4 +491,6 @@ |
||
| 491 | 491 | /** |
| 492 | 492 | * @deprecated use EvolutionCMS\Support\MysqlDumper |
| 493 | 493 | */ |
| 494 | -class Mysqldumper extends EvolutionCMS\Support\MysqlDumper{} |
|
| 494 | +class Mysqldumper extends EvolutionCMS\Support\MysqlDumper |
|
| 495 | +{ |
|
| 496 | +} |
|
@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | * @param array $ph |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | -function parsePh($tpl, $ph) { |
|
| 24 | +function parsePh($tpl, $ph) |
|
| 25 | +{ |
|
| 25 | 26 | $modx = evolutionCMS(); global $_lang; |
| 26 | 27 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
| 27 | 28 | return $modx->parseText($tpl, $ph); |
@@ -31,7 +32,8 @@ discard block |
||
| 31 | 32 | * @param string|int $cssId |
| 32 | 33 | * @return string |
| 33 | 34 | */ |
| 34 | -function renderViewSwitchButtons($cssId) { |
|
| 35 | +function renderViewSwitchButtons($cssId) |
|
| 36 | +{ |
|
| 35 | 37 | $modx = evolutionCMS(); global $_lang, $tpl; |
| 36 | 38 | |
| 37 | 39 | return parsePh($tpl['viewForm'], array( |
@@ -44,7 +46,8 @@ discard block |
||
| 44 | 46 | * @param mgrResources $resources |
| 45 | 47 | * @return string |
| 46 | 48 | */ |
| 47 | -function createResourceList($resourceTable, $resources) { |
|
| 49 | +function createResourceList($resourceTable, $resources) |
|
| 50 | +{ |
|
| 48 | 51 | $modx = evolutionCMS(); global $_lang, $_style, $modx_textdir, $tpl; |
| 49 | 52 | |
| 50 | 53 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
@@ -97,7 +100,8 @@ discard block |
||
| 97 | 100 | * @param mgrResources $resources |
| 98 | 101 | * @return string |
| 99 | 102 | */ |
| 100 | -function createCombinedView($resources) { |
|
| 103 | +function createCombinedView($resources) |
|
| 104 | +{ |
|
| 101 | 105 | $modx = evolutionCMS(); global $_lang, $_style, $modx_textdir; |
| 102 | 106 | |
| 103 | 107 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
@@ -154,14 +158,15 @@ discard block |
||
| 154 | 158 | * @param mgrResources $resources |
| 155 | 159 | * @return array |
| 156 | 160 | */ |
| 157 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
| 161 | +function prepareElementRowPh($row, $resourceTable, $resources) |
|
| 162 | +{ |
|
| 158 | 163 | $modx = evolutionCMS(); global $modx_textdir, $_style, $_lang; |
| 159 | 164 | |
| 160 | 165 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
| 161 | 166 | |
| 162 | 167 | $_lang["confirm_delete"] = $_lang["delete"]; |
| 163 | 168 | |
| 164 | - switch($resourceTable){ |
|
| 169 | + switch($resourceTable) { |
|
| 165 | 170 | case 'site_templates': |
| 166 | 171 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 167 | 172 | $lockElementType = 1; |
@@ -6,4 +6,6 @@ |
||
| 6 | 6 | /** |
| 7 | 7 | * Don't delete |
| 8 | 8 | */ |
| 9 | -class mgrResources extends EvolutionCMS\Legacy\mgrResources{} |
|
| 9 | +class mgrResources extends EvolutionCMS\Legacy\mgrResources |
|
| 10 | +{ |
|
| 11 | +} |
|
@@ -1,3 +1,5 @@ |
||
| 1 | 1 | <?php namespace EvolutionCMS\Interfaces; |
| 2 | 2 | |
| 3 | -interface ManagerThemeInterface{} |
|
| 3 | +interface ManagerThemeInterface |
|
| 4 | +{ |
|
| 5 | +} |
|
@@ -403,10 +403,12 @@ |
||
| 403 | 403 | $failedlogins += 1; |
| 404 | 404 | |
| 405 | 405 | $fields = array('failedlogincount' => $failedlogins); |
| 406 | - if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
| 406 | + if ($failedlogins >= $failed_allowed) { |
|
| 407 | + //block user for too many fail attempts |
|
| 407 | 408 | { |
| 408 | 409 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
| 409 | 410 | } |
| 411 | + } |
|
| 410 | 412 | |
| 411 | 413 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
| 412 | 414 | |
@@ -710,13 +710,15 @@ discard block |
||
| 710 | 710 | $this->virtualDir = ''; |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | - 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 */ |
|
| 713 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
| 714 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
| 714 | 715 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 715 | 716 | if ($this->config['use_alias_path'] == 1) { |
| 716 | 717 | 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))))) { |
| 717 | 718 | $this->documentMethod = 'id'; |
| 718 | 719 | return $q; |
| 719 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
| 720 | + } else { |
|
| 721 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
| 720 | 722 | $this->documentMethod = 'alias'; |
| 721 | 723 | return $q; |
| 722 | 724 | } |
@@ -724,7 +726,8 @@ discard block |
||
| 724 | 726 | $this->documentMethod = 'id'; |
| 725 | 727 | return $q; |
| 726 | 728 | } |
| 727 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 729 | + } else { |
|
| 730 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 728 | 731 | if ($this->config['friendly_alias_urls'] != 1) { |
| 729 | 732 | $q = $qOrig; |
| 730 | 733 | } |
@@ -754,13 +757,14 @@ discard block |
||
| 754 | 757 | * @param $id |
| 755 | 758 | * @return array|mixed|null|string |
| 756 | 759 | */ |
| 757 | - public function makePageCacheKey($id){ |
|
| 760 | + public function makePageCacheKey($id) |
|
| 761 | + { |
|
| 758 | 762 | $hash = $id; |
| 759 | 763 | $tmp = null; |
| 760 | 764 | $params = array(); |
| 761 | - if(!empty($this->systemCacheKey)){ |
|
| 765 | + if(!empty($this->systemCacheKey)) { |
|
| 762 | 766 | $hash = $this->systemCacheKey; |
| 763 | - }else { |
|
| 767 | + } else { |
|
| 764 | 768 | if (!empty($_GET)) { |
| 765 | 769 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 766 | 770 | $params = $_GET; |
@@ -769,7 +773,7 @@ discard block |
||
| 769 | 773 | } |
| 770 | 774 | } |
| 771 | 775 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
| 772 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 776 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 773 | 777 | $tmp = array_pop($evtOut); |
| 774 | 778 | } |
| 775 | 779 | return empty($tmp) ? $hash : $tmp; |
@@ -1096,7 +1100,8 @@ discard block |
||
| 1096 | 1100 | $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0"; |
| 1097 | 1101 | $result_pub = $this->db->select( 'id', '[+prefix+]site_content', $where); |
| 1098 | 1102 | $this->db->update($field, '[+prefix+]site_content', $where); |
| 1099 | - if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc |
|
| 1103 | + if ($this->db->getRecordCount($result_pub) >= 1) { |
|
| 1104 | +//Event unPublished doc |
|
| 1100 | 1105 | while ($row_pub = $this->db->getRow($result_pub)) { |
| 1101 | 1106 | $this->invokeEvent("OnDocUnPublished", array( |
| 1102 | 1107 | "docid" => $row_pub['id'] |
@@ -1109,7 +1114,8 @@ discard block |
||
| 1109 | 1114 | $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1"; |
| 1110 | 1115 | $result_unpub = $this->db->select( 'id', '[+prefix+]site_content', $where); |
| 1111 | 1116 | $this->db->update($field, '[+prefix+]site_content', $where); |
| 1112 | - if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
|
| 1117 | + if ($this->db->getRecordCount($result_unpub) >= 1) { |
|
| 1118 | +//Event unPublished doc |
|
| 1113 | 1119 | while ($row_unpub = $this->db->getRow($result_unpub)) { |
| 1114 | 1120 | $this->invokeEvent("OnDocUnPublished", array( |
| 1115 | 1121 | "docid" => $row_unpub['id'] |
@@ -1196,10 +1202,18 @@ discard block |
||
| 1196 | 1202 | return array(); |
| 1197 | 1203 | } |
| 1198 | 1204 | $spacer = md5('<<<EVO>>>'); |
| 1199 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1200 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1201 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1202 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1205 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
| 1206 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1207 | + } |
|
| 1208 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
| 1209 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1210 | + } |
|
| 1211 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
| 1212 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1213 | + } |
|
| 1214 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
| 1215 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1216 | + } |
|
| 1203 | 1217 | |
| 1204 | 1218 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1205 | 1219 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1252,7 +1266,8 @@ discard block |
||
| 1252 | 1266 | } |
| 1253 | 1267 | } |
| 1254 | 1268 | |
| 1255 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
| 1269 | + if (!in_array($fetch, $tags)) { |
|
| 1270 | +// Avoid double Matches |
|
| 1256 | 1271 | $tags[] = $fetch; // Fetch |
| 1257 | 1272 | }; |
| 1258 | 1273 | $fetch = ''; // and reset |
@@ -1270,7 +1285,9 @@ discard block |
||
| 1270 | 1285 | } |
| 1271 | 1286 | } |
| 1272 | 1287 | foreach($tags as $i=>$tag) { |
| 1273 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1288 | + if(strpos($tag,$spacer)!==false) { |
|
| 1289 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1290 | + } |
|
| 1274 | 1291 | } |
| 1275 | 1292 | return $tags; |
| 1276 | 1293 | } |
@@ -1310,7 +1327,10 @@ discard block |
||
| 1310 | 1327 | } |
| 1311 | 1328 | |
| 1312 | 1329 | foreach ($matches[1] as $i => $key) { |
| 1313 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1330 | + if(strpos($key,'[+')!==false) { |
|
| 1331 | + continue; |
|
| 1332 | + } |
|
| 1333 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1314 | 1334 | if (substr($key, 0, 1) == '#') { |
| 1315 | 1335 | $key = substr($key, 1); |
| 1316 | 1336 | } // remove # for QuickEdit format |
@@ -2033,7 +2053,8 @@ discard block |
||
| 2033 | 2053 | * @return mixed|string |
| 2034 | 2054 | */ |
| 2035 | 2055 | public function _getSGVar($value) |
| 2036 | - { // Get super globals |
|
| 2056 | + { |
|
| 2057 | +// Get super globals |
|
| 2037 | 2058 | $key = $value; |
| 2038 | 2059 | $_ = $this->config['enable_filter']; |
| 2039 | 2060 | $this->config['enable_filter'] = 1; |
@@ -2438,7 +2459,8 @@ discard block |
||
| 2438 | 2459 | if ($this->config['friendly_urls'] == 1) { |
| 2439 | 2460 | $aliases = array(); |
| 2440 | 2461 | if (is_array($this->documentListing)) { |
| 2441 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
| 2462 | + foreach ($this->documentListing as $path => $docid) { |
|
| 2463 | +// This is big Loop on large site! |
|
| 2442 | 2464 | $aliases[$docid] = $path; |
| 2443 | 2465 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
| 2444 | 2466 | } |
@@ -2471,7 +2493,7 @@ discard block |
||
| 2471 | 2493 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2472 | 2494 | $pref = $this->config['friendly_url_prefix']; |
| 2473 | 2495 | $suff = $this->config['friendly_url_suffix']; |
| 2474 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2496 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
| 2475 | 2497 | global $modx; |
| 2476 | 2498 | $thealias = $aliases[$m[1]]; |
| 2477 | 2499 | $thefolder = $isfolder[$m[1]]; |
@@ -4255,7 +4277,8 @@ discard block |
||
| 4255 | 4277 | if (isset ($this->snippetCache[$snippetName])) { |
| 4256 | 4278 | $snippet = $this->snippetCache[$snippetName]; |
| 4257 | 4279 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
| 4258 | - } else { // not in cache so let's check the db |
|
| 4280 | + } else { |
|
| 4281 | +// not in cache so let's check the db |
|
| 4259 | 4282 | $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;"; |
| 4260 | 4283 | $result = $this->db->query($sql); |
| 4261 | 4284 | if ($this->db->getRecordCount($result) == 1) { |
@@ -4756,7 +4779,7 @@ discard block |
||
| 4756 | 4779 | $result = $this->db->makeArray($rs); |
| 4757 | 4780 | |
| 4758 | 4781 | // get default/built-in template variables |
| 4759 | - if(is_array($docRow)){ |
|
| 4782 | + if(is_array($docRow)) { |
|
| 4760 | 4783 | ksort($docRow); |
| 4761 | 4784 | |
| 4762 | 4785 | foreach ($docRow as $key => $value) { |
@@ -5231,12 +5254,16 @@ discard block |
||
| 5231 | 5254 | return ''; |
| 5232 | 5255 | } // nothing to register |
| 5233 | 5256 | if (!is_array($options)) { |
| 5234 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
| 5257 | + if (is_bool($options)) { |
|
| 5258 | + // backward compatibility with old plaintext parameter |
|
| 5235 | 5259 | { |
| 5236 | 5260 | $options = array('plaintext' => $options); |
| 5237 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
| 5261 | + } |
|
| 5262 | + } elseif (is_string($options)) { |
|
| 5263 | + // Also allow script name as 2nd param |
|
| 5238 | 5264 | { |
| 5239 | 5265 | $options = array('name' => $options); |
| 5266 | + } |
|
| 5240 | 5267 | } else { |
| 5241 | 5268 | $options = array(); |
| 5242 | 5269 | } |
@@ -5248,7 +5275,8 @@ discard block |
||
| 5248 | 5275 | unset($overwritepos); // probably unnecessary--just making sure |
| 5249 | 5276 | |
| 5250 | 5277 | $useThisVer = true; |
| 5251 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
| 5278 | + if (isset($this->loadedjscripts[$key])) { |
|
| 5279 | +// a matching script was found |
|
| 5252 | 5280 | // if existing script is a startup script, make sure the candidate is also a startup script |
| 5253 | 5281 | if ($this->loadedjscripts[$key]['startup']) { |
| 5254 | 5282 | $startup = true; |
@@ -5268,7 +5296,8 @@ discard block |
||
| 5268 | 5296 | // overwrite the old script (the position may be important for dependent scripts) |
| 5269 | 5297 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
| 5270 | 5298 | } |
| 5271 | - } else { // Use the original version |
|
| 5299 | + } else { |
|
| 5300 | +// Use the original version |
|
| 5272 | 5301 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
| 5273 | 5302 | // need to move the exisiting script to the head |
| 5274 | 5303 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5393,7 +5422,8 @@ discard block |
||
| 5393 | 5422 | } |
| 5394 | 5423 | |
| 5395 | 5424 | $results = null; |
| 5396 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
| 5425 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
| 5426 | +// start for loop |
|
| 5397 | 5427 | if ($this->dumpPlugins) { |
| 5398 | 5428 | $eventtime = $this->getMicroTime(); |
| 5399 | 5429 | } |
@@ -5538,8 +5568,7 @@ discard block |
||
| 5538 | 5568 | } |
| 5539 | 5569 | } |
| 5540 | 5570 | } |
| 5541 | - } |
|
| 5542 | - elseif(\is_array($propertyString)) { |
|
| 5571 | + } elseif(\is_array($propertyString)) { |
|
| 5543 | 5572 | $property = $propertyString; |
| 5544 | 5573 | } |
| 5545 | 5574 | if (!empty($elementName) && !empty($elementType)) { |
@@ -5946,7 +5975,8 @@ discard block |
||
| 5946 | 5975 | * @return bool |
| 5947 | 5976 | */ |
| 5948 | 5977 | public function isSafeCode($phpcode = '', $safe_functions = '') |
| 5949 | - { // return true or false |
|
| 5978 | + { |
|
| 5979 | +// return true or false |
|
| 5950 | 5980 | if ($safe_functions == '') { |
| 5951 | 5981 | return false; |
| 5952 | 5982 | } |
@@ -6355,7 +6385,7 @@ discard block |
||
| 6355 | 6385 | $args = array_pad(array(), $_, '$var'); |
| 6356 | 6386 | $args = implode(", ", $args); |
| 6357 | 6387 | $modx = &$this; |
| 6358 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6388 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
| 6359 | 6389 | $arg = $val['args'][$tmp - 1]; |
| 6360 | 6390 | switch (true) { |
| 6361 | 6391 | case is_null($arg): { |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | $style_path = 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
| 12 | 12 | $modx->config['mgr_date_picker_path'] = 'media/calendar/datepicker.inc.php'; |
| 13 | -if(!$modx->config['lang_code']) {
|
|
| 13 | +if(!$modx->config['lang_code']) { |
|
| 14 | 14 | global $modx_lang_attribute; |
| 15 | 15 | $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if(!empty($_GET['a']) && $_GET['a'] == 2) {
|
|
| 18 | +if(!empty($_GET['a']) && $_GET['a'] == 2) { |
|
| 19 | 19 | include_once('welcome.php');
|
| 20 | 20 | } |
| 21 | 21 | |
@@ -262,68 +262,68 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | // actions buttons templates |
| 264 | 264 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
| 265 | -if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) {
|
|
| 265 | +if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) { |
|
| 266 | 266 | $_REQUEST['stay'] = 2; |
| 267 | 267 | } |
| 268 | -if (isset($_REQUEST['stay'])) {
|
|
| 268 | +if (isset($_REQUEST['stay'])) { |
|
| 269 | 269 | $_SESSION['stay'] = $_REQUEST['stay']; |
| 270 | -} else if (isset($_SESSION['stay'])) {
|
|
| 270 | +} else if (isset($_SESSION['stay'])) { |
|
| 271 | 271 | $_REQUEST['stay'] = $_SESSION['stay']; |
| 272 | 272 | } |
| 273 | 273 | $stay = isset($_REQUEST['stay']) ? $_REQUEST['stay'] : ''; |
| 274 | 274 | $addnew = 0; |
| 275 | 275 | $run = 0; |
| 276 | -switch($action) {
|
|
| 276 | +switch($action) { |
|
| 277 | 277 | case '3': |
| 278 | 278 | case '4': |
| 279 | 279 | case '27': |
| 280 | 280 | case '72': |
| 281 | - if($modx->hasPermission('new_document')) {
|
|
| 281 | + if($modx->hasPermission('new_document')) { |
|
| 282 | 282 | $addnew = 1; |
| 283 | 283 | } |
| 284 | 284 | break; |
| 285 | 285 | case '16': |
| 286 | 286 | case '19': |
| 287 | - if($modx->hasPermission('new_template')) {
|
|
| 287 | + if($modx->hasPermission('new_template')) { |
|
| 288 | 288 | $addnew = 1; |
| 289 | 289 | } |
| 290 | 290 | break; |
| 291 | 291 | case '300': |
| 292 | 292 | case '301': |
| 293 | - if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) {
|
|
| 293 | + if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
| 294 | 294 | $addnew = 1; |
| 295 | 295 | } |
| 296 | 296 | break; |
| 297 | 297 | case '77': |
| 298 | 298 | case '78': |
| 299 | - if($modx->hasPermission('new_chunk')) {
|
|
| 299 | + if($modx->hasPermission('new_chunk')) { |
|
| 300 | 300 | $addnew = 1; |
| 301 | 301 | } |
| 302 | 302 | break; |
| 303 | 303 | case '22': |
| 304 | 304 | case '23': |
| 305 | - if($modx->hasPermission('new_snippet')) {
|
|
| 305 | + if($modx->hasPermission('new_snippet')) { |
|
| 306 | 306 | $addnew = 1; |
| 307 | 307 | } |
| 308 | 308 | break; |
| 309 | 309 | case '101': |
| 310 | 310 | case '102': |
| 311 | - if($modx->hasPermission('new_plugin')) {
|
|
| 311 | + if($modx->hasPermission('new_plugin')) { |
|
| 312 | 312 | $addnew = 1; |
| 313 | 313 | } |
| 314 | 314 | break; |
| 315 | 315 | case '106': |
| 316 | 316 | case '107': |
| 317 | 317 | case '108': |
| 318 | - if($modx->hasPermission('new_module')) {
|
|
| 318 | + if($modx->hasPermission('new_module')) { |
|
| 319 | 319 | $addnew = 1; |
| 320 | 320 | } |
| 321 | - if($modx->hasPermission('exec_module')) {
|
|
| 321 | + if($modx->hasPermission('exec_module')) { |
|
| 322 | 322 | $run = 1; |
| 323 | 323 | } |
| 324 | 324 | break; |
| 325 | 325 | case '88': |
| 326 | - if($modx->hasPermission('new_web_user')) {
|
|
| 326 | + if($modx->hasPermission('new_web_user')) { |
|
| 327 | 327 | $addnew = 1; |
| 328 | 328 | } |
| 329 | 329 | break; |