GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( e7eb83...70ade0 )
by gyeong-won
12:55
created
classes/validator/Validator.class.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$this->_filters = array();
82 82
 		$this->_xml_ruleset = NULL;
83 83
 
84
-		if($xml_path)
84
+		if ($xml_path)
85 85
 			$this->load($xml_path);
86 86
 
87 87
 		// predefined rules
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		));
97 97
 
98 98
 		$this->_has_mb_func = is_callable('mb_strlen');
99
-		$this->setCacheDir(_XE_PATH_ . 'files/cache');
99
+		$this->setCacheDir(_XE_PATH_.'files/cache');
100 100
 	}
101 101
 
102 102
 	/**
@@ -119,32 +119,32 @@  discard block
 block discarded – undo
119 119
 		$this->_xml_ruleset = NULL;
120 120
 
121 121
 		$xml_path = realpath($xml_path);
122
-		if(!is_readable($xml_path))
122
+		if (!is_readable($xml_path))
123 123
 		{
124 124
 			return FALSE;
125 125
 		}
126 126
 
127 127
 		$parser = new XmlParser();
128 128
 		$xml = $parser->loadXmlFile($xml_path);
129
-		if(!isset($xml->ruleset) || !isset($xml->ruleset->fields) || !isset($xml->ruleset->fields->field))
129
+		if (!isset($xml->ruleset) || !isset($xml->ruleset->fields) || !isset($xml->ruleset->fields->field))
130 130
 		{
131 131
 			return FALSE;
132 132
 		}
133 133
 
134 134
 		// custom rules
135
-		if(isset($xml->ruleset->customrules) && isset($xml->ruleset->customrules->rule))
135
+		if (isset($xml->ruleset->customrules) && isset($xml->ruleset->customrules->rule))
136 136
 		{
137 137
 			$customrules = $xml->ruleset->customrules->rule;
138
-			if(!is_array($customrules))
138
+			if (!is_array($customrules))
139 139
 			{
140 140
 				$customrules = array($customrules);
141 141
 			}
142 142
 
143 143
 			$rules = array();
144 144
 			$messages = array();
145
-			foreach($customrules as $rule)
145
+			foreach ($customrules as $rule)
146 146
 			{
147
-				if(!isset($rule->attrs) || !isset($rule->attrs->name))
147
+				if (!isset($rule->attrs) || !isset($rule->attrs->name))
148 148
 				{
149 149
 					continue;
150 150
 				}
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 				unset($rule['name']);
157 157
 
158 158
 				$rules[$name] = $rule;
159
-				if(isset($message))
159
+				if (isset($message))
160 160
 				{
161
-					$messages['invalid_' . $name] = $message;
161
+					$messages['invalid_'.$name] = $message;
162 162
 				}
163 163
 			}
164
-			if(count($rules))
164
+			if (count($rules))
165 165
 			{
166 166
 				$this->addRule($rules);
167 167
 			}
@@ -169,19 +169,19 @@  discard block
 block discarded – undo
169 169
 
170 170
 		// filters
171 171
 		$fields = $xml->ruleset->fields->field;
172
-		if(!is_array($fields))
172
+		if (!is_array($fields))
173 173
 		{
174 174
 			$fields = array($fields);
175 175
 		}
176 176
 
177 177
 		$filters = array();
178 178
 		$fieldsNames = array();
179
-		foreach($fields as $field)
179
+		foreach ($fields as $field)
180 180
 		{
181 181
 			$name = '';
182 182
 			$filter = array();
183 183
 
184
-			if(!isset($field->attrs) || !isset($field->attrs->name))
184
+			if (!isset($field->attrs) || !isset($field->attrs->name))
185 185
 			{
186 186
 				continue;
187 187
 			}
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			$filter['title'] = $title;
192 192
 
193 193
 			$name = $filter['name'];
194
-			if(isset($title))
194
+			if (isset($title))
195 195
 			{
196 196
 				$fieldsNames[$name] = $title;
197 197
 			}
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 			unset($filter['name']);
200 200
 
201 201
 			// conditional statement
202
-			if(isset($field->if))
202
+			if (isset($field->if))
203 203
 			{
204 204
 				$if = $field->if;
205
-				if(!is_array($if))
205
+				if (!is_array($if))
206 206
 				{
207 207
 					$if = array($if);
208 208
 				}
209
-				foreach($if as $idx => $cond)
209
+				foreach ($if as $idx => $cond)
210 210
 				{
211 211
 					$if[$idx] = (array) $cond->attrs;
212 212
 				}
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	function setCacheDir($cache_dir)
234 234
 	{
235
-		if(is_dir($cache_dir))
235
+		if (is_dir($cache_dir))
236 236
 		{
237 237
 			$this->_cache_dir = preg_replace('@/$@', '', $cache_dir);
238 238
 		}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	function validate($fields_ = null)
247 247
 	{
248
-		if(is_array($fields_))
248
+		if (is_array($fields_))
249 249
 		{
250 250
 			$fields = $fields_;
251 251
 		}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			$fields = (array) Context::getRequestVars();
256 256
 		}
257 257
 
258
-		if(!is_array($fields))
258
+		if (!is_array($fields))
259 259
 		{
260 260
 			return TRUE;
261 261
 		}
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
 		$filters = array();
277 277
 
278 278
 		// get field names matching patterns
279
-		foreach($this->_filters as $key => $filter)
279
+		foreach ($this->_filters as $key => $filter)
280 280
 		{
281 281
 			$names = array();
282
-			if($key{0} == '^')
282
+			if ($key{0} == '^')
283 283
 			{
284
-				$names = preg_grep('/^' . preg_quote(substr($key, 1)) . '/', $field_names);
284
+				$names = preg_grep('/^'.preg_quote(substr($key, 1)).'/', $field_names);
285 285
 			}
286
-			elseif(substr($key, -2) == '[]')
286
+			elseif (substr($key, -2) == '[]')
287 287
 			{
288 288
 				$filters[substr($key, 0, -2)] = $filter;
289 289
 				unset($filters[$key]);
@@ -293,24 +293,24 @@  discard block
 block discarded – undo
293 293
 				$filters[$key] = $filter;
294 294
 			}
295 295
 
296
-			if(!count($names))
296
+			if (!count($names))
297 297
 			{
298 298
 				continue;
299 299
 			}
300 300
 
301
-			foreach($names as $name)
301
+			foreach ($names as $name)
302 302
 			{
303 303
 				$filters[$name] = $filter;
304 304
 			}
305 305
 			unset($filters[$key]);
306 306
 		}
307 307
 
308
-		foreach($filters as $key => $filter)
308
+		foreach ($filters as $key => $filter)
309 309
 		{
310 310
 			$fname = preg_replace('/\[\]$/', '', $key);
311 311
 			$filter = array_merge($filter_default, $filter);
312 312
 
313
-			if(preg_match("/(^[a-z_]*)[\[](?:\'|\")?([a-z_]*)(?:\'|\")?[\]]$/i", $key, $matches))
313
+			if (preg_match("/(^[a-z_]*)[\[](?:\'|\")?([a-z_]*)(?:\'|\")?[\]]$/i", $key, $matches))
314 314
 			{
315 315
 				$exists = array_key_exists($matches[1], $fields);
316 316
 				$value = $exists ? $fields[$matches[1]][$matches[2]] : NULL;
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 				$value = $exists ? $fields[$fname] : NULL;
322 322
 			}
323 323
 
324
-			if(is_array($value))
324
+			if (is_array($value))
325 325
 			{
326
-				if(!isset($value[tmp_name]))
326
+				if (!isset($value[tmp_name]))
327 327
 				{
328 328
 					$value = implode('', $value);
329 329
 				}
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 			}
335 335
 
336 336
 			// conditional statement
337
-			foreach($filter['if'] as $cond)
337
+			foreach ($filter['if'] as $cond)
338 338
 			{
339
-				if(!isset($cond['test']) || !isset($cond['attr']))
339
+				if (!isset($cond['test']) || !isset($cond['attr']))
340 340
 				{
341 341
 					continue;
342 342
 				}
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
 				$func_body = preg_replace('/\\$(\w+)/', '$c[\'$1\']', $cond['test']);
345 345
 				$func = create_function('$c', "return !!({$func_body});");
346 346
 
347
-				if($func($fields))
347
+				if ($func($fields))
348 348
 				{
349 349
 					$filter[$cond['attr']] = $cond['value'];
350 350
 				}
351 351
 			}
352 352
 
353 353
 			// attr : default
354
-			if(!$value && strlen($default = trim($filter['default'])))
354
+			if (!$value && strlen($default = trim($filter['default'])))
355 355
 			{
356 356
 				$value = $default;
357
-				if(is_null($fields_))
357
+				if (is_null($fields_))
358 358
 				{
359 359
 					Context::set($fname, $value);
360 360
 				}
@@ -366,25 +366,25 @@  discard block
 block discarded – undo
366 366
 			$value_len = strlen($value);
367 367
 
368 368
 			// attr : modifier
369
-			if(is_string($modifiers = $filter['modifiers']))
369
+			if (is_string($modifiers = $filter['modifiers']))
370 370
 			{
371 371
 				$modifiers = explode(',', trim($modifiers));
372 372
 			}
373 373
 
374 374
 			// attr : required
375
-			if($filter['required'] === 'true' && !$value_len)
375
+			if ($filter['required'] === 'true' && !$value_len)
376 376
 			{
377 377
 				return $this->error($key, 'isnull');
378 378
 			}
379 379
 
380 380
 			// if the field wasn't passed, ignore this value
381
-			if(!$exists && !$value_len)
381
+			if (!$exists && !$value_len)
382 382
 			{
383 383
 				continue;
384 384
 			}
385 385
 
386 386
 			// attr : length
387
-			if($length = $filter['length'])
387
+			if ($length = $filter['length'])
388 388
 			{
389 389
 				list($min, $max) = explode(':', trim($length));
390 390
 				$is_min_b = (substr($min, -1) === 'b');
@@ -392,41 +392,41 @@  discard block
 block discarded – undo
392 392
 				list($min, $max) = array((int) $min, (int) $max);
393 393
 
394 394
 				$strbytes = strlen($value);
395
-				if(!$is_min_b || !$is_max_b)
395
+				if (!$is_min_b || !$is_max_b)
396 396
 				{
397 397
 					$strlength = $this->_has_mb_func ? mb_strlen($value, 'utf-8') : $this->mbStrLen($value);
398 398
 				}
399 399
 
400
-				if(($min && $min > ($is_min_b ? $strbytes : $strlength)) || ($max && $max < ($is_max_b ? $strbytes : $strlength)))
400
+				if (($min && $min > ($is_min_b ? $strbytes : $strlength)) || ($max && $max < ($is_max_b ? $strbytes : $strlength)))
401 401
 				{
402 402
 					return $this->error($key, 'outofrange');
403 403
 				}
404 404
 			}
405 405
 
406 406
 			// equalto
407
-			if($equalto = $filter['equalto'])
407
+			if ($equalto = $filter['equalto'])
408 408
 			{
409
-				if(!array_key_exists($equalto, $fields) || trim($fields[$equalto]) !== $value)
409
+				if (!array_key_exists($equalto, $fields) || trim($fields[$equalto]) !== $value)
410 410
 				{
411 411
 					return $this->error($key, 'equalto');
412 412
 				}
413 413
 			}
414 414
 
415 415
 			// rules
416
-			if($rules = $filter['rule'])
416
+			if ($rules = $filter['rule'])
417 417
 			{
418 418
 				$rules = explode(',', $rules);
419
-				foreach($rules as $rule)
419
+				foreach ($rules as $rule)
420 420
 				{
421 421
 					$result = $this->applyRule($rule, $value);
422 422
 					// apply the 'not' modifier
423
-					if(in_array('not', $modifiers))
423
+					if (in_array('not', $modifiers))
424 424
 					{
425 425
 						$result = !$result;
426 426
 					}
427
-					if(!$result)
427
+					if (!$result)
428 428
 					{
429
-						return $this->error($key, 'invalid_' . $rule);
429
+						return $this->error($key, 'invalid_'.$rule);
430 430
 					}
431 431
 				}
432 432
 			}
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 	 */
443 443
 	function arrayTrim($array)
