@@ -3,7 +3,8 @@ discard block |
||
| 3 | 3 | global $ContextMenuCnt; |
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | -class ContextMenu { |
|
| 6 | +class ContextMenu |
|
| 7 | +{ |
|
| 7 | 8 | public $id; |
| 8 | 9 | /** |
| 9 | 10 | * @var string |
@@ -18,7 +19,8 @@ discard block |
||
| 18 | 19 | */ |
| 19 | 20 | public $width = 120; |
| 20 | 21 | |
| 21 | - public function __construct($id = '', $width = 120, $visible = false) { |
|
| 22 | + public function __construct($id = '', $width = 120, $visible = false) |
|
| 23 | + { |
|
| 22 | 24 | global $ContextMenuCnt; |
| 23 | 25 | $ContextMenuCnt++; |
| 24 | 26 | $this->html = ""; |
@@ -27,7 +29,8 @@ discard block |
||
| 27 | 29 | $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
| 28 | 30 | } |
| 29 | 31 | |
| 30 | - public function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
| 32 | + public function addItem($text, $action = "", $img = "", $disabled = 0) |
|
| 33 | + { |
|
| 31 | 34 | global $base_url, $_style; |
| 32 | 35 | if($disabled) { |
| 33 | 36 | return; |
@@ -52,13 +55,15 @@ discard block |
||
| 52 | 55 | $this->html .= $img . ' ' . $text . '</div>'; |
| 53 | 56 | } |
| 54 | 57 | |
| 55 | - public function addSeparator() { |
|
| 58 | + public function addSeparator() |
|
| 59 | + { |
|
| 56 | 60 | $this->html .= " |
| 57 | 61 | <div class='cntxMnuSeparator'></div> |
| 58 | 62 | "; |
| 59 | 63 | } |
| 60 | 64 | |
| 61 | - public function render() { |
|
| 65 | + public function render() |
|
| 66 | + { |
|
| 62 | 67 | global $ContextMenuScript; |
| 63 | 68 | |
| 64 | 69 | $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
@@ -66,7 +71,8 @@ discard block |
||
| 66 | 71 | return $html; |
| 67 | 72 | } |
| 68 | 73 | |
| 69 | - public function getClientScriptObject() { |
|
| 74 | + public function getClientScriptObject() |
|
| 75 | + { |
|
| 70 | 76 | return "getCntxMenu('" . $this->id . "')"; |
| 71 | 77 | } |
| 72 | 78 | } |
@@ -10,7 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataSetPagerCnt = 0; |
| 12 | 12 | |
| 13 | -class DataSetPager { |
|
| 13 | +class DataSetPager |
|
| 14 | +{ |
|
| 14 | 15 | |
| 15 | 16 | public $ds; // datasource |
| 16 | 17 | public $pageSize; |
@@ -31,7 +32,8 @@ discard block |
||
| 31 | 32 | public $renderPagerFnc; |
| 32 | 33 | public $renderPagerFncArgs; |
| 33 | 34 | |
| 34 | - public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
| 35 | + public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) |
|
| 36 | + { |
|
| 35 | 37 | global $_PAGE; // use view state object |
| 36 | 38 | |
| 37 | 39 | global $__DataSetPagerCnt; |
@@ -61,35 +63,42 @@ discard block |
||
| 61 | 63 | $this->pager = ''; |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | - public function getRenderedPager() { |
|
| 66 | + public function getRenderedPager() |
|
| 67 | + { |
|
| 65 | 68 | return $this->pager; |
| 66 | 69 | } |
| 67 | 70 | |
| 68 | - public function getRenderedRows() { |
|
| 71 | + public function getRenderedRows() |
|
| 72 | + { |
|
| 69 | 73 | return $this->rows; |
| 70 | 74 | } |
| 71 | 75 | |
| 72 | - public function setDataSource($ds) { |
|
| 76 | + public function setDataSource($ds) |
|
| 77 | + { |
|
| 73 | 78 | $this->ds = $ds; |
| 74 | 79 | } |
| 75 | 80 | |
| 76 | - public function setPageSize($ps) { |
|
| 81 | + public function setPageSize($ps) |
|
| 82 | + { |
|
| 77 | 83 | $this->pageSize = $ps; |
| 78 | 84 | } |
| 79 | 85 | |
| 80 | - public function setRenderRowFnc($fncName, $args = "") { |
|
| 86 | + public function setRenderRowFnc($fncName, $args = "") |
|
| 87 | + { |
|
| 81 | 88 | $this->renderRowFnc = &$fncName; |
| 82 | 89 | $this->renderRowFncArgs = $args; // extra agruments |
| 83 | 90 | |
| 84 | 91 | |
| 85 | 92 | } |
| 86 | 93 | |
| 87 | - public function setRenderPagerFnc($fncName, $args = "") { |
|
| 94 | + public function setRenderPagerFnc($fncName, $args = "") |
|
| 95 | + { |
|
| 88 | 96 | $this->renderPagerFnc = $fncName; |
| 89 | 97 | $this->renderPagerFncArgs = $args; // extra agruments |
| 90 | 98 | } |
| 91 | 99 | |
| 92 | - public function render() { |
|
| 100 | + public function render() |
|
| 101 | + { |
|
| 93 | 102 | global $modx, $_PAGE; |
| 94 | 103 | |
| 95 | 104 | $isDataset = $modx->db->isResult($this->ds); |
@@ -142,8 +151,10 @@ discard block |
||
| 142 | 151 | $url = $_SERVER['PHP_SELF'] . '?'; |
| 143 | 152 | } |
| 144 | 153 | $i = 0; |
| 145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 154 | + foreach($_GET as $n => $v) { |
|
| 155 | + if($n != 'dpgn' . $this->id) { |
|
| 146 | 156 | $i++; |
| 157 | + } |
|
| 147 | 158 | $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
| 148 | 159 | } |
| 149 | 160 | if($i >= 1) { |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // this is the old error handler. Here for legacy, until i replace all the old errors. |
| 3 | -class errorHandler{ |
|
| 3 | +class errorHandler |
|
| 4 | +{ |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * @var int |
@@ -15,7 +16,8 @@ discard block |
||
| 15 | 16 | */ |
| 16 | 17 | public $errormessage; |
| 17 | 18 | |
| 18 | - public function __construct() { |
|
| 19 | + public function __construct() |
|
| 20 | + { |
|
| 19 | 21 | |
| 20 | 22 | $_lang = $this->include_lang('errormsg'); |
| 21 | 23 | |
@@ -50,25 +52,31 @@ discard block |
||
| 50 | 52 | ); |
| 51 | 53 | } |
| 52 | 54 | |
| 53 | - function include_lang($context='common') { |
|
| 55 | + function include_lang($context='common') |
|
| 56 | + { |
|
| 54 | 57 | global $modx; |
| 55 | 58 | $_lang = array(); |
| 56 | 59 | |
| 57 | 60 | $context = trim($context,'/'); |
| 58 | - if(strpos($context,'..')!==false) return; |
|
| 61 | + if(strpos($context,'..')!==false) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 59 | 64 | |
| 60 | - if($context === 'common') |
|
| 61 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
| 62 | - else |
|
| 63 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
| 65 | + if($context === 'common') { |
|
| 66 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
| 67 | + } else { |
|
| 68 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
| 69 | + } |
|
| 64 | 70 | include_once($lang_path . 'english.inc.php'); |
| 65 | 71 | $manager_language = $modx->config['manager_language']; |
| 66 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
| 67 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
| 72 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) { |
|
| 73 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
| 74 | + } |
|
| 68 | 75 | return $_lang; |
| 69 | 76 | } |
| 70 | 77 | |
| 71 | - function setError($errorcode, $custommessage=""){ |
|
| 78 | + function setError($errorcode, $custommessage="") |
|
| 79 | + { |
|
| 72 | 80 | $this->errorcode=$errorcode; |
| 73 | 81 | $this->errormessage=$this->errors[$errorcode]; |
| 74 | 82 | if($custommessage!="") { |
@@ -76,11 +84,13 @@ discard block |
||
| 76 | 84 | } |
| 77 | 85 | } |
| 78 | 86 | |
| 79 | - function getError() { |
|
| 87 | + function getError() |
|
| 88 | + { |
|
| 80 | 89 | return $this->errorcode; |
| 81 | 90 | } |
| 82 | 91 | |
| 83 | - function dumpError(){ |
|
| 92 | + function dumpError() |
|
| 93 | + { |
|
| 84 | 94 | ?> |
| 85 | 95 | <html> |
| 86 | 96 | <head> |
@@ -3,13 +3,15 @@ discard block |
||
| 3 | 3 | global $site_sessionname; |
| 4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
| 5 | 5 | |
| 6 | -function genEvoSessionName() {
|
|
| 6 | +function genEvoSessionName() |
|
| 7 | +{ |
|
| 7 | 8 | $_ = crc32(__FILE__); |
| 8 | 9 | $_ = sprintf('%u', $_);
|
| 9 | 10 | return 'evo' . base_convert($_,10,36); |
| 10 | 11 | } |
| 11 | 12 | |
| 12 | -function startCMSSession(){
|
|
| 13 | +function startCMSSession() |
|
| 14 | +{ |
|
| 13 | 15 | |
| 14 | 16 | global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain; |
| 15 | 17 | |
@@ -23,24 +25,27 @@ discard block |
||
| 23 | 25 | session_start(); |
| 24 | 26 | |
| 25 | 27 | $key = "modx.{$context}.session.cookie.lifetime";
|
| 26 | - if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
|
|
| 28 | + if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
| 27 | 29 | $cookieLifetime= (int)$_SESSION[$key]; |
| 28 | - if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
| 30 | + if($cookieLifetime) { |
|
| 31 | + $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
| 32 | + } |
|
| 29 | 33 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
| 30 | 34 | } |
| 31 | - if (!isset($_SESSION['modx.session.created.time'])) {
|
|
| 35 | + if (!isset($_SESSION['modx.session.created.time'])) { |
|
| 32 | 36 | $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME']; |
| 33 | 37 | } |
| 34 | 38 | } |
| 35 | 39 | |
| 36 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) {
|
|
| 37 | - if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) |
|
| 38 | - {
|
|
| 40 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
| 41 | +{ |
|
| 42 | + if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
| 39 | 43 | unset($storage[$session_name]); |
| 40 | 44 | } |
| 41 | 45 | } |
| 42 | 46 | |
| 43 | -function removeInvalidCmsSessionIds($session_name) {
|
|
| 47 | +function removeInvalidCmsSessionIds($session_name) |
|
| 48 | +{ |
|
| 44 | 49 | // session ids is invalid iff it is empty string |
| 45 | 50 | // storage priorioty can see in PHP source ext/session/session.c |
| 46 | 51 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -14,16 +14,16 @@ discard block |
||
| 14 | 14 | 'DIRECTORY' |
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
| 17 | +function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) |
|
| 18 | +{ |
|
| 18 | 19 | global $modx; |
| 19 | 20 | $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
| 20 | 21 | $nvalue = trim($value); |
| 21 | - if (substr($nvalue, 0, 1) != '@') |
|
| 22 | - return $value; |
|
| 23 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
| 22 | + if (substr($nvalue, 0, 1) != '@') { |
|
| 23 | + return $value; |
|
| 24 | + } elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
| 24 | 25 | return '@Bindings is disabled.'; |
| 25 | - } |
|
| 26 | - else { |
|
| 26 | + } else { |
|
| 27 | 27 | list ($cmd, $param) = ParseCommand($nvalue); |
| 28 | 28 | $cmd = trim($cmd); |
| 29 | 29 | $param = parseTvValues($param, $tvsArray); |
@@ -39,10 +39,11 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | case "DOCUMENT" : // retrieve a document and process it's content |
| 41 | 41 | $rs = $modx->getDocument($param); |
| 42 | - if (is_array($rs)) |
|
| 43 | - $output = $rs['content']; |
|
| 44 | - else |
|
| 45 | - $output = "Unable to locate document $param"; |
|
| 42 | + if (is_array($rs)) { |
|
| 43 | + $output = $rs['content']; |
|
| 44 | + } else { |
|
| 45 | + $output = "Unable to locate document $param"; |
|
| 46 | + } |
|
| 46 | 47 | break; |
| 47 | 48 | |
| 48 | 49 | case "SELECT" : // selects a record from the cms database |
@@ -72,8 +73,10 @@ discard block |
||
| 72 | 73 | |
| 73 | 74 | // Grab document regardless of publish status |
| 74 | 75 | $doc = $modx->getPageInfo($parent_id, 0, 'id,parent,published'); |
| 75 | - if ($doc['parent'] != 0 && !$doc['published']) |
|
| 76 | - continue; // hide unpublished docs if we're not at the top |
|
| 76 | + if ($doc['parent'] != 0 && !$doc['published']) { |
|
| 77 | + continue; |
|
| 78 | + } |
|
| 79 | + // hide unpublished docs if we're not at the top |
|
| 77 | 80 | |
| 78 | 81 | $tv = $modx->getTemplateVar($name, '*', $doc['id'], $doc['published']); |
| 79 | 82 | |
@@ -117,10 +120,13 @@ discard block |
||
| 117 | 120 | } |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | -function ProcessFile($file) { |
|
| 123 | +function ProcessFile($file) |
|
| 124 | +{ |
|
| 121 | 125 | // get the file |
| 122 | 126 | $buffer = @file_get_contents($file); |
| 123 | - if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
| 127 | + if ($buffer===false) { |
|
| 128 | + $buffer = " Could not retrieve document '$file'."; |
|
| 129 | + } |
|
| 124 | 130 | return $buffer; |
| 125 | 131 | } |
| 126 | 132 | |
@@ -129,10 +135,8 @@ discard block |
||
| 129 | 135 | { |
| 130 | 136 | global $BINDINGS; |
| 131 | 137 | $binding_array = array(); |
| 132 | - foreach($BINDINGS as $cmd) |
|
| 133 | - { |
|
| 134 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
| 135 | - { |
|
| 138 | + foreach($BINDINGS as $cmd) { |
|
| 139 | + if(strpos($binding_string,'@'.$cmd)===0) { |
|
| 136 | 140 | $code = substr($binding_string,strlen($cmd)+1); |
| 137 | 141 | $binding_array = array($cmd,trim($code)); |
| 138 | 142 | break; |
@@ -29,7 +29,8 @@ discard block |
||
| 29 | 29 | // include MagPieRSS |
| 30 | 30 | require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
| 31 | 31 | // Convert relative path into absolute url |
| 32 | -function rel2abs( $rel, $base ) { |
|
| 32 | +function rel2abs( $rel, $base ) |
|
| 33 | +{ |
|
| 33 | 34 | // parse base URL and convert to local variables: $scheme, $host, $path |
| 34 | 35 | $tmp = parse_url( $base ); |
| 35 | 36 | extract( $tmp ); |
@@ -64,7 +65,7 @@ discard block |
||
| 64 | 65 | foreach ($urls as $section=>$url) { |
| 65 | 66 | $output = ''; |
| 66 | 67 | $rss = @fetch_rss($url); |
| 67 | - if( !$rss ){ |
|
| 68 | + if( !$rss ) { |
|
| 68 | 69 | $feedData[$section] = 'Failed to retrieve ' . $url; |
| 69 | 70 | continue; |
| 70 | 71 | } |
@@ -5,7 +5,8 @@ discard block |
||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | // Added by Raymond 20-Jan-2005 |
| 8 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
| 8 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') |
|
| 9 | +{ |
|
| 9 | 10 | |
| 10 | 11 | global $modx; |
| 11 | 12 | $o = ''; |
@@ -49,7 +50,9 @@ discard block |
||
| 49 | 50 | if(isset($params['align']) && $params['align'] != 'none') { |
| 50 | 51 | $attr['align'] = $params['align']; |
| 51 | 52 | } |
| 52 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 53 | + foreach($attr as $k => $v) { |
|
| 54 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 55 | + } |
|
| 53 | 56 | $attributes .= ' ' . $params['attrib']; |
| 54 | 57 | |
| 55 | 58 | // Output the image with attributes |
@@ -118,7 +121,9 @@ discard block |
||
| 118 | 121 | 'style' => $params['style'], |
| 119 | 122 | 'target' => $params['target'], |
| 120 | 123 | ); |
| 121 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 124 | + foreach($attr as $k => $v) { |
|
| 125 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 126 | + } |
|
| 122 | 127 | $attributes .= ' ' . $params['attrib']; // add extra |
| 123 | 128 | |
| 124 | 129 | // Output the link |
@@ -147,7 +152,9 @@ discard block |
||
| 147 | 152 | 'class' => $params['class'], |
| 148 | 153 | 'style' => $params['style'], |
| 149 | 154 | ); |
| 150 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 155 | + foreach($attr as $k => $v) { |
|
| 156 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 157 | + } |
|
| 151 | 158 | $attributes .= ' ' . $params['attrib']; // add extra |
| 152 | 159 | |
| 153 | 160 | // Output the HTML Tag |
@@ -327,19 +334,24 @@ discard block |
||
| 327 | 334 | return $o; |
| 328 | 335 | } |
| 329 | 336 | |
| 330 | -function decodeParamValue($s) { |
|
| 337 | +function decodeParamValue($s) |
|
| 338 | +{ |
|
| 331 | 339 | $s = str_replace("%3D", '=', $s); // = |
| 332 | 340 | $s = str_replace("%26", '&', $s); // & |
| 333 | 341 | return $s; |
| 334 | 342 | } |
| 335 | 343 | |
| 336 | 344 | // returns an array if a delimiter is present. returns array is a recordset is present |
| 337 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
| 345 | +function parseInput($src, $delim = "||", $type = "string", $columns = true) |
|
| 346 | +{ |
|
| 347 | +// type can be: string, array |
|
| 338 | 348 | global $modx; |
| 339 | 349 | if($modx->db->isResult($src)) { |
| 340 | 350 | // must be a recordset |
| 341 | 351 | $rows = array(); |
| 342 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
| 352 | + while($cols = $modx->db->getRow($src, 'num')) { |
|
| 353 | + $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
| 354 | + } |
|
| 343 | 355 | return ($type == "array") ? $rows : implode($delim, $rows); |
| 344 | 356 | } else { |
| 345 | 357 | // must be a text |
@@ -351,7 +363,8 @@ discard block |
||
| 351 | 363 | } |
| 352 | 364 | } |
| 353 | 365 | |
| 354 | -function getUnixtimeFromDateString($value) { |
|
| 366 | +function getUnixtimeFromDateString($value) |
|
| 367 | +{ |
|
| 355 | 368 | $timestamp = false; |
| 356 | 369 | // Check for MySQL or legacy style date |
| 357 | 370 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
@@ -1,20 +1,29 @@ |
||
| 1 | 1 | <?php |
| 2 | -class DATEPICKER { |
|
| 3 | - public function getDP() { |
|
| 2 | +class DATEPICKER |
|
| 3 | +{ |
|
| 4 | + public function getDP() |
|
| 5 | + { |
|
| 4 | 6 | global $modx; |
| 5 | 7 | |
| 6 | 8 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
| 7 | - if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
| 9 | + if(!isset($modx->config['lang_code'])) { |
|
| 10 | + $modx->config['lang_code'] = $this->getLangCode(); |
|
| 11 | + } |
|
| 8 | 12 | $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
| 9 | 13 | return $modx->mergeSettingsContent($load_script); |
| 10 | 14 | } |
| 11 | - public function getLangCode() { |
|
| 15 | + public function getLangCode() |
|
| 16 | + { |
|
| 12 | 17 | global $modx, $modx_lang_attribute; |
| 13 | 18 | |
| 14 | - if(!$modx_lang_attribute) return 'en'; |
|
| 19 | + if(!$modx_lang_attribute) { |
|
| 20 | + return 'en'; |
|
| 21 | + } |
|
| 15 | 22 | |
| 16 | 23 | $lc = $modx_lang_attribute; |
| 17 | - if($lc === 'uk') return 'ru'; |
|
| 24 | + if($lc === 'uk') { |
|
| 25 | + return 'ru'; |
|
| 26 | + } |
|
| 18 | 27 | $dp_path = str_replace('\\','/',dirname(__FILE__)); |
| 19 | 28 | |
| 20 | 29 | return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en'; |
@@ -9,39 +9,27 @@ discard block |
||
| 9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
| 10 | 10 | unset($_POST); |
| 11 | 11 | |
| 12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
| 13 | -{ |
|
| 12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
| 14 | 13 | $htaccess = $modx->config['base_path'] . '.htaccess'; |
| 15 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
| 16 | 15 | $dir = '/' . trim($modx->config['base_url'],'/'); |
| 17 | - if(is_file($htaccess)) |
|
| 18 | - { |
|
| 16 | + if(is_file($htaccess)) { |
|
| 19 | 17 | $_ = file_get_contents($htaccess); |
| 20 | - if(strpos($_,'RewriteBase')===false) |
|
| 21 | - { |
|
| 18 | + if(strpos($_,'RewriteBase')===false) { |
|
| 22 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 23 | - } |
|
| 24 | - elseif(is_writable($htaccess)) |
|
| 25 | - { |
|
| 20 | + } elseif(is_writable($htaccess)) { |
|
| 26 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
| 27 | - if(!@file_put_contents($htaccess,$_)) |
|
| 28 | - { |
|
| 22 | + if(!@file_put_contents($htaccess,$_)) { |
|
| 29 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 30 | 24 | } |
| 31 | 25 | } |
| 32 | - } |
|
| 33 | - elseif(is_file($sample_htaccess)) |
|
| 34 | - { |
|
| 35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
| 36 | - { |
|
| 26 | + } elseif(is_file($sample_htaccess)) { |
|
| 27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
| 37 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
| 38 | - } |
|
| 39 | - elseif($modx->config['base_url']!=='/') |
|
| 40 | - { |
|
| 29 | + } elseif($modx->config['base_url']!=='/') { |
|
| 41 | 30 | $_ = file_get_contents($htaccess); |
| 42 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
| 43 | - if(!@file_put_contents($htaccess,$_)) |
|
| 44 | - { |
|
| 32 | + if(!@file_put_contents($htaccess,$_)) { |
|
| 45 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 46 | 34 | } |
| 47 | 35 | } |
@@ -70,7 +58,7 @@ discard block |
||
| 70 | 58 | foreach ($data as $k => $v) { |
| 71 | 59 | switch ($k) { |
| 72 | 60 | case 'settings_version':{ |
| 73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
| 61 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
| 74 | 62 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
| 75 | 63 | $v = $modx->getVersionData('version'); |
| 76 | 64 | } |
@@ -131,7 +119,9 @@ discard block |
||
| 131 | 119 | |
| 132 | 120 | $modx->config[$k] = $v; |
| 133 | 121 | |
| 134 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
| 122 | + if(!empty($k)) { |
|
| 123 | + $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
| 124 | + } |
|
| 135 | 125 | } |
| 136 | 126 | |
| 137 | 127 | // Run a single query to save all the values |
@@ -145,8 +135,11 @@ discard block |
||
| 145 | 135 | $oldtemplate = (int)$data['old_template']; |
| 146 | 136 | $tbl = $modx->getFullTableName('site_content'); |
| 147 | 137 | $reset = $data['reset_template']; |
| 148 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 138 | + if($reset==1) { |
|
| 139 | + $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 140 | + } else if($reset==2) { |
|
| 141 | + $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 142 | + } |
|
| 150 | 143 | } |
| 151 | 144 | |
| 152 | 145 | // empty cache |