@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | |
13 | 13 | class DataSetPager { |
14 | 14 | |
15 | - public $ds; // datasource |
|
15 | + public $ds; // datasource |
|
16 | 16 | public $pageSize; |
17 | 17 | public $pageNumber; |
18 | 18 | public $rows; |
19 | 19 | public $pager; |
20 | 20 | public $id; |
21 | 21 | |
22 | - // normal page |
|
22 | + // normal page |
|
23 | 23 | public $pageStyle; |
24 | 24 | public $pageClass; |
25 | 25 | |
26 | - // selected page |
|
26 | + // selected page |
|
27 | 27 | public $selPageStyle; |
28 | 28 | public $selPageClass; |
29 | 29 | public $renderRowFnc; |
@@ -32,166 +32,166 @@ discard block |
||
32 | 32 | public $renderPagerFncArgs; |
33 | 33 | |
34 | 34 | public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
35 | - global $_PAGE; // use view state object |
|
36 | - |
|
37 | - global $__DataSetPagerCnt; |
|
38 | - |
|
39 | - // set id |
|
40 | - $__DataSetPagerCnt++; |
|
41 | - $this->id = !empty($id) ? $id : "dsp" . $__DataSetPagerCnt; |
|
42 | - |
|
43 | - // get pagenumber |
|
44 | - // by setting pager to -1 cause pager to load it's last page number |
|
45 | - if($pageNumber == -1) { |
|
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']; |
|
51 | - } |
|
52 | - } |
|
53 | - if(!is_numeric($pageNumber)) { |
|
54 | - $pageNumber = 1; |
|
55 | - } |
|
56 | - |
|
57 | - $this->ds = $ds; // datasource |
|
58 | - $this->pageSize = $pageSize; |
|
59 | - $this->pageNumber = $pageNumber; |
|
60 | - $this->rows = ''; |
|
61 | - $this->pager = ''; |
|
62 | - } |
|
35 | + global $_PAGE; // use view state object |
|
36 | + |
|
37 | + global $__DataSetPagerCnt; |
|
38 | + |
|
39 | + // set id |
|
40 | + $__DataSetPagerCnt++; |
|
41 | + $this->id = !empty($id) ? $id : "dsp" . $__DataSetPagerCnt; |
|
42 | + |
|
43 | + // get pagenumber |
|
44 | + // by setting pager to -1 cause pager to load it's last page number |
|
45 | + if($pageNumber == -1) { |
|
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']; |
|
51 | + } |
|
52 | + } |
|
53 | + if(!is_numeric($pageNumber)) { |
|
54 | + $pageNumber = 1; |
|
55 | + } |
|
56 | + |
|
57 | + $this->ds = $ds; // datasource |
|
58 | + $this->pageSize = $pageSize; |
|
59 | + $this->pageNumber = $pageNumber; |
|
60 | + $this->rows = ''; |
|
61 | + $this->pager = ''; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | public function getRenderedPager() { |
65 | - return $this->pager; |
|
66 | - } |
|
65 | + return $this->pager; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | public function getRenderedRows() { |
69 | - return $this->rows; |
|
70 | - } |
|
69 | + return $this->rows; |
|
70 | + } |
|
71 | 71 | |
72 | 72 | public function setDataSource($ds) { |
73 | - $this->ds = $ds; |
|
74 | - } |
|
73 | + $this->ds = $ds; |
|
74 | + } |
|
75 | 75 | |
76 | 76 | public function setPageSize($ps) { |
77 | - $this->pageSize = $ps; |
|
78 | - } |
|
77 | + $this->pageSize = $ps; |
|
78 | + } |
|
79 | 79 | |
80 | 80 | public function setRenderRowFnc($fncName, $args = "") { |
81 | - $this->renderRowFnc = &$fncName; |
|
82 | - $this->renderRowFncArgs = $args; // extra agruments |
|
81 | + $this->renderRowFnc = &$fncName; |
|
82 | + $this->renderRowFncArgs = $args; // extra agruments |
|
83 | 83 | |
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | public function setRenderPagerFnc($fncName, $args = "") { |
88 | - $this->renderPagerFnc = $fncName; |
|
89 | - $this->renderPagerFncArgs = $args; // extra agruments |
|
90 | - } |
|
88 | + $this->renderPagerFnc = $fncName; |
|
89 | + $this->renderPagerFncArgs = $args; // extra agruments |
|
90 | + } |
|
91 | 91 | |
92 | 92 | public function render() { |
93 | - $modx = evolutionCMS(); global $_PAGE; |
|
94 | - |
|
95 | - $isDataset = $modx->db->isResult($this->ds); |
|
96 | - |
|
97 | - if(!$this->selPageStyle) { |
|
98 | - $this->selPageStyle = "font-weight:bold"; |
|
99 | - } |
|
100 | - |
|
101 | - // get total number of rows |
|
102 | - $tnr = ($isDataset) ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
|
103 | - |
|
104 | - // render: no records found |
|
105 | - if($tnr <= 0) { |
|
106 | - $fnc = $this->renderRowFnc; |
|
107 | - $args = $this->renderRowFncArgs; |
|
108 | - if(isset($fnc)) { |
|
109 | - if($args != "") { |
|
110 | - $this->rows .= $fnc(0, null, $args); |
|
111 | - } // if agrs was specified then we will pass three params |
|
112 | - else { |
|
113 | - $this->rows .= $fnc(0, null); |
|
114 | - } // otherwise two will be passed |
|
115 | - } |
|
116 | - return; |
|
117 | - } |
|
118 | - |
|
119 | - // get total pages |
|
120 | - $tp = ceil($tnr / $this->pageSize); |
|
121 | - if($this->pageNumber > $tp) { |
|
122 | - $this->pageNumber = 1; |
|
123 | - } |
|
124 | - |
|
125 | - // get page number |
|
126 | - $p = $this->pageNumber; |
|
127 | - |
|
128 | - // save page number to view state if available |
|
129 | - if(isset($_PAGE['vs'])) { |
|
130 | - $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
131 | - } |
|
132 | - |
|
133 | - // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
|
134 | - if($tp > 1) { |
|
135 | - $url = ''; |
|
136 | - $fnc = $this->renderPagerFnc; |
|
137 | - $args = $this->renderPagerFncArgs; |
|
138 | - if(!isset($fnc)) { |
|
139 | - if($modx->isFrontend()) { |
|
140 | - $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
141 | - } else { |
|
142 | - $url = $_SERVER['PHP_SELF'] . '?'; |
|
143 | - } |
|
144 | - $i = 0; |
|
145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
146 | - $i++; |
|
147 | - $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
148 | - } |
|
149 | - if($i >= 1) { |
|
150 | - $url .= "&"; |
|
151 | - } |
|
152 | - } |
|
153 | - for($i = 1; $i <= $tp; $i++) { |
|
154 | - if(isset($fnc)) { |
|
155 | - if($args != "") { |
|
156 | - $this->pager .= $fnc($p, $i, $args); |
|
157 | - } else { |
|
158 | - $this->pager .= $fnc($p, $i); |
|
159 | - } |
|
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> "; |
|
162 | - } |
|
163 | - } |
|
164 | - } |
|
165 | - |
|
166 | - // render row : renderRowFnc($rowNumber,$row,$arguments="") |
|
167 | - $fnc = $this->renderRowFnc; |
|
168 | - $args = $this->renderRowFncArgs; |
|
169 | - |
|
170 | - if(isset($fnc)) { |
|
171 | - $i = 1; |
|
172 | - $fncObject = is_object($fnc); |
|
173 | - $minitems = (($p - 1) * $this->pageSize) + 1; |
|
174 | - $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
|
175 | - while($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) { |
|
176 | - if($i >= $minitems && $i <= $maxitems) { |
|
177 | - if($fncObject) { |
|
178 | - if($args != "") { |
|
179 | - $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
|
180 | - } else { |
|
181 | - $this->rows .= $fnc->RenderRowFnc($i, $row); |
|
182 | - } |
|
183 | - } else { |
|
184 | - if($args != "") { |
|
185 | - $this->rows .= $fnc($i, $row, $args); |
|
186 | - } // if agrs was specified then we wil pass three params |
|
187 | - else { |
|
188 | - $this->rows .= $fnc($i, $row); |
|
189 | - } // otherwise two will be passed |
|
190 | - } |
|
191 | - |
|
192 | - } |
|
193 | - $i++; |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
93 | + $modx = evolutionCMS(); global $_PAGE; |
|
94 | + |
|
95 | + $isDataset = $modx->db->isResult($this->ds); |
|
96 | + |
|
97 | + if(!$this->selPageStyle) { |
|
98 | + $this->selPageStyle = "font-weight:bold"; |
|
99 | + } |
|
100 | + |
|
101 | + // get total number of rows |
|
102 | + $tnr = ($isDataset) ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
|
103 | + |
|
104 | + // render: no records found |
|
105 | + if($tnr <= 0) { |
|
106 | + $fnc = $this->renderRowFnc; |
|
107 | + $args = $this->renderRowFncArgs; |
|
108 | + if(isset($fnc)) { |
|
109 | + if($args != "") { |
|
110 | + $this->rows .= $fnc(0, null, $args); |
|
111 | + } // if agrs was specified then we will pass three params |
|
112 | + else { |
|
113 | + $this->rows .= $fnc(0, null); |
|
114 | + } // otherwise two will be passed |
|
115 | + } |
|
116 | + return; |
|
117 | + } |
|
118 | + |
|
119 | + // get total pages |
|
120 | + $tp = ceil($tnr / $this->pageSize); |
|
121 | + if($this->pageNumber > $tp) { |
|
122 | + $this->pageNumber = 1; |
|
123 | + } |
|
124 | + |
|
125 | + // get page number |
|
126 | + $p = $this->pageNumber; |
|
127 | + |
|
128 | + // save page number to view state if available |
|
129 | + if(isset($_PAGE['vs'])) { |
|
130 | + $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
131 | + } |
|
132 | + |
|
133 | + // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
|
134 | + if($tp > 1) { |
|
135 | + $url = ''; |
|
136 | + $fnc = $this->renderPagerFnc; |
|
137 | + $args = $this->renderPagerFncArgs; |
|
138 | + if(!isset($fnc)) { |
|
139 | + if($modx->isFrontend()) { |
|
140 | + $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
141 | + } else { |
|
142 | + $url = $_SERVER['PHP_SELF'] . '?'; |
|
143 | + } |
|
144 | + $i = 0; |
|
145 | + foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
146 | + $i++; |
|
147 | + $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
148 | + } |
|
149 | + if($i >= 1) { |
|
150 | + $url .= "&"; |
|
151 | + } |
|
152 | + } |
|
153 | + for($i = 1; $i <= $tp; $i++) { |
|
154 | + if(isset($fnc)) { |
|
155 | + if($args != "") { |
|
156 | + $this->pager .= $fnc($p, $i, $args); |
|
157 | + } else { |
|
158 | + $this->pager .= $fnc($p, $i); |
|
159 | + } |
|
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> "; |
|
162 | + } |
|
163 | + } |
|
164 | + } |
|
165 | + |
|
166 | + // render row : renderRowFnc($rowNumber,$row,$arguments="") |
|
167 | + $fnc = $this->renderRowFnc; |
|
168 | + $args = $this->renderRowFncArgs; |
|
169 | + |
|
170 | + if(isset($fnc)) { |
|
171 | + $i = 1; |
|
172 | + $fncObject = is_object($fnc); |
|
173 | + $minitems = (($p - 1) * $this->pageSize) + 1; |
|
174 | + $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
|
175 | + while($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) { |
|
176 | + if($i >= $minitems && $i <= $maxitems) { |
|
177 | + if($fncObject) { |
|
178 | + if($args != "") { |
|
179 | + $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
|
180 | + } else { |
|
181 | + $this->rows .= $fnc->RenderRowFnc($i, $row); |
|
182 | + } |
|
183 | + } else { |
|
184 | + if($args != "") { |
|
185 | + $this->rows .= $fnc($i, $row, $args); |
|
186 | + } // if agrs was specified then we wil pass three params |
|
187 | + else { |
|
188 | + $this->rows .= $fnc($i, $row); |
|
189 | + } // otherwise two will be passed |
|
190 | + } |
|
191 | + |
|
192 | + } |
|
193 | + $i++; |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | 197 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class DATEPICKER { |
4 | - function __construct() { |
|
5 | - } |
|
4 | + function __construct() { |
|
5 | + } |
|
6 | 6 | |
7 | - function getDP() { |
|
8 | - $modx = evolutionCMS(); global $_lang; |
|
7 | + function getDP() { |
|
8 | + $modx = evolutionCMS(); global $_lang; |
|
9 | 9 | |
10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
11 | - return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
12 | - } |
|
10 | + $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
11 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
12 | + } |
|
13 | 13 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Uploader class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Uploader class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class uploader { |
16 | 16 | |
@@ -18,92 +18,92 @@ discard block |
||
18 | 18 | const VERSION = "2.54"; |
19 | 19 | |
20 | 20 | /** Config session-overrided settings |
21 | - * @var array */ |
|
21 | + * @var array */ |
|
22 | 22 | protected $config = array(); |
23 | 23 | |
24 | 24 | /** Default image driver |
25 | - * @var string */ |
|
25 | + * @var string */ |
|
26 | 26 | protected $imageDriver = "gd"; |
27 | 27 | |
28 | 28 | /** Opener applocation properties |
29 | - * $opener['name'] Got from $_GET['opener']; |
|
30 | - * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | - * $opener['TinyMCE'] Boolean |
|
32 | - * @var array */ |
|
29 | + * $opener['name'] Got from $_GET['opener']; |
|
30 | + * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | + * $opener['TinyMCE'] Boolean |
|
32 | + * @var array */ |
|
33 | 33 | protected $opener = array(); |
34 | 34 | |
35 | 35 | /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant |
36 | - * @var string */ |
|
36 | + * @var string */ |
|
37 | 37 | protected $type; |
38 | 38 | |
39 | 39 | /** Helper property. Local filesystem path to the Type Directory |
40 | - * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | - * @var string */ |
|
40 | + * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | + * @var string */ |
|
42 | 42 | protected $typeDir; |
43 | 43 | |
44 | 44 | /** Helper property. Web URL to the Type Directory |
45 | - * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | - * @var string */ |
|
45 | + * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | + * @var string */ |
|
47 | 47 | protected $typeURL; |
48 | 48 | |
49 | 49 | /** Linked to $config['types'] |
50 | - * @var array */ |
|
50 | + * @var array */ |
|
51 | 51 | protected $types = array(); |
52 | 52 | |
53 | 53 | /** Settings which can override default settings if exists as keys in $config['types'][$type] array |
54 | - * @var array */ |
|
54 | + * @var array */ |
|
55 | 55 | protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark'); |
56 | 56 | |
57 | 57 | /** Got from language file |
58 | - * @var string */ |
|
58 | + * @var string */ |
|
59 | 59 | protected $charset; |
60 | 60 | |
61 | 61 | /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property |
62 | - * @var string */ |
|
62 | + * @var string */ |
|
63 | 63 | protected $lang = 'en'; |
64 | 64 | |
65 | 65 | /** Possible language $_GET keys |
66 | - * @var array */ |
|
66 | + * @var array */ |
|
67 | 67 | protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code'); |
68 | 68 | |
69 | 69 | /** Uploaded file(s) info. Linked to first $_FILES element |
70 | - * @var array */ |
|
70 | + * @var array */ |
|
71 | 71 | protected $file; |
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | - * @var string */ |
|
74 | + * @var string */ |
|
75 | 75 | protected $dateTimeFull; // Currently not used |
76 | 76 | protected $dateTimeMid; // Currently not used |
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
80 | - * @var array */ |
|
80 | + * @var array */ |
|
81 | 81 | protected $labels = array(); |
82 | 82 | |
83 | 83 | /** Contain unprocessed $_GET array. Please use this instead of $_GET |
84 | - * @var array */ |
|
84 | + * @var array */ |
|
85 | 85 | protected $get; |
86 | 86 | |
87 | 87 | /** Contain unprocessed $_POST array. Please use this instead of $_POST |
88 | - * @var array */ |
|
88 | + * @var array */ |
|
89 | 89 | protected $post; |
90 | 90 | |
91 | 91 | /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE |
92 | - * @var array */ |
|
92 | + * @var array */ |
|
93 | 93 | protected $cookie; |
94 | 94 | |
95 | 95 | /** Session array. Please use this property instead of $_SESSION |
96 | - * @var array */ |
|
96 | + * @var array */ |
|
97 | 97 | protected $session; |
98 | 98 | |
99 | 99 | /** CMS integration attribute (got from $_GET['cms']) |
100 | - * @var string */ |
|
100 | + * @var string */ |
|
101 | 101 | protected $cms = ""; |
102 | 102 | |
103 | 103 | protected $modx = null; |
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | - * @param string $property |
|
106 | - * @return mixed */ |
|
105 | + * @param string $property |
|
106 | + * @return mixed */ |
|
107 | 107 | public function __get($property) { |
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | $this->cms = $this->get['cms']; |
134 | 134 | |
135 | - // LINKING UPLOADED FILE |
|
135 | + // LINKING UPLOADED FILE |
|
136 | 136 | if (count($_FILES)) |
137 | 137 | $this->file = &$_FILES[key($_FILES)]; |
138 | 138 | |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
229 | 229 | ? path::normalize($this->config['uploadDir']) |
230 | 230 | : path::url2fullPath("/$path"); |
231 | - $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
232 | - $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
231 | + $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
232 | + $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
233 | 233 | |
234 | 234 | // SITE ROOT |
235 | 235 | } elseif ($this->config['uploadURL'] == "/") { |
@@ -365,36 +365,36 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | - protected function getTransaliasSettings() { |
|
369 | - $modx = evolutionCMS(); |
|
370 | - |
|
371 | - // Cleaning uploaded filename? |
|
372 | - $setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
373 | - if ($modx->db->getValue($setting)>0) { |
|
374 | - // Transalias plugin active? |
|
375 | - $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
376 | - if ($properties = $modx->db->getValue($res)) { |
|
377 | - $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
378 | - } else { |
|
379 | - $properties = NULL; |
|
380 | - } |
|
381 | - } else { |
|
382 | - $properties = NULL; |
|
383 | - } |
|
384 | - return $properties; |
|
385 | - } |
|
386 | - |
|
387 | - |
|
388 | - protected function normalizeFilename($filename) { |
|
389 | - if ($this->getTransaliasSettings()) { |
|
390 | - $format = strrchr($filename, "."); |
|
391 | - $filename = str_replace($format, "", $filename); |
|
392 | - $filename = $this->modx->stripAlias($filename).$format; |
|
393 | - } |
|
394 | - return $filename; |
|
395 | - } |
|
396 | - |
|
397 | - protected function normalizeDirname($dirname) { |
|
368 | + protected function getTransaliasSettings() { |
|
369 | + $modx = evolutionCMS(); |
|
370 | + |
|
371 | + // Cleaning uploaded filename? |
|
372 | + $setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
373 | + if ($modx->db->getValue($setting)>0) { |
|
374 | + // Transalias plugin active? |
|
375 | + $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
376 | + if ($properties = $modx->db->getValue($res)) { |
|
377 | + $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
378 | + } else { |
|
379 | + $properties = NULL; |
|
380 | + } |
|
381 | + } else { |
|
382 | + $properties = NULL; |
|
383 | + } |
|
384 | + return $properties; |
|
385 | + } |
|
386 | + |
|
387 | + |
|
388 | + protected function normalizeFilename($filename) { |
|
389 | + if ($this->getTransaliasSettings()) { |
|
390 | + $format = strrchr($filename, "."); |
|
391 | + $filename = str_replace($format, "", $filename); |
|
392 | + $filename = $this->modx->stripAlias($filename).$format; |
|
393 | + } |
|
394 | + return $filename; |
|
395 | + } |
|
396 | + |
|
397 | + protected function normalizeDirname($dirname) { |
|
398 | 398 | return $this->modx->stripAlias($dirname); |
399 | 399 | } |
400 | 400 | |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | return $this->label("The image is too big and/or cannot be resized."); |
473 | 473 | |
474 | 474 | |
475 | - // CHECK FOR MODX MAX FILE SIZE |
|
476 | - $actualfilesize=filesize($file['tmp_name']); |
|
477 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
478 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
475 | + // CHECK FOR MODX MAX FILE SIZE |
|
476 | + $actualfilesize=filesize($file['tmp_name']); |
|
477 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
478 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
479 | 479 | |
480 | 480 | return true; |
481 | 481 | } |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | $top = isset($this->config['watermark']['top']) |
628 | 628 | ? $this->config['watermark']['top'] : false; |
629 | 629 | $img->watermark($this->config['watermark']['file'], $left, $top); |
630 | - } |
|
630 | + } |
|
631 | 631 | |
632 | 632 | $options = array( 'file' => $file ); |
633 | 633 |
@@ -492,7 +492,7 @@ |
||
492 | 492 | }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
493 | 493 | $publishedon = $pub_date; |
494 | 494 | $publishedby = $modx->getLoginUserID(); |
495 | - }elseif ($was_published && !$published) { |
|
495 | + }elseif ($was_published && !$published) { |
|
496 | 496 | $publishedon = 0; |
497 | 497 | $publishedby = 0; |
498 | 498 | } else { |
@@ -113,31 +113,31 @@ |
||
113 | 113 | // Handle Input "Search in main fields" |
114 | 114 | if ($searchfields != '') { |
115 | 115 | |
116 | - /*start search by TV. Added Rising13*/ |
|
117 | - $tbl_site_tmplvar_contentvalues = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | - $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | - $articul_result = $modx->db->query($articul_query); |
|
120 | - $articul_id_array = $modx->db->makeArray($articul_result); |
|
121 | - if(count($articul_id_array)>0){ |
|
122 | - $articul_id = ''; |
|
123 | - $i = 1; |
|
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
128 | - } |
|
129 | - $i++; |
|
130 | - } |
|
131 | - $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | - }else{ |
|
133 | - $articul_id_query = ''; |
|
134 | - } |
|
135 | - /*end search by TV*/ |
|
116 | + /*start search by TV. Added Rising13*/ |
|
117 | + $tbl_site_tmplvar_contentvalues = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | + $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | + $articul_result = $modx->db->query($articul_query); |
|
120 | + $articul_id_array = $modx->db->makeArray($articul_result); |
|
121 | + if(count($articul_id_array)>0){ |
|
122 | + $articul_id = ''; |
|
123 | + $i = 1; |
|
124 | + foreach( $articul_id_array as $articul ) { |
|
125 | + $articul_id.=$articul['contentid']; |
|
126 | + if($i !== count($articul_id_array)){ |
|
127 | + $articul_id.=','; |
|
128 | + } |
|
129 | + $i++; |
|
130 | + } |
|
131 | + $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | + }else{ |
|
133 | + $articul_id_query = ''; |
|
134 | + } |
|
135 | + /*end search by TV*/ |
|
136 | 136 | |
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query;//search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - $site_unavailable_message_view = isset($site_unavailable_message) ? $site_unavailable_message : $_lang['siteunavailable_message_default']; |
|
2 | + $site_unavailable_message_view = isset($site_unavailable_message) ? $site_unavailable_message : $_lang['siteunavailable_message_default']; |
|
3 | 3 | ?> |
4 | 4 | <style> |
5 | 5 | table.sysSettings > tbody td, table.sysSettings > tbody th {border-bottom:1px dotted #ccc;padding:10px;} |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | <?php |
136 | 136 | // Check if PHX is enabled |
137 | 137 | $count = $modx->db->getRecordCount( |
138 | - $modx->db->select('id', '[+prefix+]site_plugins', |
|
139 | - "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
|
138 | + $modx->db->select('id', '[+prefix+]site_plugins', |
|
139 | + "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
|
140 | 140 | ); |
141 | 141 | if($count) { |
142 | 142 | $disabledFilters = 1; |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | <th><?php echo $_lang['serveroffset_title'] ?><br><small>[(server_offset_time)]</small></th> |
260 | 260 | <td> <select name="server_offset_time" size="1" class="inputBox"> |
261 | 261 | <?php |
262 | - for($i=-24; $i<25; $i++) { |
|
263 | - $seconds = $i*60*60; |
|
264 | - $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
|
265 | - ?> |
|
262 | + for($i=-24; $i<25; $i++) { |
|
263 | + $seconds = $i*60*60; |
|
264 | + $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
|
265 | + ?> |
|
266 | 266 | <option value="<?php echo $seconds; ?>" <?php echo $selectedtext; ?>><?php echo $i; ?></option> |
267 | 267 | <?php |
268 | - } |
|
269 | - ?> |
|
268 | + } |
|
269 | + ?> |
|
270 | 270 | </select> |
271 | 271 | <div class="comment"><?php printf($_lang['serveroffset_message'], strftime('%H:%M:%S', time()), strftime('%H:%M:%S', time()+$server_offset_time)); ?></div> |
272 | 272 | </td> |
@@ -102,19 +102,19 @@ |
||
102 | 102 | $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']); |
103 | 103 | |
104 | 104 | switch ($modx->config['manager_theme_mode']) { |
105 | - case '1': |
|
105 | + case '1': |
|
106 | 106 | $modx->setPlaceholder('manager_theme_style', 'lightness'); |
107 | 107 | break; |
108 | - case '2': |
|
108 | + case '2': |
|
109 | 109 | $modx->setPlaceholder('manager_theme_style', 'light'); |
110 | 110 | break; |
111 | - case '3': |
|
111 | + case '3': |
|
112 | 112 | $modx->setPlaceholder('manager_theme_style', 'dark'); |
113 | 113 | break; |
114 | - case '4': |
|
114 | + case '4': |
|
115 | 115 | $modx->setPlaceholder('manager_theme_style', 'darkness'); |
116 | 116 | break; |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | // andrazk 20070416 - notify user of install/update |
120 | 120 | if (isset($_GET['installGoingOn'])) { |
@@ -4,237 +4,237 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | $sitemenu['bars'] = array( |
7 | - 'bars', |
|
8 | - 'main', |
|
9 | - '<i class="fa fa-bars"></i>', |
|
10 | - 'javascript:;', |
|
11 | - $_lang['home'], |
|
12 | - 'modx.resizer.toggle(); return false;', |
|
13 | - ' return false;', |
|
14 | - '', |
|
15 | - 0, |
|
16 | - 10, |
|
17 | - '' |
|
7 | + 'bars', |
|
8 | + 'main', |
|
9 | + '<i class="fa fa-bars"></i>', |
|
10 | + 'javascript:;', |
|
11 | + $_lang['home'], |
|
12 | + 'modx.resizer.toggle(); return false;', |
|
13 | + ' return false;', |
|
14 | + '', |
|
15 | + 0, |
|
16 | + 10, |
|
17 | + '' |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | //mainMenu |
21 | 21 | $sitemenu['site'] = array( |
22 | - 'site', |
|
23 | - 'main', |
|
24 | - '<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>', |
|
25 | - 'index.php?a=2', |
|
26 | - $_lang['home'], |
|
27 | - '', |
|
28 | - '', |
|
29 | - 'main', |
|
30 | - 0, |
|
31 | - 10, |
|
32 | - 'active' |
|
22 | + 'site', |
|
23 | + 'main', |
|
24 | + '<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>', |
|
25 | + 'index.php?a=2', |
|
26 | + $_lang['home'], |
|
27 | + '', |
|
28 | + '', |
|
29 | + 'main', |
|
30 | + 0, |
|
31 | + 10, |
|
32 | + 'active' |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) { |
36 | - $sitemenu['elements'] = array( |
|
37 | - 'elements', |
|
38 | - 'main', |
|
39 | - '<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>', |
|
40 | - 'javascript:;', |
|
41 | - $_lang['elements'], |
|
42 | - ' return false;', |
|
43 | - '', |
|
44 | - '', |
|
45 | - 0, |
|
46 | - 20, |
|
47 | - '' |
|
48 | - ); |
|
36 | + $sitemenu['elements'] = array( |
|
37 | + 'elements', |
|
38 | + 'main', |
|
39 | + '<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>', |
|
40 | + 'javascript:;', |
|
41 | + $_lang['elements'], |
|
42 | + ' return false;', |
|
43 | + '', |
|
44 | + '', |
|
45 | + 0, |
|
46 | + 20, |
|
47 | + '' |
|
48 | + ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if($modx->hasPermission('exec_module')) { |
52 | - $sitemenu['modules'] = array( |
|
53 | - 'modules', |
|
54 | - 'main', |
|
55 | - '<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>', |
|
56 | - 'javascript:;', |
|
57 | - $_lang['modules'], |
|
58 | - ' return false;', |
|
59 | - '', |
|
60 | - '', |
|
61 | - 0, |
|
62 | - 30, |
|
63 | - '' |
|
64 | - ); |
|
52 | + $sitemenu['modules'] = array( |
|
53 | + 'modules', |
|
54 | + 'main', |
|
55 | + '<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>', |
|
56 | + 'javascript:;', |
|
57 | + $_lang['modules'], |
|
58 | + ' return false;', |
|
59 | + '', |
|
60 | + '', |
|
61 | + 0, |
|
62 | + 30, |
|
63 | + '' |
|
64 | + ); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) { |
68 | - $sitemenu['users'] = array( |
|
69 | - 'users', |
|
70 | - 'main', |
|
71 | - '<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>', |
|
72 | - 'javascript:;', |
|
73 | - $_lang['users'], |
|
74 | - ' return false;', |
|
75 | - 'edit_user', |
|
76 | - '', |
|
77 | - 0, |
|
78 | - 40, |
|
79 | - '' |
|
80 | - ); |
|
68 | + $sitemenu['users'] = array( |
|
69 | + 'users', |
|
70 | + 'main', |
|
71 | + '<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>', |
|
72 | + 'javascript:;', |
|
73 | + $_lang['users'], |
|
74 | + ' return false;', |
|
75 | + 'edit_user', |
|
76 | + '', |
|
77 | + 0, |
|
78 | + 40, |
|
79 | + '' |
|
80 | + ); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) { |
84 | - $sitemenu['tools'] = array( |
|
85 | - 'tools', |
|
86 | - 'main', |
|
87 | - '<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>', |
|
88 | - 'javascript:;', |
|
89 | - $_lang['tools'], |
|
90 | - ' return false;', |
|
91 | - '', |
|
92 | - '', |
|
93 | - 0, |
|
94 | - 50, |
|
95 | - '' |
|
96 | - ); |
|
84 | + $sitemenu['tools'] = array( |
|
85 | + 'tools', |
|
86 | + 'main', |
|
87 | + '<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>', |
|
88 | + 'javascript:;', |
|
89 | + $_lang['tools'], |
|
90 | + ' return false;', |
|
91 | + '', |
|
92 | + '', |
|
93 | + 0, |
|
94 | + 50, |
|
95 | + '' |
|
96 | + ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | $tab = 0; |
100 | 100 | if($modx->hasPermission('edit_template')) { |
101 | - $sitemenu['element_templates'] = array( |
|
102 | - 'element_templates', |
|
103 | - 'elements', |
|
104 | - '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
105 | - 'index.php?a=76&tab=' . $tab++, |
|
106 | - $_lang['manage_templates'], |
|
107 | - '', |
|
108 | - 'new_template,edit_template', |
|
109 | - 'main', |
|
110 | - 0, |
|
111 | - 10, |
|
112 | - 'dropdown-toggle' |
|
113 | - ); |
|
101 | + $sitemenu['element_templates'] = array( |
|
102 | + 'element_templates', |
|
103 | + 'elements', |
|
104 | + '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
105 | + 'index.php?a=76&tab=' . $tab++, |
|
106 | + $_lang['manage_templates'], |
|
107 | + '', |
|
108 | + 'new_template,edit_template', |
|
109 | + 'main', |
|
110 | + 0, |
|
111 | + 10, |
|
112 | + 'dropdown-toggle' |
|
113 | + ); |
|
114 | 114 | } |
115 | 115 | if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
116 | - $sitemenu['element_tplvars'] = array( |
|
117 | - 'element_tplvars', |
|
118 | - 'elements', |
|
119 | - '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
120 | - 'index.php?a=76&tab=' . $tab++, |
|
121 | - $_lang['tmplvars'], |
|
122 | - '', |
|
123 | - 'new_template,edit_template', |
|
124 | - 'main', |
|
125 | - 0, |
|
126 | - 20, |
|
127 | - 'dropdown-toggle' |
|
128 | - ); |
|
116 | + $sitemenu['element_tplvars'] = array( |
|
117 | + 'element_tplvars', |
|
118 | + 'elements', |
|
119 | + '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
120 | + 'index.php?a=76&tab=' . $tab++, |
|
121 | + $_lang['tmplvars'], |
|
122 | + '', |
|
123 | + 'new_template,edit_template', |
|
124 | + 'main', |
|
125 | + 0, |
|
126 | + 20, |
|
127 | + 'dropdown-toggle' |
|
128 | + ); |
|
129 | 129 | } |
130 | 130 | if($modx->hasPermission('edit_chunk')) { |
131 | - $sitemenu['element_htmlsnippets'] = array( |
|
132 | - 'element_htmlsnippets', |
|
133 | - 'elements', |
|
134 | - '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
135 | - 'index.php?a=76&tab=' . $tab++, |
|
136 | - $_lang['manage_htmlsnippets'], |
|
137 | - '', |
|
138 | - 'new_chunk,edit_chunk', |
|
139 | - 'main', |
|
140 | - 0, |
|
141 | - 30, |
|
142 | - 'dropdown-toggle' |
|
143 | - ); |
|
131 | + $sitemenu['element_htmlsnippets'] = array( |
|
132 | + 'element_htmlsnippets', |
|
133 | + 'elements', |
|
134 | + '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
135 | + 'index.php?a=76&tab=' . $tab++, |
|
136 | + $_lang['manage_htmlsnippets'], |
|
137 | + '', |
|
138 | + 'new_chunk,edit_chunk', |
|
139 | + 'main', |
|
140 | + 0, |
|
141 | + 30, |
|
142 | + 'dropdown-toggle' |
|
143 | + ); |
|
144 | 144 | } |
145 | 145 | if($modx->hasPermission('edit_snippet')) { |
146 | - $sitemenu['element_snippets'] = array( |
|
147 | - 'element_snippets', |
|
148 | - 'elements', |
|
149 | - '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
150 | - 'index.php?a=76&tab=' . $tab++, |
|
151 | - $_lang['manage_snippets'], |
|
152 | - '', |
|
153 | - 'new_snippet,edit_snippet', |
|
154 | - 'main', |
|
155 | - 0, |
|
156 | - 40, |
|
157 | - 'dropdown-toggle' |
|
158 | - ); |
|
146 | + $sitemenu['element_snippets'] = array( |
|
147 | + 'element_snippets', |
|
148 | + 'elements', |
|
149 | + '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
150 | + 'index.php?a=76&tab=' . $tab++, |
|
151 | + $_lang['manage_snippets'], |
|
152 | + '', |
|
153 | + 'new_snippet,edit_snippet', |
|
154 | + 'main', |
|
155 | + 0, |
|
156 | + 40, |
|
157 | + 'dropdown-toggle' |
|
158 | + ); |
|
159 | 159 | } |
160 | 160 | if($modx->hasPermission('edit_plugin')) { |
161 | - $sitemenu['element_plugins'] = array( |
|
162 | - 'element_plugins', |
|
163 | - 'elements', |
|
164 | - '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
165 | - 'index.php?a=76&tab=' . $tab++, |
|
166 | - $_lang['manage_plugins'], |
|
167 | - '', |
|
168 | - 'new_plugin,edit_plugin', |
|
169 | - 'main', |
|
170 | - 0, |
|
171 | - 50, |
|
172 | - 'dropdown-toggle' |
|
173 | - ); |
|
161 | + $sitemenu['element_plugins'] = array( |
|
162 | + 'element_plugins', |
|
163 | + 'elements', |
|
164 | + '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
165 | + 'index.php?a=76&tab=' . $tab++, |
|
166 | + $_lang['manage_plugins'], |
|
167 | + '', |
|
168 | + 'new_plugin,edit_plugin', |
|
169 | + 'main', |
|
170 | + 0, |
|
171 | + 50, |
|
172 | + 'dropdown-toggle' |
|
173 | + ); |
|
174 | 174 | } |
175 | 175 | //$sitemenu['element_categories'] = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,''); |
176 | 176 | |
177 | 177 | if($modx->hasPermission('file_manager')) { |
178 | - $sitemenu['manage_files'] = array( |
|
179 | - 'manage_files', |
|
180 | - 'elements', |
|
181 | - '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
182 | - 'index.php?a=31', |
|
183 | - $_lang['manage_files'], |
|
184 | - '', |
|
185 | - 'file_manager', |
|
186 | - 'main', |
|
187 | - 0, |
|
188 | - 80, |
|
189 | - '' |
|
190 | - ); |
|
178 | + $sitemenu['manage_files'] = array( |
|
179 | + 'manage_files', |
|
180 | + 'elements', |
|
181 | + '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
182 | + 'index.php?a=31', |
|
183 | + $_lang['manage_files'], |
|
184 | + '', |
|
185 | + 'file_manager', |
|
186 | + 'main', |
|
187 | + 0, |
|
188 | + 80, |
|
189 | + '' |
|
190 | + ); |
|
191 | 191 | } |
192 | 192 | if($modx->hasPermission('category_manager')) { |
193 | - $sitemenu['manage_categories'] = array( |
|
194 | - 'manage_categories', |
|
195 | - 'elements', |
|
196 | - '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
197 | - 'index.php?a=120', |
|
198 | - $_lang['manage_categories'], |
|
199 | - '', |
|
200 | - 'category_manager', |
|
201 | - 'main', |
|
202 | - 0, |
|
203 | - 70, |
|
204 | - '' |
|
205 | - ); |
|
193 | + $sitemenu['manage_categories'] = array( |
|
194 | + 'manage_categories', |
|
195 | + 'elements', |
|
196 | + '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
197 | + 'index.php?a=120', |
|
198 | + $_lang['manage_categories'], |
|
199 | + '', |
|
200 | + 'category_manager', |
|
201 | + 'main', |
|
202 | + 0, |
|
203 | + 70, |
|
204 | + '' |
|
205 | + ); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // Modules Menu Items |
209 | 209 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) { |
210 | - $sitemenu['new_module'] = array( |
|
211 | - 'new_module', |
|
212 | - 'modules', |
|
213 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
214 | - 'index.php?a=106', |
|
215 | - $_lang['module_management'], |
|
216 | - '', |
|
217 | - 'new_module,edit_module', |
|
218 | - 'main', |
|
219 | - 1, |
|
220 | - 0, |
|
221 | - '' |
|
222 | - ); |
|
210 | + $sitemenu['new_module'] = array( |
|
211 | + 'new_module', |
|
212 | + 'modules', |
|
213 | + '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
214 | + 'index.php?a=106', |
|
215 | + $_lang['module_management'], |
|
216 | + '', |
|
217 | + 'new_module,edit_module', |
|
218 | + 'main', |
|
219 | + 1, |
|
220 | + 0, |
|
221 | + '' |
|
222 | + ); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | if($modx->hasPermission('exec_module')) { |
226 | - if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
227 | - $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member |
|
226 | + if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
227 | + $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member |
|
228 | 228 | FROM ' . $modx->getFullTableName('site_modules') . ' AS sm |
229 | 229 | LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id |
230 | 230 | LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group |
231 | 231 | WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
232 | 232 | ORDER BY sm.name'); |
233 | - } else { |
|
234 | - $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name'); |
|
235 | - } |
|
236 | - if($modx->db->getRecordCount($rs)) { |
|
237 | - while ($row = $modx->db->getRow($rs)) { |
|
233 | + } else { |
|
234 | + $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name'); |
|
235 | + } |
|
236 | + if($modx->db->getRecordCount($rs)) { |
|
237 | + while ($row = $modx->db->getRow($rs)) { |
|
238 | 238 | $sitemenu['module' . $row['id']] = array( |
239 | 239 | 'module' . $row['id'], |
240 | 240 | 'modules', |
@@ -255,83 +255,83 @@ discard block |
||
255 | 255 | // security menu items (users) |
256 | 256 | |
257 | 257 | if($modx->hasPermission('edit_user')) { |
258 | - $sitemenu['user_management_title'] = array( |
|
259 | - 'user_management_title', |
|
260 | - 'users', |
|
261 | - '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
262 | - 'index.php?a=75', |
|
263 | - $_lang['user_management_title'], |
|
264 | - '', |
|
265 | - 'edit_user', |
|
266 | - 'main', |
|
267 | - 0, |
|
268 | - 10, |
|
269 | - 'dropdown-toggle' |
|
270 | - ); |
|
258 | + $sitemenu['user_management_title'] = array( |
|
259 | + 'user_management_title', |
|
260 | + 'users', |
|
261 | + '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
262 | + 'index.php?a=75', |
|
263 | + $_lang['user_management_title'], |
|
264 | + '', |
|
265 | + 'edit_user', |
|
266 | + 'main', |
|
267 | + 0, |
|
268 | + 10, |
|
269 | + 'dropdown-toggle' |
|
270 | + ); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | if($modx->hasPermission('edit_web_user')) { |
274 | - $sitemenu['web_user_management_title'] = array( |
|
275 | - 'web_user_management_title', |
|
276 | - 'users', |
|
277 | - '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
278 | - 'index.php?a=99', |
|
279 | - $_lang['web_user_management_title'], |
|
280 | - '', |
|
281 | - 'edit_web_user', |
|
282 | - 'main', |
|
283 | - 0, |
|
284 | - 20, |
|
285 | - 'dropdown-toggle' |
|
286 | - ); |
|
274 | + $sitemenu['web_user_management_title'] = array( |
|
275 | + 'web_user_management_title', |
|
276 | + 'users', |
|
277 | + '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
278 | + 'index.php?a=99', |
|
279 | + $_lang['web_user_management_title'], |
|
280 | + '', |
|
281 | + 'edit_web_user', |
|
282 | + 'main', |
|
283 | + 0, |
|
284 | + 20, |
|
285 | + 'dropdown-toggle' |
|
286 | + ); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | if($modx->hasPermission('edit_role')) { |
290 | - $sitemenu['role_management_title'] = array( |
|
291 | - 'role_management_title', |
|
292 | - 'users', |
|
293 | - '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
294 | - 'index.php?a=86', |
|
295 | - $_lang['role_management_title'], |
|
296 | - '', |
|
297 | - 'new_role,edit_role,delete_role', |
|
298 | - 'main', |
|
299 | - 0, |
|
300 | - 30, |
|
301 | - '' |
|
302 | - ); |
|
290 | + $sitemenu['role_management_title'] = array( |
|
291 | + 'role_management_title', |
|
292 | + 'users', |
|
293 | + '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
294 | + 'index.php?a=86', |
|
295 | + $_lang['role_management_title'], |
|
296 | + '', |
|
297 | + 'new_role,edit_role,delete_role', |
|
298 | + 'main', |
|
299 | + 0, |
|
300 | + 30, |
|
301 | + '' |
|
302 | + ); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | if($modx->hasPermission('access_permissions')) { |
306 | - $sitemenu['manager_permissions'] = array( |
|
307 | - 'manager_permissions', |
|
308 | - 'users', |
|
309 | - '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
310 | - 'index.php?a=40', |
|
311 | - $_lang['manager_permissions'], |
|
312 | - '', |
|
313 | - 'access_permissions', |
|
314 | - 'main', |
|
315 | - 0, |
|
316 | - 40, |
|
317 | - '' |
|
318 | - ); |
|
306 | + $sitemenu['manager_permissions'] = array( |
|
307 | + 'manager_permissions', |
|
308 | + 'users', |
|
309 | + '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
310 | + 'index.php?a=40', |
|
311 | + $_lang['manager_permissions'], |
|
312 | + '', |
|
313 | + 'access_permissions', |
|
314 | + 'main', |
|
315 | + 0, |
|
316 | + 40, |
|
317 | + '' |
|
318 | + ); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | if($modx->hasPermission('web_access_permissions')) { |
322 | - $sitemenu['web_permissions'] = array( |
|
323 | - 'web_permissions', |
|
324 | - 'users', |
|
325 | - '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
326 | - 'index.php?a=91', |
|
327 | - $_lang['web_permissions'], |
|
328 | - '', |
|
329 | - 'web_access_permissions', |
|
330 | - 'main', |
|
331 | - 0, |
|
332 | - 50, |
|
333 | - '' |
|
334 | - ); |
|
322 | + $sitemenu['web_permissions'] = array( |
|
323 | + 'web_permissions', |
|
324 | + 'users', |
|
325 | + '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
326 | + 'index.php?a=91', |
|
327 | + $_lang['web_permissions'], |
|
328 | + '', |
|
329 | + 'web_access_permissions', |
|
330 | + 'main', |
|
331 | + 0, |
|
332 | + 50, |
|
333 | + '' |
|
334 | + ); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // Tools Menu |
@@ -361,104 +361,104 @@ discard block |
||
361 | 361 | ); |
362 | 362 | |
363 | 363 | $sitemenu['search'] = array( |
364 | - 'search', |
|
365 | - 'tools', |
|
366 | - '<i class="fa fa-search"></i>' . $_lang['search'], |
|
367 | - 'index.php?a=71', |
|
368 | - $_lang['search'], |
|
369 | - '', |
|
370 | - '', |
|
371 | - 'main', |
|
372 | - 1, |
|
373 | - 9, |
|
374 | - '' |
|
364 | + 'search', |
|
365 | + 'tools', |
|
366 | + '<i class="fa fa-search"></i>' . $_lang['search'], |
|
367 | + 'index.php?a=71', |
|
368 | + $_lang['search'], |
|
369 | + '', |
|
370 | + '', |
|
371 | + 'main', |
|
372 | + 1, |
|
373 | + 9, |
|
374 | + '' |
|
375 | 375 | ); |
376 | 376 | |
377 | 377 | if($modx->hasPermission('bk_manager')) { |
378 | - $sitemenu['bk_manager'] = array( |
|
379 | - 'bk_manager', |
|
380 | - 'tools', |
|
381 | - '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
382 | - 'index.php?a=93', |
|
383 | - $_lang['bk_manager'], |
|
384 | - '', |
|
385 | - 'bk_manager', |
|
386 | - 'main', |
|
387 | - 0, |
|
388 | - 10, |
|
389 | - '' |
|
390 | - ); |
|
378 | + $sitemenu['bk_manager'] = array( |
|
379 | + 'bk_manager', |
|
380 | + 'tools', |
|
381 | + '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
382 | + 'index.php?a=93', |
|
383 | + $_lang['bk_manager'], |
|
384 | + '', |
|
385 | + 'bk_manager', |
|
386 | + 'main', |
|
387 | + 0, |
|
388 | + 10, |
|
389 | + '' |
|
390 | + ); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | if($modx->hasPermission('remove_locks')) { |
394 | - $sitemenu['remove_locks'] = array( |
|
395 | - 'remove_locks', |
|
396 | - 'tools', |
|
397 | - '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
398 | - 'javascript:modx.removeLocks();', |
|
399 | - $_lang['remove_locks'], |
|
400 | - '', |
|
401 | - 'remove_locks', |
|
402 | - '', |
|
403 | - 0, |
|
404 | - 20, |
|
405 | - '' |
|
406 | - ); |
|
394 | + $sitemenu['remove_locks'] = array( |
|
395 | + 'remove_locks', |
|
396 | + 'tools', |
|
397 | + '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
398 | + 'javascript:modx.removeLocks();', |
|
399 | + $_lang['remove_locks'], |
|
400 | + '', |
|
401 | + 'remove_locks', |
|
402 | + '', |
|
403 | + 0, |
|
404 | + 20, |
|
405 | + '' |
|
406 | + ); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if($modx->hasPermission('import_static')) { |
410 | - $sitemenu['import_site'] = array( |
|
411 | - 'import_site', |
|
412 | - 'tools', |
|
413 | - '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
414 | - 'index.php?a=95', |
|
415 | - $_lang['import_site'], |
|
416 | - '', |
|
417 | - 'import_static', |
|
418 | - 'main', |
|
419 | - 0, |
|
420 | - 30, |
|
421 | - '' |
|
422 | - ); |
|
410 | + $sitemenu['import_site'] = array( |
|
411 | + 'import_site', |
|
412 | + 'tools', |
|
413 | + '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
414 | + 'index.php?a=95', |
|
415 | + $_lang['import_site'], |
|
416 | + '', |
|
417 | + 'import_static', |
|
418 | + 'main', |
|
419 | + 0, |
|
420 | + 30, |
|
421 | + '' |
|
422 | + ); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | if($modx->hasPermission('export_static')) { |
426 | - $sitemenu['export_site'] = array( |
|
427 | - 'export_site', |
|
428 | - 'tools', |
|
429 | - '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
430 | - 'index.php?a=83', |
|
431 | - $_lang['export_site'], |
|
432 | - '', |
|
433 | - 'export_static', |
|
434 | - 'main', |
|
435 | - 1, |
|
436 | - 40, |
|
437 | - '' |
|
438 | - ); |
|
426 | + $sitemenu['export_site'] = array( |
|
427 | + 'export_site', |
|
428 | + 'tools', |
|
429 | + '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
430 | + 'index.php?a=83', |
|
431 | + $_lang['export_site'], |
|
432 | + '', |
|
433 | + 'export_static', |
|
434 | + 'main', |
|
435 | + 1, |
|
436 | + 40, |
|
437 | + '' |
|
438 | + ); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu)); |
442 | 442 | if(is_array($menu)) { |
443 | - $newmenu = array(); |
|
444 | - foreach($menu as $item){ |
|
445 | - if(is_array(unserialize($item))){ |
|
446 | - $newmenu = array_merge($newmenu, unserialize($item)); |
|
447 | - } |
|
448 | - } |
|
449 | - if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
443 | + $newmenu = array(); |
|
444 | + foreach($menu as $item){ |
|
445 | + if(is_array(unserialize($item))){ |
|
446 | + $newmenu = array_merge($newmenu, unserialize($item)); |
|
447 | + } |
|
448 | + } |
|
449 | + if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) { |
453 | - include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
453 | + include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
454 | 454 | } else { |
455 | - include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
455 | + include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
456 | 456 | } |
457 | 457 | $menu = new EVOmenu(); |
458 | 458 | $menu->Build($sitemenu, array( |
459 | - 'outerClass' => 'nav', |
|
460 | - 'innerClass' => 'dropdown-menu', |
|
461 | - 'parentClass' => 'dropdown', |
|
459 | + 'outerClass' => 'nav', |
|
460 | + 'innerClass' => 'dropdown-menu', |
|
461 | + 'parentClass' => 'dropdown', |
|
462 | 462 | 'parentLinkClass' => 'dropdown-toggle', |
463 | 463 | 'parentLinkAttr' => '', |
464 | 464 | 'parentLinkIn' => '' |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('settings')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | $data = $_POST; |
9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
@@ -11,41 +11,41 @@ discard block |
||
11 | 11 | |
12 | 12 | if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
13 | 13 | { |
14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | - if(is_file($htaccess)) |
|
18 | - { |
|
19 | - $_ = file_get_contents($htaccess); |
|
20 | - if(strpos($_,'RewriteBase')===false) |
|
21 | - { |
|
22 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | - } |
|
24 | - elseif(is_writable($htaccess)) |
|
25 | - { |
|
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | - if(!@file_put_contents($htaccess,$_)) |
|
28 | - { |
|
29 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
33 | - elseif(is_file($sample_htaccess)) |
|
34 | - { |
|
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
14 | + $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
15 | + $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | + $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | + if(is_file($htaccess)) |
|
18 | + { |
|
19 | + $_ = file_get_contents($htaccess); |
|
20 | + if(strpos($_,'RewriteBase')===false) |
|
36 | 21 | { |
37 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | - } |
|
39 | - elseif($modx->config['base_url']!=='/') |
|
40 | - { |
|
41 | - $_ = file_get_contents($htaccess); |
|
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | - if(!@file_put_contents($htaccess,$_)) |
|
44 | - { |
|
45 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
22 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | + } |
|
24 | + elseif(is_writable($htaccess)) |
|
25 | + { |
|
26 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | + if(!@file_put_contents($htaccess,$_)) |
|
28 | + { |
|
29 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | + elseif(is_file($sample_htaccess)) |
|
34 | + { |
|
35 | + if(!@rename($sample_htaccess,$htaccess)) |
|
36 | + { |
|
37 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | + } |
|
39 | + elseif($modx->config['base_url']!=='/') |
|
40 | + { |
|
41 | + $_ = file_get_contents($htaccess); |
|
42 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | + if(!@file_put_contents($htaccess,$_)) |
|
44 | + { |
|
45 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -56,22 +56,22 @@ discard block |
||
56 | 56 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
57 | 57 | |
58 | 58 | if (isset($data) && count($data) > 0) { |
59 | - if(isset($data['manager_language'])) { |
|
60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | - if(is_file($lang_path)) { |
|
62 | - include($lang_path); |
|
59 | + if(isset($data['manager_language'])) { |
|
60 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | + if(is_file($lang_path)) { |
|
62 | + include($lang_path); |
|
63 | 63 | global $modx_lang_attribute; |
64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
65 | - } |
|
66 | - } |
|
67 | - $savethese = array(); |
|
68 | - $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']); |
|
69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | - foreach ($data as $k => $v) { |
|
71 | - switch ($k) { |
|
72 | - case 'site_name': |
|
73 | - $v = htmlspecialchars($v); |
|
74 | - break; |
|
65 | + } |
|
66 | + } |
|
67 | + $savethese = array(); |
|
68 | + $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']); |
|
69 | + $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | + foreach ($data as $k => $v) { |
|
71 | + switch ($k) { |
|
72 | + case 'site_name': |
|
73 | + $v = htmlspecialchars($v); |
|
74 | + break; |
|
75 | 75 | case 'settings_version':{ |
76 | 76 | if($modx->getVersionData('version')!=$data['settings_version']){ |
77 | 77 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -79,24 +79,24 @@ discard block |
||
79 | 79 | } |
80 | 80 | break; |
81 | 81 | } |
82 | - case 'error_page': |
|
83 | - case 'unauthorized_page': |
|
84 | - if (trim($v) == '' || !is_numeric($v)) { |
|
85 | - $v = $data['site_start']; |
|
86 | - } |
|
87 | - break; |
|
82 | + case 'error_page': |
|
83 | + case 'unauthorized_page': |
|
84 | + if (trim($v) == '' || !is_numeric($v)) { |
|
85 | + $v = $data['site_start']; |
|
86 | + } |
|
87 | + break; |
|
88 | 88 | |
89 | - case 'lst_custom_contenttype': |
|
90 | - case 'txt_custom_contenttype': |
|
91 | - // Skip these |
|
92 | - $k = ''; |
|
93 | - break; |
|
94 | - case 'rb_base_dir': |
|
95 | - case 'rb_base_url': |
|
96 | - case 'filemanager_path': |
|
97 | - $v = trim($v); |
|
98 | - $v = rtrim($v,'/') . '/'; |
|
99 | - break; |
|
89 | + case 'lst_custom_contenttype': |
|
90 | + case 'txt_custom_contenttype': |
|
91 | + // Skip these |
|
92 | + $k = ''; |
|
93 | + break; |
|
94 | + case 'rb_base_dir': |
|
95 | + case 'rb_base_url': |
|
96 | + case 'filemanager_path': |
|
97 | + $v = trim($v); |
|
98 | + $v = rtrim($v,'/') . '/'; |
|
99 | + break; |
|
100 | 100 | case 'manager_language': |
101 | 101 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
102 | 102 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -104,56 +104,56 @@ discard block |
||
104 | 104 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
105 | 105 | $v = 'english'; |
106 | 106 | } |
107 | - break; |
|
108 | - case 'smtppw': |
|
109 | - if ($v !== '********************' && $v !== '') { |
|
110 | - $v = trim($v); |
|
111 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | - $v = str_replace('=','%',$v); |
|
113 | - } elseif ($v === '********************') { |
|
114 | - $k = ''; |
|
115 | - } |
|
116 | - break; |
|
107 | + break; |
|
108 | + case 'smtppw': |
|
109 | + if ($v !== '********************' && $v !== '') { |
|
110 | + $v = trim($v); |
|
111 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | + $v = str_replace('=','%',$v); |
|
113 | + } elseif ($v === '********************') { |
|
114 | + $k = ''; |
|
115 | + } |
|
116 | + break; |
|
117 | 117 | case 'valid_hostnames': |
118 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
119 | - if ($v !== ',') { |
|
120 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
121 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
123 | - } |
|
124 | - $k = ''; |
|
125 | - break; |
|
126 | - case 'session_timeout': |
|
127 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
128 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
129 | - break; |
|
130 | - default: |
|
131 | - break; |
|
132 | - } |
|
133 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
118 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
119 | + if ($v !== ',') { |
|
120 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
121 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
123 | + } |
|
124 | + $k = ''; |
|
125 | + break; |
|
126 | + case 'session_timeout': |
|
127 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
128 | + $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
129 | + break; |
|
130 | + default: |
|
131 | + break; |
|
132 | + } |
|
133 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
134 | 134 | |
135 | - $modx->config[$k] = $v; |
|
135 | + $modx->config[$k] = $v; |
|
136 | 136 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
138 | - } |
|
137 | + if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
138 | + } |
|
139 | 139 | |
140 | - // Run a single query to save all the values |
|
141 | - $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
140 | + // Run a single query to save all the values |
|
141 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
142 | 142 | VALUES ".implode(', ', $savethese); |
143 | - $modx->db->query($sql); |
|
143 | + $modx->db->query($sql); |
|
144 | 144 | |
145 | - // Reset Template Pages |
|
146 | - if (isset($data['reset_template'])) { |
|
147 | - $newtemplate = (int)$data['default_template']; |
|
148 | - $oldtemplate = (int)$data['old_template']; |
|
149 | - $tbl = $modx->getFullTableName('site_content'); |
|
150 | - $reset = $data['reset_template']; |
|
151 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | - } |
|
145 | + // Reset Template Pages |
|
146 | + if (isset($data['reset_template'])) { |
|
147 | + $newtemplate = (int)$data['default_template']; |
|
148 | + $oldtemplate = (int)$data['old_template']; |
|
149 | + $tbl = $modx->getFullTableName('site_content'); |
|
150 | + $reset = $data['reset_template']; |
|
151 | + if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | + else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | + } |
|
154 | 154 | |
155 | - // empty cache |
|
156 | - $modx->clearCache('full'); |
|
155 | + // empty cache |
|
156 | + $modx->clearCache('full'); |
|
157 | 157 | } |
158 | 158 | $header="Location: index.php?a=7&r=10"; |
159 | 159 | header($header); |