444 444
 	{
445
-		if(!is_array($array))
445
+		if (!is_array($array))
446 446
 		{
447 447
 			return trim($array);
448 448
 		}
449 449
 
450
-		foreach($array as $key => $value)
450
+		foreach ($array as $key => $value)
451 451
 		{
452 452
 			$array[$key] = $this->arrayTrim($value);
453 453
 		}
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	 */
463 463
 	function error($field, $msg)
464 464
 	{
465
-		if(isset($this->_message[$msg]))
465
+		if (isset($this->_message[$msg]))
466 466
 		{
467 467
 			$msg = $this->_message[$msg];
468 468
 		}
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 			$msg = isset($lang_filter->{$msg}) ? $lang_filter->{$msg} : $lang_filter->invalid;
473 473
 		}
474 474
 
475
-		if(isset($this->_fieldNames[$field]))
475
+		if (isset($this->_fieldNames[$field]))
476 476
 		{
477 477
 			$fieldName = $this->_fieldNames[$field];
478 478
 		}
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	 */
506 506
 	function addRule($name, $rule = '')
507 507
 	{
508
-		if(is_array($name))
508
+		if (is_array($name))
509 509
 		{
510 510
 			$args = $name;
511 511
 		}
@@ -514,18 +514,18 @@  discard block
 block discarded – undo
514 514
 			$args = array($name => $rule);
515 515
 		}
516 516
 
517
-		foreach($args as $name => $rule)
517
+		foreach ($args as $name => $rule)
518 518
 		{
519
-			if(!$rule)
519
+			if (!$rule)
520 520
 			{
521 521
 				continue;
522 522
 			}
523
-			if(is_string($rule))
523
+			if (is_string($rule))
524 524
 			{
525 525
 				$rule = array('type' => 'regex', 'test' => $rule);
526 526
 			}
527 527
 
528
-			if($rule['type'] == 'enum')
528
+			if ($rule['type'] == 'enum')
529 529
 			{
530 530
 				$delim = isset($rule['delim']) ? $rule['delim'] : ',';
531 531
 				$rule['test'] = explode($delim, $rule['test']);
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 	 */
554 554
 	function addFilter($name, $filter = '')
555 555
 	{
556
-		if(is_array($name))
556
+		if (is_array($name))
557 557
 		{
558 558
 			$args = $name;
559 559
 		}
@@ -562,19 +562,19 @@  discard block
 block discarded – undo
562 562
 			$args = array($name => $filter);
563 563
 		}
564 564
 
565
-		foreach($args as $name => $filter)
565
+		foreach ($args as $name => $filter)
566 566
 		{
567
-			if(!$filter)
567
+			if (!$filter)
568 568
 			{
569 569
 				continue;
570 570
 			}
571 571
 
572
-			if(isset($filter['if']))
572
+			if (isset($filter['if']))
573 573
 			{
574
-				if(is_array($filter['if']) && count($filter['if']))
574
+				if (is_array($filter['if']) && count($filter['if']))
575 575
 				{
576 576
 					$key = key($filter['if']);
577
-					if(!is_int($key))
577
+					if (!is_int($key))
578 578
 					{
579 579
 						$filter['if'] = array($filter['if']);
580 580
 					}
@@ -609,21 +609,21 @@  discard block
 block discarded – undo
609 609
 	{
610 610
 		$rule = $this->_rules[$name];
611 611
 
612
-		if(is_array($value) && isset($value['tmp_name']))
612
+		if (is_array($value) && isset($value['tmp_name']))
613 613
 		{
614 614
 			$value = $value['name'];
615 615
 		}
616 616
 
617
-		switch($rule['type'])
617
+		switch ($rule['type'])
618 618
 		{
619 619
 			case 'regex':
620 620
 				return (preg_match($rule['test'], $value) > 0);
621 621
 			case 'enum':
622 622
 				return in_array($value, $rule['test']);
623 623
 			case 'expr':
624
-				if(!$rule['func_test'])
624
+				if (!$rule['func_test'])
625 625
 				{
626
-					$rule['func_test'] = create_function('$a', 'return (' . preg_replace('/\$\$/', '$a', html_entity_decode($rule['test'])) . ');');
626
+					$rule['func_test'] = create_function('$a', 'return ('.preg_replace('/\$\$/', '$a', html_entity_decode($rule['test'])).');');
627 627
 				}
628 628
 				return $rule['func_test']($value);
629 629
 		}
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	function mbStrLen($str)
640 640
 	{
641 641
 		$arr = count_chars($str);
642
-		for($i = 0x80; $i < 0xc0; $i++)
642
+		for ($i = 0x80; $i < 0xc0; $i++)
643 643
 		{
644 644
 			unset($arr[$i]);
645 645
 		}
@@ -652,17 +652,17 @@  discard block
 block discarded – undo
652 652
 	 */
653 653
 	function getJsPath()
654 654
 	{
655
-		if(!$this->_cache_dir)
655
+		if (!$this->_cache_dir)
656 656
 		{
657 657
 			return FALSE;
658 658
 		}
659 659
 
660
-		$dir = $this->_cache_dir . '/ruleset';
661
-		if(!is_dir($dir) && !mkdir($dir))
660
+		$dir = $this->_cache_dir.'/ruleset';
661
+		if (!is_dir($dir) && !mkdir($dir))
662 662
 		{
663 663
 			return FALSE;
664 664
 		}
665
-		if(!$this->_xml_path)
665
+		if (!$this->_xml_path)
666 666
 		{
667 667
 			return FALSE;
668 668
 		}
@@ -671,14 +671,14 @@  discard block
 block discarded – undo
671 671
 		$lang_type = class_exists('Context', false) ? Context::getLangType() : 'en';
672 672
 
673 673
 		// check the file
674
-		$filepath = $dir . '/' . md5($this->_version . ' ' . $this->_xml_path) . ".{$lang_type}.js";
675
-		if(is_readable($filepath) && filemtime($filepath) > filemtime($this->_xml_path))
674
+		$filepath = $dir.'/'.md5($this->_version.' '.$this->_xml_path).".{$lang_type}.js";
675
+		if (is_readable($filepath) && filemtime($filepath) > filemtime($this->_xml_path))
676 676
 		{
677 677
 			return $filepath;
678 678
 		}
679 679
 
680 680
 		$content = $this->_compile2js();
681
-		if($content === FALSE)
681
+		if ($content === FALSE)
682 682
 		{
683 683
 			return FALSE;
684 684
 		}
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 		$ruleset = basename($this->_xml_path, '.xml');
700 700
 		$content = array();
701 701
 
702
-		if(preg_match('@(^|/)files/ruleset/\w+\.xml$@i', $this->_xml_path))
702
+		if (preg_match('@(^|/)files/ruleset/\w+\.xml$@i', $this->_xml_path))
703 703
 		{
704
-			$ruleset = '@' . $ruleset;
704
+			$ruleset = '@'.$ruleset;
705 705
 		}
706 706
 
707 707
 		list($ruleset) = explode('.', $ruleset);
@@ -711,22 +711,22 @@  discard block
 block discarded – undo
711 711
 
712 712
 		// custom rulesets
713 713
 		$addrules = array();
714
-		foreach($this->_rules as $name => $rule)
714
+		foreach ($this->_rules as $name => $rule)
715 715
 		{
716 716
 			$name = strtolower($name);
717 717
 
718
-			if(in_array($name, array('email', 'userid', 'url', 'alpha', 'alpha_number', 'number', 'float')))
718
+			if (in_array($name, array('email', 'userid', 'url', 'alpha', 'alpha_number', 'number', 'float')))
719 719
 			{
720 720
 				continue;
721 721
 			}
722 722
 
723
-			switch($rule['type'])
723
+			switch ($rule['type'])
724 724
 			{
725 725
 				case 'regex':
726 726
 					$addrules[] = "v.cast('ADD_RULE', ['{$name}', {$rule['test']}]);";
727 727
 					break;
728 728
 				case 'enum':
729
-					$enums = '"' . implode('","', $rule['test']) . '"';
729
+					$enums = '"'.implode('","', $rule['test']).'"';
730 730
 					$addrules[] = "v.cast('ADD_RULE', ['{$name}', function($$){ return ($.inArray($$,[{$enums}]) > -1); }]);";
731 731
 					break;
732 732
 				case 'expr':
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 			}
736 736
 
737 737
 			// if have a message, add message
738
-			if(isset($rule['message']))
738
+			if (isset($rule['message']))
739 739
 			{
740 740
 				$text = preg_replace('@\r?\n@', '\\n', addslashes($rule['message']));
741 741
 				$addrules[] = "v.cast('ADD_MESSAGE',['invalid_{$name}','{$text}']);";
@@ -746,79 +746,79 @@  discard block
 block discarded – undo
746 746
 		// filters
747 747
 		$content = array();
748 748
 		$messages = array();
749
-		foreach($this->_filters as $name => $filter)
749
+		foreach ($this->_filters as $name => $filter)
750 750
 		{
751 751
 			$field = array();
752 752
 
753 753
 			// form filed name
754
-			if(isset($filter['title']))
754
+			if (isset($filter['title']))
755 755
 			{
756 756
 				$field_lang = addslashes($filter['title']);
757 757
 				$messages[] = "v.cast('ADD_MESSAGE',['{$name}','{$field_lang}']);";
758 758
 			}
759
-			elseif(isset($lang->{$name}))
759
+			elseif (isset($lang->{$name}))
760 760
 			{
761 761
 				$field_lang = addslashes($lang->{$name});
762 762
 				$messages[] = "v.cast('ADD_MESSAGE',['{$name}','{$field_lang}']);";
763 763
 			}
764 764
 
765
-			if($filter['required'] == 'true')
765
+			if ($filter['required'] == 'true')
766 766
 			{
767 767
 				$field[] = 'required:true';
768 768
 			}
769
-			if($filter['rule'])
769
+			if ($filter['rule'])
770 770
 			{
771
-				$field[] = "rule:'" . strtolower($filter['rule']) . "'";
771
+				$field[] = "rule:'".strtolower($filter['rule'])."'";
772 772
 			}
773
-			if($filter['default'])
773
+			if ($filter['default'])
774 774
 			{
775 775
 				$field[] = "default:'{$filter['default']}'";
776 776
 			}
777
-			if($filter['modifier'])
777
+			if ($filter['modifier'])
778 778
 			{
779 779
 				$field[] = "modifier:'{$filter['modifier']}'";
780 780
 			}
781
-			if($filter['length'])
781
+			if ($filter['length'])
782 782
 			{
783 783
 				list($min, $max) = explode(':', $filter['length']);
784
-				if($min)
784
+				if ($min)
785 785
 				{
786 786
 					$field[] = "minlength:'{$min}'";
787 787
 				}
788
-				if($max)
788
+				if ($max)
789 789
 				{
790 790
 					$field[] = "maxlength:'{$max}'";
791 791
 				}
792 792
 			}
793
-			if($filter['if'])
793
+			if ($filter['if'])
794 794
 			{
795 795
 				$ifs = array();
796
-				if(!isset($filter['if'][0]))
796
+				if (!isset($filter['if'][0]))
797 797
 				{
798 798
 					$filter['if'] = array($filter['if']);
799 799
 				}
800
-				foreach($filter['if'] as $if)
800
+				foreach ($filter['if'] as $if)
801 801
 				{
802
-					$ifs[] = "{test:'" . addslashes($if['test']) . "', attr:'{$if['attr']}', value:'" . addslashes($if['value']) . "'}";
802
+					$ifs[] = "{test:'".addslashes($if['test'])."', attr:'{$if['attr']}', value:'".addslashes($if['value'])."'}";
803 803
 				}
804
-				$field[] = "'if':[" . implode(',', $ifs) . "]";
804
+				$field[] = "'if':[".implode(',', $ifs)."]";
805 805
 			}
806
-			if(count($field))
806
+			if (count($field))
807 807
 			{
808
-				$field = '{' . implode(',', $field) . '}';
808
+				$field = '{'.implode(',', $field).'}';
809 809
 				$content[] = "'{$name}':{$field}";
810 810
 			}
811 811
 		}
812 812
 
813
-		if(!$content)
813
+		if (!$content)
814 814
 		{
815 815
 			return '/* Error : empty ruleset  */';
816 816
 		}
817 817
 
818 818
 		// error messages
819
-		foreach($lang->filter as $key => $text)
819
+		foreach ($lang->filter as $key => $text)
820 820
 		{
821
-			if($text)
821
+			if ($text)
822 822
 			{
823 823
 				$text = preg_replace('@\r?\n@', '\\n', addslashes($text));
824 824
 				$messages[] = "v.cast('ADD_MESSAGE',['{$key}','{$text}']);";
Please login to merge, or discard this patch.
modules/document/document.item.php 2 patches
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function _loadFromDB($load_extra_vars = true)
76 76
 	{
77
-		if(!$this->document_srl) return;
77
+		if (!$this->document_srl) return;
78 78
 
79 79
 		$document_item = false;
80 80
 		$cache_put = false;
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
 		// cache controll
85 85
 		$oCacheHandler = CacheHandler::getInstance('object');
86
-		if($oCacheHandler->isSupport())
86
+		if ($oCacheHandler->isSupport())
87 87
 		{
88
-			$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
88
+			$cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl;
89 89
 			$document_item = $oCacheHandler->get($cache_key);
90
-			if($document_item !== false)
90
+			if ($document_item !== false)
91 91
 			{
92 92
 				$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
93 93
 			}
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 		$args->document_srl = $this->document_srl;
98 98
 		$output = executeQuery('document.getDocument', $args, $columnList);
99 99
 
100
-		if($document_item === false)
100
+		if ($document_item === false)
101 101
 		{
102 102
 			$document_item = $output->data;
103 103
 
104 104
 				//insert in cache
105
-			if($document_item && $oCacheHandler->isSupport())
105
+			if ($document_item && $oCacheHandler->isSupport())
106 106
 			{
107 107
 				$oCacheHandler->put($cache_key, $document_item);
108 108
 			}
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 		$this->setAttribute($document_item, $load_extra_vars);
120 120
 	}
121 121
 
122
-	function setAttribute($attribute, $load_extra_vars=true)
122
+	function setAttribute($attribute, $load_extra_vars = true)
123 123
 	{
124
-		if(!$attribute->document_srl)
124
+		if (!$attribute->document_srl)
125 125
 		{
126 126
 			$this->document_srl = null;
127 127
 			return;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$this->adds($attribute);
132 132
 
133 133
 		// Tags
134
-		if($this->get('tags'))
134
+		if ($this->get('tags'))
135 135
 		{
136 136
 			$tag_list = explode(',', $this->get('tags'));
137 137
 			$tag_list = array_map('trim', $tag_list);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		}
140 140
 
141 141
 		$oDocumentModel = getModel('document');
142
-		if($load_extra_vars)
142
+		if ($load_extra_vars)
143 143
 		{
144 144
 			$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
145 145
 			$oDocumentModel->setToAllDocumentExtraVars();
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 
155 155
 	function isGranted()
156 156
 	{
157
-		if($_SESSION['own_document'][$this->document_srl]) return true;
157
+		if ($_SESSION['own_document'][$this->document_srl]) return true;
158 158
 
159
-		if(!Context::get('is_logged')) return false;
159
+		if (!Context::get('is_logged')) return false;
160 160
 
161 161
 		$logged_info = Context::get('logged_info');
162
-		if($logged_info->is_admin == 'Y') return true;
162
+		if ($logged_info->is_admin == 'Y') return true;
163 163
 
164 164
 		$oModuleModel = getModel('module');
165 165
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
166
-		if($grant->manager) return true;
166
+		if ($grant->manager) return true;
167 167
 
168
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true;
168
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return true;
169 169
 
170 170
 		return false;
171 171
 	}
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 
178 178
 	function isAccessible()
179 179
 	{
180
-		return $_SESSION['accessible'][$this->document_srl]==true?true:false;
180
+		return $_SESSION['accessible'][$this->document_srl] == true ? true : false;
181 181
 	}
182 182
 
183 183
 	function allowComment()
184 184
 	{
185 185
 		// init write, document is not exists. so allow comment status is true
186
-		if(!$this->isExists()) return true;
186
+		if (!$this->isExists()) return true;
187 187
 
188 188
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
189 189
 	}
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	function allowTrackback()
192 192
 	{
193 193
 		static $allow_trackback_status = null;
194
-		if(is_null($allow_trackback_status))
194
+		if (is_null($allow_trackback_status))
195 195
 		{
196 196
 			
197 197
 			// Check the tarckback module exist
198
-			if(!getClass('trackback'))
198
+			if (!getClass('trackback'))
199 199
 			{
200 200
 				$allow_trackback_status = false;
201 201
 			}
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
 				$oModuleModel = getModel('module');
206 206
 				$trackback_config = $oModuleModel->getModuleConfig('trackback');
207 207
 				
208
-				if(!$trackback_config)
208
+				if (!$trackback_config)
209 209
 				{
210 210
 					$trackback_config = new stdClass();
211 211
 				}
212 212
 				
213
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
213
+				if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
+				if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
215 215
 				else
216 216
 				{
217 217
 					$module_srl = $this->get('module_srl');
218 218
 					// Check settings of each module
219 219
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
220
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
220
+					if ($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
+					else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true;
222 222
 				}
223 223
 			}
224 224
 		}
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 
228 228
 	function isLocked()
229 229
 	{
230
-		if(!$this->isExists()) return false;
230
+		if (!$this->isExists()) return false;
231 231
 
232 232
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
233 233
 	}
234 234
 
235 235
 	function isEditable()
236 236
 	{
237
-		if($this->isGranted() || !$this->get('member_srl')) return true;
237
+		if ($this->isGranted() || !$this->get('member_srl')) return true;
238 238
 		return false;
239 239
 	}
240 240
 
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 
252 252
 	function useNotify()
253 253
 	{
254
-		return $this->get('notify_message')=='Y' ? true : false;
254
+		return $this->get('notify_message') == 'Y' ? true : false;
255 255
 	}
256 256
 
257 257
 	function doCart()
258 258
 	{
259
-		if(!$this->document_srl) return false;
260
-		if($this->isCarted()) $this->removeCart();
259
+		if (!$this->document_srl) return false;
260
+		if ($this->isCarted()) $this->removeCart();
261 261
 		else $this->addCart();
262 262
 	}
263 263
 
@@ -284,18 +284,18 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	function notify($type, $content)
286 286
 	{
287
-		if(!$this->document_srl) return;
287
+		if (!$this->document_srl) return;
288 288
 		// return if it is not useNotify
289
-		if(!$this->useNotify()) return;
289
+		if (!$this->useNotify()) return;
290 290
 		// Pass if an author is not a logged-in user
291
-		if(!$this->get('member_srl')) return;
291
+		if (!$this->get('member_srl')) return;
292 292
 		// Return if the currently logged-in user is an author
293 293
 		$logged_info = Context::get('logged_info');
294
-		if($logged_info->member_srl == $this->get('member_srl')) return;
294
+		if ($logged_info->member_srl == $this->get('member_srl')) return;
295 295
 		// List variables
296
-		if($type) $title = "[".$type."] ";
296
+		if ($type) $title = "[".$type."] ";
297 297
 		$title .= cut_str(strip_tags($content), 10, '...');
298
-		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
298
+		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
299 299
 		$receiver_srl = $this->get('member_srl');
300 300
 		$sender_member_srl = $logged_info->member_srl;
301 301
 		// Send a message
@@ -310,26 +310,26 @@  discard block
 block discarded – undo
310 310
 
311 311
 	function getIpAddress()
312 312
 	{
313
-		if($this->isGranted())
313
+		if ($this->isGranted())
314 314
 		{
315 315
 			return $this->get('ipaddress');
316 316
 		}
317 317
 
318
-		return '*' . strstr($this->get('ipaddress'), '.');
318
+		return '*'.strstr($this->get('ipaddress'), '.');
319 319
 	}
320 320
 
321 321
 	function isExistsHomepage()
322 322
 	{
323
-		if(trim($this->get('homepage'))) return true;
323
+		if (trim($this->get('homepage'))) return true;
324 324
 		return false;
325 325
 	}
326 326
 
327 327
 	function getHomepageUrl()
328 328
 	{
329 329
 		$url = trim($this->get('homepage'));
330
-		if(!$url) return;
330
+		if (!$url) return;
331 331
 
332
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
332
+		if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://'.$url;
333 333
 
334 334
 		return $url;
335 335
 	}
@@ -359,52 +359,52 @@  discard block
 block discarded – undo
359 359
 		return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
360 360
 	}
361 361
 
362
-	function getTitleText($cut_size = 0, $tail='...')
362
+	function getTitleText($cut_size = 0, $tail = '...')
363 363
 	{
364
-		if(!$this->document_srl) return;
364
+		if (!$this->document_srl) return;
365 365
 
366
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
366
+		if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
367 367
 		else $title = $this->get('title');
368 368
 
369 369
 		return $title;
370 370
 	}
371 371
 
372
-	function getTitle($cut_size = 0, $tail='...')
372
+	function getTitle($cut_size = 0, $tail = '...')
373 373
 	{
374
-		if(!$this->document_srl) return;
374
+		if (!$this->document_srl) return;
375 375
 
376 376
 		$title = $this->getTitleText($cut_size, $tail);
377 377
 
378 378
 		$attrs = array();
379 379
 		$this->add('title_color', trim($this->get('title_color')));
380
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
381
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
380
+		if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;";
381
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
382 382
 
383
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
383
+		if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
384 384
 		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
385 385
 	}
386 386
 
387 387
 	function getContentText($strlen = 0)
388 388
 	{
389
-		if(!$this->document_srl) return;
389
+		if (!$this->document_srl) return;
390 390
 
391
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
391
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
392 392
 
393 393
 		$result = $this->_checkAccessibleFromStatus();
394
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
394
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
395 395
 
396 396
 		$content = $this->get('content');
397 397
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
398 398
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
399 399
 
400
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
400
+		if ($strlen) return cut_str(strip_tags($content), $strlen, '...');
401 401
 
402 402
 		return htmlspecialchars($content);
403 403
 	}
404 404
 
405 405
 	function _addAllowScriptAccess($m)
406 406
 	{
407
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
407
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
408 408
 		{
409 409
 			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
410 410
 		}
@@ -414,26 +414,26 @@  discard block
 block discarded – undo
414 414
 
415 415
 	function _checkAllowScriptAccess($m)
416 416
 	{
417
-		if($m[1] == 'object')
417
+		if ($m[1] == 'object')
418 418
 		{
419 419
 			$this->allowscriptaccessList[] = 1;
420 420
 		}
421 421
 
422
-		if($m[1] == 'param')
422
+		if ($m[1] == 'param')
423 423
 		{
424
-			if(stripos($m[0], 'allowscriptaccess'))
424
+			if (stripos($m[0], 'allowscriptaccess'))
425 425
 			{
426 426
 				$m[0] = '<param name="allowscriptaccess" value="never"';
427
-				if(substr($m[0], -1) == '/')
427
+				if (substr($m[0], -1) == '/')
428 428
 				{
429 429
 					$m[0] .= '/';
430 430
 				}
431
-				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
431
+				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
432 432
 			}
433 433
 		}
434
-		else if($m[1] == 'embed')
434
+		else if ($m[1] == 'embed')
435 435
 		{
436
-			if(stripos($m[0], 'allowscriptaccess'))
436
+			if (stripos($m[0], 'allowscriptaccess'))
437 437
 			{
438 438
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
439 439
 			}
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
 
448 448
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
449 449
 	{
450
-		if(!$this->document_srl) return;
450
+		if (!$this->document_srl) return;
451 451
 
452
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
452
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
453 453
 
454 454
 		$result = $this->_checkAccessibleFromStatus();
455
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
455
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
456 456
 
457 457
 		$content = $this->get('content');
458
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
458
+		if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
459 459
 
460 460
 		// Define a link if using a rewrite module
461 461
 		$oContext = &Context::getInstance();
462
-		if($oContext->allow_rewrite)
462
+		if ($oContext->allow_rewrite)
463 463
 		{
464
-			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
464
+			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content);
465 465
 		}
466 466
 		// To display a pop-up menu
467
-		if($add_popup_menu)
467
+		if ($add_popup_menu)
468 468
 		{
469 469
 			$content = sprintf(
470 470
 				'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
 			);
474 474
 		}
475 475
 		// If additional content information is set
476
-		if($add_content_info)
476
+		if ($add_content_info)
477 477
 		{
478 478
 			$memberSrl = $this->get('member_srl');
479
-			if($memberSrl < 0)
479
+			if ($memberSrl < 0)
480 480
 			{
481 481
 				$memberSrl = 0;
482 482
 			}
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 		else
494 494
 		{
495
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
495
+			if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
496 496
 		}
497 497
 		// Change the image path to a valid absolute path if resource_realpath is true
498
-		if($resource_realpath)
498
+		if ($resource_realpath)
499 499
 		{
500
-			$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
500
+			$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
501 501
 		}
502 502
 
503 503
 		return $content;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		$content = trim(cut_str($content, $str_size, $tail));
547 547
 
548 548
 		// Replace back < , <, "
549
-		$content = str_replace(array('<', '>', '"'),array('&lt;', '&gt;', '&quot;'), $content);
549
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
550 550
 
551 551
 		return $content;
552 552
 	}
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 	function getRegdateTime()
560 560
 	{
561 561
 		$regdate = $this->get('regdate');
562
-		$year = substr($regdate,0,4);
563
-		$month = substr($regdate,4,2);
564
-		$day = substr($regdate,6,2);
565
-		$hour = substr($regdate,8,2);
566
-		$min = substr($regdate,10,2);
567
-		$sec = substr($regdate,12,2);
568
-		return mktime($hour,$min,$sec,$month,$day,$year);
562
+		$year = substr($regdate, 0, 4);
563
+		$month = substr($regdate, 4, 2);
564
+		$day = substr($regdate, 6, 2);
565
+		$hour = substr($regdate, 8, 2);
566
+		$min = substr($regdate, 10, 2);
567
+		$sec = substr($regdate, 12, 2);
568
+		return mktime($hour, $min, $sec, $month, $day, $year);
569 569
 	}
570 570
 
571 571
 	function getRegdateGM()
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 
576 576
 	function getRegdateDT()
577 577
 	{
578
-		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
578
+		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
579 579
 	}
580 580
 
581 581
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 
586 586
 	function getUpdateTime()
587 587
 	{
588
-		$year = substr($this->get('last_update'),0,4);
589
-		$month = substr($this->get('last_update'),4,2);
590
-		$day = substr($this->get('last_update'),6,2);
591
-		$hour = substr($this->get('last_update'),8,2);
592
-		$min = substr($this->get('last_update'),10,2);
593
-		$sec = substr($this->get('last_update'),12,2);
594
-		return mktime($hour,$min,$sec,$month,$day,$year);
588
+		$year = substr($this->get('last_update'), 0, 4);
589
+		$month = substr($this->get('last_update'), 4, 2);
590
+		$day = substr($this->get('last_update'), 6, 2);
591
+		$hour = substr($this->get('last_update'), 8, 2);
592
+		$min = substr($this->get('last_update'), 10, 2);
593
+		$sec = substr($this->get('last_update'), 12, 2);
594
+		return mktime($hour, $min, $sec, $month, $day, $year);
595 595
 	}
596 596
 
597 597
 	function getUpdateGM()
@@ -601,21 +601,21 @@  discard block
 block discarded – undo
601 601
 
602 602
 	function getUpdateDT()
603 603
 	{
604
-		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
604
+		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
605 605
 	}
606 606
 
607 607
 	function getPermanentUrl()
608 608
 	{
609
-		return getFullUrl('','document_srl',$this->get('document_srl'));
609
+		return getFullUrl('', 'document_srl', $this->get('document_srl'));
610 610
 	}
611 611
 
612 612
 	function getTrackbackUrl()
613 613
 	{
614
-		if(!$this->document_srl) return;
614
+		if (!$this->document_srl) return;
615 615
 
616 616
 		// Generate a key to prevent spams
617 617
 		$oTrackbackModel = getModel('trackback');
618
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
618
+		if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
619 619
 	}
620 620
 
621 621
 	/**
@@ -625,24 +625,24 @@  discard block
 block discarded – undo
625 625
 	function updateReadedCount()
626 626
 	{
627 627
 		$oDocumentController = getController('document');
628
-		if($oDocumentController->updateReadedCount($this))
628
+		if ($oDocumentController->updateReadedCount($this))
629 629
 		{
630 630
 			$readed_count = $this->get('readed_count');
631
-			$this->add('readed_count', $readed_count+1);
631
+			$this->add('readed_count', $readed_count + 1);
632 632
 		}
633 633
 	}
634 634
 
635 635
 	function isExtraVarsExists()
636 636
 	{
637
-		if(!$this->get('module_srl')) return false;
637
+		if (!$this->get('module_srl')) return false;
638 638
 		$oDocumentModel = getModel('document');
639 639
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
640
-		return count($extra_keys)?true:false;
640
+		return count($extra_keys) ? true : false;
641 641
 	}
642 642
 
643 643
 	function getExtraVars()
644 644
 	{
645
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
645
+		if (!$this->get('module_srl') || !$this->document_srl) return null;
646 646
 
647 647
 		$oDocumentModel = getModel('document');
648 648
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	function getExtraValue($idx)
652 652
 	{
653 653
 		$extra_vars = $this->getExtraVars();
654
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
654
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
655 655
 		{
656 656
 			return $extra_vars[$idx]->getValue();
657 657
 		}
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	function getExtraValueHTML($idx)
665 665
 	{
666 666
 		$extra_vars = $this->getExtraVars();
667
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
667
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
668 668
 		{
669 669
 			return $extra_vars[$idx]->getValueHTML();
670 670
 		}
@@ -678,16 +678,16 @@  discard block
 block discarded – undo
678 678
 	{
679 679
 		$extra_vars = $this->getExtraVars();
680 680
 
681
-		if($extra_vars)
681
+		if ($extra_vars)
682 682
 		{
683 683
 			// Handle extra variable(eid)
684
-			foreach($extra_vars as $idx => $key)
684
+			foreach ($extra_vars as $idx => $key)
685 685
 			{
686 686
 				$extra_eid[$key->eid] = $key;
687 687
 			}
688 688
 		}
689 689
 		
690
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
690
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
691 691
 		{
692 692
 			return $extra_eid[$eid]->getValue();
693 693
 		}
@@ -701,12 +701,12 @@  discard block
 block discarded – undo
701 701
 	{
702 702
 		$extra_vars = $this->getExtraVars();
703 703
 		// Handle extra variable(eid)
704
-		foreach($extra_vars as $idx => $key)
704
+		foreach ($extra_vars as $idx => $key)
705 705
 		{
706 706
 			$extra_eid[$key->eid] = $key;
707 707
 		}
708 708
 		
709
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
709
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
710 710
 		{
711 711
 			return $extra_eid[$eid]->getValueHTML();
712 712
 		}
@@ -730,13 +730,13 @@  discard block
 block discarded – undo
730 730
 
731 731
 	function getComments()
732 732
 	{
733
-		if(!$this->getCommentCount()) return;
734
-		if(!$this->isGranted() && $this->isSecret()) return;
733
+		if (!$this->getCommentCount()) return;
734
+		if (!$this->isGranted() && $this->isSecret()) return;
735 735
 		// cpage is a number of comment pages
736 736
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
737 737
 		$cpage = Context::get($cpageStr);
738 738
 
739
-		if(!$cpage)
739
+		if (!$cpage)
740 740
 		{
741 741
 			$cpage = Context::get('cpage');
742 742
 		}
@@ -744,19 +744,19 @@  discard block
 block discarded – undo
744 744
 		// Get a list of comments
745 745
 		$oCommentModel = getModel('comment');
746 746
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
747
-		if(!$output->toBool() || !count($output->data)) return;
747
+		if (!$output->toBool() || !count($output->data)) return;
748 748
 		// Create commentItem object from a comment list
749 749
 		// If admin priviledge is granted on parent posts, you can read its child posts.
750 750
 		$accessible = array();
751 751
 		$comment_list = array();
752
-		foreach($output->data as $key => $val)
752
+		foreach ($output->data as $key => $val)
753 753
 		{
754 754
 			$oCommentItem = new commentItem();
755 755
 			$oCommentItem->setAttribute($val);
756 756
 			// If permission is granted to the post, you can access it temporarily
757
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
757
+			if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
758 758
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
759
-			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
759
+			if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true)
760 760
 			{
761 761
 				$oCommentItem->setAccessible();
762 762
 			}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 		// Variable setting to be displayed on the skin
766 766
 		Context::set($cpageStr, $output->page_navigation->cur_page);
767 767
 		Context::set('cpage', $output->page_navigation->cur_page);
768
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
768
+		if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation;
769 769
 
770 770
 		return $comment_list;
771 771
 	}
@@ -777,9 +777,9 @@  discard block
 block discarded – undo
777 777
 
778 778
 	function getTrackbacks()
779 779
 	{
780
-		if(!$this->document_srl) return;
780
+		if (!$this->document_srl) return;
781 781
 
782
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
782
+		if (!$this->allowTrackback() || !$this->get('trackback_count')) return;
783 783
 
784 784
 		$oTrackbackModel = getModel('trackback');
785 785
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -787,47 +787,47 @@  discard block
 block discarded – undo
787 787
 
788 788
 	function thumbnailExists($width = 80, $height = 0, $type = '')
789 789
 	{
790
-		if(!$this->document_srl) return false;
791
-		if(!$this->getThumbnail($width, $height, $type)) return false;
790
+		if (!$this->document_srl) return false;
791
+		if (!$this->getThumbnail($width, $height, $type)) return false;
792 792
 		return true;
793 793
 	}
794 794
 
795 795
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
796 796
 	{
797 797
 		// Return false if the document doesn't exist
798
-		if(!$this->document_srl) return;
798
+		if (!$this->document_srl) return;
799 799
 
800
-		if($this->isSecret() && !$this->isGranted())
800
+		if ($this->isSecret() && !$this->isGranted())
801 801
 		{
802 802
 			return;
803 803
 		}
804 804
 
805 805
 		// If not specify its height, create a square
806
-		if(!$height) $height = $width;
806
+		if (!$height) $height = $width;
807 807
 
808 808
 		// Return false if neither attachement nor image files in the document
809 809
 		$content = $this->get('content');
810
-		if(!$this->get('uploaded_count'))
810
+		if (!$this->get('uploaded_count'))
811 811
 		{
812
-			if(!$content)
812
+			if (!$content)
813 813
 			{
814 814
 				$args = new stdClass();
815 815
 				$args->document_srl = $this->document_srl;
816 816
 				$output = executeQuery('document.getDocument', $args, array('content'));
817
-				if($output->toBool() && $output->data)
817
+				if ($output->toBool() && $output->data)
818 818
 				{
819 819
 					$content = $output->data->content;
820 820
 					$this->add('content', $content);
821 821
 				}
822 822
 			}
823 823
 
824
-			if(!preg_match("!<img!is", $content)) return;
824
+			if (!preg_match("!<img!is", $content)) return;
825 825
 		}
826 826
 		// Get thumbnai_type information from document module's configuration
827
-		if(!in_array($thumbnail_type, array('crop','ratio')))
827
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
828 828
 		{
829 829
 			$config = $GLOBALS['__document_config__'];
830
-			if(!$config)
830
+			if (!$config)
831 831
 			{
832 832
 				$oDocumentModel = getModel('document');
833 833
 				$config = $oDocumentModel->getDocumentConfig();
@@ -837,15 +837,15 @@  discard block
 block discarded – undo
837 837
 		}
838 838
 
839 839
 		// Define thumbnail information
840
-		$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
840
+		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3));
841 841
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
842 842
 		$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
843 843
 		$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
844 844
 
845 845
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
846
-		if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
846
+		if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
847 847
 		{
848
-			if(filesize($thumbnail_file) < 1)
848
+			if (filesize($thumbnail_file) < 1)
849 849
 			{
850 850
 				return FALSE;
851 851
 			}
@@ -863,64 +863,64 @@  discard block
 block discarded – undo
863 863
 		$is_tmp_file = false;
864 864
 
865 865
 		// Find an iamge file among attached files if exists
866
-		if($this->hasUploadedFiles())
866
+		if ($this->hasUploadedFiles())
867 867
 		{
868 868
 			$file_list = $this->getUploadedFiles();
869 869
 
870 870
 			$first_image = null;
871
-			foreach($file_list as $file)
871
+			foreach ($file_list as $file)
872 872
 			{
873
-				if($file->direct_download !== 'Y') continue;
873
+				if ($file->direct_download !== 'Y') continue;
874 874
 
875
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
875
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
876 876
 				{
877 877
 					$source_file = $file->uploaded_filename;
878 878
 					break;
879 879
 				}
880 880
 
881
-				if($first_image) continue;
881
+				if ($first_image) continue;
882 882
 
883
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
883
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
884 884
 				{
885
-					if(file_exists($file->uploaded_filename))
885
+					if (file_exists($file->uploaded_filename))
886 886
 					{
887 887
 						$first_image = $file->uploaded_filename;
888 888
 					}
889 889
 				}
890 890
 			}
891 891
 
892
-			if(!$source_file && $first_image)
892
+			if (!$source_file && $first_image)
893 893
 			{
894 894
 				$source_file = $first_image;
895 895
 			}
896 896
 		}
897 897
 		// If not exists, file an image file from the content
898 898
 		$is_tmp_file = false;
899
-		if(!$source_file)
899
+		if (!$source_file)
900 900
 		{
901 901
 			$random = new Password();
902 902
 
903 903
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
904 904
 
905
-			foreach($matches as $target_image)
905
+			foreach ($matches as $target_image)
906 906
 			{
907 907
 				$target_src = trim($target_image[1]);
908
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
908
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
909 909
 
910
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
910
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
911 911
 				{
912 912
 					$target_src = Context::getRequestUri().$target_src;
913 913
 				}
914 914
 
915 915
 				$target_src = htmlspecialchars_decode($target_src);
916 916
 
917
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
917
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
918 918
 				FileHandler::getRemoteFile($target_src, $tmp_file);
919
-				if(!file_exists($tmp_file)) continue;
919
+				if (!file_exists($tmp_file)) continue;
920 920
 
921 921
 				$imageinfo = getimagesize($tmp_file);
922 922
 				list($_w, $_h) = $imageinfo;
923
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
923
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
924 924
 					FileHandler::removeFile($tmp_file);
925 925
 					continue;
926 926
 				}
@@ -931,13 +931,13 @@  discard block
 block discarded – undo
931 931
 			}
932 932
 		}
933 933
 
934
-		if($source_file)
934
+		if ($source_file)
935 935
 		{
936 936
 			$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
937 937
 		}
938 938
 
939 939
 		// Remove source file if it was temporary
940
-		if($is_tmp_file)
940
+		if ($is_tmp_file)
941 941
 		{
942 942
 			FileHandler::removeFile($source_file);
943 943
 		}
@@ -946,14 +946,14 @@  discard block
 block discarded – undo
946 946
 		FileHandler::removeFile($thumbnail_lockfile);
947 947
 
948 948
 		// Return the thumbnail path if it was successfully generated
949
-		if($output)
949
+		if ($output)
950 950
 		{
951 951
 			return $thumbnail_url;
952 952
 		}
953 953
 		// Create an empty file if thumbnail generation failed
954 954
 		else
955 955
 		{
956
-			FileHandler::writeFile($thumbnail_file, '','w');
956
+			FileHandler::writeFile($thumbnail_file, '', 'w');
957 957
 		}
958 958
 
959 959
 		return;
@@ -967,21 +967,21 @@  discard block
 block discarded – undo
967 967
 	 */
968 968
 	function getExtraImages($time_interval = 43200)
969 969
 	{
970
-		if(!$this->document_srl) return;
970
+		if (!$this->document_srl) return;
971 971
 		// variables for icon list
972 972
 		$buffs = array();
973 973
 
974 974
 		$check_files = false;
975 975
 
976 976
 		// Check if secret post is
977
-		if($this->isSecret()) $buffs[] = "secret";
977
+		if ($this->isSecret()) $buffs[] = "secret";
978 978
 
979 979
 		// Set the latest time
980
-		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
980
+		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval);
981 981
 
982 982
 		// Check new post
983
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
984
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
983
+		if ($this->get('regdate') > $time_check) $buffs[] = "new";
984
+		else if ($this->get('last_update') > $time_check) $buffs[] = "update";
985 985
 
986 986
 		/*
987 987
 		   $content = $this->get('content');
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
 		 */
1005 1005
 
1006 1006
 		// Check the attachment
1007
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1007
+		if ($this->hasUploadedFiles()) $buffs[] = "file";
1008 1008
 
1009 1009
 		return $buffs;
1010 1010
 	}
1011 1011
 
1012 1012
 	function getStatus()
1013 1013
 	{
1014
-		if(!$this->get('status')) return $this->getDefaultStatus();
1014
+		if (!$this->get('status')) return $this->getDefaultStatus();
1015 1015
 		return $this->get('status');
1016 1016
 	}
1017 1017
 
@@ -1022,15 +1022,15 @@  discard block
 block discarded – undo
1022 1022
 	 */
1023 1023
 	function printExtraImages($time_check = 43200)
1024 1024
 	{
1025
-		if(!$this->document_srl) return;
1025
+		if (!$this->document_srl) return;
1026 1026
 		// Get the icon directory
1027
-		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
1027
+		$path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/');
1028 1028
 
1029 1029
 		$buffs = $this->getExtraImages($time_check);
1030
-		if(!count($buffs)) return;
1030
+		if (!count($buffs)) return;
1031 1031
 
1032 1032
 		$buff = array();
1033
-		foreach($buffs as $key => $val)
1033
+		foreach ($buffs as $key => $val)
1034 1034
 		{
1035 1035
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
1036 1036
 		}
@@ -1039,20 +1039,20 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
 	function hasUploadedFiles()
1041 1041
 	{
1042
-		if(!$this->document_srl) return;
1042
+		if (!$this->document_srl) return;
1043 1043
 
1044
-		if($this->isSecret() && !$this->isGranted()) return false;
1045
-		return $this->get('uploaded_count')? true : false;
1044
+		if ($this->isSecret() && !$this->isGranted()) return false;
1045
+		return $this->get('uploaded_count') ? true : false;
1046 1046
 	}
1047 1047
 
1048 1048
 	function getUploadedFiles($sortIndex = 'file_srl')
1049 1049
 	{
1050
-		if(!$this->document_srl) return;
1050
+		if (!$this->document_srl) return;
1051 1051
 
1052
-		if($this->isSecret() && !$this->isGranted()) return;
1053
-		if(!$this->get('uploaded_count')) return;
1052
+		if ($this->isSecret() && !$this->isGranted()) return;
1053
+		if (!$this->get('uploaded_count')) return;
1054 1054
 
1055
-		if(!$this->uploadedFiles[$sortIndex])
1055
+		if (!$this->uploadedFiles[$sortIndex])
1056 1056
 		{
1057 1057
 			$oFileModel = getModel('file');
1058 1058
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 	function getEditor()
1069 1069
 	{
1070 1070
 		$module_srl = $this->get('module_srl');
1071
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1071
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1072 1072
 
1073 1073
 		$oEditorModel = getModel('editor');
1074 1074
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 	{
1084 1084
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1085 1085
 		if (!$this->allowComment()) return false;
1086
-		if(!$this->isGranted() && $this->isSecret()) return false;
1086
+		if (!$this->isGranted() && $this->isSecret()) return false;
1087 1087
 
1088 1088
 		return true;
1089 1089
 	}
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 	 */
1095 1095
 	function getCommentEditor()
1096 1096
 	{
1097
-		if(!$this->isEnableComment()) return;
1097
+		if (!$this->isEnableComment()) return;
1098 1098
 
1099 1099
 		$oEditorModel = getModel('editor');
1100 1100
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1106,10 +1106,10 @@  discard block
 block discarded – undo
1106 1106
 	 */
1107 1107
 	function getProfileImage()
1108 1108
 	{
1109
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1109
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1110 1110
 		$oMemberModel = getModel('member');
1111 1111
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1112
-		if(!$profile_info) return;
1112
+		if (!$profile_info) return;
1113 1113
 
1114 1114
 		return $profile_info->src;
1115 1115
 	}
@@ -1121,21 +1121,21 @@  discard block
 block discarded – undo
1121 1121
 	function getSignature()
1122 1122
 	{
1123 1123
 		// Pass if a document doesn't exist
1124
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1124
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1125 1125
 		// Get signature information
1126 1126
 		$oMemberModel = getModel('member');
1127 1127
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1128 1128
 		// Check if a maximum height of signiture is set in the member module
1129
-		if(!isset($GLOBALS['__member_signature_max_height']))
1129
+		if (!isset($GLOBALS['__member_signature_max_height']))
1130 1130
 		{
1131 1131
 			$oModuleModel = getModel('module');
1132 1132
 			$member_config = $oModuleModel->getModuleConfig('member');
1133 1133
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1134 1134
 		}
1135
-		if($signature)
1135
+		if ($signature)
1136 1136
 		{
1137 1137
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1138
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1138
+			if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1139 1139
 		}
1140 1140
 
1141 1141
 		return $signature;
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 	 */
1149 1149
 	function replaceResourceRealPath($matches)
1150 1150
 	{
1151
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1151
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
1152 1152
 	}
1153 1153
 
1154 1154
 	/**
@@ -1159,19 +1159,19 @@  discard block
 block discarded – undo
1159 1159
 	function _checkAccessibleFromStatus()
1160 1160
 	{
1161 1161
 		$logged_info = Context::get('logged_info');
1162
-		if($logged_info->is_admin == 'Y') return true;
1162
+		if ($logged_info->is_admin == 'Y') return true;
1163 1163
 
1164 1164
 		$status = $this->get('status');
1165
-		if(empty($status)) return false;
1165
+		if (empty($status)) return false;
1166 1166
 
1167 1167
 		$oDocumentModel = getModel('document');
1168 1168
 		$configStatusList = $oDocumentModel->getStatusList();
1169 1169
 
1170
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1170
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1171 1171
 			return true;
1172
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1172
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1173 1173
 		{
1174
-			if($this->get('member_srl') == $logged_info->member_srl)
1174
+			if ($this->get('member_srl') == $logged_info->member_srl)
1175 1175
 				return true;
1176 1176
 		}
1177 1177
 		return false;
Please login to merge, or discard this patch.
Braces   +263 added lines, -110 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function _loadFromDB($load_extra_vars = true)
76 76
 	{
77
-		if(!$this->document_srl) return;
77
+		if(!$this->document_srl) {
78
+			return;
79
+		}
78 80
 
79 81
 		$document_item = false;
80 82
 		$cache_put = false;
@@ -106,8 +108,7 @@  discard block
 block discarded – undo
106 108
 			{
107 109
 				$oCacheHandler->put($cache_key, $document_item);
108 110
 			}
109
-		}
110
-		else
111
+		} else
111 112
 		{
112 113
 			$document_item->readed_count = $output->data->readed_count;
113 114
 			$document_item->voted_count = $output->data->voted_count;
@@ -154,18 +155,28 @@  discard block
 block discarded – undo
154 155
 
155 156
 	function isGranted()
156 157
 	{
157
-		if($_SESSION['own_document'][$this->document_srl]) return true;
158
+		if($_SESSION['own_document'][$this->document_srl]) {
159
+			return true;
160
+		}
158 161
 
159
-		if(!Context::get('is_logged')) return false;
162
+		if(!Context::get('is_logged')) {
163
+			return false;
164
+		}
160 165
 
161 166
 		$logged_info = Context::get('logged_info');
162
-		if($logged_info->is_admin == 'Y') return true;
167
+		if($logged_info->is_admin == 'Y') {
168
+			return true;
169
+		}
163 170
 
164 171
 		$oModuleModel = getModel('module');
165 172
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
166
-		if($grant->manager) return true;
173
+		if($grant->manager) {
174
+			return true;
175
+		}
167 176
 
168
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true;
177
+		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) {
178
+			return true;
179
+		}
169 180
 
170 181
 		return false;
171 182
 	}
@@ -183,7 +194,9 @@  discard block
 block discarded – undo
183 194
 	function allowComment()
184 195
 	{
185 196
 		// init write, document is not exists. so allow comment status is true
186
-		if(!$this->isExists()) return true;
197
+		if(!$this->isExists()) {
198
+			return true;
199
+		}
187 200
 
188 201
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
189 202
 	}
@@ -198,8 +211,7 @@  discard block
 block discarded – undo
198 211
 			if(!getClass('trackback'))
199 212
 			{
200 213
 				$allow_trackback_status = false;
201
-			}
202
-			else
214
+			} else
203 215
 			{
204 216
 				// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
205 217
 				$oModuleModel = getModel('module');
@@ -210,15 +222,21 @@  discard block
 block discarded – undo
210 222
 					$trackback_config = new stdClass();
211 223
 				}
212 224
 				
213
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
215
-				else
225
+				if(!isset($trackback_config->enable_trackback)) {
226
+					$trackback_config->enable_trackback = 'Y';
227
+				}
228
+				if($trackback_config->enable_trackback != 'Y') {
229
+					$allow_trackback_status = false;
230
+				} else
216 231
 				{
217 232
 					$module_srl = $this->get('module_srl');
218 233
 					// Check settings of each module
219 234
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
220
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
235
+					if($module_config->enable_trackback == 'N') {
236
+						$allow_trackback_status = false;
237
+					} else if($this->get('allow_trackback')=='Y' || !$this->isExists()) {
238
+						$allow_trackback_status = true;
239
+					}
222 240
 				}
223 241
 			}
224 242
 		}
@@ -227,14 +245,18 @@  discard block
 block discarded – undo
227 245
 
228 246
 	function isLocked()
229 247
 	{
230
-		if(!$this->isExists()) return false;
248
+		if(!$this->isExists()) {
249
+			return false;
250
+		}
231 251
 
232 252
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
233 253
 	}
234 254
 
235 255
 	function isEditable()
236 256
 	{
237
-		if($this->isGranted() || !$this->get('member_srl')) return true;
257
+		if($this->isGranted() || !$this->get('member_srl')) {
258
+			return true;
259
+		}
238 260
 		return false;
239 261
 	}
240 262
 
@@ -256,9 +278,14 @@  discard block
 block discarded – undo
256 278
 
257 279
 	function doCart()
258 280
 	{
259
-		if(!$this->document_srl) return false;
260
-		if($this->isCarted()) $this->removeCart();
261
-		else $this->addCart();
281
+		if(!$this->document_srl) {
282
+			return false;
283
+		}
284
+		if($this->isCarted()) {
285
+			$this->removeCart();
286
+		} else {
287
+			$this->addCart();
288
+		}
262 289
 	}
263 290
 
264 291
 	function addCart()
@@ -284,16 +311,26 @@  discard block
 block discarded – undo
284 311
 	 */
285 312
 	function notify($type, $content)
286 313
 	{
287
-		if(!$this->document_srl) return;
314
+		if(!$this->document_srl) {
315
+			return;
316
+		}
288 317
 		// return if it is not useNotify
289
-		if(!$this->useNotify()) return;
318
+		if(!$this->useNotify()) {
319
+			return;
320
+		}
290 321
 		// Pass if an author is not a logged-in user
291
-		if(!$this->get('member_srl')) return;
322
+		if(!$this->get('member_srl')) {
323
+			return;
324
+		}
292 325
 		// Return if the currently logged-in user is an author
293 326
 		$logged_info = Context::get('logged_info');
294
-		if($logged_info->member_srl == $this->get('member_srl')) return;
327
+		if($logged_info->member_srl == $this->get('member_srl')) {
328
+			return;
329
+		}
295 330
 		// List variables
296
-		if($type) $title = "[".$type."] ";
331
+		if($type) {
332
+			$title = "[".$type."] ";
333
+		}
297 334
 		$title .= cut_str(strip_tags($content), 10, '...');
298 335
 		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
299 336
 		$receiver_srl = $this->get('member_srl');
@@ -320,16 +357,22 @@  discard block
 block discarded – undo
320 357
 
321 358
 	function isExistsHomepage()
322 359
 	{
323
-		if(trim($this->get('homepage'))) return true;
360
+		if(trim($this->get('homepage'))) {
361
+			return true;
362
+		}
324 363
 		return false;
325 364
 	}
326 365
 
327 366
 	function getHomepageUrl()
328 367
 	{
329 368
 		$url = trim($this->get('homepage'));
330
-		if(!$url) return;
369
+		if(!$url) {
370
+			return;
371
+		}
331 372
 
332
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
373
+		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) {
374
+			$url = 'http://' . $url;
375
+		}
333 376
 
334 377
 		return $url;
335 378
 	}
@@ -361,43 +404,65 @@  discard block
 block discarded – undo
361 404
 
362 405
 	function getTitleText($cut_size = 0, $tail='...')
363 406
 	{
364
-		if(!$this->document_srl) return;
407
+		if(!$this->document_srl) {
408
+			return;
409
+		}
365 410
 
366
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
367
-		else $title = $this->get('title');
411
+		if($cut_size) {
412
+			$title = cut_str($this->get('title'), $cut_size, $tail);
413
+		} else {
414
+			$title = $this->get('title');
415
+		}
368 416
 
369 417
 		return $title;
370 418
 	}
371 419
 
372 420
 	function getTitle($cut_size = 0, $tail='...')
373 421
 	{
374
-		if(!$this->document_srl) return;
422
+		if(!$this->document_srl) {
423
+			return;
424
+		}
375 425
 
376 426
 		$title = $this->getTitleText($cut_size, $tail);
377 427
 
378 428
 		$attrs = array();
379 429
 		$this->add('title_color', trim($this->get('title_color')));
380
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
381
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
430
+		if($this->get('title_bold')=='Y') {
431
+			$attrs[] = "font-weight:bold;";
432
+		}
433
+		if($this->get('title_color') && $this->get('title_color') != 'N') {
434
+			$attrs[] = "color:#".$this->get('title_color');
435
+		}
382 436
 
383
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
384
-		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
437
+		if(count($attrs)) {
438
+			return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
439
+		} else {
440
+			return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
441
+		}
385 442
 	}
386 443
 
387 444
 	function getContentText($strlen = 0)
388 445
 	{
389
-		if(!$this->document_srl) return;
446
+		if(!$this->document_srl) {
447
+			return;
448
+		}
390 449
 
391
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
450
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
451
+			return Context::getLang('msg_is_secret');
452
+		}
392 453
 
393 454
 		$result = $this->_checkAccessibleFromStatus();
394
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
455
+		if($result) {
456
+			$_SESSION['accessible'][$this->document_srl] = true;
457
+		}
395 458
 
396 459
 		$content = $this->get('content');
397 460
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
398 461
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
399 462
 
400
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
463
+		if($strlen) {
464
+			return cut_str(strip_tags($content),$strlen,'...');
465
+		}
401 466
 
402 467
 		return htmlspecialchars($content);
403 468
 	}
@@ -430,14 +495,12 @@  discard block
 block discarded – undo
430 495
 				}
431 496
 				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
432 497
 			}
433
-		}
434
-		else if($m[1] == 'embed')
498
+		} else if($m[1] == 'embed')
435 499
 		{
436 500
 			if(stripos($m[0], 'allowscriptaccess'))
437 501
 			{
438 502
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
439
-			}
440
-			else
503
+			} else
441 504
 			{
442 505
 				$m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]);
443 506
 			}
@@ -447,15 +510,23 @@  discard block
 block discarded – undo
447 510
 
448 511
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
449 512
 	{
450
-		if(!$this->document_srl) return;
513
+		if(!$this->document_srl) {
514
+			return;
515
+		}
451 516
 
452
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
517
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
518
+			return Context::getLang('msg_is_secret');
519
+		}
453 520
 
454 521
 		$result = $this->_checkAccessibleFromStatus();
455
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
522
+		if($result) {
523
+			$_SESSION['accessible'][$this->document_srl] = true;
524
+		}
456 525
 
457 526
 		$content = $this->get('content');
458
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
527
+		if(!$stripEmbedTagException) {
528
+			stripEmbedTagForAdmin($content, $this->get('member_srl'));
529
+		}
459 530
 
460 531
 		// Define a link if using a rewrite module
461 532
 		$oContext = &Context::getInstance();
@@ -489,10 +560,11 @@  discard block
 block discarded – undo
489 560
 				$this->document_srl, $memberSrl
490 561
 			);
491 562
 			// Add xe_content class although accessing content is not required
492
-		}
493
-		else
563
+		} else
494 564
 		{
495
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
565
+			if($add_xe_content_class) {
566
+				$content = sprintf('<div class="xe_content">%s</div>', $content);
567
+			}
496 568
 		}
497 569
 		// Change the image path to a valid absolute path if resource_realpath is true
498 570
 		if($resource_realpath)
@@ -611,11 +683,15 @@  discard block
 block discarded – undo
611 683
 
612 684
 	function getTrackbackUrl()
613 685
 	{
614
-		if(!$this->document_srl) return;
686
+		if(!$this->document_srl) {
687
+			return;
688
+		}
615 689
 
616 690
 		// Generate a key to prevent spams
617 691
 		$oTrackbackModel = getModel('trackback');
618
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
692
+		if($oTrackbackModel) {
693
+			return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
694
+		}
619 695
 	}
620 696
 
621 697
 	/**
@@ -634,7 +710,9 @@  discard block
 block discarded – undo
634 710
 
635 711
 	function isExtraVarsExists()
636 712
 	{
637
-		if(!$this->get('module_srl')) return false;
713
+		if(!$this->get('module_srl')) {
714
+			return false;
715
+		}
638 716
 		$oDocumentModel = getModel('document');
639 717
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
640 718
 		return count($extra_keys)?true:false;
@@ -642,7 +720,9 @@  discard block
 block discarded – undo
642 720
 
643 721
 	function getExtraVars()
644 722
 	{
645
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
723
+		if(!$this->get('module_srl') || !$this->document_srl) {
724
+			return null;
725
+		}
646 726
 
647 727
 		$oDocumentModel = getModel('document');
648 728
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -654,8 +734,7 @@  discard block
 block discarded – undo
654 734
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
655 735
 		{
656 736
 			return $extra_vars[$idx]->getValue();
657
-		}
658
-		else
737
+		} else
659 738
 		{
660 739
 			return '';
661 740
 		}
@@ -667,8 +746,7 @@  discard block
 block discarded – undo
667 746
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
668 747
 		{
669 748
 			return $extra_vars[$idx]->getValueHTML();
670
-		}
671
-		else
749
+		} else
672 750
 		{
673 751
 			return '';
674 752
 		}
@@ -690,8 +768,7 @@  discard block
 block discarded – undo
690 768
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
691 769
 		{
692 770
 			return $extra_eid[$eid]->getValue();
693
-		}
694
-		else
771
+		} else
695 772
 		{
696 773
 			return '';
697 774
 		}
@@ -709,8 +786,7 @@  discard block
 block discarded – undo
709 786
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
710 787
 		{
711 788
 			return $extra_eid[$eid]->getValueHTML();
712
-		}
713
-		else
789
+		} else
714 790
 		{
715 791
 			return '';
716 792
 		}
@@ -730,8 +806,12 @@  discard block
 block discarded – undo
730 806
 
731 807
 	function getComments()
732 808
 	{
733
-		if(!$this->getCommentCount()) return;
734
-		if(!$this->isGranted() && $this->isSecret()) return;
809
+		if(!$this->getCommentCount()) {
810
+			return;
811
+		}
812
+		if(!$this->isGranted() && $this->isSecret()) {
813
+			return;
814
+		}
735 815
 		// cpage is a number of comment pages
736 816
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
737 817
 		$cpage = Context::get($cpageStr);
@@ -744,7 +824,9 @@  discard block
 block discarded – undo
744 824
 		// Get a list of comments
745 825
 		$oCommentModel = getModel('comment');
746 826
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
747
-		if(!$output->toBool() || !count($output->data)) return;
827
+		if(!$output->toBool() || !count($output->data)) {
828
+			return;
829
+		}
748 830
 		// Create commentItem object from a comment list
749 831
 		// If admin priviledge is granted on parent posts, you can read its child posts.
750 832
 		$accessible = array();
@@ -754,7 +836,9 @@  discard block
 block discarded – undo
754 836
 			$oCommentItem = new commentItem();
755 837
 			$oCommentItem->setAttribute($val);
756 838
 			// If permission is granted to the post, you can access it temporarily
757
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
839
+			if($oCommentItem->isGranted()) {
840
+				$accessible[$val->comment_srl] = true;
841
+			}
758 842
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
759 843
 			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
760 844
 			{
@@ -765,7 +849,9 @@  discard block
 block discarded – undo
765 849
 		// Variable setting to be displayed on the skin
766 850
 		Context::set($cpageStr, $output->page_navigation->cur_page);
767 851
 		Context::set('cpage', $output->page_navigation->cur_page);
768
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
852
+		if($output->total_page>1) {
853
+			$this->comment_page_navigation = $output->page_navigation;
854
+		}
769 855
 
770 856
 		return $comment_list;
771 857
 	}
@@ -777,9 +863,13 @@  discard block
 block discarded – undo
777 863
 
778 864
 	function getTrackbacks()
779 865
 	{
780
-		if(!$this->document_srl) return;
866
+		if(!$this->document_srl) {
867
+			return;
868
+		}
781 869
 
782
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
870
+		if(!$this->allowTrackback() || !$this->get('trackback_count')) {
871
+			return;
872
+		}
783 873
 
784 874
 		$oTrackbackModel = getModel('trackback');
785 875
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -787,15 +877,21 @@  discard block
 block discarded – undo
787 877
 
788 878
 	function thumbnailExists($width = 80, $height = 0, $type = '')
789 879
 	{
790
-		if(!$this->document_srl) return false;
791
-		if(!$this->getThumbnail($width, $height, $type)) return false;
880
+		if(!$this->document_srl) {
881
+			return false;
882
+		}
883
+		if(!$this->getThumbnail($width, $height, $type)) {
884
+			return false;
885
+		}
792 886
 		return true;
793 887
 	}
794 888
 
795 889
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
796 890
 	{
797 891
 		// Return false if the document doesn't exist
798
-		if(!$this->document_srl) return;
892
+		if(!$this->document_srl) {
893
+			return;
894
+		}
799 895
 
800 896
 		if($this->isSecret() && !$this->isGranted())
801 897
 		{
@@ -803,7 +899,9 @@  discard block
 block discarded – undo
803 899
 		}
804 900
 
805 901
 		// If not specify its height, create a square
806
-		if(!$height) $height = $width;
902
+		if(!$height) {
903
+			$height = $width;
904
+		}
807 905
 
808 906
 		// Return false if neither attachement nor image files in the document
809 907
 		$content = $this->get('content');
@@ -821,7 +919,9 @@  discard block
 block discarded – undo
821 919
 				}
822 920
 			}
823 921
 
824
-			if(!preg_match("!<img!is", $content)) return;
922
+			if(!preg_match("!<img!is", $content)) {
923
+				return;
924
+			}
825 925
 		}
826 926
 		// Get thumbnai_type information from document module's configuration
827 927
 		if(!in_array($thumbnail_type, array('crop','ratio')))
@@ -848,8 +948,7 @@  discard block
 block discarded – undo
848 948
 			if(filesize($thumbnail_file) < 1)
849 949
 			{
850 950
 				return FALSE;
851
-			}
852
-			else
951
+			} else
853 952
 			{
854 953
 				return $thumbnail_url;
855 954
 			}
@@ -870,7 +969,9 @@  discard block
 block discarded – undo
870 969
 			$first_image = null;
871 970
 			foreach($file_list as $file)
872 971
 			{
873
-				if($file->direct_download !== 'Y') continue;
972
+				if($file->direct_download !== 'Y') {
973
+					continue;
974
+				}
874 975
 
875 976
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
876 977
 				{
@@ -878,7 +979,9 @@  discard block
 block discarded – undo
878 979
 					break;
879 980
 				}
880 981
 
881
-				if($first_image) continue;
982
+				if($first_image) {
983
+					continue;
984
+				}
882 985
 
883 986
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
884 987
 				{
@@ -905,7 +1008,9 @@  discard block
 block discarded – undo
905 1008
 			foreach($matches as $target_image)
906 1009
 			{
907 1010
 				$target_src = trim($target_image[1]);
908
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
1011
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
1012
+					continue;
1013
+				}
909 1014
 
910 1015
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
911 1016
 				{
@@ -916,7 +1021,9 @@  discard block
 block discarded – undo
916 1021
 
917 1022
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
918 1023
 				FileHandler::getRemoteFile($target_src, $tmp_file);
919
-				if(!file_exists($tmp_file)) continue;
1024
+				if(!file_exists($tmp_file)) {
1025
+					continue;
1026
+				}
920 1027
 
921 1028
 				$imageinfo = getimagesize($tmp_file);
922 1029
 				list($_w, $_h) = $imageinfo;
@@ -967,21 +1074,28 @@  discard block
 block discarded – undo
967 1074
 	 */
968 1075
 	function getExtraImages($time_interval = 43200)
969 1076
 	{
970
-		if(!$this->document_srl) return;
1077
+		if(!$this->document_srl) {
1078
+			return;
1079
+		}
971 1080
 		// variables for icon list
972 1081
 		$buffs = array();
973 1082
 
974 1083
 		$check_files = false;
975 1084
 
976 1085
 		// Check if secret post is
977
-		if($this->isSecret()) $buffs[] = "secret";
1086
+		if($this->isSecret()) {
1087
+			$buffs[] = "secret";
1088
+		}
978 1089
 
979 1090
 		// Set the latest time
980 1091
 		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
981 1092
 
982 1093
 		// Check new post
983
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
984
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
1094
+		if($this->get('regdate')>$time_check) {
1095
+			$buffs[] = "new";
1096
+		} else if($this->get('last_update')>$time_check) {
1097
+			$buffs[] = "update";
1098
+		}
985 1099
 
986 1100
 		/*
987 1101
 		   $content = $this->get('content');
@@ -1004,14 +1118,18 @@  discard block
 block discarded – undo
1004 1118
 		 */
1005 1119
 
1006 1120
 		// Check the attachment
1007
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1121
+		if($this->hasUploadedFiles()) {
1122
+			$buffs[] = "file";
1123
+		}
1008 1124
 
1009 1125
 		return $buffs;
1010 1126
 	}
1011 1127
 
1012 1128
 	function getStatus()
1013 1129
 	{
1014
-		if(!$this->get('status')) return $this->getDefaultStatus();
1130
+		if(!$this->get('status')) {
1131
+			return $this->getDefaultStatus();
1132
+		}
1015 1133
 		return $this->get('status');
1016 1134
 	}
1017 1135
 
@@ -1022,12 +1140,16 @@  discard block
 block discarded – undo
1022 1140
 	 */
1023 1141
 	function printExtraImages($time_check = 43200)
1024 1142
 	{
1025
-		if(!$this->document_srl) return;
1143
+		if(!$this->document_srl) {
1144
+			return;
1145
+		}
1026 1146
 		// Get the icon directory
1027 1147
 		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
1028 1148
 
1029 1149
 		$buffs = $this->getExtraImages($time_check);
1030
-		if(!count($buffs)) return;
1150
+		if(!count($buffs)) {
1151
+			return;
1152
+		}
1031 1153
 
1032 1154
 		$buff = array();
1033 1155
 		foreach($buffs as $key => $val)
@@ -1039,18 +1161,28 @@  discard block
 block discarded – undo
1039 1161
 
1040 1162
 	function hasUploadedFiles()
1041 1163
 	{
1042
-		if(!$this->document_srl) return;
1164
+		if(!$this->document_srl) {
1165
+			return;
1166
+		}
1043 1167
 
1044
-		if($this->isSecret() && !$this->isGranted()) return false;
1168
+		if($this->isSecret() && !$this->isGranted()) {
1169
+			return false;
1170
+		}
1045 1171
 		return $this->get('uploaded_count')? true : false;
1046 1172
 	}
1047 1173
 
1048 1174
 	function getUploadedFiles($sortIndex = 'file_srl')
1049 1175
 	{
1050
-		if(!$this->document_srl) return;
1176
+		if(!$this->document_srl) {
1177
+			return;
1178
+		}
1051 1179
 
1052
-		if($this->isSecret() && !$this->isGranted()) return;
1053
-		if(!$this->get('uploaded_count')) return;
1180
+		if($this->isSecret() && !$this->isGranted()) {
1181
+			return;
1182
+		}
1183
+		if(!$this->get('uploaded_count')) {
1184
+			return;
1185
+		}
1054 1186
 
1055 1187
 		if(!$this->uploadedFiles[$sortIndex])
1056 1188
 		{
@@ -1068,7 +1200,9 @@  discard block
 block discarded – undo
1068 1200
 	function getEditor()
1069 1201
 	{
1070 1202
 		$module_srl = $this->get('module_srl');
1071
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1203
+		if(!$module_srl) {
1204
+			$module_srl = Context::get('module_srl');
1205
+		}
1072 1206
 
1073 1207
 		$oEditorModel = getModel('editor');
1074 1208
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1082,8 +1216,12 @@  discard block
 block discarded – undo
1082 1216
 	function isEnableComment()
1083 1217
 	{
1084 1218
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1085
-		if (!$this->allowComment()) return false;
1086
-		if(!$this->isGranted() && $this->isSecret()) return false;
1219
+		if (!$this->allowComment()) {
1220
+			return false;
1221
+		}
1222
+		if(!$this->isGranted() && $this->isSecret()) {
1223
+			return false;
1224
+		}
1087 1225
 
1088 1226
 		return true;
1089 1227
 	}
@@ -1094,7 +1232,9 @@  discard block
 block discarded – undo
1094 1232
 	 */
1095 1233
 	function getCommentEditor()
1096 1234
 	{
1097
-		if(!$this->isEnableComment()) return;
1235
+		if(!$this->isEnableComment()) {
1236
+			return;
1237
+		}
1098 1238
 
1099 1239
 		$oEditorModel = getModel('editor');
1100 1240
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1106,10 +1246,14 @@  discard block
 block discarded – undo
1106 1246
 	 */
1107 1247
 	function getProfileImage()
1108 1248
 	{
1109
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1249
+		if(!$this->isExists() || !$this->get('member_srl')) {
1250
+			return;
1251
+		}
1110 1252
 		$oMemberModel = getModel('member');
1111 1253
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1112
-		if(!$profile_info) return;
1254
+		if(!$profile_info) {
1255
+			return;
1256
+		}
1113 1257
 
1114 1258
 		return $profile_info->src;
1115 1259
 	}
@@ -1121,7 +1265,9 @@  discard block
 block discarded – undo
1121 1265
 	function getSignature()
1122 1266
 	{
1123 1267
 		// Pass if a document doesn't exist
1124
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1268
+		if(!$this->isExists() || !$this->get('member_srl')) {
1269
+			return;
1270
+		}
1125 1271
 		// Get signature information
1126 1272
 		$oMemberModel = getModel('member');
1127 1273
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
@@ -1135,7 +1281,9 @@  discard block
 block discarded – undo
1135 1281
 		if($signature)
1136 1282
 		{
1137 1283
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1138
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1284
+			if($max_signature_height) {
1285
+				$signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1286
+			}
1139 1287
 		}
1140 1288
 
1141 1289
 		return $signature;
@@ -1159,20 +1307,25 @@  discard block
 block discarded – undo
1159 1307
 	function _checkAccessibleFromStatus()
1160 1308
 	{
1161 1309
 		$logged_info = Context::get('logged_info');
1162
-		if($logged_info->is_admin == 'Y') return true;
1310
+		if($logged_info->is_admin == 'Y') {
1311
+			return true;
1312
+		}
1163 1313
 
1164 1314
 		$status = $this->get('status');
1165
-		if(empty($status)) return false;
1315
+		if(empty($status)) {
1316
+			return false;
1317
+		}
1166 1318
 
1167 1319
 		$oDocumentModel = getModel('document');
1168 1320
 		$configStatusList = $oDocumentModel->getStatusList();
1169 1321
 
1170
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1171
-			return true;
1172
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1322
+		if($status == $configStatusList['public'] || $status == $configStatusList['publish']) {
1323
+					return true;
1324
+		} else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1173 1325
 		{
1174
-			if($this->get('member_srl') == $logged_info->member_srl)
1175
-				return true;
1326
+			if($this->get('member_srl') == $logged_info->member_srl) {
1327
+							return true;
1328
+			}
1176 1329
 		}
1177 1330
 		return false;
1178 1331
 	}
Please login to merge, or discard this patch.
modules/comment/comment.item.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	function _loadFromDB()
51 51
 	{
52
-		if(!$this->comment_srl)
52
+		if (!$this->comment_srl)
53 53
 		{
54 54
 			return;
55 55
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	function setAttribute($attribute)
69 69
 	{
70
-		if(!$attribute->comment_srl)
70
+		if (!$attribute->comment_srl)
71 71
 		{
72 72
 			$this->comment_srl = NULL;
73 73
 			return;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 		$this->adds($attribute);
78 78
 
79 79
 		// define vars on the object for backward compatibility of skins
80
-		if(count($attribute))
80
+		if (count($attribute))
81 81
 		{
82
-			foreach($attribute as $key => $val)
82
+			foreach ($attribute as $key => $val)
83 83
 			{
84 84
 				$this->{$key} = $val;
85 85
 			}
@@ -93,29 +93,29 @@  discard block
 block discarded – undo
93 93
 
94 94
 	function isGranted()
95 95
 	{
96
-		if($_SESSION['own_comment'][$this->comment_srl])
96
+		if ($_SESSION['own_comment'][$this->comment_srl])
97 97
 		{
98 98
 			return TRUE;
99 99
 		}
100 100
 
101
-		if(!Context::get('is_logged'))
101
+		if (!Context::get('is_logged'))
102 102
 		{
103 103
 			return FALSE;
104 104
 		}
105 105
 
106 106
 		$logged_info = Context::get('logged_info');
107
-		if($logged_info->is_admin == 'Y')
107
+		if ($logged_info->is_admin == 'Y')
108 108
 		{
109 109
 			return TRUE;
110 110
 		}
111 111
 
112 112
 		$grant = Context::get('grant');
113
-		if($grant->manager)
113
+		if ($grant->manager)
114 114
 		{
115 115
 			return TRUE;
116 116
 		}
117 117
 
118
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
118
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
119 119
 		{
120 120
 			return TRUE;
121 121
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 	function isEditable()
138 138
 	{
139
-		if($this->isGranted() || !$this->get('member_srl'))
139
+		if ($this->isGranted() || !$this->get('member_srl'))
140 140
 		{
141 141
 			return TRUE;
142 142
 		}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 
151 151
 	function isAccessible()
152 152
 	{
153
-		if($_SESSION['accessibled_comment'][$this->comment_srl])
153
+		if ($_SESSION['accessibled_comment'][$this->comment_srl])
154 154
 		{
155 155
 			return TRUE;
156 156
 		}
157 157
 
158
-		if($this->isGranted() || !$this->isSecret())
158
+		if ($this->isGranted() || !$this->isSecret())
159 159
 		{
160 160
 			$this->setAccessible();
161 161
 			return TRUE;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 		$oDocumentModel = getModel('document');
165 165
 		$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
166
-		if($oDocument->isGranted())
166
+		if ($oDocument->isGranted())
167 167
 		{
168 168
 			$this->setAccessible();
169 169
 			return TRUE;
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
 	function notify($type, $content)
185 185
 	{
186 186
 		// return if not useNotify
187
-		if(!$this->useNotify())
187
+		if (!$this->useNotify())
188 188
 		{
189 189
 			return;
190 190
 		}
191 191
 
192 192
 		// pass if the author is not logged-in user 
193
-		if(!$this->get('member_srl'))
193
+		if (!$this->get('member_srl'))
194 194
 		{
195 195
 			return;
196 196
 		}
197 197
 
198 198
 		// return if the currently logged-in user is an author of the comment.
199 199
 		$logged_info = Context::get('logged_info');
200
-		if($logged_info->member_srl == $this->get('member_srl'))
200
+		if ($logged_info->member_srl == $this->get('member_srl'))
201 201
 		{
202 202
 			return;
203 203
 		}
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 		$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
208 208
 
209 209
 		// Variables
210
-		if($type)
210
+		if ($type)
211 211
 		{
212
-			$title = "[" . $type . "] ";
212
+			$title = "[".$type."] ";
213 213
 		}
214 214
 
215 215
 		$title .= cut_str(strip_tags($content), 30, '...');
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 
225 225
 	function getIpAddress()
226 226
 	{
227
-		if($this->isGranted())
227
+		if ($this->isGranted())
228 228
 		{
229 229
 			return $this->get('ipaddress');
230 230
 		}
231 231
 
232
-		return '*' . strstr($this->get('ipaddress'), '.');
232
+		return '*'.strstr($this->get('ipaddress'), '.');
233 233
 	}
234 234
 
235 235
 	function isExistsHomepage()
236 236
 	{
237
-		if(trim($this->get('homepage')))
237
+		if (trim($this->get('homepage')))
238 238
 		{
239 239
 			return TRUE;
240 240
 		}
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 	function getHomepageUrl()
246 246
 	{
247 247
 		$url = trim($this->get('homepage'));
248
-		if(!$url)
248
+		if (!$url)
249 249
 		{
250 250
 			return;
251 251
 		}
252 252
 
253
-		if(strncasecmp('http://', $url, 7) !== 0)
253
+		if (strncasecmp('http://', $url, 7) !== 0)
254 254
 		{
255
-			$url = "http://" . $url;
255
+			$url = "http://".$url;
256 256
 		}
257 257
 
258 258
 		return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	function getContentText($strlen = 0)
286 286
 	{
287
-		if($this->isSecret() && !$this->isAccessible())
287
+		if ($this->isSecret() && !$this->isAccessible())
288 288
 		{
289 289
 			return Context::getLang('msg_is_secret');
290 290
 		}
291 291
 
292 292
 		$content = $this->get('content');
293 293
 
294
-		if($strlen)
294
+		if ($strlen)
295 295
 		{
296 296
 			return cut_str(strip_tags($content), $strlen, '...');
297 297
 		}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE)
307 307
 	{
308
-		if($this->isSecret() && !$this->isAccessible())
308
+		if ($this->isSecret() && !$this->isAccessible())
309 309
 		{
310 310
 			return Context::getLang('msg_is_secret');
311 311
 		}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		stripEmbedTagForAdmin($content, $this->get('member_srl'));
315 315
 
316 316
 		// when displaying the comment on the pop-up menu
317
-		if($add_popup_menu && Context::get('is_logged'))
317
+		if ($add_popup_menu && Context::get('is_logged'))
318 318
 		{
319 319
 			$content = sprintf(
320 320
 					'%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do')
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 		}
323 323
 
324 324
 		// if additional information which can access contents is set
325
-		if($add_content_info)
325
+		if ($add_content_info)
326 326
 		{
327 327
 			$memberSrl = $this->get('member_srl');
328
-			if($memberSrl < 0)
328
+			if ($memberSrl < 0)
329 329
 			{
330 330
 				$memberSrl = 0;
331 331
 			}
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		}
337 337
 		else
338 338
 		{
339
-			if($add_xe_content_class)
339
+			if ($add_xe_content_class)
340 340
 			{
341 341
 				$content = sprintf('<div class="xe_content">%s</div>', $content);
342 342
 			}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 	function getRegdateGM()
398 398
 	{
399
-		return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone'];
399
+		return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone'];
400 400
 	}
401 401
 
402 402
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
 	function getPermanentUrl()
408 408
 	{
409
-		return getFullUrl('', 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl');
409
+		return getFullUrl('', 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl');
410 410
 	}
411 411
 
412 412
 	function getUpdateTime()
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
 	function hasUploadedFiles()
429 429
 	{
430
-		if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
430
+		if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
431 431
 		{
432 432
 			return FALSE;
433 433
 		}
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
 
437 437
 	function getUploadedFiles()
438 438
 	{
439
-		if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
439
+		if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
440 440
 		{
441 441
 			return;
442 442
 		}
443 443
 
444
-		if(!$this->get('uploaded_count'))
444
+		if (!$this->get('uploaded_count'))
445 445
 		{
446 446
 			return;
447 447
 		}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	function getEditor()
459 459
 	{
460 460
 		$module_srl = $this->get('module_srl');
461
-		if(!$module_srl)
461
+		if (!$module_srl)
462 462
 		{
463 463
 			$module_srl = Context::get('module_srl');
464 464
 		}
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
 	 */
473 473
 	function getProfileImage()
474 474
 	{
475
-		if(!$this->isExists() || !$this->get('member_srl'))
475
+		if (!$this->isExists() || !$this->get('member_srl'))
476 476
 		{
477 477
 			return;
478 478
 		}
479 479
 		$oMemberModel = getModel('member');
480 480
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
481
-		if(!$profile_info)
481
+		if (!$profile_info)
482 482
 		{
483 483
 			return;
484 484
 		}
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	function getSignature()
494 494
 	{
495 495
 		// pass if the posting not exists.
496
-		if(!$this->isExists() || !$this->get('member_srl'))
496
+		if (!$this->isExists() || !$this->get('member_srl'))
497 497
 		{
498 498
 			return;
499 499
 		}
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
504 504
 
505 505
 		// check if max height of the signiture is specified on the member module
506
-		if(!isset($GLOBALS['__member_signature_max_height']))
506
+		if (!isset($GLOBALS['__member_signature_max_height']))
507 507
 		{
508 508
 			$oModuleModel = getModel('module');
509 509
 			$member_config = $oModuleModel->getModuleConfig('member');
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 		$max_signature_height = $GLOBALS['__member_signature_max_height'];
514 514
 
515
-		if($max_signature_height)
515
+		if ($max_signature_height)
516 516
 		{
517 517
 			$signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
518 518
 		}
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 
523 523
 	function thumbnailExists($width = 80, $height = 0, $type = '')
524 524
 	{
525
-		if(!$this->comment_srl)
525
+		if (!$this->comment_srl)
526 526
 		{
527 527
 			return FALSE;
528 528
 		}
529 529
 
530
-		if(!$this->getThumbnail($width, $height, $type))
530
+		if (!$this->getThumbnail($width, $height, $type))
531 531
 		{
532 532
 			return FALSE;
533 533
 		}
@@ -538,42 +538,42 @@  discard block
 block discarded – undo
538 538
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
539 539
 	{
540 540
 		// return false if no doc exists
541
-		if(!$this->comment_srl)
541
+		if (!$this->comment_srl)
542 542
 		{
543 543
 			return;
544 544
 		}
545 545
 
546
-		if($this->isSecret() && !$this->isGranted())
546
+		if ($this->isSecret() && !$this->isGranted())
547 547
 		{
548 548
 			return;
549 549
 		}
550 550
 
551 551
 		// If signiture height setting is omitted, create a square
552
-		if(!$height)
552
+		if (!$height)
553 553
 		{
554 554
 			$height = $width;
555 555
 		}
556 556
 
557 557
 		$content = $this->get('content');
558
-		if(!$this->hasUploadedFiles())
558
+		if (!$this->hasUploadedFiles())
559 559
 		{
560
-			if(!$content)
560
+			if (!$content)
561 561
 			{
562 562
 				$args = new stdClass();
563 563
 				$args->comment_srl = $this->comment_srl;
564 564
 				$output = executeQuery('document.getComment', $args, array('content'));
565
-				if($output->toBool() && $output->data)
565
+				if ($output->toBool() && $output->data)
566 566
 				{
567 567
 					$content = $output->data->content;
568 568
 					$this->add('content', $content);
569 569
 				}
570 570
 			}
571 571
 
572
-			if(!preg_match("!<img!is", $content)) return;
572
+			if (!preg_match("!<img!is", $content)) return;
573 573
 		}
574 574
 
575 575
 		// get thumbail generation info on the doc module configuration.
576
-		if(!in_array($thumbnail_type, array('crop', 'ratio')))
576
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
577 577
 		{
578 578
 			$thumbnail_type = 'crop';
579 579
 		}
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
 		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3));
583 583
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
584 584
 		$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
585
-		$thumbnail_url = Context::getRequestUri() . $thumbnail_file;
585
+		$thumbnail_url = Context::getRequestUri().$thumbnail_file;
586 586
 
587 587
 		// return false if a size of existing thumbnail file is 0. otherwise return the file path
588
-		if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
588
+		if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
589 589
 		{
590
-			if(filesize($thumbnail_file) < 1)
590
+			if (filesize($thumbnail_file) < 1)
591 591
 			{
592 592
 				return FALSE;
593 593
 			}
@@ -605,33 +605,33 @@  discard block
 block discarded – undo
605 605
 		$is_tmp_file = FALSE;
606 606
 
607 607
 		// find an image file among attached files
608
-		if($this->hasUploadedFiles())
608
+		if ($this->hasUploadedFiles())
609 609
 		{
610 610
 			$file_list = $this->getUploadedFiles();
611 611
 
612 612
 			$first_image = null;
613
-			foreach($file_list as $file)
613
+			foreach ($file_list as $file)
614 614
 			{
615
-				if($file->direct_download !== 'Y') continue;
615
+				if ($file->direct_download !== 'Y') continue;
616 616
 
617
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
617
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
618 618
 				{
619 619
 					$source_file = $file->uploaded_filename;
620 620
 					break;
621 621
 				}
622 622
 
623
-				if($first_image) continue;
623
+				if ($first_image) continue;
624 624
 
625
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
625
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
626 626
 				{
627
-					if(file_exists($file->uploaded_filename))
627
+					if (file_exists($file->uploaded_filename))
628 628
 					{
629 629
 						$first_image = $file->uploaded_filename;
630 630
 					}
631 631
 				}
632 632
 			}
633 633
 
634
-			if(!$source_file && $first_image)
634
+			if (!$source_file && $first_image)
635 635
 			{
636 636
 				$source_file = $first_image;
637 637
 			}
@@ -639,31 +639,31 @@  discard block
 block discarded – undo
639 639
 
640 640
 		// get an image file from the doc content if no file attached. 
641 641
 		$is_tmp_file = false;
642
-		if(!$source_file)
642
+		if (!$source_file)
643 643
 		{
644 644
 			$random = new Password();
645 645
 
646 646
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
647 647
 
648
-			foreach($matches as $target_image)
648
+			foreach ($matches as $target_image)
649 649
 			{
650 650
 				$target_src = trim($target_image[1]);
651
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
651
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
652 652
 
653
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
653
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
654 654
 				{
655 655
 					$target_src = Context::getRequestUri().$target_src;
656 656
 				}
657 657
 
658 658
 				$target_src = htmlspecialchars_decode($target_src);
659 659
 
660
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
660
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
661 661
 				FileHandler::getRemoteFile($target_src, $tmp_file);
662
-				if(!file_exists($tmp_file)) continue;
662
+				if (!file_exists($tmp_file)) continue;
663 663
 
664 664
 				$imageinfo = getimagesize($tmp_file);
665 665
 				list($_w, $_h) = $imageinfo;
666
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
666
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
667 667
 					FileHandler::removeFile($tmp_file);
668 668
 					continue;
669 669
 				}
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
678 678
 
679 679
 		// Remove source file if it was temporary
680
-		if($is_tmp_file)
680
+		if ($is_tmp_file)
681 681
 		{
682 682
 			FileHandler::removeFile($source_file);
683 683
 		}
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
 		FileHandler::removeFile($thumbnail_lockfile);
687 687
 
688 688
 		// Return the thumbnail path if it was successfully generated
689
-		if($output)
689
+		if ($output)
690 690
 		{
691 691
 			return $thumbnail_url;
692 692
 		}
693 693
 		// Create an empty file if thumbnail generation failed
694 694
 		else
695 695
 		{
696
-			FileHandler::writeFile($thumbnail_file, '','w');
696
+			FileHandler::writeFile($thumbnail_file, '', 'w');
697 697
 		}
698 698
 
699 699
 		return;
Please login to merge, or discard this patch.
classes/security/Password.class.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 	public function getSupportedAlgorithms()
20 20
 	{
21 21
 		$retval = array();
22
-		if(function_exists('hash_hmac') && in_array('sha256', hash_algos()))
22
+		if (function_exists('hash_hmac') && in_array('sha256', hash_algos()))
23 23
 		{
24 24
 			$retval['pbkdf2'] = 'pbkdf2';
25 25
 		}
26
-		if(version_compare(PHP_VERSION, '5.3.7', '>=') && defined('CRYPT_BLOWFISH'))
26
+		if (version_compare(PHP_VERSION, '5.3.7', '>=') && defined('CRYPT_BLOWFISH'))
27 27
 		{
28 28
 			$retval['bcrypt'] = 'bcrypt';
29 29
 		}
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function getCurrentlySelectedAlgorithm()
49 49
 	{
50
-		if(function_exists('getModel'))
50
+		if (function_exists('getModel'))
51 51
 		{
52 52
 			$config = getModel('member')->getMemberConfig();
53 53
 			$algorithm = $config->password_hashing_algorithm;
54
-			if(strval($algorithm) === '')
54
+			if (strval($algorithm) === '')
55 55
 			{
56
-				$algorithm = 'md5';  // Historical default for XE
56
+				$algorithm = 'md5'; // Historical default for XE
57 57
 			}
58 58
 		}
59 59
 		else
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function getWorkFactor()
71 71
 	{
72
-		if(function_exists('getModel'))
72
+		if (function_exists('getModel'))
73 73
 		{
74 74
 			$config = getModel('member')->getMemberConfig();
75 75
 			$work_factor = $config->password_hashing_work_factor;
76
-			if(!$work_factor || $work_factor < 4 || $work_factor > 31)
76
+			if (!$work_factor || $work_factor < 4 || $work_factor > 31)
77 77
 			{
78
-				$work_factor = 8;  // Reasonable default
78
+				$work_factor = 8; // Reasonable default
79 79
 			}
80 80
 		}
81 81
 		else
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function createHash($password, $algorithm = null)
95 95
 	{
96
-		if($algorithm === null)
96
+		if ($algorithm === null)
97 97
 		{
98 98
 			$algorithm = $this->getCurrentlySelectedAlgorithm();
99 99
 		}
100
-		if(!array_key_exists($algorithm, $this->getSupportedAlgorithms()))
100
+		if (!array_key_exists($algorithm, $this->getSupportedAlgorithms()))
101 101
 		{
102 102
 			return false;
103 103
 		}
104 104
 
105 105
 		$password = trim($password);
106 106
 
107
-		switch($algorithm)
107
+		switch ($algorithm)
108 108
 		{
109 109
 			case 'md5':
110 110
 				return md5($password);
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function checkPassword($password, $hash, $algorithm = null)
134 134
 	{
135
-		if($algorithm === null)
135
+		if ($algorithm === null)
136 136
 		{
137 137
 			$algorithm = $this->checkAlgorithm($hash);
138 138
 		}
139 139
 
140 140
 		$password = trim($password);
141 141
 
142
-		switch($algorithm)
142
+		switch ($algorithm)
143 143
 		{
144 144
 			case 'md5':
145 145
 				return md5($password) === $hash || md5(sha1(md5($password))) === $hash;
@@ -173,23 +173,23 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	function checkAlgorithm($hash)
175 175
 	{
176
-		if(preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
176
+		if (preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
177 177
 		{
178 178
 			return 'bcrypt';
179 179
 		}
180
-		elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
180
+		elseif (preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
181 181
 		{
182 182
 			return 'pbkdf2';
183 183
 		}
184
-		elseif(strlen($hash) === 32 && ctype_xdigit($hash))
184
+		elseif (strlen($hash) === 32 && ctype_xdigit($hash))
185 185
 		{
186 186
 			return 'md5';
187 187
 		}
188
-		elseif(strlen($hash) === 16 && ctype_xdigit($hash))
188
+		elseif (strlen($hash) === 16 && ctype_xdigit($hash))
189 189
 		{
190 190
 			return 'mysql_old_password';
191 191
 		}
192
-		elseif(strlen($hash) === 41 && $hash[0] === '*')
192
+		elseif (strlen($hash) === 41 && $hash[0] === '*')
193 193
 		{
194 194
 			return 'mysql_password';
195 195
 		}
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	function checkWorkFactor($hash)
208 208
 	{
209
-		if(preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
209
+		if (preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches))
210 210
 		{
211 211
 			return intval($matches[1], 10);
212 212
 		}
213
-		elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
213
+		elseif (preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches))
214 214
 		{
215 215
 			return max(0, round(log($matches[1], 2)) - 5);
216 216
 		}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	public function createSecureSalt($length, $format = 'hex')
230 230
 	{
231 231
 		// Find out how many bytes of entropy we really need
232
-		switch($format)
232
+		switch ($format)
233 233
 		{
234 234
 			case 'hex':
235 235
 				$entropy_required_bytes = ceil($length / 2);
@@ -247,19 +247,19 @@  discard block
 block discarded – undo
247 247
 
248 248
 		// Find and use the most secure way to generate a random string
249 249
 		$is_windows = (defined('PHP_OS') && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
250
-		if(function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(PHP_VERSION, '5.4', '>=')))
250
+		if (function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(PHP_VERSION, '5.4', '>=')))
251 251
 		{
252 252
 			$entropy = openssl_random_pseudo_bytes($entropy_capped_bytes);
253 253
 		}
254
-		elseif(function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(PHP_VERSION, '5.3.7', '>=')))
254
+		elseif (function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(PHP_VERSION, '5.3.7', '>=')))
255 255
 		{
256 256
 			$entropy = mcrypt_create_iv($entropy_capped_bytes, MCRYPT_DEV_URANDOM);
257 257
 		}
258
-		elseif(function_exists('mcrypt_create_iv') && $is_windows)
258
+		elseif (function_exists('mcrypt_create_iv') && $is_windows)
259 259
 		{
260 260
 			$entropy = mcrypt_create_iv($entropy_capped_bytes, MCRYPT_RAND);
261 261
 		}
262
-		elseif(!$is_windows && @is_readable('/dev/urandom'))
262
+		elseif (!$is_windows && @is_readable('/dev/urandom'))
263 263
 		{
264 264
 			$fp = fopen('/dev/urandom', 'rb');
265 265
 			$entropy = fread($fp, $entropy_capped_bytes);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		else
269 269
 		{
270 270
 			$entropy = '';
271
-			for($i = 0; $i < $entropy_capped_bytes; $i += 2)
271
+			for ($i = 0; $i < $entropy_capped_bytes; $i += 2)
272 272
 			{
273 273
 				$entropy .= pack('S', rand(0, 65536) ^ mt_rand(0, 65535));
274 274
 			}
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
 
277 277
 		// Mixing (see RFC 4086 section 5)
278 278
 		$output = '';
279
-		for($i = 0; $i < $entropy_required_bytes; $i += 32)
279
+		for ($i = 0; $i < $entropy_required_bytes; $i += 32)
280 280
 		{
281
-			$output .= hash('sha256', $entropy . $i . rand(), true);
281
+			$output .= hash('sha256', $entropy.$i.rand(), true);
282 282
 		}
283 283
 
284 284
 		// Encode and return the random string
285
-		switch($format)
285
+		switch ($format)
286 286
 		{
287 287
 			case 'hex':
288 288
 				return substr(bin2hex($output), 0, $length);
@@ -290,15 +290,15 @@  discard block
 block discarded – undo
290 290
 				return substr($output, 0, $length);
291 291
 			case 'printable':
292 292
 				$salt = '';
293
-				for($i = 0; $i < $length; $i++)
293
+				for ($i = 0; $i < $length; $i++)
294 294
 				{
295
-					$salt .= chr(33 + (crc32(sha1($i . $output)) % 94));
295
+					$salt .= chr(33 + (crc32(sha1($i.$output)) % 94));
296 296
 				}
297 297
 				return $salt;
298 298
 			case 'alnum':
299 299
 			default:
300 300
 				$salt = substr(base64_encode($output), 0, $length);
301
-				$replacements = chr(rand(65, 90)) . chr(rand(97, 122)) . rand(0, 9);
301
+				$replacements = chr(rand(65, 90)).chr(rand(97, 122)).rand(0, 9);
302 302
 				return strtr($salt, '+/=', $replacements);
303 303
 		}
304 304
 	}
@@ -310,15 +310,15 @@  discard block
 block discarded – undo
310 310
 	 */
311 311
 	public function createTemporaryPassword($length = 16)
312 312
 	{
313
-		while(true)
313
+		while (true)
314 314
 		{
315 315
 			$source = base64_encode($this->createSecureSalt(64, 'binary'));
316 316
 			$source = strtr($source, 'iIoOjl10/', '@#$%&*-!?');
317 317
 			$source_length = strlen($source);
318
-			for($i = 0; $i < $source_length - $length; $i++)
318
+			for ($i = 0; $i < $source_length - $length; $i++)
319 319
 			{
320 320
 				$candidate = substr($source, $i, $length);
321
-				if(preg_match('/[a-z]/', $candidate) && preg_match('/[A-Z]/', $candidate) &&
321
+				if (preg_match('/[a-z]/', $candidate) && preg_match('/[A-Z]/', $candidate) &&
322 322
 					preg_match('/[0-9]/', $candidate) && preg_match('/[^a-zA-Z0-9]/', $candidate))
323 323
 				{
324 324
 					return $candidate;
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		$key = self::getSecretKey();
338 338
 		$salt = self::createSecureSalt(8, 'alnum');
339 339
 		$hash = substr(base64_encode(hash_hmac('sha256', hash_hmac('sha256', $string, $salt), $key, true)), 0, 32);
340
-		return $salt . strtr($hash, '+/', '-_');
340
+		return $salt.strtr($hash, '+/', '-_');
341 341
 	}
342 342
 	
343 343
 	/**
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	public static function checkSignature($string, $signature)
350 350
 	{
351
-		if(strlen($signature) !== 40)
351
+		if (strlen($signature) !== 40)
352 352
 		{
353 353
 			return false;
354 354
 		}
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	{
368 368
 		// If the secret key does not exist, the config file needs to be updated
369 369
 		$db_info = Context::getDbInfo();
370
-		if(!isset($db_info->secret_key))
370
+		if (!isset($db_info->secret_key))
371 371
 		{
372 372
 			$db_info->secret_key = self::createSecureSalt(48, 'alnum');
373 373
 			Context::setDBInfo($db_info);
@@ -387,19 +387,19 @@  discard block
 block discarded – undo
387 387
 	 */
388 388
 	public function pbkdf2($password, $salt, $algorithm = 'sha256', $iterations = 8192, $length = 24)
389 389
 	{
390
-		if(function_exists('hash_pbkdf2'))
390
+		if (function_exists('hash_pbkdf2'))
391 391
 		{
392 392
 			return hash_pbkdf2($algorithm, $password, $salt, $iterations, $length, true);
393 393
 		}
394 394
 		else
395 395
 		{
396 396
 			$output = '';
397
-			$block_count = ceil($length / strlen(hash($algorithm, '', true)));  // key length divided by the length of one hash
398
-			for($i = 1; $i <= $block_count; $i++)
397
+			$block_count = ceil($length / strlen(hash($algorithm, '', true))); // key length divided by the length of one hash
398
+			for ($i = 1; $i <= $block_count; $i++)
399 399
 			{
400
-				$last = $salt . pack('N', $i);  // $i encoded as 4 bytes, big endian
401
-				$last = $xorsum = hash_hmac($algorithm, $last, $password, true);  // first iteration
402
-				for($j = 1; $j < $iterations; $j++)  // The other $count - 1 iterations
400
+				$last = $salt.pack('N', $i); // $i encoded as 4 bytes, big endian
401
+				$last = $xorsum = hash_hmac($algorithm, $last, $password, true); // first iteration
402
+				for ($j = 1; $j < $iterations; $j++)  // The other $count - 1 iterations
403 403
 				{
404 404
 					$xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));
405 405
 				}
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 */
418 418
 	public function bcrypt($password, $salt = null)
419 419
 	{
420
-		if($salt === null)
420
+		if ($salt === null)
421 421
 		{
422 422
 			$salt = '$2y$'.sprintf('%02d', $this->getWorkFactor()).'$'.$this->createSecureSalt(22, 'alnum');
423 423
 		}
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	{
435 435
 		$diff = strlen($a) ^ strlen($b);
436 436
 		$maxlen = min(strlen($a), strlen($b));
437
-		for($i = 0; $i < $maxlen; $i++)
437
+		for ($i = 0; $i < $maxlen; $i++)
438 438
 		{
439 439
 			$diff |= ord($a[$i]) ^ ord($b[$i]);
440 440
 		}
Please login to merge, or discard this patch.
classes/context/Context.class.php 1 patch
Spacing   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
205 205
 		{
206 206
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
207 207
 			
208 208
 			// If content is not XML JSON, unset
209
-			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
209
+			if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
210 210
 			{
211 211
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
212 212
 			}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$this->_setUploadedArgument();
229 229
 
230 230
 		$this->loadDBInfo();
231
-		if($this->db_info->use_sitelock == 'Y')
231
+		if ($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
234 234
 
235
-			if(!IpFilter::filter($whitelist))
235
+			if (!IpFilter::filter($whitelist))
236 236
 			{
237 237
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
238 238
 				$message = $this->db_info->sitelock_message;
@@ -242,52 +242,52 @@  discard block
 block discarded – undo
242 242
 				define('_XE_SITELOCK_MESSAGE_', $message);
243 243
 
244 244
 				header("HTTP/1.1 403 Forbidden");
245
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
245
+				if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html'))
246 246
 				{
247
-					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
247
+					include _XE_PATH_.'common/tpl/sitelock.user.html';
248 248
 				}
249 249
 				else
250 250
 				{
251
-					include _XE_PATH_ . 'common/tpl/sitelock.html';
251
+					include _XE_PATH_.'common/tpl/sitelock.html';
252 252
 				}
253 253
 				exit;
254 254
 			}
255 255
 		}
256 256
 
257 257
 		// If XE is installed, get virtual site information
258
-		if(self::isInstalled())
258
+		if (self::isInstalled())
259 259
 		{
260 260
 			$oModuleModel = getModel('module');
261 261
 			$site_module_info = $oModuleModel->getDefaultMid();
262 262
 
263
-			if(!isset($site_module_info))
263
+			if (!isset($site_module_info))
264 264
 			{
265 265
 				$site_module_info = new stdClass();
266 266
 			}
267 267
 
268 268
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
269
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
269
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
270 270
 			{
271 271
 				$site_module_info->domain = $this->db_info->default_url;
272 272
 			}
273 273
 
274 274
 			$this->set('site_module_info', $site_module_info);
275
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
275
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
276 276
 			{
277 277
 				$this->set('vid', $site_module_info->domain, TRUE);
278 278
 			}
279 279
 
280
-			if(!isset($this->db_info))
280
+			if (!isset($this->db_info))
281 281
 			{
282 282
 				$this->db_info = new stdClass();
283 283
 			}
284 284
 
285 285
 			$this->db_info->lang_type = $site_module_info->default_language;
286
-			if(!$this->db_info->lang_type)
286
+			if (!$this->db_info->lang_type)
287 287
 			{
288 288
 				$this->db_info->lang_type = 'en';
289 289
 			}
290
-			if(!$this->db_info->use_db_session)
290
+			if (!$this->db_info->use_db_session)
291 291
 			{
292 292
 				$this->db_info->use_db_session = 'N';
293 293
 			}
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 		$lang_supported = $this->loadLangSelected();
298 298
 
299 299
 		// Retrieve language type set in user's cookie
300
-		if($this->lang_type = $this->get('l'))
300
+		if ($this->lang_type = $this->get('l'))
301 301
 		{
302
-			if($_COOKIE['lang_type'] != $this->lang_type)
302
+			if ($_COOKIE['lang_type'] != $this->lang_type)
303 303
 			{
304 304
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/');
305 305
 			}
306 306
 		}
307
-		elseif($_COOKIE['lang_type'])
307
+		elseif ($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
311 311
 
312 312
 		// If it's not exists, follow default language type set in db_info
313
-		if(!$this->lang_type)
313
+		if (!$this->lang_type)
314 314
 		{
315 315
 			$this->lang_type = $this->db_info->lang_type;
316 316
 		}
317 317
 
318 318
 		// if still lang_type has not been set or has not-supported type , set as English.
319
-		if(!$this->lang_type)
319
+		if (!$this->lang_type)
320 320
 		{
321 321
 			$this->lang_type = 'en';
322 322
 		}
323
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
323
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
324 324
 		{
325 325
 			$this->lang_type = 'en';
326 326
 		}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if ($sess = $_POST[session_name()]) session_id($sess);
345 345
 		session_start();
346 346
 
347 347
 		// set authentication information in Context and session
348
-		if(self::isInstalled())
348
+		if (self::isInstalled())
349 349
 		{
350 350
 			$oModuleModel = getModel('module');
351 351
 			$oModuleModel->loadModuleExtends();
@@ -353,15 +353,15 @@  discard block
 block discarded – undo
353 353
 			$oMemberModel = getModel('member');
354 354
 			$oMemberController = getController('member');
355 355
 
356
-			if($oMemberController && $oMemberModel)
356
+			if ($oMemberController && $oMemberModel)
357 357
 			{
358 358
 				// if signed in, validate it.
359
-				if($oMemberModel->isLogged())
359
+				if ($oMemberModel->isLogged())
360 360
 				{
361 361
 					$oMemberController->setSessionInfo();
362 362
 				}
363 363
 				// check auto sign-in
364
-				elseif($_COOKIE['xeak'])
364
+				elseif ($_COOKIE['xeak'])
365 365
 				{
366 366
 					$oMemberController->doAutologin();
367 367
 				}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		// load common language file
375 375
 		$this->lang = &$GLOBALS['lang'];
376
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
376
+		$this->loadLang(_XE_PATH_.'common/lang/');
377 377
 
378 378
 		// check if using rewrite module
379 379
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -381,28 +381,28 @@  discard block
 block discarded – undo
381 381
 		// set locations for javascript use
382 382
 		$url = array();
383 383
 		$current_url = self::getRequestUri();
384
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
384
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
385 385
 		{
386
-			if($this->get_vars)
386
+			if ($this->get_vars)
387 387
 			{
388 388
 				$url = array();
389
-				foreach($this->get_vars as $key => $val)
389
+				foreach ($this->get_vars as $key => $val)
390 390
 				{
391
-					if(is_array($val) && count($val) > 0)
391
+					if (is_array($val) && count($val) > 0)
392 392
 					{
393
-						foreach($val as $k => $v)
393
+						foreach ($val as $k => $v)
394 394
 						{
395
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
395
+							$url[] = $key.'['.$k.']='.urlencode($v);
396 396
 						}
397 397
 					}
398
-					elseif($val)
398
+					elseif ($val)
399 399
 					{
400
-						$url[] = $key . '=' . urlencode($val);
400
+						$url[] = $key.'='.urlencode($val);
401 401
 					}
402 402
 				}
403 403
 
404 404
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
405
+				if ($url) $current_url .= '?'.join('&', $url);
406 406
 			}
407 407
 			else
408 408
 			{
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 		$this->set('current_url', $current_url);
418 418
 		$this->set('request_uri', self::getRequestUri());
419 419
 
420
-		if(strpos($current_url, 'xn--') !== FALSE)
420
+		if (strpos($current_url, 'xn--') !== FALSE)
421 421
 		{
422 422
 			$this->set('current_url', self::decodeIdna($current_url));
423 423
 		}
424 424
 
425
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
425
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
426 426
 		{
427 427
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
428 428
 		}
@@ -447,19 +447,19 @@  discard block
 block discarded – undo
447 447
 	{
448 448
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
449 449
 
450
-		if(!$self->isInstalled())
450
+		if (!$self->isInstalled())
451 451
 		{
452 452
 			return;
453 453
 		}
454 454
 
455 455
 		$config_file = $self->getConfigFile();
456
-		if(is_readable($config_file))
456
+		if (is_readable($config_file))
457 457
 		{
458 458
 			include($config_file);
459 459
 		}
460 460
 
461 461
 		// If master_db information does not exist, the config file needs to be updated
462
-		if(!isset($db_info->master_db))
462
+		if (!isset($db_info->master_db))
463 463
 		{
464 464
 			$db_info->master_db = array();
465 465
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
478 478
 			unset($db_info->db_table_prefix);
479 479
 
480
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
480
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
481 481
 			{
482 482
 				$db_info->master_db["db_table_prefix"] .= '_';
483 483
 			}
@@ -489,33 +489,33 @@  discard block
 block discarded – undo
489 489
 			$oInstallController->makeConfigFile();
490 490
 		}
491 491
 
492
-		if(!$db_info->use_prepared_statements)
492
+		if (!$db_info->use_prepared_statements)
493 493
 		{
494 494
 			$db_info->use_prepared_statements = 'Y';
495 495
 		}
496 496
 
497
-		if(!$db_info->time_zone)
497
+		if (!$db_info->time_zone)
498 498
 			$db_info->time_zone = date('O');
499 499
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
500 500
 
501
-		if($db_info->qmail_compatibility != 'Y')
501
+		if ($db_info->qmail_compatibility != 'Y')
502 502
 			$db_info->qmail_compatibility = 'N';
503 503
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
504 504
 
505
-		if(!$db_info->use_db_session)
505
+		if (!$db_info->use_db_session)
506 506
 			$db_info->use_db_session = 'N';
507
-		if(!$db_info->use_ssl)
507
+		if (!$db_info->use_ssl)
508 508
 			$db_info->use_ssl = 'none';
509 509
 		$this->set('_use_ssl', $db_info->use_ssl);
510 510
 
511 511
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
512 512
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
513 513
 
514
-		if(!$db_info->sitelock_whitelist) {
514
+		if (!$db_info->sitelock_whitelist) {
515 515
 			$db_info->sitelock_whitelist = '127.0.0.1';
516 516
 		}
517 517
 
518
-		if(is_string($db_info->sitelock_whitelist)) {
518
+		if (is_string($db_info->sitelock_whitelist)) {
519 519
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
520 520
 		}
521 521
 
@@ -586,10 +586,10 @@  discard block
 block discarded – undo
586 586
 	function loadLangSupported()
587 587
 	{
588 588
 		static $lang_supported = null;
589
-		if(!$lang_supported)
589
+		if (!$lang_supported)
590 590
 		{
591
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
592
-			foreach($langs as $val)
591
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
592
+			foreach ($langs as $val)
593 593
 			{
594 594
 				list($lang_prefix, $lang_text) = explode(',', $val);
595 595
 				$lang_text = trim($lang_text);
@@ -607,17 +607,17 @@  discard block
 block discarded – undo
607 607
 	function loadLangSelected()
608 608
 	{
609 609
 		static $lang_selected = null;
610
-		if(!$lang_selected)
610
+		if (!$lang_selected)
611 611
 		{
612
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
613
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
614
-			if(!FileHandler::hasContent($selected_lang_file))
612
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
613
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
614
+			if (!FileHandler::hasContent($selected_lang_file))
615 615
 			{
616
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
616
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
617 617
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
618 618
 			}
619 619
 
620
-			if(!FileHandler::hasContent($selected_lang_file))
620
+			if (!FileHandler::hasContent($selected_lang_file))
621 621
 			{
622 622
 				$buff = FileHandler::readFile($orig_lang_file);
623 623
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 			else
627 627
 			{
628 628
 				$langs = file($selected_lang_file);
629
-				foreach($langs as $val)
629
+				foreach ($langs as $val)
630 630
 				{
631 631
 					list($lang_prefix, $lang_text) = explode(',', $val);
632 632
 					$lang_text = trim($lang_text);
@@ -645,44 +645,44 @@  discard block
 block discarded – undo
645 645
 	function checkSSO()
646 646
 	{
647 647
 		// pass if it's not GET request or XE is not yet installed
648
-		if($this->db_info->use_sso != 'Y' || isCrawler())
648
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
649 649
 		{
650 650
 			return TRUE;
651 651
 		}
652 652
 		$checkActList = array('rss' => 1, 'atom' => 1);
653
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
653
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
654 654
 		{
655 655
 			return TRUE;
656 656
 		}
657 657
 
658 658
 		// pass if default URL is not set
659 659
 		$default_url = trim($this->db_info->default_url);
660
-		if(!$default_url)
660
+		if (!$default_url)
661 661
 		{
662 662
 			return TRUE;
663 663
 		}
664 664
 
665
-		if(substr_compare($default_url, '/', -1) !== 0)
665
+		if (substr_compare($default_url, '/', -1) !== 0)
666 666
 		{
667 667
 			$default_url .= '/';
668 668
 		}
669 669
 
670 670
 		// for sites recieving SSO valdiation
671
-		if($default_url == self::getRequestUri())
671
+		if ($default_url == self::getRequestUri())
672 672
 		{
673
-			if(self::get('url'))
673
+			if (self::get('url'))
674 674
 			{
675 675
 				$url = base64_decode(self::get('url'));
676 676
 				$url_info = parse_url($url);
677
-				if(!Password::checkSignature($url, self::get('sig')))
677
+				if (!Password::checkSignature($url, self::get('sig')))
678 678
 				{
679 679
 					echo self::get('lang')->msg_invalid_request;
680 680
 					return false;
681 681
 				}
682 682
 
683
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
684
-				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
685
-				header('location:' . $redirect_url);
683
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
684
+				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']);
685
+				header('location:'.$redirect_url);
686 686
 
687 687
 				return FALSE;
688 688
 			}
@@ -691,9 +691,9 @@  discard block
 block discarded – undo
691 691
 		else
692 692
 		{
693 693
 			// result handling : set session_name()
694
-			if($session_name = self::get('SSOID'))
694
+			if ($session_name = self::get('SSOID'))
695 695
 			{
696
-				if(!Password::checkSignature($session_name, self::get('sig')))
696
+				if (!Password::checkSignature($session_name, self::get('sig')))
697 697
 				{
698 698
 					echo self::get('lang')->msg_invalid_request;
699 699
 					return false;
@@ -702,17 +702,17 @@  discard block
 block discarded – undo
702 702
 				setcookie(session_name(), $session_name);
703 703
 
704 704
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
705
-				header('location:' . $url);
705
+				header('location:'.$url);
706 706
 				return FALSE;
707 707
 				// send SSO request
708 708
 			}
709
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
709
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
710 710
 			{
711 711
 				setcookie('sso', md5(self::getRequestUri()), 0, '/');
712 712
 				$origin_url = self::getRequestUrl();
713 713
 				$origin_sig = Password::createSignature($origin_url);
714 714
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
715
-				header('location:' . $url);
715
+				header('location:'.$url);
716 716
 				return FALSE;
717 717
 			}
718 718
 		}
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	{
740 740
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
741 741
 
742
-		if(!$self->isFTPRegisted())
742
+		if (!$self->isFTPRegisted())
743 743
 		{
744 744
 			return null;
745 745
 		}
@@ -757,15 +757,15 @@  discard block
 block discarded – undo
757 757
 	 */
758 758
 	function addBrowserTitle($site_title)
759 759
 	{
760
-		if(!$site_title)
760
+		if (!$site_title)
761 761
 		{
762 762
 			return;
763 763
 		}
764 764
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
765 765
 
766
-		if($self->site_title)
766
+		if ($self->site_title)
767 767
 		{
768
-			$self->site_title .= ' - ' . $site_title;
768
+			$self->site_title .= ' - '.$site_title;
769 769
 		}
770 770
 		else
771 771
 		{
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	function setBrowserTitle($site_title)
783 783
 	{
784
-		if(!$site_title)
784
+		if (!$site_title)
785 785
 		{
786 786
 			return;
787 787
 		}
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		$oModuleModel = getModel('module');
814 814
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
815 815
 
816
-		if(isset($moduleConfig->siteTitle))
816
+		if (isset($moduleConfig->siteTitle))
817 817
 		{
818 818
 			return $moduleConfig->siteTitle;
819 819
 		}
@@ -840,30 +840,30 @@  discard block
 block discarded – undo
840 840
 		global $lang;
841 841
 
842 842
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
843
-		if(!$self->lang_type)
843
+		if (!$self->lang_type)
844 844
 		{
845 845
 			return;
846 846
 		}
847
-		if(!is_object($lang))
847
+		if (!is_object($lang))
848 848
 		{
849 849
 			$lang = new stdClass;
850 850
 		}
851 851
 
852
-		if(!($filename = $self->_loadXmlLang($path)))
852
+		if (!($filename = $self->_loadXmlLang($path)))
853 853
 		{
854 854
 			$filename = $self->_loadPhpLang($path);
855 855
 		}
856 856
 
857
-		if(!is_array($self->loaded_lang_files))
857
+		if (!is_array($self->loaded_lang_files))
858 858
 		{
859 859
 			$self->loaded_lang_files = array();
860 860
 		}
861
-		if(in_array($filename, $self->loaded_lang_files))
861
+		if (in_array($filename, $self->loaded_lang_files))
862 862
 		{
863 863
 			return;
864 864
 		}
865 865
 
866
-		if($filename && is_readable($filename))
866
+		if ($filename && is_readable($filename))
867 867
 		{
868 868
 			$self->loaded_lang_files[] = $filename;
869 869
 			include($filename);
@@ -884,24 +884,24 @@  discard block
 block discarded – undo
884 884
 	{
885 885
 		global $lang;
886 886
 
887
-		if(!$path) return;
887
+		if (!$path) return;
888 888
 
889
-		$_path = 'eval://' . $path;
889
+		$_path = 'eval://'.$path;
890 890
 
891
-		if(in_array($_path, $this->loaded_lang_files))
891
+		if (in_array($_path, $this->loaded_lang_files))
892 892
 		{
893 893
 			return;
894 894
 		}
895 895
 
896
-		if(substr_compare($path, '/', -1) !== 0)
896
+		if (substr_compare($path, '/', -1) !== 0)
897 897
 		{
898 898
 			$path .= '/';
899 899
 		}
900 900
 
901
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
901
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
902 902
 		$content = $oXmlLangParser->getCompileContent();
903 903
 
904
-		if($content)
904
+		if ($content)
905 905
 		{
906 906
 			$this->loaded_lang_files[] = $_path;
907 907
 			eval($content);
@@ -916,9 +916,9 @@  discard block
 block discarded – undo
916 916
 	 */
917 917
 	function _loadXmlLang($path)
918 918
 	{
919
-		if(!$path) return;
919
+		if (!$path) return;
920 920
 
921
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
921
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
922 922
 		return $oXmlLangParser->compile();
923 923
 	}
924 924
 
@@ -930,22 +930,22 @@  discard block
 block discarded – undo
930 930
 	 */
931 931
 	function _loadPhpLang($path)
932 932
 	{
933
-		if(!$path) return;
933
+		if (!$path) return;
934 934
 
935
-		if(substr_compare($path, '/', -1) !== 0)
935
+		if (substr_compare($path, '/', -1) !== 0)
936 936
 		{
937 937
 			$path .= '/';
938 938
 		}
939
-		$path_tpl = $path . '%s.lang.php';
939
+		$path_tpl = $path.'%s.lang.php';
940 940
 		$file = sprintf($path_tpl, $this->lang_type);
941 941
 
942 942
 		$langs = array('ko', 'en'); // this will be configurable.
943
-		while(!is_readable($file) && $langs[0])
943
+		while (!is_readable($file) && $langs[0])
944 944
 		{
945 945
 			$file = sprintf($path_tpl, array_shift($langs));
946 946
 		}
947 947
 
948
-		if(!is_readable($file))
948
+		if (!is_readable($file))
949 949
 		{
950 950
 			return FALSE;
951 951
 		}
@@ -987,11 +987,11 @@  discard block
 block discarded – undo
987 987
 	 */
988 988
 	function getLang($code)
989 989
 	{
990
-		if(!$code)
990
+		if (!$code)
991 991
 		{
992 992
 			return;
993 993
 		}
994
-		if($GLOBALS['lang']->{$code})
994
+		if ($GLOBALS['lang']->{$code})
995 995
 		{
996 996
 			return $GLOBALS['lang']->{$code};
997 997
 		}
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 	 */
1008 1008
 	function setLang($code, $val)
1009 1009
 	{
1010
-		if(!isset($GLOBALS['lang']))
1010
+		if (!isset($GLOBALS['lang']))
1011 1011
 		{
1012 1012
 			$GLOBALS['lang'] = new stdClass();
1013 1013
 		}
@@ -1035,17 +1035,17 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
 		$obj = clone $source_obj;
1037 1037
 
1038
-		foreach($charset_list as $charset)
1038
+		foreach ($charset_list as $charset)
1039 1039
 		{
1040
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1040
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1041 1041
 			$flag = self::checkConvertFlag($flag = TRUE);
1042
-			if($flag)
1042
+			if ($flag)
1043 1043
 			{
1044
-				if($charset == 'UTF-8')
1044
+				if ($charset == 'UTF-8')
1045 1045
 				{
1046 1046
 					return $obj;
1047 1047
 				}
1048
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1048
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1049 1049
 				return $obj;
1050 1050
 			}
1051 1051
 		}
@@ -1064,11 +1064,11 @@  discard block
 block discarded – undo
1064 1064
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1065 1065
 	{
1066 1066
 		static $flag = TRUE;
1067
-		if($charset)
1067
+		if ($charset)
1068 1068
 		{
1069
-			if(is_array($val))
1070
-				array_walk($val,'Context::checkConvertFlag',$charset);
1071
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1069
+			if (is_array($val))
1070
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1071
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1072 1072
 			else $flag = FALSE;
1073 1073
 		}
1074 1074
 		else
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
 	{
1093 1093
 		if (is_array($val))
1094 1094
 		{
1095
-			array_walk($val,'Context::doConvertEncoding',$charset);
1095
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1096 1096
 		}
1097
-		else $val = iconv($charset,'UTF-8',$val);
1097
+		else $val = iconv($charset, 'UTF-8', $val);
1098 1098
 	}
1099 1099
 
1100 1100
 	/**
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	function convertEncodingStr($str)
1107 1107
 	{
1108
-        if(!$str) return null;
1108
+        if (!$str) return null;
1109 1109
 		$obj = new stdClass();
1110 1110
 		$obj->str = $str;
1111 1111
 		$obj = self::convertEncoding($obj);
@@ -1114,9 +1114,9 @@  discard block
 block discarded – undo
1114 1114
 
1115 1115
 	function decodeIdna($domain)
1116 1116
 	{
1117
-		if(strpos($domain, 'xn--') !== FALSE)
1117
+		if (strpos($domain, 'xn--') !== FALSE)
1118 1118
 		{
1119
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1119
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1120 1120
 			$IDN = new idna_convert(array('idn_version' => 2008));
1121 1121
 			$domain = $IDN->decode($domain);
1122 1122
 		}
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 	{
1148 1148
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1149 1149
 
1150
-		if($self->response_method)
1150
+		if ($self->response_method)
1151 1151
 		{
1152 1152
 			return $self->response_method;
1153 1153
 		}
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1188 1188
 
1189 1189
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1190
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1190
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1191 1191
 		{
1192 1192
 			$this->isSuccessInit = FALSE;
1193 1193
 		}
@@ -1200,30 +1200,30 @@  discard block
 block discarded – undo
1200 1200
 	 */
1201 1201
 	function _setRequestArgument()
1202 1202
 	{
1203
-		if(!count($_REQUEST))
1203
+		if (!count($_REQUEST))
1204 1204
 		{
1205 1205
 			return;
1206 1206
 		}
1207 1207
 
1208 1208
 		$requestMethod = $this->getRequestMethod();
1209
-		foreach($_REQUEST as $key => $val)
1209
+		foreach ($_REQUEST as $key => $val)
1210 1210
 		{
1211
-			if($val === '' || self::get($key))
1211
+			if ($val === '' || self::get($key))
1212 1212
 			{
1213 1213
 				continue;
1214 1214
 			}
1215 1215
 			$key = htmlentities($key);
1216 1216
 			$val = $this->_filterRequestVar($key, $val);
1217 1217
 
1218
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1218
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1219 1219
 			{
1220 1220
 				$set_to_vars = TRUE;
1221 1221
 			}
1222
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1222
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1223 1223
 			{
1224 1224
 				$set_to_vars = TRUE;
1225 1225
 			}
1226
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1226
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1227 1227
 			{
1228 1228
 				$set_to_vars = TRUE;
1229 1229
 			}
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 				$set_to_vars = FALSE;
1233 1233
 			}
1234 1234
 
1235
-			if($set_to_vars)
1235
+			if ($set_to_vars)
1236 1236
 			{
1237 1237
 				$this->_recursiveCheckVar($val);
1238 1238
 			}
@@ -1243,20 +1243,20 @@  discard block
 block discarded – undo
1243 1243
 
1244 1244
 	function _recursiveCheckVar($val)
1245 1245
 	{
1246
-		if(is_string($val))
1246
+		if (is_string($val))
1247 1247
 		{
1248
-			foreach($this->patterns as $pattern)
1248
+			foreach ($this->patterns as $pattern)
1249 1249
 			{
1250
-				if(preg_match($pattern, $val))
1250
+				if (preg_match($pattern, $val))
1251 1251
 				{
1252 1252
 					$this->isSuccessInit = FALSE;
1253 1253
 					return;
1254 1254
 				}
1255 1255
 			}
1256 1256
 		}
1257
-		else if(is_array($val))
1257
+		else if (is_array($val))
1258 1258
 		{
1259
-			foreach($val as $val2)
1259
+			foreach ($val as $val2)
1260 1260
 			{
1261 1261
 				$this->_recursiveCheckVar($val2);
1262 1262
 			}
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 	 */
1271 1271
 	function _setJSONRequestArgument()
1272 1272
 	{
1273
-		if($this->getRequestMethod() != 'JSON')
1273
+		if ($this->getRequestMethod() != 'JSON')
1274 1274
 		{
1275 1275
 			return;
1276 1276
 		}
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 		$params = array();
1279 1279
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1280 1280
 
1281
-		foreach($params as $key => $val)
1281
+		foreach ($params as $key => $val)
1282 1282
 		{
1283 1283
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1284 1284
 		}
@@ -1291,13 +1291,13 @@  discard block
 block discarded – undo
1291 1291
 	 */
1292 1292
 	function _setXmlRpcArgument()
1293 1293
 	{
1294
-		if($this->getRequestMethod() != 'XMLRPC')
1294
+		if ($this->getRequestMethod() != 'XMLRPC')
1295 1295
 		{
1296 1296
 			return;
1297 1297
 		}
1298 1298
 
1299 1299
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1300
-		if(Security::detectingXEE($xml))
1300
+		if (Security::detectingXEE($xml))
1301 1301
 		{
1302 1302
 			header("HTTP/1.0 400 Bad Request");
1303 1303
 			exit;
@@ -1309,12 +1309,12 @@  discard block
 block discarded – undo
1309 1309
 		$params = $xml_obj->methodcall->params;
1310 1310
 		unset($params->node_name, $params->attrs, $params->body);
1311 1311
 
1312
-		if(!count(get_object_vars($params)))
1312
+		if (!count(get_object_vars($params)))
1313 1313
 		{
1314 1314
 			return;
1315 1315
 		}
1316 1316
 
1317
-		foreach($params as $key => $val)
1317
+		foreach ($params as $key => $val)
1318 1318
 		{
1319 1319
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1320 1320
 		}
@@ -1329,10 +1329,10 @@  discard block
 block discarded – undo
1329 1329
 	 */
1330 1330
 	function _filterXmlVars($key, $val)
1331 1331
 	{
1332
-		if(is_array($val))
1332
+		if (is_array($val))
1333 1333
 		{
1334 1334
 			$stack = array();
1335
-			foreach($val as $k => $v)
1335
+			foreach ($val as $k => $v)
1336 1336
 			{
1337 1337
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1338 1338
 			}
@@ -1342,20 +1342,20 @@  discard block
 block discarded – undo
1342 1342
 
1343 1343
 		$body = $val->body;
1344 1344
 		unset($val->node_name, $val->attrs, $val->body);
1345
-		if(!count(get_object_vars($val)))
1345
+		if (!count(get_object_vars($val)))
1346 1346
 		{
1347 1347
 			return $this->_filterRequestVar($key, $body, 0);
1348 1348
 		}
1349 1349
 
1350 1350
 		$stack = new stdClass();
1351
-		foreach($val as $k => $v)
1351
+		foreach ($val as $k => $v)
1352 1352
 		{
1353 1353
 			$output = $this->_filterXmlVars($k, $v);
1354
-			if(is_object($v) && $v->attrs->type == 'array')
1354
+			if (is_object($v) && $v->attrs->type == 'array')
1355 1355
 			{
1356 1356
 				$output = array($output);
1357 1357
 			}
1358
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1358
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1359 1359
 			{
1360 1360
 				return $output;
1361 1361
 			}
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
 			$stack->{$k} = $output;
1364 1364
 		}
1365 1365
 
1366
-		if(!count(get_object_vars($stack)))
1366
+		if (!count(get_object_vars($stack)))
1367 1367
 		{
1368 1368
 			return NULL;
1369 1369
 		}
@@ -1382,24 +1382,24 @@  discard block
 block discarded – undo
1382 1382
 	 */
1383 1383
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1384 1384
 	{
1385
-		if(!($isArray = is_array($val)))
1385
+		if (!($isArray = is_array($val)))
1386 1386
 		{
1387 1387
 			$val = array($val);
1388 1388
 		}
1389 1389
 
1390 1390
 		$result = array();
1391
-		foreach($val as $k => $v)
1391
+		foreach ($val as $k => $v)
1392 1392
 		{
1393 1393
 			$k = htmlentities($k);
1394
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1394
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1395 1395
 			{
1396 1396
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1397 1397
 			}
1398
-			elseif($key === 'mid' || $key === 'search_keyword')
1398
+			elseif ($key === 'mid' || $key === 'search_keyword')
1399 1399
 			{
1400 1400
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1401 1401
 			}
1402
-			elseif($key === 'vid')
1402
+			elseif ($key === 'vid')
1403 1403
 			{
1404 1404
 				$result[$k] = urlencode($v);
1405 1405
 			}
@@ -1407,12 +1407,12 @@  discard block
 block discarded – undo
1407 1407
 			{
1408 1408
 				$result[$k] = $v;
1409 1409
 
1410
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1410
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1411 1411
 				{
1412 1412
 					$result[$k] = stripslashes($result[$k]);
1413 1413
 				}
1414 1414
 
1415
-				if(!is_array($result[$k]))
1415
+				if (!is_array($result[$k]))
1416 1416
 				{
1417 1417
 					$result[$k] = trim($result[$k]);
1418 1418
 				}
@@ -1440,17 +1440,17 @@  discard block
 block discarded – undo
1440 1440
 	 */
1441 1441
 	function _setUploadedArgument()
1442 1442
 	{
1443
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1443
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1444 1444
 		{
1445 1445
 			return;
1446 1446
 		}
1447 1447
 
1448
-		foreach($_FILES as $key => $val)
1448
+		foreach ($_FILES as $key => $val)
1449 1449
 		{
1450 1450
 			$tmp_name = $val['tmp_name'];
1451
-			if(!is_array($tmp_name))
1451
+			if (!is_array($tmp_name))
1452 1452
 			{
1453
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1453
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1454 1454
 				{
1455 1455
 					continue;
1456 1456
 				}
@@ -1460,9 +1460,9 @@  discard block
 block discarded – undo
1460 1460
 			}
1461 1461
 			else
1462 1462
 			{
1463
-				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1463
+				for ($i = 0, $c = count($tmp_name); $i < $c; $i++)
1464 1464
 				{
1465
-					if($val['size'][$i] > 0)
1465
+					if ($val['size'][$i] > 0)
1466 1466
 					{
1467 1467
 						$file['name'] = $val['name'][$i];
1468 1468
 						$file['type'] = $val['type'][$i];
@@ -1494,16 +1494,16 @@  discard block
 block discarded – undo
1494 1494
 	function getRequestUrl()
1495 1495
 	{
1496 1496
 		static $url = null;
1497
-		if(is_null($url))
1497
+		if (is_null($url))
1498 1498
 		{
1499 1499
 			$url = self::getRequestUri();
1500
-			if(count($_GET) > 0)
1500
+			if (count($_GET) > 0)
1501 1501
 			{
1502
-				foreach($_GET as $key => $val)
1502
+				foreach ($_GET as $key => $val)
1503 1503
 				{
1504
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1504
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1505 1505
 				}
1506
-				$url .= '?' . join('&', $vars);
1506
+				$url .= '?'.join('&', $vars);
1507 1507
 			}
1508 1508
 		}
1509 1509
 		return $url;
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1519 1519
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1520 1520
 
1521
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1521
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1522 1522
 		{
1523 1523
 			unset($js_callback_func);
1524 1524
 			unset($_GET['xe_js_callback']);
@@ -1546,22 +1546,22 @@  discard block
 block discarded – undo
1546 1546
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1547 1547
 
1548 1548
 		// retrieve virtual site information
1549
-		if(is_null($site_module_info))
1549
+		if (is_null($site_module_info))
1550 1550
 		{
1551 1551
 			$site_module_info = self::get('site_module_info');
1552 1552
 		}
1553 1553
 
1554 1554
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1555
-		if($domain && isSiteID($domain))
1555
+		if ($domain && isSiteID($domain))
1556 1556
 		{
1557 1557
 			$vid = $domain;
1558 1558
 			$domain = '';
1559 1559
 		}
1560 1560
 
1561 1561
 		// If $domain, $vid are not set, use current site information
1562
-		if(!$domain && !$vid)
1562
+		if (!$domain && !$vid)
1563 1563
 		{
1564
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1564
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1565 1565
 			{
1566 1566
 				$vid = $site_module_info->domain;
1567 1567
 			}
@@ -1572,21 +1572,21 @@  discard block
 block discarded – undo
1572 1572
 		}
1573 1573
 
1574 1574
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1575
-		if($domain)
1575
+		if ($domain)
1576 1576
 		{
1577 1577
 			$domain_info = parse_url($domain);
1578
-			if(is_null($current_info))
1578
+			if (is_null($current_info))
1579 1579
 			{
1580
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1580
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1581 1581
 			}
1582
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1582
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1583 1583
 			{
1584 1584
 				unset($domain);
1585 1585
 			}
1586 1586
 			else
1587 1587
 			{
1588 1588
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1589
-				if(substr_compare($domain, '/', -1) !== 0)
1589
+				if (substr_compare($domain, '/', -1) !== 0)
1590 1590
 				{
1591 1591
 					$domain .= '/';
1592 1592
 				}
@@ -1596,10 +1596,10 @@  discard block
 block discarded – undo
1596 1596
 		$get_vars = array();
1597 1597
 
1598 1598
 		// If there is no GET variables or first argument is '' to reset variables
1599
-		if(!$self->get_vars || $args_list[0] == '')
1599
+		if (!$self->get_vars || $args_list[0] == '')
1600 1600
 		{
1601 1601
 			// rearrange args_list
1602
-			if(is_array($args_list) && $args_list[0] == '')
1602
+			if (is_array($args_list) && $args_list[0] == '')
1603 1603
 			{
1604 1604
 				array_shift($args_list);
1605 1605
 			}
@@ -1611,13 +1611,13 @@  discard block
 block discarded – undo
1611 1611
 		}
1612 1612
 
1613 1613
 		// arrange args_list
1614
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1614
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1615 1615
 		{
1616 1616
 			$key = $args_list[$i];
1617 1617
 			$val = trim($args_list[$i + 1]);
1618 1618
 
1619 1619
 			// If value is not set, remove the key
1620
-			if(!isset($val) || !strlen($val))
1620
+			if (!isset($val) || !strlen($val))
1621 1621
 			{
1622 1622
 				unset($get_vars[$key]);
1623 1623
 				continue;
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
 
1629 1629
 		// remove vid, rnd
1630 1630
 		unset($get_vars['rnd']);
1631
-		if($vid)
1631
+		if ($vid)
1632 1632
 		{
1633 1633
 			$get_vars['vid'] = $vid;
1634 1634
 		}
@@ -1645,17 +1645,17 @@  discard block
 block discarded – undo
1645 1645
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1646 1646
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1647 1647
 		);
1648
-		if($act_alias[$act])
1648
+		if ($act_alias[$act])
1649 1649
 		{
1650 1650
 			$get_vars['act'] = $act_alias[$act];
1651 1651
 		}
1652 1652
 
1653 1653
 		// organize URL
1654 1654
 		$query = '';
1655
-		if(count($get_vars) > 0)
1655
+		if (count($get_vars) > 0)
1656 1656
 		{
1657 1657
 			// if using rewrite mod
1658
-			if($self->allow_rewrite)
1658
+			if ($self->allow_rewrite)
1659 1659
 			{
1660 1660
 				$var_keys = array_keys($get_vars);
1661 1661
 				sort($var_keys);
@@ -1675,8 +1675,8 @@  discard block
 block discarded – undo
1675 1675
 					'vid' => $vid,
1676 1676
 					'mid' => $mid,
1677 1677
 					'mid.vid' => "$vid/$mid",
1678
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1679
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1678
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1679
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1680 1680
 					'document_srl' => $srl,
1681 1681
 					'document_srl.mid' => "$mid/$srl",
1682 1682
 					'document_srl.vid' => "$vid/$srl",
@@ -1693,66 +1693,66 @@  discard block
 block discarded – undo
1693 1693
 				$query = $target_map[$target];
1694 1694
 			}
1695 1695
 
1696
-			if(!$query)
1696
+			if (!$query)
1697 1697
 			{
1698 1698
 				$queries = array();
1699
-				foreach($get_vars as $key => $val)
1699
+				foreach ($get_vars as $key => $val)
1700 1700
 				{
1701
-					if(is_array($val) && count($val) > 0)
1701
+					if (is_array($val) && count($val) > 0)
1702 1702
 					{
1703
-						foreach($val as $k => $v)
1703
+						foreach ($val as $k => $v)
1704 1704
 						{
1705
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1705
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1706 1706
 						}
1707 1707
 					}
1708
-					elseif(!is_array($val))
1708
+					elseif (!is_array($val))
1709 1709
 					{
1710
-						$queries[] = $key . '=' . urlencode($val);
1710
+						$queries[] = $key.'='.urlencode($val);
1711 1711
 					}
1712 1712
 				}
1713
-				if(count($queries) > 0)
1713
+				if (count($queries) > 0)
1714 1714
 				{
1715
-					$query = 'index.php?' . join('&', $queries);
1715
+					$query = 'index.php?'.join('&', $queries);
1716 1716
 				}
1717 1717
 			}
1718 1718
 		}
1719 1719
 
1720 1720
 		// If using SSL always
1721 1721
 		$_use_ssl = $self->get('_use_ssl');
1722
-		if($_use_ssl == 'always')
1722
+		if ($_use_ssl == 'always')
1723 1723
 		{
1724
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1724
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1725 1725
 			// optional SSL use
1726 1726
 		}
1727
-		elseif($_use_ssl == 'optional')
1727
+		elseif ($_use_ssl == 'optional')
1728 1728
 		{
1729 1729
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1730
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1730
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1731 1731
 			// no SSL
1732 1732
 		}
1733 1733
 		else
1734 1734
 		{
1735 1735
 			// currently on SSL but target is not based on SSL
1736
-			if($_SERVER['HTTPS'] == 'on')
1736
+			if ($_SERVER['HTTPS'] == 'on')
1737 1737
 			{
1738
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1738
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1739 1739
 			}
1740
-			else if($domain) // if $domain is set
1740
+			else if ($domain) // if $domain is set
1741 1741
 			{
1742
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1742
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1743 1743
 			}
1744 1744
 			else
1745 1745
 			{
1746
-				$query = getScriptPath() . $query;
1746
+				$query = getScriptPath().$query;
1747 1747
 			}
1748 1748
 		}
1749 1749
 
1750
-		if(!$encode)
1750
+		if (!$encode)
1751 1751
 		{
1752 1752
 			return $query;
1753 1753
 		}
1754 1754
 
1755
-		if(!$autoEncode)
1755
+		if (!$autoEncode)
1756 1756
 		{
1757 1757
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1758 1758
 		}
@@ -1761,16 +1761,16 @@  discard block
 block discarded – undo
1761 1761
 		$encode_queries = array();
1762 1762
 		$parsedUrl = parse_url($query);
1763 1763
 		parse_str($parsedUrl['query'], $output);
1764
-		foreach($output as $key => $value)
1764
+		foreach ($output as $key => $value)
1765 1765
 		{
1766
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1766
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1767 1767
 			{
1768 1768
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1769 1769
 			}
1770
-			$encode_queries[] = $key . '=' . $value;
1770
+			$encode_queries[] = $key.'='.$value;
1771 1771
 		}
1772 1772
 
1773
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1773
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1774 1774
 	}
1775 1775
 
1776 1776
 	/**
@@ -1785,17 +1785,17 @@  discard block
 block discarded – undo
1785 1785
 		static $url = array();
1786 1786
 
1787 1787
 		// Check HTTP Request
1788
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1788
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1789 1789
 		{
1790 1790
 			return;
1791 1791
 		}
1792 1792
 
1793
-		if(self::get('_use_ssl') == 'always')
1793
+		if (self::get('_use_ssl') == 'always')
1794 1794
 		{
1795 1795
 			$ssl_mode = ENFORCE_SSL;
1796 1796
 		}
1797 1797
 
1798
-		if($domain)
1798
+		if ($domain)
1799 1799
 		{
1800 1800
 			$domain_key = md5($domain);
1801 1801
 		}
@@ -1804,14 +1804,14 @@  discard block
 block discarded – undo
1804 1804
 			$domain_key = 'default';
1805 1805
 		}
1806 1806
 
1807
-		if(isset($url[$ssl_mode][$domain_key]))
1807
+		if (isset($url[$ssl_mode][$domain_key]))
1808 1808
 		{
1809 1809
 			return $url[$ssl_mode][$domain_key];
1810 1810
 		}
1811 1811
 
1812 1812
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1813 1813
 
1814
-		switch($ssl_mode)
1814
+		switch ($ssl_mode)
1815 1815
 		{
1816 1816
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1817 1817
 				break;
@@ -1821,34 +1821,34 @@  discard block
 block discarded – undo
1821 1821
 				break;
1822 1822
 		}
1823 1823
 
1824
-		if($domain)
1824
+		if ($domain)
1825 1825
 		{
1826 1826
 			$target_url = trim($domain);
1827
-			if(substr_compare($target_url, '/', -1) !== 0)
1827
+			if (substr_compare($target_url, '/', -1) !== 0)
1828 1828
 			{
1829
-				$target_url.= '/';
1829
+				$target_url .= '/';
1830 1830
 			}
1831 1831
 		}
1832 1832
 		else
1833 1833
 		{
1834
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1834
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1835 1835
 		}
1836 1836
 
1837
-		$url_info = parse_url('http://' . $target_url);
1837
+		$url_info = parse_url('http://'.$target_url);
1838 1838
 
1839
-		if($current_use_ssl != $use_ssl)
1839
+		if ($current_use_ssl != $use_ssl)
1840 1840
 		{
1841 1841
 			unset($url_info['port']);
1842 1842
 		}
1843 1843
 
1844
-		if($use_ssl)
1844
+		if ($use_ssl)
1845 1845
 		{
1846 1846
 			$port = self::get('_https_port');
1847
-			if($port && $port != 443)
1847
+			if ($port && $port != 443)
1848 1848
 			{
1849 1849
 				$url_info['port'] = $port;
1850 1850
 			}
1851
-			elseif($url_info['port'] == 443)
1851
+			elseif ($url_info['port'] == 443)
1852 1852
 			{
1853 1853
 				unset($url_info['port']);
1854 1854
 			}
@@ -1856,17 +1856,17 @@  discard block
 block discarded – undo
1856 1856
 		else
1857 1857
 		{
1858 1858
 			$port = self::get('_http_port');
1859
-			if($port && $port != 80)
1859
+			if ($port && $port != 80)
1860 1860
 			{
1861 1861
 				$url_info['port'] = $port;
1862 1862
 			}
1863
-			elseif($url_info['port'] == 80)
1863
+			elseif ($url_info['port'] == 80)
1864 1864
 			{
1865 1865
 				unset($url_info['port']);
1866 1866
 			}
1867 1867
 		}
1868 1868
 
1869
-		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']);
1869
+		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']);
1870 1870
 
1871 1871
 		return $url[$ssl_mode][$domain_key];
1872 1872
 	}
@@ -1883,16 +1883,16 @@  discard block
 block discarded – undo
1883 1883
 	{
1884 1884
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1885 1885
 		$self->context->{$key} = $val;
1886
-		if($set_to_get_vars === FALSE)
1886
+		if ($set_to_get_vars === FALSE)
1887 1887
 		{
1888 1888
 			return;
1889 1889
 		}
1890
-		if($val === NULL || $val === '')
1890
+		if ($val === NULL || $val === '')
1891 1891
 		{
1892 1892
 			unset($self->get_vars->{$key});
1893 1893
 			return;
1894 1894
 		}
1895
-		if($set_to_get_vars || $self->get_vars->{$key})
1895
+		if ($set_to_get_vars || $self->get_vars->{$key})
1896 1896
 		{
1897 1897
 			$self->get_vars->{$key} = $val;
1898 1898
 		}
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 	{
1909 1909
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1910 1910
 
1911
-		if(!isset($self->context->{$key}))
1911
+		if (!isset($self->context->{$key}))
1912 1912
 		{
1913 1913
 			return null;
1914 1914
 		}
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
 	function gets()
1924 1924
 	{
1925 1925
 		$num_args = func_num_args();
1926
-		if($num_args < 1)
1926
+		if ($num_args < 1)
1927 1927
 		{
1928 1928
 			return;
1929 1929
 		}
@@ -1931,7 +1931,7 @@  discard block
 block discarded – undo
1931 1931
 
1932 1932
 		$args_list = func_get_args();
1933 1933
 		$output = new stdClass();
1934
-		foreach($args_list as $v)
1934
+		foreach ($args_list as $v)
1935 1935
 		{
1936 1936
 			$output->{$v} = $self->get($v);
1937 1937
 		}
@@ -1957,7 +1957,7 @@  discard block
 block discarded – undo
1957 1957
 	function getRequestVars()
1958 1958
 	{
1959 1959
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1960
-		if($self->get_vars)
1960
+		if ($self->get_vars)
1961 1961
 		{
1962 1962
 			return clone($self->get_vars);
1963 1963
 		}
@@ -1974,13 +1974,13 @@  discard block
 block discarded – undo
1974 1974
 	{
1975 1975
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1976 1976
 
1977
-		if(!is_readable($self->sslActionCacheFile))
1977
+		if (!is_readable($self->sslActionCacheFile))
1978 1978
 		{
1979 1979
 			$buff = '<?php if(!defined("__XE__"))exit;';
1980 1980
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
1981 1981
 		}
1982 1982
 
1983
-		if(!isset($self->ssl_actions[$action]))
1983
+		if (!isset($self->ssl_actions[$action]))
1984 1984
 		{
1985 1985
 			$self->ssl_actions[$action] = 1;
1986 1986
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -1998,16 +1998,16 @@  discard block
 block discarded – undo
1998 1998
 	{
1999 1999
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2000 2000
 
2001
-		if(!is_readable($self->sslActionCacheFile))
2001
+		if (!is_readable($self->sslActionCacheFile))
2002 2002
 		{
2003 2003
 			unset($self->ssl_actions);
2004 2004
 			$buff = '<?php if(!defined("__XE__"))exit;';
2005 2005
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2006 2006
 		}
2007 2007
 
2008
-		foreach($action_array as $action)
2008
+		foreach ($action_array as $action)
2009 2009
 		{
2010
-			if(!isset($self->ssl_actions[$action]))
2010
+			if (!isset($self->ssl_actions[$action]))
2011 2011
 			{
2012 2012
 				$self->ssl_actions[$action] = 1;
2013 2013
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
 	{
2027 2027
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2028 2028
 
2029
-		if($self->isExistsSSLAction($action))
2029
+		if ($self->isExistsSSLAction($action))
2030 2030
 		{
2031 2031
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2032 2032
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 	function getSSLActions()
2044 2044
 	{
2045 2045
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2046
-		if($self->getSslStatus() == 'optional')
2046
+		if ($self->getSslStatus() == 'optional')
2047 2047
 		{
2048 2048
 			return $self->ssl_actions;
2049 2049
 		}
@@ -2070,12 +2070,12 @@  discard block
 block discarded – undo
2070 2070
 	 */
2071 2071
 	function normalizeFilePath($file)
2072 2072
 	{
2073
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2073
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2074 2074
 		{
2075
-			$file = './' . $file;
2075
+			$file = './'.$file;
2076 2076
 		}
2077 2077
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2078
-		while(strpos($file, '/../') !== FALSE)
2078
+		while (strpos($file, '/../') !== FALSE)
2079 2079
 		{
2080 2080
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2081 2081
 		}
@@ -2093,13 +2093,13 @@  discard block
 block discarded – undo
2093 2093
 	function getAbsFileUrl($file)
2094 2094
 	{
2095 2095
 		$file = self::normalizeFilePath($file);
2096
-		if(strpos($file, './') === 0)
2096
+		if (strpos($file, './') === 0)
2097 2097
 		{
2098
-			$file = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($file, 2);
2098
+			$file = dirname($_SERVER['SCRIPT_NAME']).'/'.substr($file, 2);
2099 2099
 		}
2100
-		elseif(strpos($file, '../') === 0)
2100
+		elseif (strpos($file, '../') === 0)
2101 2101
 		{
2102
-			$file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$file}");
2102
+			$file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME'])."/{$file}");
2103 2103
 		}
2104 2104
 
2105 2105
 		return $file;
@@ -2169,12 +2169,12 @@  discard block
 block discarded – undo
2169 2169
 	 */
2170 2170
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2171 2171
 	{
2172
-		if($isRuleset)
2172
+		if ($isRuleset)
2173 2173
 		{
2174
-			if(strpos($file, '#') !== FALSE)
2174
+			if (strpos($file, '#') !== FALSE)
2175 2175
 			{
2176 2176
 				$file = str_replace('#', '', $file);
2177
-				if(!is_readable($file))
2177
+				if (!is_readable($file))
2178 2178
 				{
2179 2179
 					$file = $autoPath;
2180 2180
 				}
@@ -2239,9 +2239,9 @@  discard block
 block discarded – undo
2239 2239
 		ksort($files);
2240 2240
 		$files = array_values($files);
2241 2241
 		$filenames = array();
2242
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2242
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2243 2243
 		{
2244
-			if(in_array($files[$i]['file'], $filenames))
2244
+			if (in_array($files[$i]['file'], $filenames))
2245 2245
 			{
2246 2246
 				unset($files[$i]);
2247 2247
 			}
@@ -2326,14 +2326,14 @@  discard block
 block discarded – undo
2326 2326
 	 */
2327 2327
 	function getJavascriptPluginInfo($pluginName)
2328 2328
 	{
2329
-		if($plugin_name == 'ui.datepicker')
2329
+		if ($plugin_name == 'ui.datepicker')
2330 2330
 		{
2331 2331
 			$plugin_name = 'ui';
2332 2332
 		}
2333 2333
 
2334
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2335
-		$info_file = $plugin_path . 'plugin.load';
2336
-		if(!is_readable($info_file))
2334
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2335
+		$info_file = $plugin_path.'plugin.load';
2336
+		if (!is_readable($info_file))
2337 2337
 		{
2338 2338
 			return;
2339 2339
 		}
@@ -2343,32 +2343,32 @@  discard block
 block discarded – undo
2343 2343
 		$result->jsList = array();
2344 2344
 		$result->cssList = array();
2345 2345
 
2346
-		foreach($list as $filename)
2346
+		foreach ($list as $filename)
2347 2347
 		{
2348 2348
 			$filename = trim($filename);
2349
-			if(!$filename)
2349
+			if (!$filename)
2350 2350
 			{
2351 2351
 				continue;
2352 2352
 			}
2353 2353
 
2354
-			if(strncasecmp('./', $filename, 2) === 0)
2354
+			if (strncasecmp('./', $filename, 2) === 0)
2355 2355
 			{
2356 2356
 				$filename = substr($filename, 2);
2357 2357
 			}
2358 2358
 
2359
-			if(substr_compare($filename, '.js', -3) === 0)
2359
+			if (substr_compare($filename, '.js', -3) === 0)
2360 2360
 			{
2361
-				$result->jsList[] = $plugin_path . $filename;
2361
+				$result->jsList[] = $plugin_path.$filename;
2362 2362
 			}
2363
-			elseif(substr_compare($filename, '.css', -4) === 0)
2363
+			elseif (substr_compare($filename, '.css', -4) === 0)
2364 2364
 			{
2365
-				$result->cssList[] = $plugin_path . $filename;
2365
+				$result->cssList[] = $plugin_path.$filename;
2366 2366
 			}
2367 2367
 		}
2368 2368
 
2369
-		if(is_dir($plugin_path . 'lang'))
2369
+		if (is_dir($plugin_path.'lang'))
2370 2370
 		{
2371
-			$result->langPath = $plugin_path . 'lang';
2371
+			$result->langPath = $plugin_path.'lang';
2372 2372
 		}
2373 2373
 
2374 2374
 		return $result;
@@ -2384,50 +2384,50 @@  discard block
 block discarded – undo
2384 2384
 		static $loaded_plugins = array();
2385 2385
 
2386 2386
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2387
-		if($plugin_name == 'ui.datepicker')
2387
+		if ($plugin_name == 'ui.datepicker')
2388 2388
 		{
2389 2389
 			$plugin_name = 'ui';
2390 2390
 		}
2391 2391
 
2392
-		if($loaded_plugins[$plugin_name])
2392
+		if ($loaded_plugins[$plugin_name])
2393 2393
 		{
2394 2394
 			return;
2395 2395
 		}
2396 2396
 		$loaded_plugins[$plugin_name] = TRUE;
2397 2397
 
2398
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2399
-		$info_file = $plugin_path . 'plugin.load';
2400
-		if(!is_readable($info_file))
2398
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2399
+		$info_file = $plugin_path.'plugin.load';
2400
+		if (!is_readable($info_file))
2401 2401
 		{
2402 2402
 			return;
2403 2403
 		}
2404 2404
 
2405 2405
 		$list = file($info_file);
2406
-		foreach($list as $filename)
2406
+		foreach ($list as $filename)
2407 2407
 		{
2408 2408
 			$filename = trim($filename);
2409
-			if(!$filename)
2409
+			if (!$filename)
2410 2410
 			{
2411 2411
 				continue;
2412 2412
 			}
2413 2413
 
2414
-			if(strncasecmp('./', $filename, 2) === 0)
2414
+			if (strncasecmp('./', $filename, 2) === 0)
2415 2415
 			{
2416 2416
 				$filename = substr($filename, 2);
2417 2417
 			}
2418
-			if(substr_compare($filename, '.js', -3) === 0)
2418
+			if (substr_compare($filename, '.js', -3) === 0)
2419 2419
 			{
2420
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2420
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2421 2421
 			}
2422
-			if(substr_compare($filename, '.css', -4) === 0)
2422
+			if (substr_compare($filename, '.css', -4) === 0)
2423 2423
 			{
2424
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2424
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2425 2425
 			}
2426 2426
 		}
2427 2427
 
2428
-		if(is_dir($plugin_path . 'lang'))
2428
+		if (is_dir($plugin_path.'lang'))
2429 2429
 		{
2430
-			$self->loadLang($plugin_path . 'lang');
2430
+			$self->loadLang($plugin_path.'lang');
2431 2431
 		}
2432 2432
 	}
2433 2433
 
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
 	function addHtmlHeader($header)
2441 2441
 	{
2442 2442
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2443
-		$self->html_header .= "\n" . $header;
2443
+		$self->html_header .= "\n".$header;
2444 2444
 	}
2445 2445
 
2446 2446
 	function clearHtmlHeader()
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
 	function addBodyHeader($header)
2493 2493
 	{
2494 2494
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2495
-		$self->body_header .= "\n" . $header;
2495
+		$self->body_header .= "\n".$header;
2496 2496
 	}
2497 2497
 
2498 2498
 	/**
@@ -2514,7 +2514,7 @@  discard block
 block discarded – undo
2514 2514
 	function addHtmlFooter($footer)
2515 2515
 	{
2516 2516
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2517
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2517
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2518 2518
 	}
2519 2519
 
2520 2520
 	/**
@@ -2535,7 +2535,7 @@  discard block
 block discarded – undo
2535 2535
 	 */
2536 2536
 	function getConfigFile()
2537 2537
 	{
2538
-		return _XE_PATH_ . 'files/config/db.config.php';
2538
+		return _XE_PATH_.'files/config/db.config.php';
2539 2539
 	}
2540 2540
 
2541 2541
 	/**
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
 	 */
2546 2546
 	function getFTPConfigFile()
2547 2547
 	{
2548
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2548
+		return _XE_PATH_.'files/config/ftp.config.php';
2549 2549
 	}
2550 2550
 
2551 2551
 	/**
@@ -2597,14 +2597,14 @@  discard block
 block discarded – undo
2597 2597
 		$_path = explode('/', $path);
2598 2598
 		$_base = explode('/', $base_url);
2599 2599
 
2600
-		if(!$_base[count($_base) - 1])
2600
+		if (!$_base[count($_base) - 1])
2601 2601
 		{
2602 2602
 			array_pop($_base);
2603 2603
 		}
2604 2604
 
2605
-		foreach($_xe as $idx => $dir)
2605
+		foreach ($_xe as $idx => $dir)
2606 2606
 		{
2607
-			if($_path[0] != $dir)
2607
+			if ($_path[0] != $dir)
2608 2608
 			{
2609 2609
 				break;
2610 2610
 			}
@@ -2612,9 +2612,9 @@  discard block
 block discarded – undo
2612 2612
 		}
2613 2613
 
2614 2614
 		$idx = count($_xe) - $idx - 1;
2615
-		while($idx--)
2615
+		while ($idx--)
2616 2616
 		{
2617
-			if(count($_base) > 0)
2617
+			if (count($_base) > 0)
2618 2618
 			{
2619 2619
 				array_shift($_base);
2620 2620
 			}
@@ -2624,13 +2624,13 @@  discard block
 block discarded – undo
2624 2624
 			}
2625 2625
 		}
2626 2626
 
2627
-		if(count($_base) > 0)
2627
+		if (count($_base) > 0)
2628 2628
 		{
2629 2629
 			array_unshift($_path, join('/', $_base));
2630 2630
 		}
2631 2631
 
2632
-		$path = '/' . join('/', $_path);
2633
-		if(substr_compare($path, '/', -1) !== 0)
2632
+		$path = '/'.join('/', $_path);
2633
+		if (substr_compare($path, '/', -1) !== 0)
2634 2634
 		{
2635 2635
 			$path .= '/';
2636 2636
 		}
@@ -2645,13 +2645,13 @@  discard block
 block discarded – undo
2645 2645
 	{
2646 2646
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2647 2647
 
2648
-		if(!is_array($self->meta_tags))
2648
+		if (!is_array($self->meta_tags))
2649 2649
 		{
2650 2650
 			$self->meta_tags = array();
2651 2651
 		}
2652 2652
 
2653 2653
 		$ret = array();
2654
-		foreach($self->meta_tags as $key => $val)
2654
+		foreach ($self->meta_tags as $key => $val)
2655 2655
 		{
2656 2656
 			list($name, $is_http_equiv) = explode("\t", $key);
2657 2657
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2672 2672
 	{
2673 2673
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2674
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2674
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2675 2675
 	}
2676 2676
 
2677 2677
 }
Please login to merge, or discard this patch.