@@ -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 | } |
@@ -132,7 +136,8 @@ discard block |
||
| 132 | 136 | * @param string $propertyString |
| 133 | 137 | * @return array |
| 134 | 138 | */ |
| 135 | - function parseProperties($propertyString) { |
|
| 139 | + function parseProperties($propertyString) |
|
| 140 | + { |
|
| 136 | 141 | $parameter= array (); |
| 137 | 142 | if (!empty ($propertyString)) { |
| 138 | 143 | $tmpParams= explode("&", $propertyString); |
@@ -141,11 +146,14 @@ discard block |
||
| 141 | 146 | if (strpos($tmpParams[$x], '=', 0)) { |
| 142 | 147 | $pTmp= explode("=", $tmpParams[$x]); |
| 143 | 148 | $pvTmp= explode(";", trim($pTmp[1])); |
| 144 | - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
|
| 145 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
| 149 | + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { |
|
| 150 | + $parameter[trim($pTmp[0])]= $pvTmp[3]; |
|
| 151 | + } |
|
| 152 | + //list default |
|
| 146 | 153 | else |
| 147 | - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
|
| 148 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
| 154 | + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { |
|
| 155 | + $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
| 156 | + } |
|
| 149 | 157 | } |
| 150 | 158 | } |
| 151 | 159 | } |
@@ -216,7 +224,7 @@ discard block |
||
| 216 | 224 | // custom or not |
| 217 | 225 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
| 218 | 226 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
| 219 | -}else{ |
|
| 227 | +} else { |
|
| 220 | 228 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
| 221 | 229 | } |
| 222 | 230 | |
@@ -352,7 +360,9 @@ discard block |
||
| 352 | 360 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 353 | 361 | return; |
| 354 | 362 | } |
| 355 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 363 | + if(!is_null($save_sql_id_as)) { |
|
| 364 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 365 | + } |
|
| 356 | 366 | echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
| 357 | 367 | } |
| 358 | 368 | } |
@@ -446,9 +456,9 @@ discard block |
||
| 446 | 456 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
| 447 | 457 | $filecontent = $moduleChunk[2]; |
| 448 | 458 | |
| 449 | - if (!file_exists($filecontent)) |
|
| 450 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 451 | - else { |
|
| 459 | + if (!file_exists($filecontent)) { |
|
| 460 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 461 | + } else { |
|
| 452 | 462 | |
| 453 | 463 | // Create the category if it does not already exist |
| 454 | 464 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -500,9 +510,9 @@ discard block |
||
| 500 | 510 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
| 501 | 511 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
| 502 | 512 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
| 503 | - if (!file_exists($filecontent)) |
|
| 504 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 505 | - else { |
|
| 513 | + if (!file_exists($filecontent)) { |
|
| 514 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 515 | + } else { |
|
| 506 | 516 | |
| 507 | 517 | // Create the category if it does not already exist |
| 508 | 518 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -552,9 +562,9 @@ discard block |
||
| 552 | 562 | // parse comma-separated legacy names and prepare them for sql IN clause |
| 553 | 563 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
| 554 | 564 | } |
| 555 | - if (!file_exists($filecontent)) |
|
| 556 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 557 | - else { |
|
| 565 | + if (!file_exists($filecontent)) { |
|
| 566 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 567 | + } else { |
|
| 558 | 568 | |
| 559 | 569 | // disable legacy versions based on legacy_names provided |
| 560 | 570 | if(!empty($leg_names)) { |
@@ -573,7 +583,7 @@ discard block |
||
| 573 | 583 | $insert = true; |
| 574 | 584 | while($row = mysqli_fetch_assoc($rs)) { |
| 575 | 585 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 576 | - if($row['description'] == $desc){ |
|
| 586 | + if($row['description'] == $desc) { |
|
| 577 | 587 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
| 578 | 588 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 579 | 589 | return; |
@@ -631,9 +641,9 @@ discard block |
||
| 631 | 641 | $filecontent = $moduleSnippet[2]; |
| 632 | 642 | $properties = $moduleSnippet[3]; |
| 633 | 643 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
| 634 | - if (!file_exists($filecontent)) |
|
| 635 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 636 | - else { |
|
| 644 | + if (!file_exists($filecontent)) { |
|
| 645 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 646 | + } else { |
|
| 637 | 647 | |
| 638 | 648 | // Create the category if it does not already exist |
| 639 | 649 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -741,13 +751,16 @@ discard block |
||
| 741 | 751 | } |
| 742 | 752 | |
| 743 | 753 | // call back function |
| 744 | -if ($callBackFnc != "") |
|
| 754 | +if ($callBackFnc != "") { |
|
| 745 | 755 | $callBackFnc ($sqlParser); |
| 756 | +} |
|
| 746 | 757 | |
| 747 | 758 | // Setup the MODX API -- needed for the cache processor |
| 748 | 759 | define('MODX_API_MODE', true); |
| 749 | 760 | define('MODX_BASE_PATH', $base_path); |
| 750 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
| 761 | +if (!defined('MODX_MANAGER_PATH')) { |
|
| 762 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
| 763 | +} |
|
| 751 | 764 | $database_type = 'mysqli'; |
| 752 | 765 | // initiate a new document parser |
| 753 | 766 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |
@@ -792,11 +805,12 @@ discard block |
||
| 792 | 805 | * @param string $old |
| 793 | 806 | * @return string |
| 794 | 807 | */ |
| 795 | -function propUpdate($new,$old){ |
|
| 808 | +function propUpdate($new,$old) |
|
| 809 | +{ |
|
| 796 | 810 | $newArr = parseProperties($new); |
| 797 | 811 | $oldArr = parseProperties($old); |
| 798 | - foreach ($oldArr as $k => $v){ |
|
| 799 | - if (isset($v['0']['options'])){ |
|
| 812 | + foreach ($oldArr as $k => $v) { |
|
| 813 | + if (isset($v['0']['options'])) { |
|
| 800 | 814 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
| 801 | 815 | } |
| 802 | 816 | } |
@@ -811,12 +825,17 @@ discard block |
||
| 811 | 825 | * @param bool|mixed $json |
| 812 | 826 | * @return string |
| 813 | 827 | */ |
| 814 | -function parseProperties($propertyString, $json=false) { |
|
| 828 | +function parseProperties($propertyString, $json=false) |
|
| 829 | +{ |
|
| 815 | 830 | $propertyString = str_replace('{}', '', $propertyString ); |
| 816 | 831 | $propertyString = str_replace('} {', ',', $propertyString ); |
| 817 | 832 | |
| 818 | - if(empty($propertyString)) return array(); |
|
| 819 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
| 833 | + if(empty($propertyString)) { |
|
| 834 | + return array(); |
|
| 835 | + } |
|
| 836 | + if($propertyString=='{}' || $propertyString=='[]') { |
|
| 837 | + return array(); |
|
| 838 | + } |
|
| 820 | 839 | |
| 821 | 840 | $jsonFormat = isJson($propertyString, true); |
| 822 | 841 | $property = array(); |
@@ -858,7 +877,7 @@ discard block |
||
| 858 | 877 | |
| 859 | 878 | } |
| 860 | 879 | // new json-format |
| 861 | - } else if(!empty($jsonFormat)){ |
|
| 880 | + } else if(!empty($jsonFormat)) { |
|
| 862 | 881 | $property = $jsonFormat; |
| 863 | 882 | } |
| 864 | 883 | if ($json) { |
@@ -873,7 +892,8 @@ discard block |
||
| 873 | 892 | * @param bool $returnData |
| 874 | 893 | * @return bool|mixed |
| 875 | 894 | */ |
| 876 | -function isJson($string, $returnData=false) { |
|
| 895 | +function isJson($string, $returnData=false) |
|
| 896 | +{ |
|
| 877 | 897 | $data = json_decode($string, true); |
| 878 | 898 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
| 879 | 899 | } |
@@ -883,7 +903,8 @@ discard block |
||
| 883 | 903 | * @param SqlParser $sqlParser |
| 884 | 904 | * @return int |
| 885 | 905 | */ |
| 886 | -function getCreateDbCategory($category, $sqlParser) { |
|
| 906 | +function getCreateDbCategory($category, $sqlParser) |
|
| 907 | +{ |
|
| 887 | 908 | $dbase = $sqlParser->dbname; |
| 888 | 909 | $dbase = '`' . trim($dbase,'`') . '`'; |
| 889 | 910 | $table_prefix = $sqlParser->prefix; |
@@ -911,7 +932,8 @@ discard block |
||
| 911 | 932 | * @param string $type |
| 912 | 933 | * @return string |
| 913 | 934 | */ |
| 914 | -function removeDocblock($code, $type) { |
|
| 935 | +function removeDocblock($code, $type) |
|
| 936 | +{ |
|
| 915 | 937 | |
| 916 | 938 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
| 917 | 939 | |
@@ -932,8 +954,9 @@ discard block |
||
| 932 | 954 | default: |
| 933 | 955 | return $cleaned; |
| 934 | 956 | }; |
| 935 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
| 936 | - return $cleaned; |
|
| 957 | + if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') { |
|
| 958 | + return $cleaned; |
|
| 959 | + } |
|
| 937 | 960 | |
| 938 | 961 | // fileBinding not found - return code incl docblock |
| 939 | 962 | return $code; |
@@ -1,5 +1,5 @@ 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 | 5 | header("X-XSS-Protection: 0");
|
@@ -11,22 +11,22 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; |
| 13 | 13 | |
| 14 | -if (!isset($modx->config['manager_menu_height'])) {
|
|
| 14 | +if (!isset($modx->config['manager_menu_height'])) { |
|
| 15 | 15 | $modx->config['manager_menu_height'] = 2.2; // rem |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if (!isset($modx->config['manager_tree_width'])) {
|
|
| 18 | +if (!isset($modx->config['manager_tree_width'])) { |
|
| 19 | 19 | $modx->config['manager_tree_width'] = 20; // rem |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) {
|
|
| 22 | +if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) { |
|
| 23 | 23 | $initMainframeAction = $_SESSION['onLoginForwardToAction']; |
| 24 | 24 | unset($_SESSION['onLoginForwardToAction']); |
| 25 | -} else {
|
|
| 25 | +} else { |
|
| 26 | 26 | $initMainframeAction = 2; // welcome.static |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -if (!isset($_SESSION['tree_show_only_folders'])) {
|
|
| 29 | +if (!isset($_SESSION['tree_show_only_folders'])) { |
|
| 30 | 30 | $_SESSION['tree_show_only_folders'] = 0; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -35,21 +35,21 @@ discard block |
||
| 35 | 35 | $tree_width = $modx->config['manager_tree_width']; |
| 36 | 36 | $tree_min_width = 0; |
| 37 | 37 | |
| 38 | -if (isset($_COOKIE['MODX_widthSideBar'])) {
|
|
| 38 | +if (isset($_COOKIE['MODX_widthSideBar'])) { |
|
| 39 | 39 | $MODX_widthSideBar = $_COOKIE['MODX_widthSideBar']; |
| 40 | -} else {
|
|
| 40 | +} else { |
|
| 41 | 41 | $MODX_widthSideBar = $tree_width; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -if (!$MODX_widthSideBar) {
|
|
| 44 | +if (!$MODX_widthSideBar) { |
|
| 45 | 45 | $body_class .= 'sidebar-closed'; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | -if (isset($_COOKIE['MODX_themeColor'])) {
|
|
| 48 | +if (isset($_COOKIE['MODX_themeColor'])) { |
|
| 49 | 49 | $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -if (isset($modx->pluginCache['ElementsInTree'])) {
|
|
| 52 | +if (isset($modx->pluginCache['ElementsInTree'])) { |
|
| 53 | 53 | $body_class .= ' ElementsInTree'; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | 'type8' => $_lang["lock_element_type_8"] |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | -foreach ($unlockTranslations as $key => $value) {
|
|
| 68 | +foreach ($unlockTranslations as $key => $value) { |
|
| 69 | 69 | $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $user = $modx->getUserInfo($modx->getLoginUserID()); |
| 73 | -if ($user['which_browser'] == 'default') {
|
|
| 73 | +if ($user['which_browser'] == 'default') { |
|
| 74 | 74 | $user['which_browser'] = $modx->config['which_browser']; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
| 78 | 78 | |
| 79 | -if ($modx->config['manager_theme'] == 'default') {
|
|
| 80 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
|
|
| 79 | +if ($modx->config['manager_theme'] == 'default') { |
|
| 80 | + if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
| 81 | 81 | require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
| 82 | 82 | $minifier = new Formatter\CSSMinify(); |
| 83 | 83 | $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $css = $minifier->minify(); |
| 95 | 95 | file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
| 96 | 96 | } |
| 97 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
|
|
| 97 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
| 98 | 98 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | <?php |
| 249 | 249 | // invoke OnManagerTopPrerender event |
| 250 | 250 | $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST);
|
| 251 | - if (is_array($evtOut)) {
|
|
| 251 | + if (is_array($evtOut)) { |
|
| 252 | 252 | echo implode("\n", $evtOut);
|
| 253 | 253 | } |
| 254 | 254 | ?> |
@@ -419,9 +419,12 @@ discard block |
||
| 419 | 419 | <div id="evo-tab-page-home" class="evo-tab-page show"> |
| 420 | 420 | <iframe id="mainframe" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
| 421 | 421 | </div> |
| 422 | - <?php else: ?> |
|
| 422 | + <?php else { |
|
| 423 | + : ?> |
|
| 423 | 424 | <iframe id="mainframe" name="main" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
| 424 | - <?php endif; ?> |
|
| 425 | + <?php endif; |
|
| 426 | +} |
|
| 427 | +?> |
|
| 425 | 428 | <div id="mainloader"></div> |
| 426 | 429 | </div> |
| 427 | 430 | <div id="resizer"></div> |
@@ -434,11 +437,11 @@ discard block |
||
| 434 | 437 | 'tree_sortdir', |
| 435 | 438 | 'tree_nodename' |
| 436 | 439 | ); |
| 437 | - foreach ($sortParams as $param) {
|
|
| 438 | - if (isset($_REQUEST[$param])) {
|
|
| 440 | + foreach ($sortParams as $param) { |
|
| 441 | + if (isset($_REQUEST[$param])) { |
|
| 439 | 442 | $modx->manager->saveLastUserSetting($param, $_REQUEST[$param]); |
| 440 | 443 | $_SESSION[$param] = $_REQUEST[$param]; |
| 441 | - } else if (!isset($_SESSION[$param])) {
|
|
| 444 | + } else if (!isset($_SESSION[$param])) { |
|
| 442 | 445 | $_SESSION[$param] = $modx->manager->getLastUserSetting($param); |
| 443 | 446 | } |
| 444 | 447 | } |
@@ -524,9 +527,9 @@ discard block |
||
| 524 | 527 | * @param string $text |
| 525 | 528 | * @param bool $allowed |
| 526 | 529 | */ |
| 527 | - function constructLink($action, $img, $text, $allowed) |
|
| 528 | - {
|
|
| 529 | - if ((bool)$allowed) {
|
|
| 530 | + function constructLink($action, $img, $text, $allowed) |
|
| 531 | + { |
|
| 532 | + if ((bool)$allowed) { |
|
| 530 | 533 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action);
|
| 531 | 534 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
|
| 532 | 535 | } |
@@ -631,7 +634,7 @@ discard block |
||
| 631 | 634 | ?> |
| 632 | 635 | |
| 633 | 636 | </div> |
| 634 | -<?php if ($modx->config['show_picker'] != "0") {
|
|
| 637 | +<?php if ($modx->config['show_picker'] != "0") { |
|
| 635 | 638 | include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
|
| 636 | 639 | } ?> |
| 637 | 640 | </body> |
@@ -11,7 +11,8 @@ discard block |
||
| 11 | 11 | * @param string $hereid |
| 12 | 12 | * @return string |
| 13 | 13 | */ |
| 14 | -function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') { |
|
| 14 | +function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') |
|
| 15 | +{ |
|
| 15 | 16 | global $modx; |
| 16 | 17 | global $icons, $iconsPrivate, $_style; |
| 17 | 18 | global $_lang, $opened, $opened2, $closed2; //added global vars |
@@ -455,7 +456,8 @@ discard block |
||
| 455 | 456 | * @param array $_style |
| 456 | 457 | * @return array |
| 457 | 458 | */ |
| 458 | -function getIconInfo($_style) { |
|
| 459 | +function getIconInfo($_style) |
|
| 460 | +{ |
|
| 459 | 461 | if(!isset($_style['tree_page_gif'])) { |
| 460 | 462 | $_style['tree_page_gif'] = $_style['tree_page']; |
| 461 | 463 | } |
@@ -486,7 +488,8 @@ discard block |
||
| 486 | 488 | * @param array $_style |
| 487 | 489 | * @return array |
| 488 | 490 | */ |
| 489 | -function getPrivateIconInfo($_style) { |
|
| 491 | +function getPrivateIconInfo($_style) |
|
| 492 | +{ |
|
| 490 | 493 | if(!isset($_style['tree_page_gif_secure'])) { |
| 491 | 494 | $_style['tree_page_gif_secure'] = $_style['tree_page_secure']; |
| 492 | 495 | } |
@@ -518,7 +521,8 @@ discard block |
||
| 518 | 521 | * @param array $row |
| 519 | 522 | * @return string |
| 520 | 523 | */ |
| 521 | -function getNodeTitle($nodeNameSource, $row) { |
|
| 524 | +function getNodeTitle($nodeNameSource, $row) |
|
| 525 | +{ |
|
| 522 | 526 | global $modx; |
| 523 | 527 | |
| 524 | 528 | switch($nodeNameSource) { |
@@ -568,7 +572,8 @@ discard block |
||
| 568 | 572 | * @param string $nodeNameSource |
| 569 | 573 | * @return bool |
| 570 | 574 | */ |
| 571 | -function isDateNode($nodeNameSource) { |
|
| 575 | +function isDateNode($nodeNameSource) |
|
| 576 | +{ |
|
| 572 | 577 | switch($nodeNameSource) { |
| 573 | 578 | case 'createdon': |
| 574 | 579 | case 'editedon': |
@@ -586,7 +591,8 @@ discard block |
||
| 586 | 591 | * @param int $isfolder |
| 587 | 592 | * @return int |
| 588 | 593 | */ |
| 589 | -function checkIsFolder($parent = 0, $isfolder = 1) { |
|
| 594 | +function checkIsFolder($parent = 0, $isfolder = 1) |
|
| 595 | +{ |
|
| 590 | 596 | global $modx; |
| 591 | 597 | |
| 592 | 598 | return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
@@ -596,7 +602,8 @@ discard block |
||
| 596 | 602 | * @param mixed $array |
| 597 | 603 | * @return string |
| 598 | 604 | */ |
| 599 | -function _htmlentities($array) { |
|
| 605 | +function _htmlentities($array) |
|
| 606 | +{ |
|
| 600 | 607 | global $modx; |
| 601 | 608 | |
| 602 | 609 | $array = json_encode($array, JSON_UNESCAPED_UNICODE); |
@@ -608,7 +615,8 @@ discard block |
||
| 608 | 615 | /** |
| 609 | 616 | * @return string |
| 610 | 617 | */ |
| 611 | -function getTplSingleNode() { |
|
| 618 | +function getTplSingleNode() |
|
| 619 | +{ |
|
| 612 | 620 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
| 613 | 621 | onclick="modx.tree.treeAction(event,[+id+]);" |
| 614 | 622 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -635,7 +643,8 @@ discard block |
||
| 635 | 643 | /** |
| 636 | 644 | * @return string |
| 637 | 645 | */ |
| 638 | -function getTplFolderNode() { |
|
| 646 | +function getTplFolderNode() |
|
| 647 | +{ |
|
| 639 | 648 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
| 640 | 649 | onclick="modx.tree.treeAction(event,[+id+]);" |
| 641 | 650 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -674,7 +683,8 @@ discard block |
||
| 674 | 683 | /** |
| 675 | 684 | * @return string |
| 676 | 685 | */ |
| 677 | -function getTplFolderNodeNotChildren() { |
|
| 686 | +function getTplFolderNodeNotChildren() |
|
| 687 | +{ |
|
| 678 | 688 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
| 679 | 689 | onclick="modx.tree.treeAction(event,[+id+]);" |
| 680 | 690 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -710,7 +720,8 @@ discard block |
||
| 710 | 720 | * @param int|string|array $str |
| 711 | 721 | * @param bool $flag |
| 712 | 722 | */ |
| 713 | -function dbug($str, $flag = false) { |
|
| 723 | +function dbug($str, $flag = false) |
|
| 724 | +{ |
|
| 714 | 725 | print('<pre>'); |
| 715 | 726 | print_r($str); |
| 716 | 727 | print('</pre>'); |
@@ -1,5 +1,5 @@ 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 | 5 | |
@@ -16,7 +16,8 @@ discard block |
||
| 16 | 16 | * @param array $ph |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | -function parsePh($tpl, $ph) {
|
|
| 19 | +function parsePh($tpl, $ph) |
|
| 20 | +{ |
|
| 20 | 21 | global $modx, $_lang; |
| 21 | 22 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
| 22 | 23 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +27,8 @@ discard block |
||
| 26 | 27 | * @param string|int $cssId |
| 27 | 28 | * @return string |
| 28 | 29 | */ |
| 29 | -function renderViewSwitchButtons($cssId) {
|
|
| 30 | +function renderViewSwitchButtons($cssId) |
|
| 31 | +{ |
|
| 30 | 32 | global $modx, $_lang, $tpl; |
| 31 | 33 | |
| 32 | 34 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +41,20 @@ discard block |
||
| 39 | 41 | * @param mgrResources $resources |
| 40 | 42 | * @return string |
| 41 | 43 | */ |
| 42 | -function createResourceList($resourceTable, $resources) {
|
|
| 44 | +function createResourceList($resourceTable, $resources) |
|
| 45 | +{ |
|
| 43 | 46 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
| 44 | 47 | |
| 45 | 48 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
| 46 | 49 | |
| 47 | - if( ! is_array($items) || empty($items)) {
|
|
| 50 | + if( ! is_array($items) || empty($items)) { |
|
| 48 | 51 | return $_lang['no_results']; |
| 49 | 52 | } |
| 50 | 53 | |
| 51 | 54 | // Prepare elements- and categories-list |
| 52 | 55 | $elements = array(); |
| 53 | 56 | $categories = array(); |
| 54 | - foreach($items as $row) {
|
|
| 57 | + foreach($items as $row) { |
|
| 55 | 58 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 56 | 59 | $categories[$catid] = array('name' => stripslashes($row['category']));
|
| 57 | 60 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,7 +62,7 @@ discard block |
||
| 59 | 62 | |
| 60 | 63 | // Now render categories / panel-collapse |
| 61 | 64 | $panelGroup = ''; |
| 62 | - foreach($elements as $catid => $elList) {
|
|
| 65 | + foreach($elements as $catid => $elList) { |
|
| 63 | 66 | // Add panel-heading / category-collapse to output |
| 64 | 67 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 65 | 68 | 'tab' => $resourceTable, |
@@ -70,7 +73,7 @@ discard block |
||
| 70 | 73 | |
| 71 | 74 | // Prepare content for panel-collapse |
| 72 | 75 | $panelCollapse = ''; |
| 73 | - foreach($elList as $el) {
|
|
| 76 | + foreach($elList as $el) { |
|
| 74 | 77 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
| 75 | 78 | } |
| 76 | 79 | |
@@ -92,14 +95,15 @@ discard block |
||
| 92 | 95 | * @param mgrResources $resources |
| 93 | 96 | * @return string |
| 94 | 97 | */ |
| 95 | -function createCombinedView($resources) {
|
|
| 98 | +function createCombinedView($resources) |
|
| 99 | +{ |
|
| 96 | 100 | global $modx, $_lang, $_style, $modx_textdir; |
| 97 | 101 | |
| 98 | 102 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
| 99 | 103 | $types = isset($resources->types) ? $resources->types : false; |
| 100 | 104 | $categories = isset($resources->categories) ? $resources->categories : false; |
| 101 | 105 | |
| 102 | - if(!$itemsPerCategory) {
|
|
| 106 | + if(!$itemsPerCategory) { |
|
| 103 | 107 | return $_lang['no_results']; |
| 104 | 108 | } |
| 105 | 109 | |
@@ -112,10 +116,10 @@ discard block |
||
| 112 | 116 | |
| 113 | 117 | // Easily loop through $itemsPerCategory-Array |
| 114 | 118 | $panelGroup = ''; |
| 115 | - foreach($categories as $catid => $category) {
|
|
| 119 | + foreach($categories as $catid => $category) { |
|
| 116 | 120 | // Prepare collapse content / elements-list |
| 117 | 121 | $panelCollapse = ''; |
| 118 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 122 | + foreach($itemsPerCategory[$catid] as $el) { |
|
| 119 | 123 | $resourceTable = $el['type']; |
| 120 | 124 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
| 121 | 125 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -149,14 +153,15 @@ discard block |
||
| 149 | 153 | * @param mgrResources $resources |
| 150 | 154 | * @return array |
| 151 | 155 | */ |
| 152 | -function prepareElementRowPh($row, $resourceTable, $resources) {
|
|
| 156 | +function prepareElementRowPh($row, $resourceTable, $resources) |
|
| 157 | +{ |
|
| 153 | 158 | global $modx, $modx_textdir, $_style, $_lang; |
| 154 | 159 | |
| 155 | 160 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
| 156 | 161 | |
| 157 | 162 | $_lang["confirm_delete"] = $_lang["delete"]; |
| 158 | 163 | |
| 159 | - switch($resourceTable){
|
|
| 164 | + switch($resourceTable) { |
|
| 160 | 165 | case 'site_templates': |
| 161 | 166 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 162 | 167 | $lockElementType = 1; |
@@ -193,56 +198,56 @@ discard block |
||
| 193 | 198 | // Prepare displaying user-locks |
| 194 | 199 | $lockedByUser = ''; |
| 195 | 200 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
| 196 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 197 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 201 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
| 202 | + if($rowLock['sid'] == $modx->sid) { |
|
| 198 | 203 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
| 199 | 204 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
| 200 | 205 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 201 | 206 | )); |
| 202 | 207 | $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
| 203 | - } else {
|
|
| 208 | + } else { |
|
| 204 | 209 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
| 205 | 210 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
| 206 | 211 | 'username' => $rowLock['username'], |
| 207 | 212 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 208 | 213 | )); |
| 209 | - if($modx->hasPermission('remove_locks')) {
|
|
| 214 | + if($modx->hasPermission('remove_locks')) { |
|
| 210 | 215 | $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
| 211 | - } else {
|
|
| 216 | + } else { |
|
| 212 | 217 | $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
| 213 | 218 | } |
| 214 | 219 | } |
| 215 | 220 | } |
| 216 | - if($lockedByUser) {
|
|
| 221 | + if($lockedByUser) { |
|
| 217 | 222 | $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
| 218 | 223 | } |
| 219 | 224 | |
| 220 | 225 | // Caption |
| 221 | - if($resourceTable == 'site_tmplvars') {
|
|
| 226 | + if($resourceTable == 'site_tmplvars') { |
|
| 222 | 227 | $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
| 223 | - } else {
|
|
| 228 | + } else { |
|
| 224 | 229 | $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
| 225 | 230 | } |
| 226 | 231 | |
| 227 | 232 | // Special marks |
| 228 | 233 | $tplInfo = array(); |
| 229 | - if($row['locked']) {
|
|
| 234 | + if($row['locked']) { |
|
| 230 | 235 | $tplInfo[] = $_lang['locked']; |
| 231 | 236 | } |
| 232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 237 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
| 233 | 238 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 234 | 239 | } |
| 235 | 240 | $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
|
| 236 | 241 | |
| 237 | 242 | /* row buttons */ |
| 238 | 243 | $buttons = ''; |
| 239 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 244 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
| 240 | 245 | $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
| 241 | 246 | } |
| 242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 247 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
| 243 | 248 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
| 244 | 249 | } |
| 245 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 250 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
| 246 | 251 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
| 247 | 252 | } |
| 248 | 253 | $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
@@ -3,7 +3,8 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -class mgrResources { |
|
| 6 | +class mgrResources |
|
| 7 | +{ |
|
| 7 | 8 | /** |
| 8 | 9 | * @var array |
| 9 | 10 | */ |
@@ -24,7 +25,8 @@ discard block |
||
| 24 | 25 | /** |
| 25 | 26 | * mgrResources constructor. |
| 26 | 27 | */ |
| 27 | - public function __construct() { |
|
| 28 | + public function __construct() |
|
| 29 | + { |
|
| 28 | 30 | $this->setTypes(); |
| 29 | 31 | $this->queryItemsFromDB(); |
| 30 | 32 | $this->prepareCategoryArrays(); |
@@ -33,7 +35,8 @@ discard block |
||
| 33 | 35 | /** |
| 34 | 36 | * @return void |
| 35 | 37 | */ |
| 36 | - public function setTypes() { |
|
| 38 | + public function setTypes() |
|
| 39 | + { |
|
| 37 | 40 | global $_lang; |
| 38 | 41 | $this->types['site_templates'] = array( |
| 39 | 42 | 'title'=>$_lang["manage_templates"], |
@@ -71,7 +74,8 @@ discard block |
||
| 71 | 74 | /** |
| 72 | 75 | * @return void |
| 73 | 76 | */ |
| 74 | - public function queryItemsFromDB() { |
|
| 77 | + public function queryItemsFromDB() |
|
| 78 | + { |
|
| 75 | 79 | foreach($this->types as $resourceTable=>$type) { |
| 76 | 80 | if($this->hasAnyPermissions($type['permissions'])) { |
| 77 | 81 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -84,11 +88,13 @@ discard block |
||
| 84 | 88 | * @param array $permissions |
| 85 | 89 | * @return bool |
| 86 | 90 | */ |
| 87 | - public function hasAnyPermissions($permissions) { |
|
| 91 | + public function hasAnyPermissions($permissions) |
|
| 92 | + { |
|
| 88 | 93 | global $modx; |
| 89 | 94 | |
| 90 | - foreach($permissions as $p) |
|
| 91 | - if($modx->hasPermission($p)) return true; |
|
| 95 | + foreach($permissions as $p) { |
|
| 96 | + if($modx->hasPermission($p)) return true; |
|
| 97 | + } |
|
| 92 | 98 | |
| 93 | 99 | return false; |
| 94 | 100 | } |
@@ -98,7 +104,8 @@ discard block |
||
| 98 | 104 | * @param string $nameField |
| 99 | 105 | * @return array|bool |
| 100 | 106 | */ |
| 101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
| 107 | + public function queryResources($resourceTable, $nameField = 'name') |
|
| 108 | + { |
|
| 102 | 109 | global $modx, $_lang; |
| 103 | 110 | |
| 104 | 111 | $allowed = array( |
@@ -115,8 +122,9 @@ discard block |
||
| 115 | 122 | $tvsql = 'site_tmplvars.caption, '; |
| 116 | 123 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
| 117 | 124 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
| 125 | + } else { |
|
| 126 | + $sttfield = ''; |
|
| 118 | 127 | } |
| 119 | - else $sttfield = ''; |
|
| 120 | 128 | |
| 121 | 129 | $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
| 122 | 130 | |
@@ -129,7 +137,9 @@ discard block |
||
| 129 | 137 | ); |
| 130 | 138 | $limit = $modx->db->getRecordCount($rs); |
| 131 | 139 | |
| 132 | - if($limit < 1) return false; |
|
| 140 | + if($limit < 1) { |
|
| 141 | + return false; |
|
| 142 | + } |
|
| 133 | 143 | |
| 134 | 144 | $result = array(); |
| 135 | 145 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,7 +151,8 @@ discard block |
||
| 141 | 151 | /** |
| 142 | 152 | * @return void |
| 143 | 153 | */ |
| 144 | - public function prepareCategoryArrays() { |
|
| 154 | + public function prepareCategoryArrays() |
|
| 155 | + { |
|
| 145 | 156 | foreach($this->items as $type=>$items) { |
| 146 | 157 | foreach((array)$items as $item) { |
| 147 | 158 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -157,7 +168,7 @@ discard block |
||
| 157 | 168 | |
| 158 | 169 | // Now sort by name |
| 159 | 170 | foreach($this->itemsPerCategory as $catid=>$items) { |
| 160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 171 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
| 161 | 172 | return strcasecmp($a['name'], $b['name']); |
| 162 | 173 | }); |
| 163 | 174 | } |
@@ -893,7 +893,9 @@ |
||
| 893 | 893 | global $modx, $_lang, $startpath, $filemanager_path, $uploadablefiles, $new_file_permissions; |
| 894 | 894 | $msg = ''; |
| 895 | 895 | foreach ($_FILES['userfile']['name'] as $i => $name) { |
| 896 | - if (empty($_FILES['userfile']['tmp_name'][$i])) continue; |
|
| 896 | + if (empty($_FILES['userfile']['tmp_name'][$i])) { |
|
| 897 | + continue; |
|
| 898 | + } |
|
| 897 | 899 | $userfile= array(); |
| 898 | 900 | |
| 899 | 901 | $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i]; |
@@ -5,13 +5,13 @@ discard block |
||
| 5 | 5 | * @param string $filename |
| 6 | 6 | * @return array of keys from a language file |
| 7 | 7 | */ |
| 8 | -function get_lang_keys($filename) |
|
| 9 | -{
|
|
| 8 | +function get_lang_keys($filename) |
|
| 9 | +{ |
|
| 10 | 10 | $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
| 11 | - if (is_file($file) && is_readable($file)) {
|
|
| 11 | + if (is_file($file) && is_readable($file)) { |
|
| 12 | 12 | include($file); |
| 13 | 13 | $out = isset($_lang) ? array_keys($_lang) : array(); |
| 14 | - } else {
|
|
| 14 | + } else { |
|
| 15 | 15 | $out = array(); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | * @param string $key |
| 25 | 25 | * @return array of languages that define the key in their file |
| 26 | 26 | */ |
| 27 | -function get_langs_by_key($key) |
|
| 28 | -{
|
|
| 27 | +function get_langs_by_key($key) |
|
| 28 | +{ |
|
| 29 | 29 | global $lang_keys; |
| 30 | 30 | $lang_return = array(); |
| 31 | - foreach ($lang_keys as $lang => $keys) {
|
|
| 32 | - if (in_array($key, $keys)) {
|
|
| 31 | + foreach ($lang_keys as $lang => $keys) { |
|
| 32 | + if (in_array($key, $keys)) { |
|
| 33 | 33 | $lang_return[] = $lang; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -46,25 +46,25 @@ discard block |
||
| 46 | 46 | * @param string $selected_lang specify language to select in option list, default none |
| 47 | 47 | * @return string html option list |
| 48 | 48 | */ |
| 49 | -function get_lang_options($key = '', $selected_lang = '') |
|
| 50 | -{
|
|
| 49 | +function get_lang_options($key = '', $selected_lang = '') |
|
| 50 | +{ |
|
| 51 | 51 | global $lang_keys, $_lang; |
| 52 | 52 | $lang_options = ''; |
| 53 | - if (!empty($key)) {
|
|
| 53 | + if (!empty($key)) { |
|
| 54 | 54 | $languages = get_langs_by_key($key); |
| 55 | 55 | sort($languages); |
| 56 | 56 | $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>'; |
| 57 | 57 | |
| 58 | - foreach ($languages as $language_name) {
|
|
| 58 | + foreach ($languages as $language_name) { |
|
| 59 | 59 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
|
| 60 | 60 | $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>'; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return $lang_options; |
| 64 | - } else {
|
|
| 64 | + } else { |
|
| 65 | 65 | $languages = array_keys($lang_keys); |
| 66 | 66 | sort($languages); |
| 67 | - foreach ($languages as $language_name) {
|
|
| 67 | + foreach ($languages as $language_name) { |
|
| 68 | 68 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
|
| 69 | 69 | $sel = $language_name === $selected_lang ? ' selected="selected"' : ''; |
| 70 | 70 | $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>'; |
@@ -81,17 +81,17 @@ discard block |
||
| 81 | 81 | * @param bool $disabled |
| 82 | 82 | * @return string |
| 83 | 83 | */ |
| 84 | -function form_radio($name, $value, $add = '', $disabled = false) |
|
| 85 | -{
|
|
| 84 | +function form_radio($name, $value, $add = '', $disabled = false) |
|
| 85 | +{ |
|
| 86 | 86 | global ${$name};
|
| 87 | 87 | $var = ${$name};
|
| 88 | 88 | $checked = ($var == $value) ? ' checked="checked"' : ''; |
| 89 | - if ($disabled) {
|
|
| 89 | + if ($disabled) { |
|
| 90 | 90 | $disabled = ' disabled'; |
| 91 | - } else {
|
|
| 91 | + } else { |
|
| 92 | 92 | $disabled = ''; |
| 93 | 93 | } |
| 94 | - if ($add) {
|
|
| 94 | + if ($add) { |
|
| 95 | 95 | $add = ' ' . $add; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | * @param string $object |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | -function wrap_label($str = '', $object) |
|
| 108 | -{
|
|
| 107 | +function wrap_label($str = '', $object) |
|
| 108 | +{ |
|
| 109 | 109 | return "<label>{$object}\n{$str}</label>";
|
| 110 | 110 | } |
| 111 | 111 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param array $ph |
| 115 | 115 | * @return string |
| 116 | 116 | */ |
| 117 | -function parseText($tpl = '', $ph = array()) |
|
| 118 | -{
|
|
| 119 | - if (empty($ph) || empty($tpl)) {
|
|
| 117 | +function parseText($tpl = '', $ph = array()) |
|
| 118 | +{ |
|
| 119 | + if (empty($ph) || empty($tpl)) { |
|
| 120 | 120 | return $tpl; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - foreach ($ph as $k => $v) {
|
|
| 123 | + foreach ($ph as $k => $v) { |
|
| 124 | 124 | $k = "[+{$k}+]";
|
| 125 | 125 | $tpl = str_replace($k, $v, $tpl); |
| 126 | 126 | } |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | * @param bool $cond |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | -function showHide($cond = true) |
|
| 136 | -{
|
|
| 135 | +function showHide($cond = true) |
|
| 136 | +{ |
|
| 137 | 137 | global $displayStyle; |
| 138 | 138 | $showHide = $cond ? $displayStyle : 'none'; |
| 139 | 139 | |
@@ -478,7 +478,8 @@ discard block |
||
| 478 | 478 | return s; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 481 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
| 482 | +// Web Link specific ?> |
|
| 482 | 483 | var lastImageCtrl; |
| 483 | 484 | var lastFileCtrl; |
| 484 | 485 | |
@@ -694,7 +695,8 @@ discard block |
||
| 694 | 695 | </td> |
| 695 | 696 | </tr> |
| 696 | 697 | |
| 697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 698 | + <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
| 699 | +// Web Link specific ?> |
|
| 698 | 700 | |
| 699 | 701 | <tr> |
| 700 | 702 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1353,7 +1355,9 @@ discard block |
||
| 1353 | 1355 | if($documentId > 0) { |
| 1354 | 1356 | // Load up, the permissions from the parent (if new document) or existing document |
| 1355 | 1357 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
| 1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1358 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
| 1359 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1360 | + } |
|
| 1357 | 1361 | |
| 1358 | 1362 | // Load up the current permissions and names |
| 1359 | 1363 | $vs = array( |
@@ -1415,7 +1419,9 @@ discard block |
||
| 1415 | 1419 | |
| 1416 | 1420 | // Create attribute string list |
| 1417 | 1421 | $inputString = array(); |
| 1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1422 | + foreach($inputAttributes as $k => $v) { |
|
| 1423 | + $inputString[] = $k . '="' . $v . '"'; |
|
| 1424 | + } |
|
| 1419 | 1425 | |
| 1420 | 1426 | // Make the <input> HTML |
| 1421 | 1427 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
| 1535 | 1541 | /** |
| 1536 | 1542 | * @return string |
| 1537 | 1543 | */ |
| 1538 | -function getDefaultTemplate() { |
|
| 1544 | +function getDefaultTemplate() |
|
| 1545 | +{ |
|
| 1539 | 1546 | global $modx; |
| 1540 | 1547 | |
| 1541 | 1548 | $default_template = ''; |
@@ -1,15 +1,15 @@ 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 | -switch($modx->manager->action) {
|
|
| 5 | +switch($modx->manager->action) { |
|
| 6 | 6 | case 107: |
| 7 | - if(!$modx->hasPermission('new_module')) {
|
|
| 7 | + if(!$modx->hasPermission('new_module')) { |
|
| 8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 9 | 9 | } |
| 10 | 10 | break; |
| 11 | 11 | case 108: |
| 12 | - if(!$modx->hasPermission('edit_module')) {
|
|
| 12 | + if(!$modx->hasPermission('edit_module')) { |
|
| 13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 14 | 14 | } |
| 15 | 15 | break; |
@@ -33,7 +33,8 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @return string |
| 35 | 35 | */ |
| 36 | -function createGUID() {
|
|
| 36 | +function createGUID() |
|
| 37 | +{ |
|
| 37 | 38 | srand((double) microtime() * 1000000); |
| 38 | 39 | $r = rand(); |
| 39 | 40 | $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
@@ -42,7 +43,7 @@ discard block |
||
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | // check to see the module editor isn't locked |
| 45 | -if($lockedEl = $modx->elementIsLocked(6, $id)) {
|
|
| 46 | +if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
| 46 | 47 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
| 47 | 48 | } |
| 48 | 49 | // end check for lock |
@@ -50,22 +51,22 @@ discard block |
||
| 50 | 51 | // Lock snippet for other users to edit |
| 51 | 52 | $modx->lockElement(6, $id); |
| 52 | 53 | |
| 53 | -if(isset($_GET['id'])) {
|
|
| 54 | +if(isset($_GET['id'])) { |
|
| 54 | 55 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
|
| 55 | 56 | $content = $modx->db->getRow($rs); |
| 56 | - if(!$content) {
|
|
| 57 | + if(!$content) { |
|
| 57 | 58 | $modx->webAlertAndQuit("Module not found for id '{$id}'.");
|
| 58 | 59 | } |
| 59 | 60 | $content['properties'] = str_replace("&", "&", $content['properties']);
|
| 60 | 61 | $_SESSION['itemname'] = $content['name']; |
| 61 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
|
|
| 62 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 62 | 63 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 63 | 64 | } |
| 64 | -} else {
|
|
| 65 | +} else { |
|
| 65 | 66 | $_SESSION['itemname'] = $_lang["new_module"]; |
| 66 | 67 | $content['wrap'] = '1'; |
| 67 | 68 | } |
| 68 | -if($modx->manager->hasFormValues()) {
|
|
| 69 | +if($modx->manager->hasFormValues()) { |
|
| 69 | 70 | $modx->manager->loadFormValues(); |
| 70 | 71 | } |
| 71 | 72 | |
@@ -439,7 +440,7 @@ discard block |
||
| 439 | 440 | <?php |
| 440 | 441 | // invoke OnModFormPrerender event |
| 441 | 442 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
|
| 442 | - if(is_array($evtOut)) {
|
|
| 443 | + if(is_array($evtOut)) { |
|
| 443 | 444 | echo implode('', $evtOut);
|
| 444 | 445 | } |
| 445 | 446 | |
@@ -502,7 +503,7 @@ discard block |
||
| 502 | 503 | <option> </option> |
| 503 | 504 | <?php |
| 504 | 505 | include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
| 505 | - foreach(getCategories() as $n => $v) {
|
|
| 506 | + foreach(getCategories() as $n => $v) { |
|
| 506 | 507 | echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
| 507 | 508 | } |
| 508 | 509 | ?> |
@@ -654,7 +655,7 @@ discard block |
||
| 654 | 655 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
|
| 655 | 656 | $groupsarray = $modx->db->getColumn('usergroup', $rs);
|
| 656 | 657 | |
| 657 | - if($modx->hasPermission('access_permissions')) {
|
|
| 658 | + if($modx->hasPermission('access_permissions')) { |
|
| 658 | 659 | ?> |
| 659 | 660 | <!-- User Group Access Permissions --> |
| 660 | 661 | <script type="text/javascript"> |
@@ -682,21 +683,21 @@ discard block |
||
| 682 | 683 | } |
| 683 | 684 | $chk = ''; |
| 684 | 685 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
|
| 685 | - while($row = $modx->db->getRow($rs)) {
|
|
| 686 | + while($row = $modx->db->getRow($rs)) { |
|
| 686 | 687 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
| 687 | 688 | $checked = in_array($row['id'], $groupsarray); |
| 688 | - if($modx->hasPermission('access_permissions')) {
|
|
| 689 | - if($checked) {
|
|
| 689 | + if($modx->hasPermission('access_permissions')) { |
|
| 690 | + if($checked) { |
|
| 690 | 691 | $notPublic = true; |
| 691 | 692 | } |
| 692 | 693 | $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
| 693 | - } else {
|
|
| 694 | - if($checked) {
|
|
| 694 | + } else { |
|
| 695 | + if($checked) { |
|
| 695 | 696 | $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
| 696 | 697 | } |
| 697 | 698 | } |
| 698 | 699 | } |
| 699 | - if($modx->hasPermission('access_permissions')) {
|
|
| 700 | + if($modx->hasPermission('access_permissions')) { |
|
| 700 | 701 | $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
| 701 | 702 | } |
| 702 | 703 | echo $chks; |
@@ -718,7 +719,7 @@ discard block |
||
| 718 | 719 | <?php |
| 719 | 720 | // invoke OnModFormRender event |
| 720 | 721 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
|
| 721 | - if(is_array($evtOut)) {
|
|
| 722 | + if(is_array($evtOut)) { |
|
| 722 | 723 | echo implode('', $evtOut);
|
| 723 | 724 | } |
| 724 | 725 | ?> |