@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // Set line feed |
| 75 | 75 | $lf = "\n"; |
| 76 | - $tempfile_path = $modx->config['base_path'] . 'assets/backup/temp.php'; |
|
| 76 | + $tempfile_path = $modx->config['base_path'].'assets/backup/temp.php'; |
|
| 77 | 77 | |
| 78 | 78 | $result = $modx->getDatabase()->query('SHOW TABLES'); |
| 79 | 79 | $tables = $this->result2Array(0, $result); |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // Set header |
| 88 | 88 | $output = "#{$lf}"; |
| 89 | - $output .= "# " . addslashes($modx->config['site_name']) . " Database Dump{$lf}"; |
|
| 89 | + $output .= "# ".addslashes($modx->config['site_name'])." Database Dump{$lf}"; |
|
| 90 | 90 | $output .= "# MODX Version:{$version['version']}{$lf}"; |
| 91 | 91 | $output .= "# {$lf}"; |
| 92 | 92 | $output .= "# Host: {$this->database_server}{$lf}"; |
| 93 | - $output .= "# Generation Time: " . $modx->toDateFormat(time()) . $lf; |
|
| 94 | - $output .= "# Server version: " . $modx->getDatabase()->getVersion() . $lf; |
|
| 95 | - $output .= "# PHP Version: " . phpversion() . $lf; |
|
| 93 | + $output .= "# Generation Time: ".$modx->toDateFormat(time()).$lf; |
|
| 94 | + $output .= "# Server version: ".$modx->getDatabase()->getVersion().$lf; |
|
| 95 | + $output .= "# PHP Version: ".phpversion().$lf; |
|
| 96 | 96 | $output .= "# Database: `{$this->dbname}`{$lf}"; |
| 97 | - $output .= "# Description: " . trim($_REQUEST['backup_title']) . "{$lf}"; |
|
| 97 | + $output .= "# Description: ".trim($_REQUEST['backup_title'])."{$lf}"; |
|
| 98 | 98 | $output .= "#"; |
| 99 | 99 | file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX); |
| 100 | 100 | $output = ''; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | if ($callBack === 'snapshot') { |
| 116 | - if (!preg_match('@^' . $modx->getDatabase()->config['table_prefix'] . '@', $tblval)) { |
|
| 116 | + if (!preg_match('@^'.$modx->getDatabase()->config['table_prefix'].'@', $tblval)) { |
|
| 117 | 117 | continue; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | ), '\\n', $value); |
| 151 | 151 | $value = "'{$value}'"; |
| 152 | 152 | } |
| 153 | - $insertdump .= $value . ','; |
|
| 153 | + $insertdump .= $value.','; |
|
| 154 | 154 | } |
| 155 | - $output .= rtrim($insertdump, ',') . ");\n"; |
|
| 155 | + $output .= rtrim($insertdump, ',').");\n"; |
|
| 156 | 156 | if (1048576 < strlen($output)) { |
| 157 | 157 | file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX); |
| 158 | 158 | $output = ''; |
@@ -19,46 +19,46 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public static $cnt; |
| 21 | 21 | |
| 22 | - public function __construct($id = '', $width = 120, $visible = false) { |
|
| 22 | + public function __construct($id = '', $width = 120, $visible = false){ |
|
| 23 | 23 | self::$cnt++; |
| 24 | 24 | $this->html = ""; |
| 25 | 25 | $this->visible = $visible ? $visible : false; |
| 26 | - $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | - $this->id = $id ? $id : "cntxMnu" . self::$cnt; // set id |
|
| 26 | + $this->width = is_numeric($width) ? (int) $width : 120; |
|
| 27 | + $this->id = $id ? $id : "cntxMnu".self::$cnt; // set id |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
| 30 | + public function addItem($text, $action = "", $img = "", $disabled = 0){ |
|
| 31 | 31 | global $base_url, $_style; |
| 32 | - if($disabled) { |
|
| 32 | + if ($disabled) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | - if(!$img) { |
|
| 36 | - $img = $base_url . $_style['tx']; |
|
| 35 | + if (!$img) { |
|
| 36 | + $img = $base_url.$_style['tx']; |
|
| 37 | 37 | } |
| 38 | - if(substr($action, 0, 3) == "js:") { |
|
| 38 | + if (substr($action, 0, 3) == "js:") { |
|
| 39 | 39 | $action = substr($action, 3); |
| 40 | - } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 40 | + } else if (substr($action, 0, 3) == "hl:") { |
|
| 41 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
| 42 | 42 | } else { |
| 43 | - $action = "window.location.href='" . $action . "'"; |
|
| 43 | + $action = "window.location.href='".$action."'"; |
|
| 44 | 44 | } |
| 45 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 47 | - if(substr($img, 0, 5) == 'fa fa') { |
|
| 48 | - $img = '<i class="' . $img . '"></i>'; |
|
| 49 | - } else if(substr($img, 0, 1) != '<') { |
|
| 50 | - $img = '<img src="' . $img . '" />'; |
|
| 45 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
| 46 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
| 47 | + if (substr($img, 0, 5) == 'fa fa') { |
|
| 48 | + $img = '<i class="'.$img.'"></i>'; |
|
| 49 | + } else if (substr($img, 0, 1) != '<') { |
|
| 50 | + $img = '<img src="'.$img.'" />'; |
|
| 51 | 51 | } |
| 52 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
| 52 | + $this->html .= $img.' '.$text.'</div>'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function addSeparator() { |
|
| 55 | + public function addSeparator(){ |
|
| 56 | 56 | $this->html .= " |
| 57 | 57 | <div class='cntxMnuSeparator'></div> |
| 58 | 58 | "; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function render() { |
|
| 61 | + public function render(){ |
|
| 62 | 62 | $ContextMenuScript = <<<BLOCK |
| 63 | 63 | <script> |
| 64 | 64 | function getCntxMenu(id) { |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | </script> |
| 72 | 72 | BLOCK; |
| 73 | 73 | |
| 74 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 74 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
| 75 | 75 | $ContextMenuScript = ""; // reset css |
| 76 | 76 | return $html; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function getClientScriptObject() { |
|
| 80 | - return "getCntxMenu('" . $this->id . "')"; |
|
| 79 | + public function getClientScriptObject(){ |
|
| 80 | + return "getCntxMenu('".$this->id."')"; |
|
| 81 | 81 | } |
| 82 | 82 | } |
@@ -33,24 +33,24 @@ discard block |
||
| 33 | 33 | public $renderPagerFncArgs; |
| 34 | 34 | public static $dataSetPagerCnt; |
| 35 | 35 | |
| 36 | - public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
| 36 | + public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1){ |
|
| 37 | 37 | global $_PAGE; // use view state object |
| 38 | 38 | |
| 39 | 39 | // set id |
| 40 | 40 | self::$dataSetPagerCnt++; |
| 41 | - $this->id = !empty($id) ? $id : "dsp" . self::$dataSetPagerCnt; |
|
| 41 | + $this->id = !empty($id) ? $id : "dsp".self::$dataSetPagerCnt; |
|
| 42 | 42 | |
| 43 | 43 | // get pagenumber |
| 44 | 44 | // by setting pager to -1 cause pager to load it's last page number |
| 45 | - if($pageNumber == -1) { |
|
| 45 | + if ($pageNumber == -1) { |
|
| 46 | 46 | $pageNumber = 1; |
| 47 | - if(isset($_GET["dpgn" . $this->id])) { |
|
| 48 | - $pageNumber = $_GET["dpgn" . $this->id]; |
|
| 49 | - } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) { |
|
| 50 | - $pageNumber = $_PAGE['vs'][$id . '_dpgn']; |
|
| 47 | + if (isset($_GET["dpgn".$this->id])) { |
|
| 48 | + $pageNumber = $_GET["dpgn".$this->id]; |
|
| 49 | + } elseif (isset($_PAGE['vs'][$id.'_dpgn'])) { |
|
| 50 | + $pageNumber = $_PAGE['vs'][$id.'_dpgn']; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | - if(!is_numeric($pageNumber)) { |
|
| 53 | + if (!is_numeric($pageNumber)) { |
|
| 54 | 54 | $pageNumber = 1; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -61,40 +61,40 @@ discard block |
||
| 61 | 61 | $this->pager = ''; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function getRenderedPager() { |
|
| 64 | + public function getRenderedPager(){ |
|
| 65 | 65 | return $this->pager; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function getRenderedRows() { |
|
| 68 | + public function getRenderedRows(){ |
|
| 69 | 69 | return $this->rows; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function setDataSource($ds) { |
|
| 72 | + public function setDataSource($ds){ |
|
| 73 | 73 | $this->ds = $ds; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function setPageSize($ps) { |
|
| 76 | + public function setPageSize($ps){ |
|
| 77 | 77 | $this->pageSize = $ps; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setRenderRowFnc($fncName, $args = "") { |
|
| 80 | + public function setRenderRowFnc($fncName, $args = ""){ |
|
| 81 | 81 | $this->renderRowFnc = &$fncName; |
| 82 | - $this->renderRowFncArgs = $args; // extra agruments |
|
| 82 | + $this->renderRowFncArgs = $args; // extra agruments |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function setRenderPagerFnc($fncName, $args = "") { |
|
| 87 | + public function setRenderPagerFnc($fncName, $args = ""){ |
|
| 88 | 88 | $this->renderPagerFnc = $fncName; |
| 89 | - $this->renderPagerFncArgs = $args; // extra agruments |
|
| 89 | + $this->renderPagerFncArgs = $args; // extra agruments |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function render() { |
|
| 92 | + public function render(){ |
|
| 93 | 93 | $modx = evolutionCMS(); global $_PAGE; |
| 94 | 94 | |
| 95 | 95 | $isDataset = $modx->getDatabase()->isResult($this->ds); |
| 96 | 96 | |
| 97 | - if(!$this->selPageStyle) { |
|
| 97 | + if (!$this->selPageStyle) { |
|
| 98 | 98 | $this->selPageStyle = "font-weight:bold"; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | $tnr = ($isDataset) ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds); |
| 103 | 103 | |
| 104 | 104 | // render: no records found |
| 105 | - if($tnr <= 0) { |
|
| 105 | + if ($tnr <= 0) { |
|
| 106 | 106 | $fnc = $this->renderRowFnc; |
| 107 | 107 | $args = $this->renderRowFncArgs; |
| 108 | - if(isset($fnc)) { |
|
| 109 | - if($args != "") { |
|
| 108 | + if (isset($fnc)) { |
|
| 109 | + if ($args != "") { |
|
| 110 | 110 | $this->rows .= $fnc(0, null, $args); |
| 111 | 111 | } // if agrs was specified then we will pass three params |
| 112 | 112 | else { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | // get total pages |
| 120 | 120 | $tp = ceil($tnr / $this->pageSize); |
| 121 | - if($this->pageNumber > $tp) { |
|
| 121 | + if ($this->pageNumber > $tp) { |
|
| 122 | 122 | $this->pageNumber = 1; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -126,39 +126,39 @@ discard block |
||
| 126 | 126 | $p = $this->pageNumber; |
| 127 | 127 | |
| 128 | 128 | // save page number to view state if available |
| 129 | - if(isset($_PAGE['vs'])) { |
|
| 130 | - $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
| 129 | + if (isset($_PAGE['vs'])) { |
|
| 130 | + $_PAGE['vs'][$this->id.'_dpgn'] = $p; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
| 134 | - if($tp > 1) { |
|
| 134 | + if ($tp > 1) { |
|
| 135 | 135 | $url = ''; |
| 136 | 136 | $fnc = $this->renderPagerFnc; |
| 137 | 137 | $args = $this->renderPagerFncArgs; |
| 138 | - if(!isset($fnc)) { |
|
| 139 | - if($modx->isFrontend()) { |
|
| 140 | - $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
| 138 | + if (!isset($fnc)) { |
|
| 139 | + if ($modx->isFrontend()) { |
|
| 140 | + $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full').'?'; |
|
| 141 | 141 | } else { |
| 142 | - $url = $_SERVER['PHP_SELF'] . '?'; |
|
| 142 | + $url = $_SERVER['PHP_SELF'].'?'; |
|
| 143 | 143 | } |
| 144 | 144 | $i = 0; |
| 145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 145 | + foreach ($_GET as $n => $v) if ($n != 'dpgn'.$this->id) { |
|
| 146 | 146 | $i++; |
| 147 | - $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
| 147 | + $url .= (($i > 1) ? "&" : "")."$n=$v"; |
|
| 148 | 148 | } |
| 149 | - if($i >= 1) { |
|
| 149 | + if ($i >= 1) { |
|
| 150 | 150 | $url .= "&"; |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | - for($i = 1; $i <= $tp; $i++) { |
|
| 154 | - if(isset($fnc)) { |
|
| 155 | - if($args != "") { |
|
| 153 | + for ($i = 1; $i <= $tp; $i++) { |
|
| 154 | + if (isset($fnc)) { |
|
| 155 | + if ($args != "") { |
|
| 156 | 156 | $this->pager .= $fnc($p, $i, $args); |
| 157 | 157 | } else { |
| 158 | 158 | $this->pager .= $fnc($p, $i); |
| 159 | 159 | } |
| 160 | 160 | } else { |
| 161 | - $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> "; |
|
| 161 | + $this->pager .= ($p == $i) ? " <span class='".$this->selPageClass."' style='".$this->selPageStyle."'>$i</span> " : " <a href='".$url."dpgn".$this->id."=$i' class='".$this->pageClass."' style='".$this->pageStyle."'>$i</a> "; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -167,21 +167,21 @@ discard block |
||
| 167 | 167 | $fnc = $this->renderRowFnc; |
| 168 | 168 | $args = $this->renderRowFncArgs; |
| 169 | 169 | |
| 170 | - if(isset($fnc)) { |
|
| 170 | + if (isset($fnc)) { |
|
| 171 | 171 | $i = 1; |
| 172 | 172 | $fncObject = is_object($fnc); |
| 173 | 173 | $minitems = (($p - 1) * $this->pageSize) + 1; |
| 174 | 174 | $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
| 175 | - while($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) { |
|
| 176 | - if($i >= $minitems && $i <= $maxitems) { |
|
| 177 | - if($fncObject) { |
|
| 178 | - if($args != "") { |
|
| 175 | + while ($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) { |
|
| 176 | + if ($i >= $minitems && $i <= $maxitems) { |
|
| 177 | + if ($fncObject) { |
|
| 178 | + if ($args != "") { |
|
| 179 | 179 | $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
| 180 | 180 | } else { |
| 181 | 181 | $this->rows .= $fnc->RenderRowFnc($i, $row); |
| 182 | 182 | } |
| 183 | 183 | } else { |
| 184 | - if($args != "") { |
|
| 184 | + if ($args != "") { |
|
| 185 | 185 | $this->rows .= $fnc($i, $row, $args); |
| 186 | 186 | } // if agrs was specified then we wil pass three params |
| 187 | 187 | else { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $modx = evolutionCMS(); |
| 31 | 31 | $this->modx = $modx; |
| 32 | - $this->PluginDir = MODX_MANAGER_PATH . 'includes/controls/phpmailer/'; |
|
| 32 | + $this->PluginDir = MODX_MANAGER_PATH.'includes/controls/phpmailer/'; |
|
| 33 | 33 | |
| 34 | 34 | switch ($modx->config['email_method']) { |
| 35 | 35 | case 'smtp': |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | mb_language($this->mb_language); |
| 96 | 96 | mb_internal_encoding($modx->config['modx_charset']); |
| 97 | 97 | } |
| 98 | - $exconf = MODX_MANAGER_PATH . 'includes/controls/phpmailer/config.inc.php'; |
|
| 98 | + $exconf = MODX_MANAGER_PATH.'includes/controls/phpmailer/config.inc.php'; |
|
| 99 | 99 | if (is_file($exconf)) { |
| 100 | 100 | include($exconf); |
| 101 | 101 | } |
@@ -163,12 +163,12 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if ($this->modx->debug) { |
| 166 | - $debug_info = 'CharSet = ' . $this->CharSet . "\n"; |
|
| 167 | - $debug_info .= 'Encoding = ' . $this->Encoding . "\n"; |
|
| 168 | - $debug_info .= 'mb_language = ' . $this->mb_language . "\n"; |
|
| 169 | - $debug_info .= 'encode_header_method = ' . $this->encode_header_method . "\n"; |
|
| 166 | + $debug_info = 'CharSet = '.$this->CharSet."\n"; |
|
| 167 | + $debug_info .= 'Encoding = '.$this->Encoding."\n"; |
|
| 168 | + $debug_info .= 'mb_language = '.$this->mb_language."\n"; |
|
| 169 | + $debug_info .= 'encode_header_method = '.$this->encode_header_method."\n"; |
|
| 170 | 170 | $debug_info .= "send_mode = {$mode}\n"; |
| 171 | - $debug_info .= 'Subject = ' . $this->Subject . "\n"; |
|
| 171 | + $debug_info .= 'Subject = '.$this->Subject."\n"; |
|
| 172 | 172 | $log = "<pre>{$debug_info}\n{$header}\n{$org_body}</pre>"; |
| 173 | 173 | $this->modx->logEvent(1, 1, $log, 'MODxMailer debug information'); |
| 174 | 174 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | ini_set('sendmail_from', $old_from); |
| 235 | 235 | } |
| 236 | 236 | if (!$rt) { |
| 237 | - $msg = $this->Lang('instantiate') . "<br />\n"; |
|
| 237 | + $msg = $this->Lang('instantiate')."<br />\n"; |
|
| 238 | 238 | $msg .= "{$this->Subject}<br />\n"; |
| 239 | 239 | $msg .= "{$this->FromName}<{$this->From}><br />\n"; |
| 240 | 240 | $msg .= mb_convert_encoding($body, $this->modx->config['modx_charset'], $this->CharSet); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $classDump = call_user_func('get_object_vars', $this); |
| 257 | 257 | unset($classDump['modx']); |
| 258 | 258 | $this->modx->config['send_errormail'] = '0'; |
| 259 | - $this->modx->logEvent(0, 3, $msg . '<pre>' . print_r($classDump, true) . '</pre>', 'phpmailer'); |
|
| 259 | + $this->modx->logEvent(0, 3, $msg.'<pre>'.print_r($classDump, true).'</pre>', 'phpmailer'); |
|
| 260 | 260 | |
| 261 | 261 | return parent::SetError($msg); |
| 262 | 262 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -require_once(dirname(__FILE__) . '/protect.inc.php'); |
|
| 9 | +require_once(dirname(__FILE__).'/protect.inc.php'); |
|
| 10 | 10 | |
| 11 | 11 | $action = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $_POST['action']); |
| 12 | 12 | $lang = preg_replace('/[^A-Za-z0-9_\s\+\-\.\/]/', '', $_POST['lang']); |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | switch (true) { |
| 25 | 25 | case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/', |
| 26 | - $lang) && file_exists(dirname(__FILE__) . '/lang/' . $lang . '.inc.php')): { |
|
| 27 | - include(dirname(__FILE__) . '/lang/' . $lang . '.inc.php'); |
|
| 26 | + $lang) && file_exists(dirname(__FILE__).'/lang/'.$lang.'.inc.php')): { |
|
| 27 | + include(dirname(__FILE__).'/lang/'.$lang.'.inc.php'); |
|
| 28 | 28 | $str = isset($key, $_lang, $_lang[$key]) ? $_lang[$key] : ""; |
| 29 | 29 | break; |
| 30 | 30 | } |
| 31 | 31 | case ($action == 'setsetting' && !empty($key) && !empty($value)): { |
| 32 | - $sql = "REPLACE INTO " . $modx->getFullTableName("system_settings") . " (setting_name, setting_value) VALUES('{$key}', '{$value}');"; |
|
| 32 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) VALUES('{$key}', '{$value}');"; |
|
| 33 | 33 | $str = "true"; |
| 34 | 34 | $modx->getDatabase()->query($sql); |
| 35 | 35 | $emptyCache = true; |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $newCat = $modx->getDatabase()->escape($newCat); |
| 35 | 35 | $cats = $modx->getDatabase()->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'"); |
| 36 | 36 | if ($cat = $modx->getDatabase()->getValue($cats)) { |
| 37 | - return (int)$cat; |
|
| 37 | + return (int) $cat; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return 0; |
@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // andrazk 20070416 - if installer is running, destroy active sessions |
| 21 | -if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
|
| 22 | - include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
| 21 | +if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) { |
|
| 22 | + include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
| 23 | 23 | if (isset($installStartTime)) { |
| 24 | 24 | if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
| 25 | 25 | unset($installStartTime); |
| 26 | - @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
|
| 27 | - unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
| 26 | + @ chmod(MODX_BASE_PATH.'assets/cache/installProc.inc.php', 0755); |
|
| 27 | + unlink(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
| 28 | 28 | } else { |
| 29 | 29 | if ($_SERVER['REQUEST_METHOD'] != 'POST') { |
| 30 | 30 | if (isset($_COOKIE[session_name()])) { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | // setcookie(session_name(), '', 0, MODX_BASE_URL); |
| 51 | 51 | } |
| 52 | 52 | header('HTTP/1.0 307 Redirect'); |
| 53 | - header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2'); |
|
| 53 | + header('Location: '.MODX_MANAGER_URL.'index.php?installGoingOn=2'); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | // establish fallback to English default |
| 63 | 63 | include_once "lang/english.inc.php"; |
| 64 | 64 | // include localized overrides |
| 65 | - include_once "lang/" . $manager_language . ".inc.php"; |
|
| 65 | + include_once "lang/".$manager_language.".inc.php"; |
|
| 66 | 66 | } else { |
| 67 | 67 | include_once "lang/english.inc.php"; |
| 68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
| 71 | 71 | $modx->setPlaceholder('theme', $manager_theme); |
| 72 | 72 | $modx->setPlaceholder('favicon', |
| 73 | - (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico')); |
|
| 73 | + (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico')); |
|
| 74 | 74 | |
| 75 | 75 | // invoke OnManagerLoginFormPrerender event |
| 76 | 76 | $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender'); |
@@ -81,25 +81,25 @@ discard block |
||
| 81 | 81 | $modx->setPlaceholder('manager_path', MGR_DIR); |
| 82 | 82 | $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
| 83 | 83 | $modx->setPlaceholder('login_message', $_lang["login_message"]); |
| 84 | - $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
| 84 | + $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
| 85 | 85 | $modx->setPlaceholder('year', date('Y')); |
| 86 | 86 | |
| 87 | 87 | // set login logo image |
| 88 | - if ( !empty($modx->config['login_logo']) ) { |
|
| 89 | - $modx->setPlaceholder('login_logo', MODX_SITE_URL . $modx->config['login_logo']); |
|
| 88 | + if (!empty($modx->config['login_logo'])) { |
|
| 89 | + $modx->setPlaceholder('login_logo', MODX_SITE_URL.$modx->config['login_logo']); |
|
| 90 | 90 | } else { |
| 91 | - $modx->setPlaceholder('login_logo', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-logo.png'); |
|
| 91 | + $modx->setPlaceholder('login_logo', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-logo.png'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // set login background image |
| 95 | - if ( !empty($modx->config['login_bg']) ) { |
|
| 96 | - $modx->setPlaceholder('login_bg', MODX_SITE_URL . $modx->config['login_bg']); |
|
| 95 | + if (!empty($modx->config['login_bg'])) { |
|
| 96 | + $modx->setPlaceholder('login_bg', MODX_SITE_URL.$modx->config['login_bg']); |
|
| 97 | 97 | } else { |
| 98 | - $modx->setPlaceholder('login_bg', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-background.jpg'); |
|
| 98 | + $modx->setPlaceholder('login_bg', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-background.jpg'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // set form position css class |
| 102 | - $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']); |
|
| 102 | + $modx->setPlaceholder('login_form_position_class', 'loginbox-'.$modx->config['login_form_position']); |
|
| 103 | 103 | |
| 104 | 104 | switch ($modx->config['manager_theme_mode']) { |
| 105 | 105 | case '1': |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | switch ($installGoingOn) { |
| 125 | 125 | case 1 : |
| 126 | 126 | $modx->setPlaceholder('login_message', |
| 127 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
| 127 | + "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>"); |
|
| 128 | 128 | break; |
| 129 | 129 | case 2 : |
| 130 | 130 | $modx->setPlaceholder('login_message', |
| 131 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
| 131 | + "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>"); |
|
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | if ($modx->config['use_captcha'] == 1) { |
| 137 | 137 | $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
| 138 | 138 | $modx->setPlaceholder('captcha_image', |
| 139 | - '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'captcha.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>'); |
|
| 139 | + '<a href="'.MODX_MANAGER_URL.'" class="loginCaptcha"><img id="captcha_image" src="'.MODX_MANAGER_URL.'captcha.php?rand='.rand().'" alt="'.$_lang["login_captcha_message"].'" /></a>'); |
|
| 140 | 140 | $modx->setPlaceholder('captcha_input', |
| 141 | - '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
| 141 | + '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // login info |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | // invoke OnManagerLoginFormRender event |
| 158 | 158 | $evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
| 159 | - $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
| 159 | + $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : ''; |
|
| 160 | 160 | $modx->setPlaceholder('OnManagerLoginFormRender', $html); |
| 161 | 161 | |
| 162 | 162 | // load template |
@@ -174,29 +174,29 @@ discard block |
||
| 174 | 174 | $login_tpl = file_get_contents($target); |
| 175 | 175 | } |
| 176 | 176 | } else { |
| 177 | - $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
| 178 | - if (is_file($theme_path . 'style.php')) { |
|
| 179 | - include($theme_path . 'style.php'); |
|
| 177 | + $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/'; |
|
| 178 | + if (is_file($theme_path.'style.php')) { |
|
| 179 | + include($theme_path.'style.php'); |
|
| 180 | 180 | } |
| 181 | 181 | $chunk = $modx->getChunk($target); |
| 182 | 182 | if ($chunk !== false && !empty($chunk)) { |
| 183 | 183 | $login_tpl = $chunk; |
| 184 | - } elseif (is_file(MODX_BASE_PATH . $target)) { |
|
| 185 | - $target = MODX_BASE_PATH . $target; |
|
| 184 | + } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
| 185 | + $target = MODX_BASE_PATH.$target; |
|
| 186 | 186 | $login_tpl = file_get_contents($target); |
| 187 | 187 | } elseif (is_file($target)) { |
| 188 | 188 | $login_tpl = file_get_contents($target); |
| 189 | - } elseif (is_file($theme_path . 'login.tpl')) { |
|
| 190 | - $target = $theme_path . 'login.tpl'; |
|
| 189 | + } elseif (is_file($theme_path.'login.tpl')) { |
|
| 190 | + $target = $theme_path.'login.tpl'; |
|
| 191 | 191 | $login_tpl = file_get_contents($target); |
| 192 | - } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
|
| 193 | - $target = $theme_path . 'templates/actions/login.tpl'; |
|
| 192 | + } elseif (is_file($theme_path.'templates/actions/login.tpl')) { |
|
| 193 | + $target = $theme_path.'templates/actions/login.tpl'; |
|
| 194 | 194 | $login_tpl = file_get_contents($target); |
| 195 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
| 196 | - $target = $theme_path . 'html/login.html'; |
|
| 195 | + } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible |
|
| 196 | + $target = $theme_path.'html/login.html'; |
|
| 197 | 197 | $login_tpl = file_get_contents($target); |
| 198 | 198 | } else { |
| 199 | - $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
| 199 | + $target = MODX_MANAGER_PATH.'media/style/common/login.tpl'; |
|
| 200 | 200 | $login_tpl = file_get_contents($target); |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -216,17 +216,17 @@ discard block |
||
| 216 | 216 | $modx->updateValidatedUserSession(); |
| 217 | 217 | |
| 218 | 218 | // Update last action in table active_users |
| 219 | - $itemid = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
| 219 | + $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
| 220 | 220 | $lasthittime = time(); |
| 221 | - $action = isset($_REQUEST['a']) ? (int)$_REQUEST['a'] : 1; |
|
| 221 | + $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
|
| 222 | 222 | |
| 223 | 223 | if ($action !== 1) { |
| 224 | - if ((int)$itemid <= 0) { |
|
| 224 | + if ((int) $itemid <= 0) { |
|
| 225 | 225 | $itemid = null; |
| 226 | 226 | } |
| 227 | 227 | $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", |
| 228 | 228 | $modx->getFullTableName('active_users') // Table |
| 229 | - , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string)$action, |
|
| 229 | + , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, |
|
| 230 | 230 | $itemid == null ? var_export(null, true) : $itemid); |
| 231 | 231 | $modx->getDatabase()->query($sql); |
| 232 | 232 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -$userid = (int)$value; |
|
| 2 | +$userid = (int) $value; |
|
| 3 | 3 | if (!isset($modx->getModifiers()->cache['ui'][$userid])) { |
| 4 | 4 | if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid)); |
| 5 | 5 | else $user = $modx->getUserInfo($userid); |
@@ -1,43 +1,43 @@ |
||
| 1 | 1 | <?php |
| 2 | -if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt); |
|
| 3 | -elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} |
|
| 4 | -else {$limit=124;$delim='';} |
|
| 2 | +if (strpos($opt, ',')) list($limit, $delim) = explode(',', $opt); |
|
| 3 | +elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {$limit = $opt; $delim = ''; } |
|
| 4 | +else {$limit = 124; $delim = ''; } |
|
| 5 | 5 | |
| 6 | -if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
| 7 | -$limit = (int)$limit; |
|
| 6 | +if ($delim === '') $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.'; |
|
| 7 | +$limit = (int) $limit; |
|
| 8 | 8 | |
| 9 | 9 | $content = $modx->getModifiers()->parseDocumentSource($value); |
| 10 | 10 | |
| 11 | 11 | $content = strip_tags($content); |
| 12 | 12 | |
| 13 | -$content = str_replace(array("\r\n","\r","\n","\t",' '),' ',$content); |
|
| 14 | -if(preg_match('/\s+/',$content)) |
|
| 15 | - $content = preg_replace('/\s+/',' ',$content); |
|
| 13 | +$content = str_replace(array("\r\n", "\r", "\n", "\t", ' '), ' ', $content); |
|
| 14 | +if (preg_match('/\s+/', $content)) |
|
| 15 | + $content = preg_replace('/\s+/', ' ', $content); |
|
| 16 | 16 | $content = trim($content); |
| 17 | 17 | |
| 18 | 18 | $pos = $modx->getModifiers()->strpos($content, $delim); |
| 19 | 19 | |
| 20 | -if($pos!==false && $pos<$limit) { |
|
| 20 | +if ($pos !== false && $pos < $limit) { |
|
| 21 | 21 | $_ = explode($delim, $content); |
| 22 | 22 | $text = ''; |
| 23 | - foreach($_ as $v) { |
|
| 24 | - if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break; |
|
| 23 | + foreach ($_ as $v) { |
|
| 24 | + if ($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break; |
|
| 25 | 25 | $text .= $v.$delim; |
| 26 | 26 | } |
| 27 | - if($text) $content = $text; |
|
| 27 | + if ($text) $content = $text; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | -if($limit<$modx->getModifiers()->strlen($content) && strpos($content,' ')!==false) { |
|
| 30 | +if ($limit < $modx->getModifiers()->strlen($content) && strpos($content, ' ') !== false) { |
|
| 31 | 31 | $_ = explode(' ', $content); |
| 32 | 32 | $text = ''; |
| 33 | - foreach($_ as $v) { |
|
| 34 | - if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break; |
|
| 35 | - $text .= $v . ' '; |
|
| 33 | + foreach ($_ as $v) { |
|
| 34 | + if ($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break; |
|
| 35 | + $text .= $v.' '; |
|
| 36 | 36 | } |
| 37 | - if($text!=='') $content = $text; |
|
| 37 | + if ($text !== '') $content = $text; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | -if($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit); |
|
| 41 | -if($modx->getModifiers()->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim; |
|
| 40 | +if ($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit); |
|
| 41 | +if ($modx->getModifiers()->substr($content, -1) == $delim) $content = rtrim($content, $delim).$delim; |
|
| 42 | 42 | |
| 43 | 43 | return $content; |