@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class image_gmagick extends image { |
|
15 | +class image_gmagick extends image |
|
16 | +{ |
|
16 | 17 | |
17 | 18 | static $MIMES = array( |
18 | 19 | //'tif' => "image/tiff" |
@@ -21,9 +22,15 @@ discard block |
||
21 | 22 | |
22 | 23 | // ABSTRACT PUBLIC METHODS |
23 | 24 | |
24 | - public function resize($width, $height) {// |
|
25 | - if (!$width) $width = 1; |
|
26 | - if (!$height) $height = 1; |
|
25 | + public function resize($width, $height) |
|
26 | + { |
|
27 | +// |
|
28 | + if (!$width) { |
|
29 | + $width = 1; |
|
30 | + } |
|
31 | + if (!$height) { |
|
32 | + $height = 1; |
|
33 | + } |
|
27 | 34 | try { |
28 | 35 | $this->image->scaleImage($width, $height); |
29 | 36 | } catch (Exception $e) { |
@@ -34,9 +41,15 @@ discard block |
||
34 | 41 | return true; |
35 | 42 | } |
36 | 43 | |
37 | - public function resizeFit($width, $height, $background=false) {// |
|
38 | - if (!$width) $width = 1; |
|
39 | - if (!$height) $height = 1; |
|
44 | + public function resizeFit($width, $height, $background=false) |
|
45 | + { |
|
46 | +// |
|
47 | + if (!$width) { |
|
48 | + $width = 1; |
|
49 | + } |
|
50 | + if (!$height) { |
|
51 | + $height = 1; |
|
52 | + } |
|
40 | 53 | |
41 | 54 | try { |
42 | 55 | $this->image->scaleImage($width, $height, true); |
@@ -69,43 +82,58 @@ discard block |
||
69 | 82 | } |
70 | 83 | } |
71 | 84 | |
72 | - public function resizeCrop($width, $height, $offset=false) { |
|
73 | - if (!$width) $width = 1; |
|
74 | - if (!$height) $height = 1; |
|
85 | + public function resizeCrop($width, $height, $offset=false) |
|
86 | + { |
|
87 | + if (!$width) { |
|
88 | + $width = 1; |
|
89 | + } |
|
90 | + if (!$height) { |
|
91 | + $height = 1; |
|
92 | + } |
|
75 | 93 | |
76 | 94 | if (($this->width / $this->height) > ($width / $height)) { |
77 | 95 | $h = $height; |
78 | 96 | $w = ($this->width * $h) / $this->height; |
79 | 97 | $y = 0; |
80 | 98 | if ($offset !== false) { |
81 | - if ($offset > 0) |
|
82 | - $offset = -$offset; |
|
83 | - if (($w + $offset) <= $width) |
|
84 | - $offset = $width - $w; |
|
99 | + if ($offset > 0) { |
|
100 | + $offset = -$offset; |
|
101 | + } |
|
102 | + if (($w + $offset) <= $width) { |
|
103 | + $offset = $width - $w; |
|
104 | + } |
|
85 | 105 | $x = $offset; |
86 | - } else |
|
87 | - $x = ($width - $w) / 2; |
|
106 | + } else { |
|
107 | + $x = ($width - $w) / 2; |
|
108 | + } |
|
88 | 109 | |
89 | 110 | } else { |
90 | 111 | $w = $width; |
91 | 112 | $h = ($this->height * $w) / $this->width; |
92 | 113 | $x = 0; |
93 | 114 | if ($offset !== false) { |
94 | - if ($offset > 0) |
|
95 | - $offset = -$offset; |
|
96 | - if (($h + $offset) <= $height) |
|
97 | - $offset = $height - $h; |
|
115 | + if ($offset > 0) { |
|
116 | + $offset = -$offset; |
|
117 | + } |
|
118 | + if (($h + $offset) <= $height) { |
|
119 | + $offset = $height - $h; |
|
120 | + } |
|
98 | 121 | $y = $offset; |
99 | - } else |
|
100 | - $y = ($height - $h) / 2; |
|
122 | + } else { |
|
123 | + $y = ($height - $h) / 2; |
|
124 | + } |
|
101 | 125 | } |
102 | 126 | |
103 | 127 | $x = round($x); |
104 | 128 | $y = round($y); |
105 | 129 | $w = round($w); |
106 | 130 | $h = round($h); |
107 | - if (!$w) $w = 1; |
|
108 | - if (!$h) $h = 1; |
|
131 | + if (!$w) { |
|
132 | + $w = 1; |
|
133 | + } |
|
134 | + if (!$h) { |
|
135 | + $h = 1; |
|
136 | + } |
|
109 | 137 | |
110 | 138 | try { |
111 | 139 | $this->image->scaleImage($w, $h); |
@@ -119,7 +147,8 @@ discard block |
||
119 | 147 | return true; |
120 | 148 | } |
121 | 149 | |
122 | - public function rotate($angle, $background="#000000") { |
|
150 | + public function rotate($angle, $background="#000000") |
|
151 | + { |
|
123 | 152 | try { |
124 | 153 | $this->image->rotateImage($background, $angle); |
125 | 154 | $w = $this->image->getImageWidth(); |
@@ -132,7 +161,8 @@ discard block |
||
132 | 161 | return true; |
133 | 162 | } |
134 | 163 | |
135 | - public function flipHorizontal() { |
|
164 | + public function flipHorizontal() |
|
165 | + { |
|
136 | 166 | try { |
137 | 167 | $this->image->flopImage(); |
138 | 168 | } catch (Exception $e) { |
@@ -141,7 +171,8 @@ discard block |
||
141 | 171 | return true; |
142 | 172 | } |
143 | 173 | |
144 | - public function flipVertical() { |
|
174 | + public function flipVertical() |
|
175 | + { |
|
145 | 176 | try { |
146 | 177 | $this->image->flipImage(); |
147 | 178 | } catch (Exception $e) { |
@@ -150,7 +181,8 @@ discard block |
||
150 | 181 | return true; |
151 | 182 | } |
152 | 183 | |
153 | - public function watermark($file, $left=false, $top=false) { |
|
184 | + public function watermark($file, $left=false, $top=false) |
|
185 | + { |
|
154 | 186 | try { |
155 | 187 | $wm = new Gmagick($file); |
156 | 188 | $w = $wm->getImageWidth(); |
@@ -171,8 +203,9 @@ discard block |
||
171 | 203 | if ((($x + $w) > $this->width) || |
172 | 204 | (($y + $h) > $this->height) || |
173 | 205 | ($x < 0) || ($y < 0) |
174 | - ) |
|
175 | - return false; |
|
206 | + ) { |
|
207 | + return false; |
|
208 | + } |
|
176 | 209 | |
177 | 210 | try { |
178 | 211 | $this->image->compositeImage($wm, 1, $x, $y); |
@@ -185,7 +218,8 @@ discard block |
||
185 | 218 | |
186 | 219 | // ABSTRACT PROTECTED METHODS |
187 | 220 | |
188 | - protected function getBlankImage($width, $height) { |
|
221 | + protected function getBlankImage($width, $height) |
|
222 | + { |
|
189 | 223 | try { |
190 | 224 | $img = new Gmagick(); |
191 | 225 | $img->newImage($width, $height, "none"); |
@@ -195,7 +229,8 @@ discard block |
||
195 | 229 | return $img; |
196 | 230 | } |
197 | 231 | |
198 | - protected function getImage($image, &$width, &$height) { |
|
232 | + protected function getImage($image, &$width, &$height) |
|
233 | + { |
|
199 | 234 | |
200 | 235 | if (is_object($image) && ($image instanceof image_gmagick)) { |
201 | 236 | $width = $image->width; |
@@ -225,18 +260,21 @@ discard block |
||
225 | 260 | $height = $h; |
226 | 261 | return $image; |
227 | 262 | |
228 | - } else |
|
229 | - return false; |
|
263 | + } else { |
|
264 | + return false; |
|
265 | + } |
|
230 | 266 | } |
231 | 267 | |
232 | 268 | |
233 | 269 | // PSEUDO-ABSTRACT STATIC METHODS |
234 | 270 | |
235 | - static function available() { |
|
271 | + static function available() |
|
272 | + { |
|
236 | 273 | return class_exists("Gmagick"); |
237 | 274 | } |
238 | 275 | |
239 | - static function checkImage($file) { |
|
276 | + static function checkImage($file) |
|
277 | + { |
|
240 | 278 | try { |
241 | 279 | $img = new Gmagic($file); |
242 | 280 | } catch (Exception $e) { |
@@ -248,7 +286,8 @@ discard block |
||
248 | 286 | |
249 | 287 | // INHERIT METHODS |
250 | 288 | |
251 | - public function output($type="jpeg", array $options=array()) { |
|
289 | + public function output($type="jpeg", array $options=array()) |
|
290 | + { |
|
252 | 291 | $type = strtolower($type); |
253 | 292 | try { |
254 | 293 | $this->image->setImageFormat($type); |
@@ -256,8 +295,9 @@ discard block |
||
256 | 295 | return false; |
257 | 296 | } |
258 | 297 | $method = "optimize_$type"; |
259 | - if (method_exists($this, $method) && !$this->$method($options)) |
|
260 | - return false; |
|
298 | + if (method_exists($this, $method) && !$this->$method($options)) { |
|
299 | + return false; |
|
300 | + } |
|
261 | 301 | |
262 | 302 | if (!isset($options['file'])) { |
263 | 303 | if (!headers_sent()) { |
@@ -287,7 +327,8 @@ discard block |
||
287 | 327 | |
288 | 328 | // OWN METHODS |
289 | 329 | |
290 | - protected function optimize_jpeg(array $options=array()) { |
|
330 | + protected function optimize_jpeg(array $options=array()) |
|
331 | + { |
|
291 | 332 | $quality = isset($options['quality']) ? $options['quality'] : self::DEFAULT_JPEG_QUALITY; |
292 | 333 | try { |
293 | 334 | $this->image->setCompressionQuality($quality); |
@@ -13,20 +13,23 @@ discard block |
||
13 | 13 | * @link http://kcfinder.sunhater.com |
14 | 14 | */ |
15 | 15 | |
16 | -class zipFolder { |
|
16 | +class zipFolder |
|
17 | +{ |
|
17 | 18 | protected $zip; |
18 | 19 | protected $root; |
19 | 20 | protected $ignored; |
20 | 21 | |
21 | - function __construct($file, $folder, $ignored=null) { |
|
22 | + function __construct($file, $folder, $ignored=null) |
|
23 | + { |
|
22 | 24 | $this->zip = new ZipArchive(); |
23 | 25 | |
24 | 26 | $this->ignored = is_array($ignored) |
25 | 27 | ? $ignored |
26 | 28 | : ($ignored ? array($ignored) : array()); |
27 | 29 | |
28 | - if ($this->zip->open($file, ZIPARCHIVE::CREATE) !== TRUE) |
|
29 | - throw new Exception("cannot open <$file>\n"); |
|
30 | + if ($this->zip->open($file, ZIPARCHIVE::CREATE) !== TRUE) { |
|
31 | + throw new Exception("cannot open <$file>\n"); |
|
32 | + } |
|
30 | 33 | |
31 | 34 | $folder = rtrim($folder, '/'); |
32 | 35 | |
@@ -39,19 +42,22 @@ discard block |
||
39 | 42 | $this->zip->close(); |
40 | 43 | } |
41 | 44 | |
42 | - function zip($folder, $parent=null) { |
|
45 | + function zip($folder, $parent=null) |
|
46 | + { |
|
43 | 47 | $full_path = "{$this->root}$parent$folder"; |
44 | 48 | $zip_path = "$parent$folder"; |
45 | 49 | $this->zip->addEmptyDir($zip_path); |
46 | 50 | $dir = new DirectoryIterator($full_path); |
47 | - foreach ($dir as $file) |
|
48 | - if (!$file->isDot()) { |
|
51 | + foreach ($dir as $file) { |
|
52 | + if (!$file->isDot()) { |
|
49 | 53 | $filename = $file->getFilename(); |
54 | + } |
|
50 | 55 | if (!in_array($filename, $this->ignored)) { |
51 | - if ($file->isDir()) |
|
52 | - $this->zip($filename, "$zip_path/"); |
|
53 | - else |
|
54 | - $this->zip->addFile("$full_path/$filename", "$zip_path/$filename"); |
|
56 | + if ($file->isDir()) { |
|
57 | + $this->zip($filename, "$zip_path/"); |
|
58 | + } else { |
|
59 | + $this->zip->addFile("$full_path/$filename", "$zip_path/$filename"); |
|
60 | + } |
|
55 | 61 | } |
56 | 62 | } |
57 | 63 | } |
@@ -14,14 +14,19 @@ |
||
14 | 14 | |
15 | 15 | require "core/autoload.php"; // Init MODX |
16 | 16 | |
17 | -function returnNoPermissionsMessage($role) { |
|
17 | +function returnNoPermissionsMessage($role) |
|
18 | +{ |
|
18 | 19 | global $_lang; |
19 | 20 | echo sprintf($_lang['files_management_no_permission'], $role); |
20 | 21 | exit; |
21 | 22 | } |
22 | 23 | |
23 | -if( $_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images'); |
|
24 | -if( $_GET['type'] == 'files' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) returnNoPermissionsMessage('assets_files'); |
|
24 | +if( $_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) { |
|
25 | + returnNoPermissionsMessage('assets_images'); |
|
26 | +} |
|
27 | +if( $_GET['type'] == 'files' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) { |
|
28 | + returnNoPermissionsMessage('assets_files'); |
|
29 | +} |
|
25 | 30 | |
26 | 31 | $browser = new browser($modx); |
27 | 32 | $browser->action(); |
@@ -1,24 +1,37 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
4 | + function __construct() |
|
5 | + { |
|
4 | 6 | } |
5 | - function getDP() { |
|
7 | + function getDP() |
|
8 | + { |
|
6 | 9 | global $modx; |
7 | 10 | |
8 | 11 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
9 | - if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
12 | + if(!isset($modx->config['lang_code'])) { |
|
13 | + $modx->config['lang_code'] = $this->getLangCode(); |
|
14 | + } |
|
10 | 15 | $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
11 | 16 | return $modx->mergeSettingsContent($load_script); |
12 | 17 | } |
13 | - function getLangCode() { |
|
18 | + function getLangCode() |
|
19 | + { |
|
14 | 20 | global $modx, $modx_lang_attribute; |
15 | 21 | |
16 | - if(!$modx_lang_attribute) return 'en'; |
|
22 | + if(!$modx_lang_attribute) { |
|
23 | + return 'en'; |
|
24 | + } |
|
17 | 25 | |
18 | 26 | $lc = $modx_lang_attribute; |
19 | - if($lc=='uk') return 'ru'; |
|
27 | + if($lc=='uk') { |
|
28 | + return 'ru'; |
|
29 | + } |
|
20 | 30 | $dp_path = str_replace('\\','/',dirname(__FILE__)); |
21 | - if(is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) return $modx_lang_attribute; |
|
22 | - else return 'en'; |
|
31 | + if(is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) { |
|
32 | + return $modx_lang_attribute; |
|
33 | + } else { |
|
34 | + return 'en'; |
|
35 | + } |
|
23 | 36 | } |
24 | 37 | } |
@@ -3,9 +3,11 @@ |
||
3 | 3 | |
4 | 4 | $modx->addSnippet('hasPermission','return $modx->hasPermission($key);'); |
5 | 5 | |
6 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) |
|
7 | - $hasAnyPermission = 1; |
|
8 | -else $hasAnyPermission = 0; |
|
6 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
7 | + $hasAnyPermission = 1; |
|
8 | +} else { |
|
9 | + $hasAnyPermission = 0; |
|
10 | +} |
|
9 | 11 | $modx->addSnippet('hasAnyPermission','global $hasAnyPermission; return $hasAnyPermission;'); |
10 | 12 | $modx->addSnippet('getLoginUserName','return $modx->getLoginUserName();'); |
11 | 13 | $code = 'global $_lang;return $_SESSION["nrtotalmessages"] ? sprintf($_lang["welcome_messages"], $_SESSION["nrtotalmessages"], \'<span style="color:red;">\' . $_SESSION["nrnewmessages"] . "</span>") : $_lang["messages_no_messages"];'; |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | |
8 | 8 | $modx->db->connect(); |
9 | 9 | |
10 | -if (empty ($modx->config)) { |
|
10 | +if (empty ($modx->config)) { |
|
11 | 11 | $modx->getSettings(); |
12 | 12 | } |
13 | 13 | |
14 | -if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) { |
|
14 | +if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) { |
|
15 | 15 | $modx->sendErrorPage(); |
16 | 16 | } |
17 | 17 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $_lang = array(); |
22 | 22 | include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
23 | -if ($modx->config['manager_language'] != 'english') { |
|
23 | +if ($modx->config['manager_language'] != 'english') { |
|
24 | 24 | include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
25 | 25 | } |
26 | 26 | include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | // set limit sql query |
34 | 34 | $limit = !empty($modx->config['number_of_results']) ? (int) $modx->config['number_of_results'] : 100; |
35 | 35 | |
36 | -if (isset($action)) { |
|
37 | - switch ($action) { |
|
36 | +if (isset($action)) { |
|
37 | + switch ($action) { |
|
38 | 38 | |
39 | 39 | case '1': { |
40 | 40 | |
41 | - switch ($frame) { |
|
41 | + switch ($frame) { |
|
42 | 42 | case 'nodes': |
43 | 43 | include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : ''; |
54 | 54 | |
55 | - if ($elements) { |
|
55 | + if ($elements) { |
|
56 | 56 | $output = ''; |
57 | 57 | $items = ''; |
58 | 58 | $sql = ''; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
62 | 62 | $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
63 | 63 | |
64 | - switch ($elements) { |
|
64 | + switch ($elements) { |
|
65 | 65 | case 'element_templates': |
66 | 66 | $a = 16; |
67 | 67 | $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | ORDER BY t1.templatename ASC |
72 | 72 | ' . $sqlLimit); |
73 | 73 | |
74 | - if ($modx->hasPermission('new_template')) { |
|
74 | + if ($modx->hasPermission('new_template')) { |
|
75 | 75 | $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
76 | 76 | } |
77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ORDER BY t1.name ASC |
88 | 88 | ' . $sqlLimit); |
89 | 89 | |
90 | - if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
90 | + if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
91 | 91 | $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
92 | 92 | } |
93 | 93 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ORDER BY t1.name ASC |
102 | 102 | ' . $sqlLimit); |
103 | 103 | |
104 | - if ($modx->hasPermission('new_chunk')) { |
|
104 | + if ($modx->hasPermission('new_chunk')) { |
|
105 | 105 | $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
106 | 106 | } |
107 | 107 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ORDER BY t1.name ASC |
116 | 116 | ' . $sqlLimit); |
117 | 117 | |
118 | - if ($modx->hasPermission('new_snippet')) { |
|
118 | + if ($modx->hasPermission('new_snippet')) { |
|
119 | 119 | $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
120 | 120 | } |
121 | 121 | |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | ORDER BY t1.name ASC |
130 | 130 | ' . $sqlLimit); |
131 | 131 | |
132 | - if ($modx->hasPermission('new_plugin')) { |
|
132 | + if ($modx->hasPermission('new_plugin')) { |
|
133 | 133 | $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
134 | 134 | } |
135 | 135 | |
136 | 136 | break; |
137 | 137 | } |
138 | 138 | |
139 | - if ($count = $modx->db->getRecordCount($sql)) { |
|
140 | - if ($count == $limit) { |
|
139 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
140 | + if ($count == $limit) { |
|
141 | 141 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
142 | 142 | } |
143 | - while ($row = $modx->db->getRow($sql)) { |
|
144 | - if (($row['disabled'] || $row['locked']) && $role != 1) { |
|
143 | + while ($row = $modx->db->getRow($sql)) { |
|
144 | + if (($row['disabled'] || $row['locked']) && $role != 1) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - if (isset($_REQUEST['filter'])) { |
|
152 | + if (isset($_REQUEST['filter'])) { |
|
153 | 153 | $output = $items; |
154 | - } else { |
|
154 | + } else { |
|
155 | 155 | $output .= $items; |
156 | 156 | } |
157 | 157 | |
@@ -176,22 +176,22 @@ discard block |
||
176 | 176 | ORDER BY t1.username ASC |
177 | 177 | ' . $sqlLimit); |
178 | 178 | |
179 | - if ($modx->hasPermission('new_user')) { |
|
179 | + if ($modx->hasPermission('new_user')) { |
|
180 | 180 | $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
181 | 181 | } |
182 | 182 | |
183 | - if ($count = $modx->db->getRecordCount($sql)) { |
|
184 | - if ($count == $limit) { |
|
183 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
184 | + if ($count == $limit) { |
|
185 | 185 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
186 | 186 | } |
187 | - while ($row = $modx->db->getRow($sql)) { |
|
187 | + while ($row = $modx->db->getRow($sql)) { |
|
188 | 188 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - if (isset($_REQUEST['filter'])) { |
|
192 | + if (isset($_REQUEST['filter'])) { |
|
193 | 193 | $output = $items; |
194 | - } else { |
|
194 | + } else { |
|
195 | 195 | $output .= $items; |
196 | 196 | } |
197 | 197 | |
@@ -215,22 +215,22 @@ discard block |
||
215 | 215 | ORDER BY t1.username ASC |
216 | 216 | ' . $sqlLimit); |
217 | 217 | |
218 | - if ($modx->hasPermission('new_web_user')) { |
|
218 | + if ($modx->hasPermission('new_web_user')) { |
|
219 | 219 | $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
220 | 220 | } |
221 | 221 | |
222 | - if ($count = $modx->db->getRecordCount($sql)) { |
|
223 | - if ($count == $limit) { |
|
222 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
223 | + if ($count == $limit) { |
|
224 | 224 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
225 | 225 | } |
226 | - while ($row = $modx->db->getRow($sql)) { |
|
226 | + while ($row = $modx->db->getRow($sql)) { |
|
227 | 227 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | - if (isset($_REQUEST['filter'])) { |
|
231 | + if (isset($_REQUEST['filter'])) { |
|
232 | 232 | $output = $items; |
233 | - } else { |
|
233 | + } else { |
|
234 | 234 | $output .= $items; |
235 | 235 | } |
236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->db->escape($_REQUEST['type']) : false; |
245 | 245 | $contextmenu = ''; |
246 | 246 | |
247 | - if ($role && $name && $type) { |
|
248 | - switch ($type) { |
|
247 | + if ($role && $name && $type) { |
|
248 | + switch ($type) { |
|
249 | 249 | case 'Snippet': |
250 | 250 | case 'SnippetNoCache': { |
251 | 251 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | WHERE name="' . $name . '" |
255 | 255 | LIMIT 1'); |
256 | 256 | |
257 | - if ($modx->db->getRecordCount($sql)) { |
|
257 | + if ($modx->db->getRecordCount($sql)) { |
|
258 | 258 | $row = $modx->db->getRow($sql); |
259 | 259 | $contextmenu = array( |
260 | 260 | 'header' => array( |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | 'url' => "index.php?a=22&id=" . $row['id'] |
266 | 266 | ) |
267 | 267 | ); |
268 | - if (!empty($row['description'])) { |
|
268 | + if (!empty($row['description'])) { |
|
269 | 269 | $contextmenu['seperator'] = ''; |
270 | 270 | $contextmenu['description'] = array( |
271 | 271 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
272 | 272 | ); |
273 | 273 | } |
274 | - } else { |
|
274 | + } else { |
|
275 | 275 | $contextmenu = array( |
276 | 276 | 'header' => array( |
277 | 277 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | WHERE name="' . $name . '" |
293 | 293 | LIMIT 1'); |
294 | 294 | |
295 | - if ($modx->db->getRecordCount($sql)) { |
|
295 | + if ($modx->db->getRecordCount($sql)) { |
|
296 | 296 | $row = $modx->db->getRow($sql); |
297 | 297 | $contextmenu = array( |
298 | 298 | 'header' => array( |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | 'url' => "index.php?a=78&id=" . $row['id'] |
304 | 304 | ) |
305 | 305 | ); |
306 | - if (!empty($row['description'])) { |
|
306 | + if (!empty($row['description'])) { |
|
307 | 307 | $contextmenu['seperator'] = ''; |
308 | 308 | $contextmenu['description'] = array( |
309 | 309 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
310 | 310 | ); |
311 | 311 | } |
312 | - } else { |
|
312 | + } else { |
|
313 | 313 | $contextmenu = array( |
314 | 314 | 'header' => array( |
315 | 315 | 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | WHERE name="' . $name . '" |
330 | 330 | LIMIT 1'); |
331 | 331 | |
332 | - if ($modx->db->getRecordCount($sql)) { |
|
332 | + if ($modx->db->getRecordCount($sql)) { |
|
333 | 333 | $row = $modx->db->getRow($sql); |
334 | 334 | $contextmenu = array( |
335 | 335 | 'header' => array( |
@@ -340,20 +340,20 @@ discard block |
||
340 | 340 | 'url' => "index.php?a=78&id=" . $row['id'] |
341 | 341 | ) |
342 | 342 | ); |
343 | - if (!empty($row['description'])) { |
|
343 | + if (!empty($row['description'])) { |
|
344 | 344 | $contextmenu['seperator'] = ''; |
345 | 345 | $contextmenu['description'] = array( |
346 | 346 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
347 | 347 | ); |
348 | 348 | } |
349 | - } else { |
|
349 | + } else { |
|
350 | 350 | |
351 | 351 | $sql = $modx->db->query('SELECT * |
352 | 352 | FROM ' . $modx->getFullTableName('site_snippets') . ' |
353 | 353 | WHERE name="' . $name . '" |
354 | 354 | LIMIT 1'); |
355 | 355 | |
356 | - if ($modx->db->getRecordCount($sql)) { |
|
356 | + if ($modx->db->getRecordCount($sql)) { |
|
357 | 357 | $row = $modx->db->getRow($sql); |
358 | 358 | $contextmenu = array( |
359 | 359 | 'header' => array( |
@@ -364,13 +364,13 @@ discard block |
||
364 | 364 | 'url' => "index.php?a=22&id=" . $row['id'] |
365 | 365 | ) |
366 | 366 | ); |
367 | - if (!empty($row['description'])) { |
|
367 | + if (!empty($row['description'])) { |
|
368 | 368 | $contextmenu['seperator'] = ''; |
369 | 369 | $contextmenu['description'] = array( |
370 | 370 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
371 | 371 | ); |
372 | 372 | } |
373 | - } else { |
|
373 | + } else { |
|
374 | 374 | $contextmenu = array( |
375 | 375 | 'header' => array( |
376 | 376 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | 'alias_visible' |
433 | 433 | ); |
434 | 434 | |
435 | - if (in_array($name, $default_field)) { |
|
435 | + if (in_array($name, $default_field)) { |
|
436 | 436 | return; |
437 | 437 | } |
438 | 438 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | WHERE name="' . $name . '" |
442 | 442 | LIMIT 1'); |
443 | 443 | |
444 | - if ($modx->db->getRecordCount($sql)) { |
|
444 | + if ($modx->db->getRecordCount($sql)) { |
|
445 | 445 | $row = $modx->db->getRow($sql); |
446 | 446 | $contextmenu = array( |
447 | 447 | 'header' => array( |
@@ -452,13 +452,13 @@ discard block |
||
452 | 452 | 'url' => "index.php?a=301&id=" . $row['id'] |
453 | 453 | ) |
454 | 454 | ); |
455 | - if (!empty($row['description'])) { |
|
455 | + if (!empty($row['description'])) { |
|
456 | 456 | $contextmenu['seperator'] = ''; |
457 | 457 | $contextmenu['description'] = array( |
458 | 458 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
459 | 459 | ); |
460 | 460 | } |
461 | - } else { |
|
461 | + } else { |
|
462 | 462 | $contextmenu = array( |
463 | 463 | 'header' => array( |
464 | 464 | 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
@@ -483,13 +483,13 @@ discard block |
||
483 | 483 | case 'movedocument' : { |
484 | 484 | $json = array(); |
485 | 485 | |
486 | - if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
486 | + if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
487 | 487 | $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
488 | 488 | $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
489 | 489 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
490 | 490 | |
491 | 491 | // set parent |
492 | - if ($id && $parent >= 0) { |
|
492 | + if ($id && $parent >= 0) { |
|
493 | 493 | |
494 | 494 | // find older parent |
495 | 495 | $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id)); |
@@ -500,31 +500,31 @@ discard block |
||
500 | 500 | 'new_parent' => $parent, |
501 | 501 | ]); |
502 | 502 | |
503 | - if (is_array($eventOut) && count($eventOut) > 0) { |
|
503 | + if (is_array($eventOut) && count($eventOut) > 0) { |
|
504 | 504 | $eventParent = array_pop($eventOut); |
505 | 505 | |
506 | - if ($eventParent == $parentOld) { |
|
506 | + if ($eventParent == $parentOld) { |
|
507 | 507 | $json['errors'] = $_lang['error_movedocument2']; |
508 | - } else { |
|
508 | + } else { |
|
509 | 509 | $parent = $eventParent; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | - if (empty($json['errors'])) { |
|
513 | + if (empty($json['errors'])) { |
|
514 | 514 | // check privileges user for move docs |
515 | - if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
515 | + if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
516 | 516 | $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')'); |
517 | - if ($modx->db->getRecordCount($sql)) { |
|
517 | + if ($modx->db->getRecordCount($sql)) { |
|
518 | 518 | $document_groups = array(); |
519 | - while ($row = $modx->db->getRow($sql)) { |
|
519 | + while ($row = $modx->db->getRow($sql)) { |
|
520 | 520 | $document_groups[$row['document']]['groups'][] = $row['document_group']; |
521 | 521 | } |
522 | - foreach ($document_groups as $key => $value) { |
|
523 | - if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
522 | + foreach ($document_groups as $key => $value) { |
|
523 | + if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
524 | 524 | $json['errors'] = $_lang["error_no_privileges"]; |
525 | 525 | } |
526 | 526 | } |
527 | - if ($json['errors']) { |
|
527 | + if ($json['errors']) { |
|
528 | 528 | header('content-type: application/json'); |
529 | 529 | echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE); |
530 | 530 | break; |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
535 | - if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
535 | + if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
536 | 536 | $json['errors'] = $_lang["error_no_privileges"]; |
537 | - } else { |
|
537 | + } else { |
|
538 | 538 | // set new parent |
539 | 539 | $modx->db->update(array( |
540 | 540 | 'parent' => $parent |
@@ -544,13 +544,13 @@ discard block |
||
544 | 544 | 'isfolder' => 1 |
545 | 545 | ), $modx->getFullTableName('site_content'), 'id=' . $parent); |
546 | 546 | |
547 | - if ($parent != $parentOld) { |
|
547 | + if ($parent != $parentOld) { |
|
548 | 548 | // check children docs and set parent isfolder |
549 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
549 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
550 | 550 | $modx->db->update(array( |
551 | 551 | 'isfolder' => 1 |
552 | 552 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
553 | - } else { |
|
553 | + } else { |
|
554 | 554 | $modx->db->update(array( |
555 | 555 | 'isfolder' => 0 |
556 | 556 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
@@ -558,16 +558,16 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | // set menuindex |
561 | - if (!empty($menuindex)) { |
|
561 | + if (!empty($menuindex)) { |
|
562 | 562 | $menuindex = explode(',', $menuindex); |
563 | - foreach ($menuindex as $key => $value) { |
|
563 | + foreach ($menuindex as $key => $value) { |
|
564 | 564 | $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value); |
565 | 565 | } |
566 | - } else { |
|
566 | + } else { |
|
567 | 567 | // TODO: max(*) menuindex |
568 | 568 | } |
569 | 569 | |
570 | - if (!$json['errors']) { |
|
570 | + if (!$json['errors']) { |
|
571 | 571 | $json['success'] = $_lang["actioncomplete"]; |
572 | 572 | |
573 | 573 | $modx->invokeEvent('onAfterMoveDocument', [ |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | } |
580 | 580 | } |
581 | 581 | } |
582 | - } else { |
|
582 | + } else { |
|
583 | 583 | $json['errors'] = $_lang["error_no_privileges"]; |
584 | 584 | } |
585 | 585 | |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | |
596 | 596 | $output = !!$modx->elementIsLocked($type, $id, true); |
597 | 597 | |
598 | - if (!$output) { |
|
598 | + if (!$output) { |
|
599 | 599 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
600 | 600 | $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : ''; |
601 | 601 | $sql = ' |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id |
605 | 605 | WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
606 | 606 | $sql = $modx->db->query($sql); |
607 | - if ($modx->db->getRecordCount($sql)) { |
|
607 | + if ($modx->db->getRecordCount($sql)) { |
|
608 | 608 | $row = $modx->db->getRow($sql); |
609 | 609 | $output = !!$row['locked']; |
610 | 610 | } |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | */ |
11 | 11 | $style_path = 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
12 | 12 | $modx->config['mgr_date_picker_path'] = 'media/calendar/datepicker.inc.php'; |
13 | -if(!$modx->config['lang_code']) { |
|
13 | +if(!$modx->config['lang_code']) { |
|
14 | 14 | global $modx_lang_attribute; |
15 | 15 | $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
16 | 16 | } |
17 | 17 | |
18 | -if($_GET['a'] == 2) { |
|
18 | +if($_GET['a'] == 2) { |
|
19 | 19 | include_once('welcome.php'); |
20 | 20 | } |
21 | 21 | |
@@ -262,68 +262,68 @@ discard block |
||
262 | 262 | |
263 | 263 | // actions buttons templates |
264 | 264 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
265 | -if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) { |
|
265 | +if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) { |
|
266 | 266 | $_REQUEST['stay'] = 2; |
267 | 267 | } |
268 | -if (isset($_REQUEST['stay'])) { |
|
268 | +if (isset($_REQUEST['stay'])) { |
|
269 | 269 | $_SESSION['stay'] = $_REQUEST['stay']; |
270 | -} else if (isset($_SESSION['stay'])) { |
|
270 | +} else if (isset($_SESSION['stay'])) { |
|
271 | 271 | $_REQUEST['stay'] = $_SESSION['stay']; |
272 | 272 | } |
273 | 273 | $stay = isset($_REQUEST['stay']) ? $_REQUEST['stay'] : ''; |
274 | 274 | $addnew = 0; |
275 | 275 | $run = 0; |
276 | -switch($action) { |
|
276 | +switch($action) { |
|
277 | 277 | case '3': |
278 | 278 | case '4': |
279 | 279 | case '27': |
280 | 280 | case '72': |
281 | - if($modx->hasPermission('new_document')) { |
|
281 | + if($modx->hasPermission('new_document')) { |
|
282 | 282 | $addnew = 1; |
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case '16': |
286 | 286 | case '19': |
287 | - if($modx->hasPermission('new_template')) { |
|
287 | + if($modx->hasPermission('new_template')) { |
|
288 | 288 | $addnew = 1; |
289 | 289 | } |
290 | 290 | break; |
291 | 291 | case '300': |
292 | 292 | case '301': |
293 | - if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
293 | + if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
294 | 294 | $addnew = 1; |
295 | 295 | } |
296 | 296 | break; |
297 | 297 | case '77': |
298 | 298 | case '78': |
299 | - if($modx->hasPermission('new_chunk')) { |
|
299 | + if($modx->hasPermission('new_chunk')) { |
|
300 | 300 | $addnew = 1; |
301 | 301 | } |
302 | 302 | break; |
303 | 303 | case '22': |
304 | 304 | case '23': |
305 | - if($modx->hasPermission('new_snippet')) { |
|
305 | + if($modx->hasPermission('new_snippet')) { |
|
306 | 306 | $addnew = 1; |
307 | 307 | } |
308 | 308 | break; |
309 | 309 | case '101': |
310 | 310 | case '102': |
311 | - if($modx->hasPermission('new_plugin')) { |
|
311 | + if($modx->hasPermission('new_plugin')) { |
|
312 | 312 | $addnew = 1; |
313 | 313 | } |
314 | 314 | break; |
315 | 315 | case '106': |
316 | 316 | case '107': |
317 | 317 | case '108': |
318 | - if($modx->hasPermission('new_module')) { |
|
318 | + if($modx->hasPermission('new_module')) { |
|
319 | 319 | $addnew = 1; |
320 | 320 | } |
321 | - if($modx->hasPermission('exec_module')) { |
|
321 | + if($modx->hasPermission('exec_module')) { |
|
322 | 322 | $run = 1; |
323 | 323 | } |
324 | 324 | break; |
325 | 325 | case '88': |
326 | - if($modx->hasPermission('new_web_user')) { |
|
326 | + if($modx->hasPermission('new_web_user')) { |
|
327 | 327 | $addnew = 1; |
328 | 328 | } |
329 | 329 | break; |
@@ -1,8 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
4 | + function __construct() |
|
5 | + { |
|
4 | 6 | } |
5 | - function getDP() { |
|
7 | + function getDP() |
|
8 | + { |
|
6 | 9 | global $modx,$_lang; |
7 | 10 | |
8 | 11 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | NOTE: http://www.w3.org/TR/NOTE-datetime |
23 | 23 | \*======================================================================*/ |
24 | 24 | |
25 | -function parse_w3cdtf ( $date_str ) { |
|
25 | +function parse_w3cdtf ( $date_str ) |
|
26 | +{ |
|
26 | 27 | |
27 | 28 | # regex to match wc3dtf |
28 | 29 | $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; |
@@ -37,8 +38,7 @@ discard block |
||
37 | 38 | $offset = 0; |
38 | 39 | if ( $match[10] == 'Z' ) { |
39 | 40 | # zulu time, aka GMT |
40 | - } |
|
41 | - else { |
|
41 | + } else { |
|
42 | 42 | list( $tz_mod, $tz_hour, $tz_min ) = |
43 | 43 | array( $match[8], $match[9], $match[10]); |
44 | 44 | |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | $epoch = $epoch + $offset; |
60 | 60 | return $epoch; |
61 | - } |
|
62 | - else { |
|
61 | + } else { |
|
63 | 62 | return -1; |
64 | 63 | } |
65 | 64 | } |