@@ -50,17 +50,23 @@ |
||
50 | 50 | include_once($autoloader); |
51 | 51 | } |
52 | 52 | |
53 | -if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
53 | +if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) { |
|
54 | + $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
55 | +} |
|
54 | 56 | |
55 | 57 | $base_path = str_replace('\\','/',dirname(__FILE__)) . '/'; |
56 | -if(is_file($base_path . 'assets/cache/siteManager.php')) |
|
58 | +if(is_file($base_path . 'assets/cache/siteManager.php')) { |
|
57 | 59 | include_once($base_path . 'assets/cache/siteManager.php'); |
58 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
|
60 | +} |
|
61 | +if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
59 | 62 | define('MGR_DIR', 'manager'); |
60 | -if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
|
63 | +} |
|
64 | +if(is_file($base_path . 'assets/cache/siteHostnames.php')) { |
|
61 | 65 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
62 | -if(!defined('MODX_SITE_HOSTNAMES')) |
|
66 | +} |
|
67 | +if(!defined('MODX_SITE_HOSTNAMES')) { |
|
63 | 68 | define('MODX_SITE_HOSTNAMES', ''); |
69 | +} |
|
64 | 70 | |
65 | 71 | // get start time |
66 | 72 | $mstart = memory_get_usage(); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) { |
3 | 3 | include_once(dirname(__FILE__)."/../assets/cache/siteManager.php"); |
4 | -}else{ |
|
4 | +} else { |
|
5 | 5 | define('MGR_DIR', 'manager'); |
6 | 6 | } |
7 | 7 | |
@@ -58,13 +58,15 @@ discard block |
||
58 | 58 | |
59 | 59 | // get base path and url |
60 | 60 | $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); |
61 | -if (count($a) > 1) |
|
61 | +if (count($a) > 1) { |
|
62 | 62 | array_pop($a); |
63 | +} |
|
63 | 64 | $url = implode("install", $a); |
64 | 65 | reset($a); |
65 | 66 | $a = explode("install", str_replace("\\", "/", realpath(dirname(__FILE__)))); |
66 | -if (count($a) > 1) |
|
67 | +if (count($a) > 1) { |
|
67 | 68 | array_pop($a); |
69 | +} |
|
68 | 70 | $pth = implode("install", $a); |
69 | 71 | unset ($a); |
70 | 72 | $base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
@@ -85,7 +87,9 @@ discard block |
||
85 | 87 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
86 | 88 | $create = true; |
87 | 89 | } else { |
88 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
90 | + if (function_exists('mysqli_set_charset')) { |
|
91 | + mysqli_set_charset($conn, $database_charset); |
|
92 | + } |
|
89 | 93 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
90 | 94 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
91 | 95 | } |
@@ -127,7 +131,8 @@ discard block |
||
127 | 131 | if(!function_exists('parseProperties')) { |
128 | 132 | // parses a resource property string and returns the result as an array |
129 | 133 | // duplicate of method in documentParser class |
130 | - function parseProperties($propertyString) { |
|
134 | + function parseProperties($propertyString) |
|
135 | + { |
|
131 | 136 | $parameter= array (); |
132 | 137 | if (!empty ($propertyString)) { |
133 | 138 | $tmpParams= explode("&", $propertyString); |
@@ -135,11 +140,14 @@ discard block |
||
135 | 140 | if (strpos($tmpParams[$x], '=', 0)) { |
136 | 141 | $pTmp= explode("=", $tmpParams[$x]); |
137 | 142 | $pvTmp= explode(";", trim($pTmp[1])); |
138 | - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
|
139 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
143 | + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { |
|
144 | + $parameter[trim($pTmp[0])]= $pvTmp[3]; |
|
145 | + } |
|
146 | + //list default |
|
140 | 147 | else |
141 | - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
|
142 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
148 | + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { |
|
149 | + $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
150 | + } |
|
143 | 151 | } |
144 | 152 | } |
145 | 153 | } |
@@ -210,7 +218,7 @@ discard block |
||
210 | 218 | // custom or not |
211 | 219 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
212 | 220 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
213 | -}else{ |
|
221 | +} else { |
|
214 | 222 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
215 | 223 | } |
216 | 224 | |
@@ -346,7 +354,9 @@ discard block |
||
346 | 354 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
347 | 355 | return; |
348 | 356 | } |
349 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
357 | + if(!is_null($save_sql_id_as)) { |
|
358 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
359 | + } |
|
350 | 360 | echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
351 | 361 | } |
352 | 362 | } |
@@ -440,9 +450,9 @@ discard block |
||
440 | 450 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
441 | 451 | $filecontent = $moduleChunk[2]; |
442 | 452 | |
443 | - if (!file_exists($filecontent)) |
|
444 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
445 | - else { |
|
453 | + if (!file_exists($filecontent)) { |
|
454 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
455 | + } else { |
|
446 | 456 | |
447 | 457 | // Create the category if it does not already exist |
448 | 458 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -494,9 +504,9 @@ discard block |
||
494 | 504 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
495 | 505 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
496 | 506 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
497 | - if (!file_exists($filecontent)) |
|
498 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
499 | - else { |
|
507 | + if (!file_exists($filecontent)) { |
|
508 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
509 | + } else { |
|
500 | 510 | |
501 | 511 | // Create the category if it does not already exist |
502 | 512 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -546,9 +556,9 @@ discard block |
||
546 | 556 | // parse comma-separated legacy names and prepare them for sql IN clause |
547 | 557 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
548 | 558 | } |
549 | - if (!file_exists($filecontent)) |
|
550 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
551 | - else { |
|
559 | + if (!file_exists($filecontent)) { |
|
560 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
561 | + } else { |
|
552 | 562 | |
553 | 563 | // disable legacy versions based on legacy_names provided |
554 | 564 | if(!empty($leg_names)) { |
@@ -567,7 +577,7 @@ discard block |
||
567 | 577 | $insert = true; |
568 | 578 | while($row = mysqli_fetch_assoc($rs)) { |
569 | 579 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
570 | - if($row['description'] == $desc){ |
|
580 | + if($row['description'] == $desc) { |
|
571 | 581 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
572 | 582 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
573 | 583 | return; |
@@ -625,9 +635,9 @@ discard block |
||
625 | 635 | $filecontent = $moduleSnippet[2]; |
626 | 636 | $properties = $moduleSnippet[3]; |
627 | 637 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
628 | - if (!file_exists($filecontent)) |
|
629 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
630 | - else { |
|
638 | + if (!file_exists($filecontent)) { |
|
639 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
640 | + } else { |
|
631 | 641 | |
632 | 642 | // Create the category if it does not already exist |
633 | 643 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -735,13 +745,16 @@ discard block |
||
735 | 745 | } |
736 | 746 | |
737 | 747 | // call back function |
738 | -if ($callBackFnc != "") |
|
748 | +if ($callBackFnc != "") { |
|
739 | 749 | $callBackFnc ($sqlParser); |
750 | +} |
|
740 | 751 | |
741 | 752 | // Setup the MODX API -- needed for the cache processor |
742 | 753 | define('MODX_API_MODE', true); |
743 | 754 | define('MODX_BASE_PATH', $base_path); |
744 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
755 | +if (!defined('MODX_MANAGER_PATH')) { |
|
756 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
757 | +} |
|
745 | 758 | $database_type = 'mysqli'; |
746 | 759 | // initiate a new document parser |
747 | 760 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |
@@ -780,11 +793,12 @@ discard block |
||
780 | 793 | } |
781 | 794 | |
782 | 795 | // Property Update function |
783 | -function propUpdate($new,$old){ |
|
796 | +function propUpdate($new,$old) |
|
797 | +{ |
|
784 | 798 | $newArr = parseProperties($new); |
785 | 799 | $oldArr = parseProperties($old); |
786 | - foreach ($oldArr as $k => $v){ |
|
787 | - if (isset($v['0']['options'])){ |
|
800 | + foreach ($oldArr as $k => $v) { |
|
801 | + if (isset($v['0']['options'])) { |
|
788 | 802 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
789 | 803 | } |
790 | 804 | } |
@@ -794,12 +808,17 @@ discard block |
||
794 | 808 | return $return; |
795 | 809 | } |
796 | 810 | |
797 | -function parseProperties($propertyString, $json=false) { |
|
811 | +function parseProperties($propertyString, $json=false) |
|
812 | +{ |
|
798 | 813 | $propertyString = str_replace('{}', '', $propertyString ); |
799 | 814 | $propertyString = str_replace('} {', ',', $propertyString ); |
800 | 815 | |
801 | - if(empty($propertyString)) return array(); |
|
802 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
816 | + if(empty($propertyString)) { |
|
817 | + return array(); |
|
818 | + } |
|
819 | + if($propertyString=='{}' || $propertyString=='[]') { |
|
820 | + return array(); |
|
821 | + } |
|
803 | 822 | |
804 | 823 | $jsonFormat = isJson($propertyString, true); |
805 | 824 | $property = array(); |
@@ -841,7 +860,7 @@ discard block |
||
841 | 860 | |
842 | 861 | } |
843 | 862 | // new json-format |
844 | - } else if(!empty($jsonFormat)){ |
|
863 | + } else if(!empty($jsonFormat)) { |
|
845 | 864 | $property = $jsonFormat; |
846 | 865 | } |
847 | 866 | if ($json) { |
@@ -851,12 +870,14 @@ discard block |
||
851 | 870 | return $property; |
852 | 871 | } |
853 | 872 | |
854 | -function isJson($string, $returnData=false) { |
|
873 | +function isJson($string, $returnData=false) |
|
874 | +{ |
|
855 | 875 | $data = json_decode($string, true); |
856 | 876 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
857 | 877 | } |
858 | 878 | |
859 | -function getCreateDbCategory($category, $sqlParser) { |
|
879 | +function getCreateDbCategory($category, $sqlParser) |
|
880 | +{ |
|
860 | 881 | $dbase = $sqlParser->dbname; |
861 | 882 | $dbase = '`' . trim($dbase,'`') . '`'; |
862 | 883 | $table_prefix = $sqlParser->prefix; |
@@ -878,7 +899,8 @@ discard block |
||
878 | 899 | } |
879 | 900 | |
880 | 901 | // Remove installer Docblock only from components using plugin FileSource / fileBinding |
881 | -function removeDocblock($code, $type) { |
|
902 | +function removeDocblock($code, $type) |
|
903 | +{ |
|
882 | 904 | |
883 | 905 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
884 | 906 | |
@@ -899,8 +921,9 @@ discard block |
||
899 | 921 | default: |
900 | 922 | return $cleaned; |
901 | 923 | }; |
902 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
903 | - return $cleaned; |
|
924 | + if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') { |
|
925 | + return $cleaned; |
|
926 | + } |
|
904 | 927 | |
905 | 928 | // fileBinding not found - return code incl docblock |
906 | 929 | return $code; |
@@ -4,7 +4,9 @@ discard block |
||
4 | 4 | if (is_file($base_path . 'assets/cache/siteManager.php')) { |
5 | 5 | include_once($base_path . 'assets/cache/siteManager.php'); |
6 | 6 | } |
7 | -if(!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
7 | +if(!defined('MGR_DIR')) { |
|
8 | + define('MGR_DIR', 'manager'); |
|
9 | +} |
|
8 | 10 | |
9 | 11 | require_once('../'.MGR_DIR.'/includes/version.inc.php'); |
10 | 12 | |
@@ -19,12 +21,12 @@ discard block |
||
19 | 21 | $mt = &$moduleTemplates; |
20 | 22 | if(is_dir($templatePath) && is_readable($templatePath)) { |
21 | 23 | $d = dir($templatePath); |
22 | - while (false !== ($tplfile = $d->read())) |
|
23 | - { |
|
24 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
24 | + while (false !== ($tplfile = $d->read())) { |
|
25 | + if(substr($tplfile, -4) != '.tpl') { |
|
26 | + continue; |
|
27 | + } |
|
25 | 28 | $params = parse_docblock($templatePath, $tplfile); |
26 | - if(is_array($params) && (count($params)>0)) |
|
27 | - { |
|
29 | + if(is_array($params) && (count($params)>0)) { |
|
28 | 30 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
29 | 31 | $mt[] = array |
30 | 32 | ( |
@@ -48,7 +50,9 @@ discard block |
||
48 | 50 | if(is_dir($tvPath) && is_readable($tvPath)) { |
49 | 51 | $d = dir($tvPath); |
50 | 52 | while (false !== ($tplfile = $d->read())) { |
51 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
53 | + if(substr($tplfile, -4) != '.tpl') { |
|
54 | + continue; |
|
55 | + } |
|
52 | 56 | $params = parse_docblock($tvPath, $tplfile); |
53 | 57 | if(is_array($params) && (count($params)>0)) { |
54 | 58 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
@@ -241,7 +245,8 @@ discard block |
||
241 | 245 | // setup callback function |
242 | 246 | $callBackFnc = "clean_up"; |
243 | 247 | |
244 | -function clean_up($sqlParser) { |
|
248 | +function clean_up($sqlParser) |
|
249 | +{ |
|
245 | 250 | $ids = array(); |
246 | 251 | |
247 | 252 | // secure web documents - privateweb |
@@ -254,9 +259,10 @@ discard block |
||
254 | 259 | $ds = mysqli_query($sqlParser->conn,$sql); |
255 | 260 | if(!$ds) { |
256 | 261 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
257 | - } |
|
258 | - else { |
|
259 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
262 | + } else { |
|
263 | + while($r = mysqli_fetch_assoc($ds)) { |
|
264 | + $ids[]=$r["id"]; |
|
265 | + } |
|
260 | 266 | if(count($ids)>0) { |
261 | 267 | mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
262 | 268 | unset($ids); |
@@ -273,9 +279,10 @@ discard block |
||
273 | 279 | $ds = mysqli_query($sqlParser->conn,$sql); |
274 | 280 | if(!$ds) { |
275 | 281 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
276 | - } |
|
277 | - else { |
|
278 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
282 | + } else { |
|
283 | + while($r = mysqli_fetch_assoc($ds)) { |
|
284 | + $ids[]=$r["id"]; |
|
285 | + } |
|
279 | 286 | if(count($ids)>0) { |
280 | 287 | mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
281 | 288 | unset($ids); |
@@ -283,7 +290,8 @@ discard block |
||
283 | 290 | } |
284 | 291 | } |
285 | 292 | |
286 | -function parse_docblock($element_dir, $filename) { |
|
293 | +function parse_docblock($element_dir, $filename) |
|
294 | +{ |
|
287 | 295 | $params = array(); |
288 | 296 | $fullpath = $element_dir . '/' . $filename; |
289 | 297 | if(is_readable($fullpath)) { |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class image_imagick extends image { |
|
15 | +class image_imagick extends image |
|
16 | +{ |
|
16 | 17 | |
17 | 18 | static $MIMES = array( |
18 | 19 | //'tif' => "image/tiff" |
@@ -21,9 +22,15 @@ discard block |
||
21 | 22 | |
22 | 23 | // ABSTRACT PUBLIC METHODS |
23 | 24 | |
24 | - public function resize($width, $height) {// |
|
25 | - if (!$width) $width = 1; |
|
26 | - if (!$height) $height = 1; |
|
25 | + public function resize($width, $height) |
|
26 | + { |
|
27 | +// |
|
28 | + if (!$width) { |
|
29 | + $width = 1; |
|
30 | + } |
|
31 | + if (!$height) { |
|
32 | + $height = 1; |
|
33 | + } |
|
27 | 34 | try { |
28 | 35 | $this->image->scaleImage($width, $height); |
29 | 36 | } catch (Exception $e) { |
@@ -34,9 +41,15 @@ discard block |
||
34 | 41 | return true; |
35 | 42 | } |
36 | 43 | |
37 | - public function resizeFit($width, $height, $background=false) {// |
|
38 | - if (!$width) $width = 1; |
|
39 | - if (!$height) $height = 1; |
|
44 | + public function resizeFit($width, $height, $background=false) |
|
45 | + { |
|
46 | +// |
|
47 | + if (!$width) { |
|
48 | + $width = 1; |
|
49 | + } |
|
50 | + if (!$height) { |
|
51 | + $height = 1; |
|
52 | + } |
|
40 | 53 | |
41 | 54 | try { |
42 | 55 | $this->image->scaleImage($width, $height, true); |
@@ -65,43 +78,58 @@ discard block |
||
65 | 78 | } |
66 | 79 | } |
67 | 80 | |
68 | - public function resizeCrop($width, $height, $offset=false) { |
|
69 | - if (!$width) $width = 1; |
|
70 | - if (!$height) $height = 1; |
|
81 | + public function resizeCrop($width, $height, $offset=false) |
|
82 | + { |
|
83 | + if (!$width) { |
|
84 | + $width = 1; |
|
85 | + } |
|
86 | + if (!$height) { |
|
87 | + $height = 1; |
|
88 | + } |
|
71 | 89 | |
72 | 90 | if (($this->width / $this->height) > ($width / $height)) { |
73 | 91 | $h = $height; |
74 | 92 | $w = ($this->width * $h) / $this->height; |
75 | 93 | $y = 0; |
76 | 94 | if ($offset !== false) { |
77 | - if ($offset > 0) |
|
78 | - $offset = -$offset; |
|
79 | - if (($w + $offset) <= $width) |
|
80 | - $offset = $width - $w; |
|
95 | + if ($offset > 0) { |
|
96 | + $offset = -$offset; |
|
97 | + } |
|
98 | + if (($w + $offset) <= $width) { |
|
99 | + $offset = $width - $w; |
|
100 | + } |
|
81 | 101 | $x = $offset; |
82 | - } else |
|
83 | - $x = ($width - $w) / 2; |
|
102 | + } else { |
|
103 | + $x = ($width - $w) / 2; |
|
104 | + } |
|
84 | 105 | |
85 | 106 | } else { |
86 | 107 | $w = $width; |
87 | 108 | $h = ($this->height * $w) / $this->width; |
88 | 109 | $x = 0; |
89 | 110 | if ($offset !== false) { |
90 | - if ($offset > 0) |
|
91 | - $offset = -$offset; |
|
92 | - if (($h + $offset) <= $height) |
|
93 | - $offset = $height - $h; |
|
111 | + if ($offset > 0) { |
|
112 | + $offset = -$offset; |
|
113 | + } |
|
114 | + if (($h + $offset) <= $height) { |
|
115 | + $offset = $height - $h; |
|
116 | + } |
|
94 | 117 | $y = $offset; |
95 | - } else |
|
96 | - $y = ($height - $h) / 2; |
|
118 | + } else { |
|
119 | + $y = ($height - $h) / 2; |
|
120 | + } |
|
97 | 121 | } |
98 | 122 | |
99 | 123 | $x = round($x); |
100 | 124 | $y = round($y); |
101 | 125 | $w = round($w); |
102 | 126 | $h = round($h); |
103 | - if (!$w) $w = 1; |
|
104 | - if (!$h) $h = 1; |
|
127 | + if (!$w) { |
|
128 | + $w = 1; |
|
129 | + } |
|
130 | + if (!$h) { |
|
131 | + $h = 1; |
|
132 | + } |
|
105 | 133 | |
106 | 134 | try { |
107 | 135 | $this->image->scaleImage($w, $h); |
@@ -115,7 +143,8 @@ discard block |
||
115 | 143 | return true; |
116 | 144 | } |
117 | 145 | |
118 | - public function rotate($angle, $background="#000000") { |
|
146 | + public function rotate($angle, $background="#000000") |
|
147 | + { |
|
119 | 148 | try { |
120 | 149 | $this->image->rotateImage(new ImagickPixel($background), $angle); |
121 | 150 | $size = $this->image->getImageGeometry(); |
@@ -127,7 +156,8 @@ discard block |
||
127 | 156 | return true; |
128 | 157 | } |
129 | 158 | |
130 | - public function flipHorizontal() { |
|
159 | + public function flipHorizontal() |
|
160 | + { |
|
131 | 161 | try { |
132 | 162 | $this->image->flopImage(); |
133 | 163 | } catch (Exception $e) { |
@@ -136,7 +166,8 @@ discard block |
||
136 | 166 | return true; |
137 | 167 | } |
138 | 168 | |
139 | - public function flipVertical() { |
|
169 | + public function flipVertical() |
|
170 | + { |
|
140 | 171 | try { |
141 | 172 | $this->image->flipImage(); |
142 | 173 | } catch (Exception $e) { |
@@ -145,7 +176,8 @@ discard block |
||
145 | 176 | return true; |
146 | 177 | } |
147 | 178 | |
148 | - public function watermark($file, $left=false, $top=false) { |
|
179 | + public function watermark($file, $left=false, $top=false) |
|
180 | + { |
|
149 | 181 | try { |
150 | 182 | $wm = new Imagick($file); |
151 | 183 | $size = $wm->getImageGeometry(); |
@@ -167,8 +199,9 @@ discard block |
||
167 | 199 | if ((($x + $w) > $this->width) || |
168 | 200 | (($y + $h) > $this->height) || |
169 | 201 | ($x < 0) || ($y < 0) |
170 | - ) |
|
171 | - return false; |
|
202 | + ) { |
|
203 | + return false; |
|
204 | + } |
|
172 | 205 | |
173 | 206 | try { |
174 | 207 | $this->image->compositeImage($wm, Imagick::COMPOSITE_DEFAULT, $x, $y); |
@@ -181,7 +214,8 @@ discard block |
||
181 | 214 | |
182 | 215 | // ABSTRACT PROTECTED METHODS |
183 | 216 | |
184 | - protected function getBlankImage($width, $height) { |
|
217 | + protected function getBlankImage($width, $height) |
|
218 | + { |
|
185 | 219 | try { |
186 | 220 | $img = new Imagick(); |
187 | 221 | $img->newImage($width, $height, "none"); |
@@ -192,7 +226,8 @@ discard block |
||
192 | 226 | return $img; |
193 | 227 | } |
194 | 228 | |
195 | - protected function getImage($image, &$width, &$height) { |
|
229 | + protected function getImage($image, &$width, &$height) |
|
230 | + { |
|
196 | 231 | |
197 | 232 | if (is_object($image) && ($image instanceof image_imagick)) { |
198 | 233 | try { |
@@ -227,18 +262,21 @@ discard block |
||
227 | 262 | $height = $size['height']; |
228 | 263 | return $image; |
229 | 264 | |
230 | - } else |
|
231 | - return false; |
|
265 | + } else { |
|
266 | + return false; |
|
267 | + } |
|
232 | 268 | } |
233 | 269 | |
234 | 270 | |
235 | 271 | // PSEUDO-ABSTRACT STATIC METHODS |
236 | 272 | |
237 | - static function available() { |
|
273 | + static function available() |
|
274 | + { |
|
238 | 275 | return class_exists("Imagick"); |
239 | 276 | } |
240 | 277 | |
241 | - static function checkImage($file) { |
|
278 | + static function checkImage($file) |
|
279 | + { |
|
242 | 280 | try { |
243 | 281 | new Imagick($file); |
244 | 282 | } catch (Exception $e) { |
@@ -250,7 +288,8 @@ discard block |
||
250 | 288 | |
251 | 289 | // INHERIT METHODS |
252 | 290 | |
253 | - public function output($type="jpeg", array $options=array()) { |
|
291 | + public function output($type="jpeg", array $options=array()) |
|
292 | + { |
|
254 | 293 | $type = strtolower($type); |
255 | 294 | try { |
256 | 295 | $this->image->setImageFormat($type); |
@@ -258,8 +297,9 @@ discard block |
||
258 | 297 | return false; |
259 | 298 | } |
260 | 299 | $method = "optimize_$type"; |
261 | - if (method_exists($this, $method) && !$this->$method($options)) |
|
262 | - return false; |
|
300 | + if (method_exists($this, $method) && !$this->$method($options)) { |
|
301 | + return false; |
|
302 | + } |
|
263 | 303 | |
264 | 304 | if (!isset($options['file'])) { |
265 | 305 | if (!headers_sent()) { |
@@ -289,7 +329,8 @@ discard block |
||
289 | 329 | |
290 | 330 | // OWN METHODS |
291 | 331 | |
292 | - protected function optimize_jpeg(array $options=array()) { |
|
332 | + protected function optimize_jpeg(array $options=array()) |
|
333 | + { |
|
293 | 334 | $quality = isset($options['quality']) ? $options['quality'] : self::DEFAULT_JPEG_QUALITY; |
294 | 335 | try { |
295 | 336 | $this->image->setImageCompression(Imagick::COMPRESSION_JPEG); |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class image_gmagick extends image { |
|
15 | +class image_gmagick extends image |
|
16 | +{ |
|
16 | 17 | |
17 | 18 | static $MIMES = array( |
18 | 19 | //'tif' => "image/tiff" |
@@ -21,9 +22,15 @@ discard block |
||
21 | 22 | |
22 | 23 | // ABSTRACT PUBLIC METHODS |
23 | 24 | |
24 | - public function resize($width, $height) {// |
|
25 | - if (!$width) $width = 1; |
|
26 | - if (!$height) $height = 1; |
|
25 | + public function resize($width, $height) |
|
26 | + { |
|
27 | +// |
|
28 | + if (!$width) { |
|
29 | + $width = 1; |
|
30 | + } |
|
31 | + if (!$height) { |
|
32 | + $height = 1; |
|
33 | + } |
|
27 | 34 | try { |
28 | 35 | $this->image->scaleImage($width, $height); |
29 | 36 | } catch (Exception $e) { |
@@ -34,9 +41,15 @@ discard block |
||
34 | 41 | return true; |
35 | 42 | } |
36 | 43 | |
37 | - public function resizeFit($width, $height, $background=false) {// |
|
38 | - if (!$width) $width = 1; |
|
39 | - if (!$height) $height = 1; |
|
44 | + public function resizeFit($width, $height, $background=false) |
|
45 | + { |
|
46 | +// |
|
47 | + if (!$width) { |
|
48 | + $width = 1; |
|
49 | + } |
|
50 | + if (!$height) { |
|
51 | + $height = 1; |
|
52 | + } |
|
40 | 53 | |
41 | 54 | try { |
42 | 55 | $this->image->scaleImage($width, $height, true); |
@@ -69,43 +82,58 @@ discard block |
||
69 | 82 | } |
70 | 83 | } |
71 | 84 | |
72 | - public function resizeCrop($width, $height, $offset=false) { |
|
73 | - if (!$width) $width = 1; |
|
74 | - if (!$height) $height = 1; |
|
85 | + public function resizeCrop($width, $height, $offset=false) |
|
86 | + { |
|
87 | + if (!$width) { |
|
88 | + $width = 1; |
|
89 | + } |
|
90 | + if (!$height) { |
|
91 | + $height = 1; |
|
92 | + } |
|
75 | 93 | |
76 | 94 | if (($this->width / $this->height) > ($width / $height)) { |
77 | 95 | $h = $height; |
78 | 96 | $w = ($this->width * $h) / $this->height; |
79 | 97 | $y = 0; |
80 | 98 | if ($offset !== false) { |
81 | - if ($offset > 0) |
|
82 | - $offset = -$offset; |
|
83 | - if (($w + $offset) <= $width) |
|
84 | - $offset = $width - $w; |
|
99 | + if ($offset > 0) { |
|
100 | + $offset = -$offset; |
|
101 | + } |
|
102 | + if (($w + $offset) <= $width) { |
|
103 | + $offset = $width - $w; |
|
104 | + } |
|
85 | 105 | $x = $offset; |
86 | - } else |
|
87 | - $x = ($width - $w) / 2; |
|
106 | + } else { |
|
107 | + $x = ($width - $w) / 2; |
|
108 | + } |
|
88 | 109 | |
89 | 110 | } else { |
90 | 111 | $w = $width; |
91 | 112 | $h = ($this->height * $w) / $this->width; |
92 | 113 | $x = 0; |
93 | 114 | if ($offset !== false) { |
94 | - if ($offset > 0) |
|
95 | - $offset = -$offset; |
|
96 | - if (($h + $offset) <= $height) |
|
97 | - $offset = $height - $h; |
|
115 | + if ($offset > 0) { |
|
116 | + $offset = -$offset; |
|
117 | + } |
|
118 | + if (($h + $offset) <= $height) { |
|
119 | + $offset = $height - $h; |
|
120 | + } |
|
98 | 121 | $y = $offset; |
99 | - } else |
|
100 | - $y = ($height - $h) / 2; |
|
122 | + } else { |
|
123 | + $y = ($height - $h) / 2; |
|
124 | + } |
|
101 | 125 | } |
102 | 126 | |
103 | 127 | $x = round($x); |
104 | 128 | $y = round($y); |
105 | 129 | $w = round($w); |
106 | 130 | $h = round($h); |
107 | - if (!$w) $w = 1; |
|
108 | - if (!$h) $h = 1; |
|
131 | + if (!$w) { |
|
132 | + $w = 1; |
|
133 | + } |
|
134 | + if (!$h) { |
|
135 | + $h = 1; |
|
136 | + } |
|
109 | 137 | |
110 | 138 | try { |
111 | 139 | $this->image->scaleImage($w, $h); |
@@ -119,7 +147,8 @@ discard block |
||
119 | 147 | return true; |
120 | 148 | } |
121 | 149 | |
122 | - public function rotate($angle, $background="#000000") { |
|
150 | + public function rotate($angle, $background="#000000") |
|
151 | + { |
|
123 | 152 | try { |
124 | 153 | $this->image->rotateImage($background, $angle); |
125 | 154 | $w = $this->image->getImageWidth(); |
@@ -132,7 +161,8 @@ discard block |
||
132 | 161 | return true; |
133 | 162 | } |
134 | 163 | |
135 | - public function flipHorizontal() { |
|
164 | + public function flipHorizontal() |
|
165 | + { |
|
136 | 166 | try { |
137 | 167 | $this->image->flopImage(); |
138 | 168 | } catch (Exception $e) { |
@@ -141,7 +171,8 @@ discard block |
||
141 | 171 | return true; |
142 | 172 | } |
143 | 173 | |
144 | - public function flipVertical() { |
|
174 | + public function flipVertical() |
|
175 | + { |
|
145 | 176 | try { |
146 | 177 | $this->image->flipImage(); |
147 | 178 | } catch (Exception $e) { |
@@ -150,7 +181,8 @@ discard block |
||
150 | 181 | return true; |
151 | 182 | } |
152 | 183 | |
153 | - public function watermark($file, $left=false, $top=false) { |
|
184 | + public function watermark($file, $left=false, $top=false) |
|
185 | + { |
|
154 | 186 | try { |
155 | 187 | $wm = new Gmagick($file); |
156 | 188 | $w = $wm->getImageWidth(); |
@@ -171,8 +203,9 @@ discard block |
||
171 | 203 | if ((($x + $w) > $this->width) || |
172 | 204 | (($y + $h) > $this->height) || |
173 | 205 | ($x < 0) || ($y < 0) |
174 | - ) |
|
175 | - return false; |
|
206 | + ) { |
|
207 | + return false; |
|
208 | + } |
|
176 | 209 | |
177 | 210 | try { |
178 | 211 | $this->image->compositeImage($wm, 1, $x, $y); |
@@ -185,7 +218,8 @@ discard block |
||
185 | 218 | |
186 | 219 | // ABSTRACT PROTECTED METHODS |
187 | 220 | |
188 | - protected function getBlankImage($width, $height) { |
|
221 | + protected function getBlankImage($width, $height) |
|
222 | + { |
|
189 | 223 | try { |
190 | 224 | $img = new Gmagick(); |
191 | 225 | $img->newImage($width, $height, "none"); |
@@ -195,7 +229,8 @@ discard block |
||
195 | 229 | return $img; |
196 | 230 | } |
197 | 231 | |
198 | - protected function getImage($image, &$width, &$height) { |
|
232 | + protected function getImage($image, &$width, &$height) |
|
233 | + { |
|
199 | 234 | |
200 | 235 | if (is_object($image) && ($image instanceof image_gmagick)) { |
201 | 236 | $width = $image->width; |
@@ -225,18 +260,21 @@ discard block |
||
225 | 260 | $height = $h; |
226 | 261 | return $image; |
227 | 262 | |
228 | - } else |
|
229 | - return false; |
|
263 | + } else { |
|
264 | + return false; |
|
265 | + } |
|
230 | 266 | } |
231 | 267 | |
232 | 268 | |
233 | 269 | // PSEUDO-ABSTRACT STATIC METHODS |
234 | 270 | |
235 | - static function available() { |
|
271 | + static function available() |
|
272 | + { |
|
236 | 273 | return class_exists("Gmagick"); |
237 | 274 | } |
238 | 275 | |
239 | - static function checkImage($file) { |
|
276 | + static function checkImage($file) |
|
277 | + { |
|
240 | 278 | try { |
241 | 279 | new Gmagick($file); |
242 | 280 | } catch (Exception $e) { |
@@ -248,7 +286,8 @@ discard block |
||
248 | 286 | |
249 | 287 | // INHERIT METHODS |
250 | 288 | |
251 | - public function output($type="jpeg", array $options=array()) { |
|
289 | + public function output($type="jpeg", array $options=array()) |
|
290 | + { |
|
252 | 291 | $type = strtolower($type); |
253 | 292 | try { |
254 | 293 | $this->image->setImageFormat($type); |
@@ -256,8 +295,9 @@ discard block |
||
256 | 295 | return false; |
257 | 296 | } |
258 | 297 | $method = "optimize_$type"; |
259 | - if (method_exists($this, $method) && !$this->$method($options)) |
|
260 | - return false; |
|
298 | + if (method_exists($this, $method) && !$this->$method($options)) { |
|
299 | + return false; |
|
300 | + } |
|
261 | 301 | |
262 | 302 | if (!isset($options['file'])) { |
263 | 303 | if (!headers_sent()) { |
@@ -287,7 +327,8 @@ discard block |
||
287 | 327 | |
288 | 328 | // OWN METHODS |
289 | 329 | |
290 | - protected function optimize_jpeg(array $options=array()) { |
|
330 | + protected function optimize_jpeg(array $options=array()) |
|
331 | + { |
|
291 | 332 | $quality = isset($options['quality']) ? $options['quality'] : self::DEFAULT_JPEG_QUALITY; |
292 | 333 | try { |
293 | 334 | $this->image->setCompressionQuality($quality); |
@@ -21,13 +21,17 @@ discard block |
||
21 | 21 | |
22 | 22 | public function __construct($uri = null) |
23 | 23 | { |
24 | - if ($uri) $this->load($uri); |
|
24 | + if ($uri) { |
|
25 | + $this->load($uri); |
|
26 | + } |
|
25 | 27 | } |
26 | 28 | |
27 | 29 | |
28 | 30 | public function load($uri) |
29 | 31 | { |
30 | - if ($this->handle) $this->close(); |
|
32 | + if ($this->handle) { |
|
33 | + $this->close(); |
|
34 | + } |
|
31 | 35 | |
32 | 36 | $this->uri = $uri; |
33 | 37 | $this->handle = fopen($uri, 'r'); |
@@ -36,15 +40,16 @@ discard block |
||
36 | 40 | |
37 | 41 | public function close() |
38 | 42 | { |
39 | - if (is_resource($this->handle)) fclose($this->handle); |
|
43 | + if (is_resource($this->handle)) { |
|
44 | + fclose($this->handle); |
|
45 | + } |
|
40 | 46 | } |
41 | 47 | |
42 | 48 | |
43 | 49 | public function getSize() |
44 | 50 | { |
45 | 51 | $this->strpos = 0; |
46 | - if ($this->getType()) |
|
47 | - { |
|
52 | + if ($this->getType()) { |
|
48 | 53 | return array_values($this->parseSize()); |
49 | 54 | } |
50 | 55 | |
@@ -56,10 +61,8 @@ discard block |
||
56 | 61 | { |
57 | 62 | $this->strpos = 0; |
58 | 63 | |
59 | - if (!$this->type) |
|
60 | - { |
|
61 | - switch ($this->getChars(2)) |
|
62 | - { |
|
64 | + if (!$this->type) { |
|
65 | + switch ($this->getChars(2)) { |
|
63 | 66 | case "BM": |
64 | 67 | return $this->type = 'bmp'; |
65 | 68 | case "GI": |
@@ -81,8 +84,7 @@ discard block |
||
81 | 84 | { |
82 | 85 | $this->strpos = 0; |
83 | 86 | |
84 | - switch ($this->type) |
|
85 | - { |
|
87 | + switch ($this->type) { |
|
86 | 88 | case 'png': |
87 | 89 | return $this->parseSizeForPNG(); |
88 | 90 | case 'gif': |
@@ -127,10 +129,8 @@ discard block |
||
127 | 129 | { |
128 | 130 | $state = null; |
129 | 131 | |
130 | - while (true) |
|
131 | - { |
|
132 | - switch ($state) |
|
133 | - { |
|
132 | + while (true) { |
|
133 | + switch ($state) { |
|
134 | 134 | default: |
135 | 135 | $this->getChars(2); |
136 | 136 | $state = 'started'; |
@@ -138,27 +138,22 @@ discard block |
||
138 | 138 | |
139 | 139 | case 'started': |
140 | 140 | $b = $this->getByte(); |
141 | - if ($b === false) return false; |
|
141 | + if ($b === false) { |
|
142 | + return false; |
|
143 | + } |
|
142 | 144 | |
143 | 145 | $state = $b == 0xFF ? 'sof' : 'started'; |
144 | 146 | break; |
145 | 147 | |
146 | 148 | case 'sof': |
147 | 149 | $b = $this->getByte(); |
148 | - if (in_array($b, range(0xe0, 0xef))) |
|
149 | - { |
|
150 | + if (in_array($b, range(0xe0, 0xef))) { |
|
150 | 151 | $state = 'skipframe'; |
151 | - } |
|
152 | - elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) |
|
153 | - { |
|
152 | + } elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) { |
|
154 | 153 | $state = 'readsize'; |
155 | - } |
|
156 | - elseif ($b == 0xFF) |
|
157 | - { |
|
154 | + } elseif ($b == 0xFF) { |
|
158 | 155 | $state = 'sof'; |
159 | - } |
|
160 | - else |
|
161 | - { |
|
156 | + } else { |
|
162 | 157 | $state = 'skipframe'; |
163 | 158 | } |
164 | 159 | break; |
@@ -187,21 +182,16 @@ discard block |
||
187 | 182 | $response = null; |
188 | 183 | |
189 | 184 | // do we need more data? |
190 | - if ($this->strpos + $n -1 >= strlen($this->str)) |
|
191 | - { |
|
185 | + if ($this->strpos + $n -1 >= strlen($this->str)) { |
|
192 | 186 | $end = ($this->strpos + $n); |
193 | 187 | |
194 | - while (strlen($this->str) < $end && $response !== false) |
|
195 | - { |
|
188 | + while (strlen($this->str) < $end && $response !== false) { |
|
196 | 189 | // read more from the file handle |
197 | 190 | $need = $end - ftell($this->handle); |
198 | 191 | |
199 | - if ($response = fread($this->handle, $need)) |
|
200 | - { |
|
192 | + if ($response = fread($this->handle, $need)) { |
|
201 | 193 | $this->str .= $response; |
202 | - } |
|
203 | - else |
|
204 | - { |
|
194 | + } else { |
|
205 | 195 | return false; |
206 | 196 | } |
207 | 197 | } |
@@ -31,7 +31,8 @@ discard block |
||
31 | 31 | * see: rss_fetch.inc for a simpler interface with integrated caching support |
32 | 32 | * |
33 | 33 | */ |
34 | -class MagpieRSS { |
|
34 | +class MagpieRSS |
|
35 | +{ |
|
35 | 36 | var $parser; |
36 | 37 | |
37 | 38 | var $current_item = array(); // item currently being parsed |
@@ -143,7 +144,8 @@ discard block |
||
143 | 144 | $this->normalize(); |
144 | 145 | } |
145 | 146 | |
146 | - function feed_start_element($p, $element, &$attrs) { |
|
147 | + function feed_start_element($p, $element, &$attrs) |
|
148 | + { |
|
147 | 149 | $el = $element = strtolower($element); |
148 | 150 | $attrs = array_change_key_case($attrs, CASE_LOWER); |
149 | 151 | |
@@ -163,12 +165,10 @@ discard block |
||
163 | 165 | if ( $el == 'rdf' ) { |
164 | 166 | $this->feed_type = RSS; |
165 | 167 | $this->feed_version = '1.0'; |
166 | - } |
|
167 | - elseif ( $el == 'rss' ) { |
|
168 | + } elseif ( $el == 'rss' ) { |
|
168 | 169 | $this->feed_type = RSS; |
169 | 170 | $this->feed_version = $attrs['version']; |
170 | - } |
|
171 | - elseif ( $el == 'feed' ) { |
|
171 | + } elseif ( $el == 'feed' ) { |
|
172 | 172 | $this->feed_type = ATOM; |
173 | 173 | $this->feed_version = $attrs['version']; |
174 | 174 | $this->inchannel = true; |
@@ -176,12 +176,9 @@ discard block |
||
176 | 176 | return; |
177 | 177 | } |
178 | 178 | |
179 | - if ( $el == 'channel' ) |
|
180 | - { |
|
179 | + if ( $el == 'channel' ) { |
|
181 | 180 | $this->inchannel = true; |
182 | - } |
|
183 | - elseif ($el == 'item' or $el == 'entry' ) |
|
184 | - { |
|
181 | + } elseif ($el == 'item' or $el == 'entry' ) { |
|
185 | 182 | $this->initem = true; |
186 | 183 | if ( isset($attrs['rdf:about']) ) { |
187 | 184 | $this->current_item['about'] = $attrs['rdf:about']; |
@@ -193,22 +190,17 @@ discard block |
||
193 | 190 | elseif ( |
194 | 191 | $this->feed_type == RSS and |
195 | 192 | $this->current_namespace == '' and |
196 | - $el == 'textinput' ) |
|
197 | - { |
|
193 | + $el == 'textinput' ) { |
|
198 | 194 | $this->intextinput = true; |
199 | - } |
|
200 | - |
|
201 | - elseif ( |
|
195 | + } elseif ( |
|
202 | 196 | $this->feed_type == RSS and |
203 | 197 | $this->current_namespace == '' and |
204 | - $el == 'image' ) |
|
205 | - { |
|
198 | + $el == 'image' ) { |
|
206 | 199 | $this->inimage = true; |
207 | 200 | } |
208 | 201 | |
209 | 202 | # handle atom content constructs |
210 | - elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) |
|
211 | - { |
|
203 | + elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) { |
|
212 | 204 | // avoid clashing w/ RSS mod_content |
213 | 205 | if ($el == 'content' ) { |
214 | 206 | $el = 'atom_content'; |
@@ -220,8 +212,7 @@ discard block |
||
220 | 212 | } |
221 | 213 | |
222 | 214 | // if inside an Atom content construct (e.g. content or summary) field treat tags as text |
223 | - elseif ($this->feed_type == ATOM and $this->incontent ) |
|
224 | - { |
|
215 | + elseif ($this->feed_type == ATOM and $this->incontent ) { |
|
225 | 216 | // if tags are inlined, then flatten |
226 | 217 | $attrs_str = join(' ', |
227 | 218 | array_map('map_attrs', |
@@ -237,13 +228,10 @@ discard block |
||
237 | 228 | // Magpie treats link elements of type rel='alternate' |
238 | 229 | // as being equivalent to RSS's simple link element. |
239 | 230 | // |
240 | - elseif ($this->feed_type == ATOM and $el == 'link' ) |
|
241 | - { |
|
242 | - if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) |
|
243 | - { |
|
231 | + elseif ($this->feed_type == ATOM and $el == 'link' ) { |
|
232 | + if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) { |
|
244 | 233 | $link_el = 'link'; |
245 | - } |
|
246 | - else { |
|
234 | + } else { |
|
247 | 235 | $link_el = 'link_' . $attrs['rel']; |
248 | 236 | } |
249 | 237 | |
@@ -257,63 +245,51 @@ discard block |
||
257 | 245 | |
258 | 246 | |
259 | 247 | |
260 | - function feed_cdata ($p, $text) { |
|
261 | - if ($this->feed_type == ATOM and $this->incontent) |
|
262 | - { |
|
248 | + function feed_cdata ($p, $text) |
|
249 | + { |
|
250 | + if ($this->feed_type == ATOM and $this->incontent) { |
|
263 | 251 | $this->append_content( $text ); |
264 | - } |
|
265 | - else { |
|
252 | + } else { |
|
266 | 253 | $current_el = join('_', array_reverse($this->stack)); |
267 | 254 | $this->append($current_el, $text); |
268 | 255 | } |
269 | 256 | } |
270 | 257 | |
271 | - function feed_end_element ($p, $el) { |
|
258 | + function feed_end_element ($p, $el) |
|
259 | + { |
|
272 | 260 | $el = strtolower($el); |
273 | 261 | |
274 | - if ( $el == 'item' or $el == 'entry' ) |
|
275 | - { |
|
262 | + if ( $el == 'item' or $el == 'entry' ) { |
|
276 | 263 | $this->items[] = $this->current_item; |
277 | 264 | $this->current_item = array(); |
278 | 265 | $this->initem = false; |
279 | - } |
|
280 | - elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) |
|
281 | - { |
|
266 | + } elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) { |
|
282 | 267 | $this->intextinput = false; |
283 | - } |
|
284 | - elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) |
|
285 | - { |
|
268 | + } elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) { |
|
286 | 269 | $this->inimage = false; |
287 | - } |
|
288 | - elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) |
|
289 | - { |
|
270 | + } elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) { |
|
290 | 271 | $this->incontent = false; |
291 | - } |
|
292 | - elseif ($el == 'channel' or $el == 'feed' ) |
|
293 | - { |
|
272 | + } elseif ($el == 'channel' or $el == 'feed' ) { |
|
294 | 273 | $this->inchannel = false; |
295 | - } |
|
296 | - elseif ($this->feed_type == ATOM and $this->incontent ) { |
|
274 | + } elseif ($this->feed_type == ATOM and $this->incontent ) { |
|
297 | 275 | // balance tags properly |
298 | 276 | // note: i don't think this is actually neccessary |
299 | - if ( $this->stack[0] == $el ) |
|
300 | - { |
|
277 | + if ( $this->stack[0] == $el ) { |
|
301 | 278 | $this->append_content("</$el>"); |
302 | - } |
|
303 | - else { |
|
279 | + } else { |
|
304 | 280 | $this->append_content("<$el />"); |
305 | 281 | } |
306 | 282 | |
307 | 283 | array_shift( $this->stack ); |
308 | - } |
|
309 | - else { |
|
284 | + } else { |
|
310 | 285 | array_shift( $this->stack ); |
311 | 286 | } |
312 | 287 | |
313 | 288 | $this->current_namespace = false; |
314 | 289 | } |
315 | 290 | |
316 | - function concat (&$str1, $str2="") { |
|
291 | + function concat (&$str1, $str2="") |
|
292 | + { |
|
317 | 293 | if (!isset($str1) ) { |
318 | 294 | $str1=""; |
319 | 295 | } |
@@ -322,53 +298,46 @@ discard block |
||
322 | 298 | |
323 | 299 | |
324 | 300 | |
325 | - function append_content($text) { |
|
301 | + function append_content($text) |
|
302 | + { |
|
326 | 303 | if ( $this->initem ) { |
327 | 304 | $this->concat( $this->current_item[ $this->incontent ], $text ); |
328 | - } |
|
329 | - elseif ( $this->inchannel ) { |
|
305 | + } elseif ( $this->inchannel ) { |
|
330 | 306 | $this->concat( $this->channel[ $this->incontent ], $text ); |
331 | 307 | } |
332 | 308 | } |
333 | 309 | |
334 | 310 | // smart append - field and namespace aware |
335 | - function append($el, $text) { |
|
311 | + function append($el, $text) |
|
312 | + { |
|
336 | 313 | if (!$el) { |
337 | 314 | return; |
338 | 315 | } |
339 | - if ( $this->current_namespace ) |
|
340 | - { |
|
316 | + if ( $this->current_namespace ) { |
|
341 | 317 | if ( $this->initem ) { |
342 | 318 | $this->concat( |
343 | 319 | $this->current_item[ $this->current_namespace ][ $el ], $text); |
344 | - } |
|
345 | - elseif ($this->inchannel) { |
|
320 | + } elseif ($this->inchannel) { |
|
346 | 321 | $this->concat( |
347 | 322 | $this->channel[ $this->current_namespace][ $el ], $text ); |
348 | - } |
|
349 | - elseif ($this->intextinput) { |
|
323 | + } elseif ($this->intextinput) { |
|
350 | 324 | $this->concat( |
351 | 325 | $this->textinput[ $this->current_namespace][ $el ], $text ); |
352 | - } |
|
353 | - elseif ($this->inimage) { |
|
326 | + } elseif ($this->inimage) { |
|
354 | 327 | $this->concat( |
355 | 328 | $this->image[ $this->current_namespace ][ $el ], $text ); |
356 | 329 | } |
357 | - } |
|
358 | - else { |
|
330 | + } else { |
|
359 | 331 | if ( $this->initem ) { |
360 | 332 | $this->concat( |
361 | 333 | $this->current_item[ $el ], $text); |
362 | - } |
|
363 | - elseif ($this->intextinput) { |
|
334 | + } elseif ($this->intextinput) { |
|
364 | 335 | $this->concat( |
365 | 336 | $this->textinput[ $el ], $text ); |
366 | - } |
|
367 | - elseif ($this->inimage) { |
|
337 | + } elseif ($this->inimage) { |
|
368 | 338 | $this->concat( |
369 | 339 | $this->image[ $el ], $text ); |
370 | - } |
|
371 | - elseif ($this->inchannel) { |
|
340 | + } elseif ($this->inchannel) { |
|
372 | 341 | $this->concat( |
373 | 342 | $this->channel[ $el ], $text ); |
374 | 343 | } |
@@ -376,16 +345,19 @@ discard block |
||
376 | 345 | } |
377 | 346 | } |
378 | 347 | |
379 | - function normalize () { |
|
348 | + function normalize () |
|
349 | + { |
|
380 | 350 | // if atom populate rss fields |
381 | 351 | if ( $this->is_atom() ) { |
382 | 352 | $this->channel['description'] = $this->channel['tagline']; |
383 | 353 | for ( $i = 0; $i < count($this->items); $i++) { |
384 | 354 | $item = $this->items[$i]; |
385 | - if ( isset($item['summary']) ) |
|
386 | - $item['description'] = $item['summary']; |
|
387 | - if ( isset($item['atom_content'])) |
|
388 | - $item['content']['encoded'] = $item['atom_content']; |
|
355 | + if ( isset($item['summary']) ) { |
|
356 | + $item['description'] = $item['summary']; |
|
357 | + } |
|
358 | + if ( isset($item['atom_content'])) { |
|
359 | + $item['content']['encoded'] = $item['atom_content']; |
|
360 | + } |
|
389 | 361 | |
390 | 362 | $atom_date = (isset($item['issued']) ) ? $item['issued'] : $item['modified']; |
391 | 363 | if ( $atom_date ) { |
@@ -397,23 +369,23 @@ discard block |
||
397 | 369 | |
398 | 370 | $this->items[$i] = $item; |
399 | 371 | } |
400 | - } |
|
401 | - elseif ( $this->is_rss() ) { |
|
372 | + } elseif ( $this->is_rss() ) { |
|
402 | 373 | $this->channel['tagline'] = $this->channel['description']; |
403 | 374 | for ( $i = 0; $i < count($this->items); $i++) { |
404 | 375 | $item = $this->items[$i]; |
405 | - if ( isset($item['description'])) |
|
406 | - $item['summary'] = $item['description']; |
|
407 | - if ( isset($item['content']['encoded'] ) ) |
|
408 | - $item['atom_content'] = $item['content']['encoded']; |
|
376 | + if ( isset($item['description'])) { |
|
377 | + $item['summary'] = $item['description']; |
|
378 | + } |
|
379 | + if ( isset($item['content']['encoded'] ) ) { |
|
380 | + $item['atom_content'] = $item['content']['encoded']; |
|
381 | + } |
|
409 | 382 | |
410 | 383 | if ( $this->is_rss() == '1.0' and isset($item['dc']['date']) ) { |
411 | 384 | $epoch = @parse_w3cdtf($item['dc']['date']); |
412 | 385 | if ($epoch and $epoch > 0) { |
413 | 386 | $item['date_timestamp'] = $epoch; |
414 | 387 | } |
415 | - } |
|
416 | - elseif ( isset($item['pubdate']) ) { |
|
388 | + } elseif ( isset($item['pubdate']) ) { |
|
417 | 389 | $epoch = @strtotime($item['pubdate']); |
418 | 390 | if ($epoch > 0) { |
419 | 391 | $item['date_timestamp'] = $epoch; |
@@ -426,20 +398,20 @@ discard block |
||
426 | 398 | } |
427 | 399 | |
428 | 400 | |
429 | - function is_rss () { |
|
401 | + function is_rss () |
|
402 | + { |
|
430 | 403 | if ( $this->feed_type == RSS ) { |
431 | 404 | return $this->feed_version; |
432 | - } |
|
433 | - else { |
|
405 | + } else { |
|
434 | 406 | return false; |
435 | 407 | } |
436 | 408 | } |
437 | 409 | |
438 | - function is_atom() { |
|
410 | + function is_atom() |
|
411 | + { |
|
439 | 412 | if ( $this->feed_type == ATOM ) { |
440 | 413 | return $this->feed_version; |
441 | - } |
|
442 | - else { |
|
414 | + } else { |
|
443 | 415 | return false; |
444 | 416 | } |
445 | 417 | } |
@@ -448,11 +420,11 @@ discard block |
||
448 | 420 | * return XML parser, and possibly re-encoded source |
449 | 421 | * |
450 | 422 | */ |
451 | - function create_parser($source, $out_enc, $in_enc, $detect) { |
|
423 | + function create_parser($source, $out_enc, $in_enc, $detect) |
|
424 | + { |
|
452 | 425 | if ( substr(phpversion(),0,1) == 5) { |
453 | 426 | $parser = $this->php5_create_parser($in_enc, $detect); |
454 | - } |
|
455 | - else { |
|
427 | + } else { |
|
456 | 428 | list($parser, $source) = $this->php4_create_parser($source, $in_enc, $detect); |
457 | 429 | } |
458 | 430 | if ($out_enc) { |
@@ -472,12 +444,12 @@ discard block |
||
472 | 444 | * All hail libxml2! |
473 | 445 | * |
474 | 446 | */ |
475 | - function php5_create_parser($in_enc, $detect) { |
|
447 | + function php5_create_parser($in_enc, $detect) |
|
448 | + { |
|
476 | 449 | // by default php5 does a fine job of detecting input encodings |
477 | 450 | if(!$detect && $in_enc) { |
478 | 451 | return xml_parser_create($in_enc); |
479 | - } |
|
480 | - else { |
|
452 | + } else { |
|
481 | 453 | return xml_parser_create(''); |
482 | 454 | } |
483 | 455 | } |
@@ -497,7 +469,8 @@ discard block |
||
497 | 469 | * @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss |
498 | 470 | * |
499 | 471 | */ |
500 | - function php4_create_parser($source, $in_enc, $detect) { |
|
472 | + function php4_create_parser($source, $in_enc, $detect) |
|
473 | + { |
|
501 | 474 | if ( !$detect ) { |
502 | 475 | return array(xml_parser_create($in_enc), $source); |
503 | 476 | } |
@@ -506,8 +479,7 @@ discard block |
||
506 | 479 | if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) { |
507 | 480 | $in_enc = strtoupper($m[1]); |
508 | 481 | $this->source_encoding = $in_enc; |
509 | - } |
|
510 | - else { |
|
482 | + } else { |
|
511 | 483 | $in_enc = 'UTF-8'; |
512 | 484 | } |
513 | 485 | } |
@@ -522,7 +494,7 @@ discard block |
||
522 | 494 | // cast the XML to a known encoding |
523 | 495 | // @see http://php.net/iconv |
524 | 496 | |
525 | - if (function_exists('iconv')) { |
|
497 | + if (function_exists('iconv')) { |
|
526 | 498 | $encoded_source = iconv($in_enc,'UTF-8', $source); |
527 | 499 | if ($encoded_source) { |
528 | 500 | return array(xml_parser_create('UTF-8'), $encoded_source); |
@@ -546,25 +518,25 @@ discard block |
||
546 | 518 | return array(xml_parser_create(), $source); |
547 | 519 | } |
548 | 520 | |
549 | - function known_encoding($enc) { |
|
521 | + function known_encoding($enc) |
|
522 | + { |
|
550 | 523 | $enc = strtoupper($enc); |
551 | 524 | if ( in_array($enc, $this->_KNOWN_ENCODINGS) ) { |
552 | 525 | return $enc; |
553 | - } |
|
554 | - else { |
|
526 | + } else { |
|
555 | 527 | return false; |
556 | 528 | } |
557 | 529 | } |
558 | 530 | |
559 | - function error ($errormsg, $lvl=E_USER_WARNING) { |
|
531 | + function error ($errormsg, $lvl=E_USER_WARNING) |
|
532 | + { |
|
560 | 533 | // append PHP's error message if track_errors enabled |
561 | 534 | if ( isset($php_errormsg) ) { |
562 | 535 | $errormsg .= " ($php_errormsg)"; |
563 | 536 | } |
564 | 537 | if ( MAGPIE_DEBUG ) { |
565 | 538 | trigger_error( $errormsg, $lvl); |
566 | - } |
|
567 | - else { |
|
539 | + } else { |
|
568 | 540 | error_log( $errormsg, 0); |
569 | 541 | } |
570 | 542 | |
@@ -579,7 +551,8 @@ discard block |
||
579 | 551 | |
580 | 552 | } // end class RSS |
581 | 553 | |
582 | -function map_attrs($k, $v) { |
|
554 | +function map_attrs($k, $v) |
|
555 | +{ |
|
583 | 556 | return "$k=\"$v\""; |
584 | 557 | } |
585 | 558 | |
@@ -591,9 +564,10 @@ discard block |
||
591 | 564 | define('CASE_LOWER', 0); |
592 | 565 | |
593 | 566 | |
594 | - function array_change_key_case($array, $case=CASE_LOWER) { |
|
567 | + function array_change_key_case($array, $case=CASE_LOWER) |
|
568 | + { |
|
595 | 569 | $output = array(); |
596 | - switch($case){ |
|
570 | + switch($case) { |
|
597 | 571 | case CASE_LOWER: |
598 | 572 | $cmd='strtolower'; |
599 | 573 | break; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('view_eventlog')) { |
|
5 | +if(!$modx->hasPermission('view_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | ?> |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | <?php |
20 | 20 | $rs = $modx->db->select('id, pagetitle, pub_date', $modx->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC'); |
21 | 21 | $limit = $modx->db->getRecordCount($rs); |
22 | - if($limit < 1) { |
|
22 | + if($limit < 1) { |
|
23 | 23 | ?> |
24 | 24 | <p><?= $_lang["no_docs_pending_publishing"] ?></p> |
25 | 25 | <?php |
26 | - } else { |
|
26 | + } else { |
|
27 | 27 | ?> |
28 | 28 | <div class="table-responsive"> |
29 | 29 | <table class="grid sortabletable" id="table-1"> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | </thead> |
37 | 37 | <tbody> |
38 | 38 | <?php |
39 | - while($row = $modx->db->getRow($rs)) { |
|
39 | + while($row = $modx->db->getRow($rs)) { |
|
40 | 40 | ?> |
41 | 41 | <tr> |
42 | 42 | <td class="text-right"><?= $row['id'] ?></td> |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | <?php |
59 | 59 | $rs = $modx->db->select('id, pagetitle, unpub_date', $modx->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC'); |
60 | 60 | $limit = $modx->db->getRecordCount($rs); |
61 | - if($limit < 1) { |
|
61 | + if($limit < 1) { |
|
62 | 62 | ?> |
63 | 63 | <p><?= $_lang["no_docs_pending_unpublishing"] ?></p> |
64 | 64 | <?php |
65 | - } else { |
|
65 | + } else { |
|
66 | 66 | ?> |
67 | 67 | <div class="table-responsive"> |
68 | 68 | <table class="grid sortabletable" id="table-2"> |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | </thead> |
76 | 76 | <tbody> |
77 | 77 | <?php |
78 | - while($row = $modx->db->getRow($rs)) { |
|
78 | + while($row = $modx->db->getRow($rs)) { |
|
79 | 79 | ?> |
80 | 80 | <tr> |
81 | 81 | <td class="text-right"><?= $row['id'] ?></td> |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | <?php |
98 | 98 | $rs = $modx->db->select('id, pagetitle, pub_date, unpub_date', $modx->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC"); |
99 | 99 | $limit = $modx->db->getRecordCount($rs); |
100 | - if($limit < 1) { |
|
100 | + if($limit < 1) { |
|
101 | 101 | ?> |
102 | 102 | <p><?= $_lang["no_docs_pending_pubunpub"] ?></p> |
103 | 103 | <?php |
104 | - } else { |
|
104 | + } else { |
|
105 | 105 | ?> |
106 | 106 | <div class="table-responsive"> |
107 | 107 | <table class="grid sortabletable" id="table-3"> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | </thead> |
116 | 116 | <tbody> |
117 | 117 | <?php |
118 | - while($row = $modx->db->getRow($rs)) { |
|
118 | + while($row = $modx->db->getRow($rs)) { |
|
119 | 119 | ?> |
120 | 120 | <tr> |
121 | 121 | <td class="text-right"><?= $row['id'] ?></td> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) { |
|
5 | +if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | $modx->manager->initPageViewState(); |
11 | 11 | |
12 | 12 | // get and save search string |
13 | -if ($_REQUEST['op'] == 'reset') { |
|
13 | +if ($_REQUEST['op'] == 'reset') { |
|
14 | 14 | $query = ''; |
15 | 15 | $_PAGE['vs']['search'] = ''; |
16 | -} else { |
|
16 | +} else { |
|
17 | 17 | $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
18 | 18 | $sqlQuery = $modx->db->escape($query); |
19 | 19 | $_PAGE['vs']['search'] = $query; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php"; |
29 | 29 | $cm = new ContextMenu("cntxm", 150); |
30 | 30 | $cm->addItem($_lang["run_module"], "js:menuAction(1)", $_style['actions_run'], (!$modx->hasPermission('exec_module') ? 1 : 0)); |
31 | -if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) { |
|
31 | +if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) { |
|
32 | 32 | $cm->addSeparator(); |
33 | 33 | } |
34 | 34 | $cm->addItem($_lang["edit"], "js:menuAction(2)", $_style['actions_edit'], (!$modx->hasPermission('edit_module') ? 1 : 0)); |
@@ -107,21 +107,21 @@ discard block |
||
107 | 107 | <div class="tab-page"> |
108 | 108 | <div class="table-responsive"> |
109 | 109 | <?php |
110 | - if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
110 | + if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
111 | 111 | $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"' . $_lang['yes'] . '","-") as disabled, IF(sm.icon<>"",sm.icon,"' . $_style['icons_modules'] . '") as icon |
112 | 112 | FROM ' . $modx->getFullTableName('site_modules') . ' AS sm |
113 | 113 | LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id |
114 | 114 | LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group |
115 | 115 | WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
116 | 116 | ORDER BY sm.name'); |
117 | - if ($modx->hasPermission('edit_module')) { |
|
117 | + if ($modx->hasPermission('edit_module')) { |
|
118 | 118 | $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
119 | - } else if ($modx->hasPermission('exec_module')) { |
|
119 | + } else if ($modx->hasPermission('exec_module')) { |
|
120 | 120 | $title = "<a href='index.php?a=112&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
121 | - } else { |
|
121 | + } else { |
|
122 | 122 | $title = '[+value+]'; |
123 | 123 | } |
124 | - } else { |
|
124 | + } else { |
|
125 | 125 | $rs = $modx->db->select("id, name, description, IF(locked,'{$_lang['yes']}','-') as locked, IF(disabled,'{$_lang['yes']}','-') as disabled, IF(icon<>'',icon,'{$_style['icons_module']}') as icon", $modx->getFullTableName("site_modules"), (!empty($sqlQuery) ? "(name LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "name"); |
126 | 126 | $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
127 | 127 | } |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | $grd->colWidths = "34,,,60,60"; |
138 | 138 | $grd->colAligns = "center,,,center,center"; |
139 | 139 | $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='[+value+]'></i></a>||template:" . $title; |
140 | - if ($listmode == '1') { |
|
140 | + if ($listmode == '1') { |
|
141 | 141 | $grd->pageSize = 0; |
142 | 142 | } |
143 | - if ($_REQUEST['op'] == 'reset') { |
|
143 | + if ($_REQUEST['op'] == 'reset') { |
|
144 | 144 | $grd->pageNumber = 1; |
145 | 145 | } |
146 | 146 | // render grid |