@@ -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 | |
@@ -11,17 +11,17 @@ discard block |
||
| 11 | 11 | * @param string $checkKey |
| 12 | 12 | * @return array |
| 13 | 13 | */ |
| 14 | -function array_unique_multi($array, $checkKey) |
|
| 15 | -{
|
|
| 14 | +function array_unique_multi($array, $checkKey) |
|
| 15 | +{ |
|
| 16 | 16 | // Use the builtin if we're not a multi-dimensional array |
| 17 | - if (!is_array(current($array)) || empty($checkKey)) {
|
|
| 17 | + if (!is_array(current($array)) || empty($checkKey)) { |
|
| 18 | 18 | return array_unique($array); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $ret = array(); |
| 22 | 22 | $checkValues = array(); // contains the unique key Values |
| 23 | - foreach ($array as $key => $current) {
|
|
| 24 | - if (in_array($current[$checkKey], $checkValues)) {
|
|
| 23 | + foreach ($array as $key => $current) { |
|
| 24 | + if (in_array($current[$checkKey], $checkValues)) { |
|
| 25 | 25 | continue; |
| 26 | 26 | } // duplicate |
| 27 | 27 | |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | * @param string $key |
| 37 | 37 | * @return array |
| 38 | 38 | */ |
| 39 | -function record_sort($array, $key) |
|
| 40 | -{
|
|
| 39 | +function record_sort($array, $key) |
|
| 40 | +{ |
|
| 41 | 41 | $hash = array(); |
| 42 | - foreach ($array as $k => $v) {
|
|
| 42 | + foreach ($array as $k => $v) { |
|
| 43 | 43 | $hash[$k] = $v[$key]; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | natsort($hash); |
| 47 | 47 | |
| 48 | 48 | $records = array(); |
| 49 | - foreach ($hash as $k => $row) {
|
|
| 49 | + foreach ($hash as $k => $row) { |
|
| 50 | 50 | $records[$k] = $array[$k]; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | <?php |
| 74 | 74 | // get all users currently in the log |
| 75 | 75 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
| 76 | - foreach ($logs_user as $row) {
|
|
| 76 | + foreach ($logs_user as $row) { |
|
| 77 | 77 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
| 78 | 78 | echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
| 79 | 79 | } |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | // get all available actions in the log |
| 91 | 91 | include_once "actionlist.inc.php"; |
| 92 | 92 | $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action'); |
| 93 | - foreach ($logs_actions as $row) {
|
|
| 93 | + foreach ($logs_actions as $row) { |
|
| 94 | 94 | $action = getAction($row['action']); |
| 95 | - if ($action == 'Idle') {
|
|
| 95 | + if ($action == 'Idle') { |
|
| 96 | 96 | continue; |
| 97 | 97 | } |
| 98 | 98 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | <?php |
| 111 | 111 | // get all itemid currently in logging |
| 112 | 112 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
| 113 | - foreach ($logs_items as $row) {
|
|
| 113 | + foreach ($logs_items as $row) { |
|
| 114 | 114 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
| 115 | 115 | echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
| 116 | 116 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | <?php |
| 127 | 127 | // get all itemname currently in logging |
| 128 | 128 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
| 129 | - foreach ($logs_names as $row) {
|
|
| 129 | + foreach ($logs_names as $row) { |
|
| 130 | 130 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
| 131 | 131 | echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
| 132 | 132 | } |
@@ -182,36 +182,36 @@ discard block |
||
| 182 | 182 | <div class="container container-body"> |
| 183 | 183 | |
| 184 | 184 | <?php |
| 185 | -if (isset($_REQUEST['log_submit'])) {
|
|
| 185 | +if (isset($_REQUEST['log_submit'])) { |
|
| 186 | 186 | // get the selections the user made. |
| 187 | 187 | $sqladd = array(); |
| 188 | - if ($_REQUEST['searchuser'] != 0) {
|
|
| 188 | + if ($_REQUEST['searchuser'] != 0) { |
|
| 189 | 189 | $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'"; |
| 190 | 190 | } |
| 191 | - if ($_REQUEST['action'] != 0) {
|
|
| 191 | + if ($_REQUEST['action'] != 0) { |
|
| 192 | 192 | $sqladd[] = "action=" . (int)$_REQUEST['action']; |
| 193 | 193 | } |
| 194 | - if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
|
|
| 194 | + if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
| 195 | 195 | $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
| 196 | 196 | } |
| 197 | - if ($_REQUEST['itemname'] != '0') {
|
|
| 197 | + if ($_REQUEST['itemname'] != '0') { |
|
| 198 | 198 | $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
| 199 | 199 | } |
| 200 | - if ($_REQUEST['message'] != "") {
|
|
| 200 | + if ($_REQUEST['message'] != "") { |
|
| 201 | 201 | $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
| 202 | 202 | } |
| 203 | 203 | // date stuff |
| 204 | - if ($_REQUEST['datefrom'] != "") {
|
|
| 204 | + if ($_REQUEST['datefrom'] != "") { |
|
| 205 | 205 | $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
| 206 | 206 | } |
| 207 | - if ($_REQUEST['dateto'] != "") {
|
|
| 207 | + if ($_REQUEST['dateto'] != "") { |
|
| 208 | 208 | $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | // If current position is not set, set it to zero |
| 212 | - if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
|
|
| 212 | + if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
| 213 | 213 | $int_cur_position = 0; |
| 214 | - } else {
|
|
| 214 | + } else { |
|
| 215 | 215 | $int_cur_position = $_REQUEST['int_cur_position']; |
| 216 | 216 | } |
| 217 | 217 | |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
|
| 227 | 227 | |
| 228 | -if ($limit < 1) {
|
|
| 228 | +if ($limit < 1) { |
|
| 229 | 229 | echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
| 230 | -} else {
|
|
| 230 | +} else { |
|
| 231 | 231 | echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
| 232 | 232 | |
| 233 | 233 | include_once "paginate.inc.php"; |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
| 247 | 247 | $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
| 248 | 248 | $pagesfound = sizeof($array_row_paging); |
| 249 | - if ($pagesfound > 6) {
|
|
| 249 | + if ($pagesfound > 6) { |
|
| 250 | 250 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
| 251 | 251 | $paging .= $array_row_paging[$current_row - 1]; // ." "; |
| 252 | 252 | $paging .= $array_row_paging[$current_row]; // ." "; |
| 253 | 253 | $paging .= $array_row_paging[$current_row + 1]; // ." "; |
| 254 | 254 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
| 255 | - } else {
|
|
| 256 | - for ($i = 0; $i < $pagesfound; $i++) {
|
|
| 255 | + } else { |
|
| 256 | + for ($i = 0; $i < $pagesfound; $i++) { |
|
| 257 | 257 | $paging .= $array_row_paging[$i] . " "; |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -288,12 +288,12 @@ discard block |
||
| 288 | 288 | // grab the entire log file... |
| 289 | 289 | $logentries = array(); |
| 290 | 290 | $i = 0; |
| 291 | - while ($logentry = $modx->db->getRow($rs)) {
|
|
| 292 | - if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
|
|
| 291 | + while ($logentry = $modx->db->getRow($rs)) { |
|
| 292 | + if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
| 293 | 293 | $item = '<div style="text-align:center;">-</div>'; |
| 294 | - } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
|
|
| 294 | + } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
| 295 | 295 | $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
| 296 | - } else {
|
|
| 296 | + } else { |
|
| 297 | 297 | $item = $logentry['itemname']; |
| 298 | 298 | } |
| 299 | 299 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
@@ -328,6 +328,6 @@ discard block |
||
| 328 | 328 | // @see index.php @ 915 |
| 329 | 329 | global $action; |
| 330 | 330 | $action = 1; |
| 331 | -} else {
|
|
| 331 | +} else { |
|
| 332 | 332 | echo $_lang["mgrlog_noquery"]; |
| 333 | 333 | } |
@@ -23,12 +23,15 @@ |
||
| 23 | 23 | * @param array $linkArr |
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | -function createList($sectionHeader, $linkArr) { |
|
| 26 | +function createList($sectionHeader, $linkArr) |
|
| 27 | +{ |
|
| 27 | 28 | $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
| 28 | 29 | $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
| 29 | 30 | $links = ''; |
| 30 | 31 | foreach($linkArr as $row) { |
| 31 | - if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
| 32 | + if (!is_array($row['link'])) { |
|
| 33 | + $row['link'] = array($row['link']); |
|
| 34 | + } |
|
| 32 | 35 | foreach ($row['link'] as $link) { |
| 33 | 36 | $links .= $links != '' ? '<br/>' : ''; |
| 34 | 37 | $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
@@ -139,11 +139,14 @@ |
||
| 139 | 139 | * @param string $itemid |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | -function getAction($actionId, $itemid='') { |
|
| 142 | +function getAction($actionId, $itemid='') |
|
| 143 | +{ |
|
| 143 | 144 | global $action_list; |
| 144 | 145 | |
| 145 | 146 | $ret = sprintf($action_list[$actionId], $itemid); |
| 146 | - if (!$ret) $ret = "Idle (unknown)"; |
|
| 147 | + if (!$ret) { |
|
| 148 | + $ret = "Idle (unknown)"; |
|
| 149 | + } |
|
| 147 | 150 | |
| 148 | 151 | return $ret; |
| 149 | 152 | } |
@@ -7,15 +7,17 @@ |
||
| 7 | 7 | |
| 8 | 8 | global $database_type; |
| 9 | 9 | |
| 10 | -if (empty($database_type)) $database_type = 'mysql'; |
|
| 10 | +if (empty($database_type)) { |
|
| 11 | + $database_type = 'mysql'; |
|
| 12 | +} |
|
| 11 | 13 | |
| 12 | 14 | $out = false; |
| 13 | 15 | $class = 'DBAPI'; |
| 14 | -if( ! class_exists($class)){ |
|
| 16 | +if( ! class_exists($class)) { |
|
| 15 | 17 | include_once MODX_MANAGER_PATH . 'includes/extenders/dbapi.' . $database_type . '.class.inc.php'; |
| 16 | 18 | } |
| 17 | 19 | |
| 18 | -if(class_exists($class)){ |
|
| 20 | +if(class_exists($class)) { |
|
| 19 | 21 | $this->db= new $class; |
| 20 | 22 | $out = true; |
| 21 | 23 | } |
@@ -279,7 +279,8 @@ discard block |
||
| 279 | 279 | $row['count'] = $this->count; |
| 280 | 280 | $row['url'] = $modx->makeUrl($row['id']); |
| 281 | 281 | |
| 282 | - if (!$row['wasNull']) { // needs writing a document |
|
| 282 | + if (!$row['wasNull']) { |
|
| 283 | +// needs writing a document |
|
| 283 | 284 | $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix); |
| 284 | 285 | $filename = $dirpath . $docname; |
| 285 | 286 | if (!is_file($filename)) { |
@@ -307,7 +308,8 @@ discard block |
||
| 307 | 308 | $this->output[] = $this->parsePlaceholder($_lang['export_site_exporting_document'], $row); |
| 308 | 309 | } |
| 309 | 310 | if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'], |
| 310 | - '.') === false)) { // needs making a folder |
|
| 311 | + '.') === false)) { |
|
| 312 | +// needs making a folder |
|
| 311 | 313 | $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id']; |
| 312 | 314 | $dir_path = $dirpath . $end_dir; |
| 313 | 315 | if (strpos($dir_path, MODX_BASE_PATH) === false) { |
@@ -373,7 +373,8 @@ discard block |
||
| 373 | 373 | * @return bool|mixed|mysqli_result |
| 374 | 374 | */ |
| 375 | 375 | public function save($fields, $table, $where = '') |
| 376 | - { // This is similar to "replace into table". |
|
| 376 | + { |
|
| 377 | +// This is similar to "replace into table". |
|
| 377 | 378 | |
| 378 | 379 | if ($where === '') { |
| 379 | 380 | $mode = 'insert'; |
@@ -490,7 +491,7 @@ discard block |
||
| 490 | 491 | { |
| 491 | 492 | $out = false; |
| 492 | 493 | if ($ds instanceof mysqli_result) { |
| 493 | - switch($mode){ |
|
| 494 | + switch($mode) { |
|
| 494 | 495 | case 'assoc': |
| 495 | 496 | $out = $ds->fetch_assoc(); |
| 496 | 497 | break; |
@@ -457,7 +457,8 @@ |
||
| 457 | 457 | if ($this->formElementType) { |
| 458 | 458 | $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table; |
| 459 | 459 | } |
| 460 | - if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists. |
|
| 460 | + if (strlen($this->pageNav) > 1) { |
|
| 461 | +//changed to display the pagination if exists. |
|
| 461 | 462 | /* commented this part because of cookie |
| 462 | 463 | $table .= '<div id="max-display-records" ><select style="display:inline" onchange="javascript:updatePageSize(this[this.selectedIndex].value);">'; |
| 463 | 464 | $pageSizes= array (10, 25, 50, 100, 250); |
@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
| 22 | 22 | include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
| 23 | 23 | if (isset($installStartTime)) { |
| 24 | - if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
| 24 | + if ((time() - $installStartTime) > 5 * 60) { |
|
| 25 | +// if install flag older than 5 minutes, discard |
|
| 25 | 26 | unset($installStartTime); |
| 26 | 27 | @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
| 27 | 28 | unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
@@ -163,7 +164,8 @@ discard block |
||
| 163 | 164 | } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
| 164 | 165 | $target = $theme_path . 'templates/actions/login.tpl'; |
| 165 | 166 | $login_tpl = file_get_contents($target); |
| 166 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
| 167 | + } elseif (is_file($theme_path . 'html/login.html')) { |
|
| 168 | +// ClipperCMS compatible |
|
| 167 | 169 | $target = $theme_path . 'html/login.html'; |
| 168 | 170 | $login_tpl = file_get_contents($target); |
| 169 | 171 | } else { |
@@ -16,7 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | -function createGUID(){ |
|
| 19 | +function createGUID() |
|
| 20 | +{ |
|
| 20 | 21 | srand((double)microtime()*1000000); |
| 21 | 22 | $r = rand() ; |
| 22 | 23 | $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
@@ -27,8 +28,11 @@ discard block |
||
| 27 | 28 | // count duplicates |
| 28 | 29 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
| 29 | 30 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 30 | -if($count>=1) $count = ' '.($count+1); |
|
| 31 | -else $count = ''; |
|
| 31 | +if($count>=1) { |
|
| 32 | + $count = ' '.($count+1); |
|
| 33 | +} else { |
|
| 34 | + $count = ''; |
|
| 35 | +} |
|
| 32 | 36 | |
| 33 | 37 | // duplicate module |
| 34 | 38 | $newid = $modx->db->insert( |