@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
| 22 | 22 | include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
| 23 | 23 | if (isset($installStartTime)) { |
| 24 | - if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
| 24 | + if ((time() - $installStartTime) > 5 * 60) { |
|
| 25 | +// if install flag older than 5 minutes, discard |
|
| 25 | 26 | unset($installStartTime); |
| 26 | 27 | @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
| 27 | 28 | unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
@@ -163,7 +164,8 @@ discard block |
||
| 163 | 164 | } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
| 164 | 165 | $target = $theme_path . 'templates/actions/login.tpl'; |
| 165 | 166 | $login_tpl = file_get_contents($target); |
| 166 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
| 167 | + } elseif (is_file($theme_path . 'html/login.html')) { |
|
| 168 | +// ClipperCMS compatible |
|
| 167 | 169 | $target = $theme_path . 'html/login.html'; |
| 168 | 170 | $login_tpl = file_get_contents($target); |
| 169 | 171 | } else { |
@@ -102,16 +102,16 @@ |
||
| 102 | 102 | $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']); |
| 103 | 103 | |
| 104 | 104 | switch ($modx->config['manager_theme_mode']) { |
| 105 | - case '1': |
|
| 105 | + case '1': |
|
| 106 | 106 | $modx->setPlaceholder('manager_theme_style', 'lightness'); |
| 107 | 107 | break; |
| 108 | - case '2': |
|
| 108 | + case '2': |
|
| 109 | 109 | $modx->setPlaceholder('manager_theme_style', 'light'); |
| 110 | 110 | break; |
| 111 | - case '3': |
|
| 111 | + case '3': |
|
| 112 | 112 | $modx->setPlaceholder('manager_theme_style', 'dark'); |
| 113 | 113 | break; |
| 114 | - case '4': |
|
| 114 | + case '4': |
|
| 115 | 115 | $modx->setPlaceholder('manager_theme_style', 'darkness'); |
| 116 | 116 | break; |
| 117 | 117 | } |
@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // andrazk 20070416 - if installer is running, destroy active sessions |
| 21 | -if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
|
| 22 | - include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
| 21 | +if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) { |
|
| 22 | + include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
| 23 | 23 | if (isset($installStartTime)) { |
| 24 | 24 | if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
| 25 | 25 | unset($installStartTime); |
| 26 | - @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
|
| 27 | - unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
| 26 | + @ chmod(MODX_BASE_PATH.'assets/cache/installProc.inc.php', 0755); |
|
| 27 | + unlink(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
| 28 | 28 | } else { |
| 29 | 29 | if ($_SERVER['REQUEST_METHOD'] != 'POST') { |
| 30 | 30 | if (isset($_COOKIE[session_name()])) { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | // setcookie(session_name(), '', 0, MODX_BASE_URL); |
| 51 | 51 | } |
| 52 | 52 | header('HTTP/1.0 307 Redirect'); |
| 53 | - header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2'); |
|
| 53 | + header('Location: '.MODX_MANAGER_URL.'index.php?installGoingOn=2'); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | // establish fallback to English default |
| 63 | 63 | include_once "lang/english.inc.php"; |
| 64 | 64 | // include localized overrides |
| 65 | - include_once "lang/" . $manager_language . ".inc.php"; |
|
| 65 | + include_once "lang/".$manager_language.".inc.php"; |
|
| 66 | 66 | } else { |
| 67 | 67 | include_once "lang/english.inc.php"; |
| 68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
| 71 | 71 | $modx->setPlaceholder('theme', $manager_theme); |
| 72 | 72 | $modx->setPlaceholder('favicon', |
| 73 | - (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico')); |
|
| 73 | + (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico')); |
|
| 74 | 74 | |
| 75 | 75 | // invoke OnManagerLoginFormPrerender event |
| 76 | 76 | $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender'); |
@@ -81,25 +81,25 @@ discard block |
||
| 81 | 81 | $modx->setPlaceholder('manager_path', MGR_DIR); |
| 82 | 82 | $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
| 83 | 83 | $modx->setPlaceholder('login_message', $_lang["login_message"]); |
| 84 | - $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
| 84 | + $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
| 85 | 85 | $modx->setPlaceholder('year', date('Y')); |
| 86 | 86 | |
| 87 | 87 | // set login logo image |
| 88 | 88 | if (!empty($modx->config['login_logo'])) { |
| 89 | - $modx->setPlaceholder('login_logo', MODX_SITE_URL . $modx->config['login_logo']); |
|
| 89 | + $modx->setPlaceholder('login_logo', MODX_SITE_URL.$modx->config['login_logo']); |
|
| 90 | 90 | } else { |
| 91 | - $modx->setPlaceholder('login_logo', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-logo.png'); |
|
| 91 | + $modx->setPlaceholder('login_logo', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-logo.png'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // set login background image |
| 95 | 95 | if (!empty($modx->config['login_bg'])) { |
| 96 | - $modx->setPlaceholder('login_bg', MODX_SITE_URL . $modx->config['login_bg']); |
|
| 96 | + $modx->setPlaceholder('login_bg', MODX_SITE_URL.$modx->config['login_bg']); |
|
| 97 | 97 | } else { |
| 98 | - $modx->setPlaceholder('login_bg', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-background.jpg'); |
|
| 98 | + $modx->setPlaceholder('login_bg', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-background.jpg'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // set form position css class |
| 102 | - $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']); |
|
| 102 | + $modx->setPlaceholder('login_form_position_class', 'loginbox-'.$modx->config['login_form_position']); |
|
| 103 | 103 | |
| 104 | 104 | switch ($modx->config['manager_theme_mode']) { |
| 105 | 105 | case '1': |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | switch ($installGoingOn) { |
| 125 | 125 | case 1: |
| 126 | 126 | $modx->setPlaceholder('login_message', |
| 127 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
| 127 | + "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>"); |
|
| 128 | 128 | break; |
| 129 | 129 | case 2: |
| 130 | 130 | $modx->setPlaceholder('login_message', |
| 131 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
| 131 | + "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>"); |
|
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | if ($modx->config['use_captcha'] == 1) { |
| 137 | 137 | $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
| 138 | 138 | $modx->setPlaceholder('captcha_image', |
| 139 | - '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>'); |
|
| 139 | + '<a href="'.MODX_MANAGER_URL.'" class="loginCaptcha"><img id="captcha_image" src="'.MODX_MANAGER_URL.'includes/veriword.php?rand='.rand().'" alt="'.$_lang["login_captcha_message"].'" /></a>'); |
|
| 140 | 140 | $modx->setPlaceholder('captcha_input', |
| 141 | - '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
| 141 | + '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // login info |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | // invoke OnManagerLoginFormRender event |
| 158 | 158 | $evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
| 159 | - $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
| 159 | + $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : ''; |
|
| 160 | 160 | $modx->setPlaceholder('OnManagerLoginFormRender', $html); |
| 161 | 161 | |
| 162 | 162 | // load template |
@@ -174,29 +174,29 @@ discard block |
||
| 174 | 174 | $login_tpl = file_get_contents($target); |
| 175 | 175 | } |
| 176 | 176 | } else { |
| 177 | - $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
| 178 | - if (is_file($theme_path . 'style.php')) { |
|
| 179 | - include($theme_path . 'style.php'); |
|
| 177 | + $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/'; |
|
| 178 | + if (is_file($theme_path.'style.php')) { |
|
| 179 | + include($theme_path.'style.php'); |
|
| 180 | 180 | } |
| 181 | 181 | $chunk = $modx->getChunk($target); |
| 182 | 182 | if ($chunk !== false && !empty($chunk)) { |
| 183 | 183 | $login_tpl = $chunk; |
| 184 | - } elseif (is_file(MODX_BASE_PATH . $target)) { |
|
| 185 | - $target = MODX_BASE_PATH . $target; |
|
| 184 | + } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
| 185 | + $target = MODX_BASE_PATH.$target; |
|
| 186 | 186 | $login_tpl = file_get_contents($target); |
| 187 | 187 | } elseif (is_file($target)) { |
| 188 | 188 | $login_tpl = file_get_contents($target); |
| 189 | - } elseif (is_file($theme_path . 'login.tpl')) { |
|
| 190 | - $target = $theme_path . 'login.tpl'; |
|
| 189 | + } elseif (is_file($theme_path.'login.tpl')) { |
|
| 190 | + $target = $theme_path.'login.tpl'; |
|
| 191 | 191 | $login_tpl = file_get_contents($target); |
| 192 | - } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
|
| 193 | - $target = $theme_path . 'templates/actions/login.tpl'; |
|
| 192 | + } elseif (is_file($theme_path.'templates/actions/login.tpl')) { |
|
| 193 | + $target = $theme_path.'templates/actions/login.tpl'; |
|
| 194 | 194 | $login_tpl = file_get_contents($target); |
| 195 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
| 196 | - $target = $theme_path . 'html/login.html'; |
|
| 195 | + } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible |
|
| 196 | + $target = $theme_path.'html/login.html'; |
|
| 197 | 197 | $login_tpl = file_get_contents($target); |
| 198 | 198 | } else { |
| 199 | - $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
| 199 | + $target = MODX_MANAGER_PATH.'media/style/common/login.tpl'; |
|
| 200 | 200 | $login_tpl = file_get_contents($target); |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -215,17 +215,17 @@ discard block |
||
| 215 | 215 | $modx->updateValidatedUserSession(); |
| 216 | 216 | |
| 217 | 217 | // Update last action in table active_users |
| 218 | - $itemid = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
| 218 | + $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
| 219 | 219 | $lasthittime = time(); |
| 220 | - $action = isset($_REQUEST['a']) ? (int)$_REQUEST['a'] : 1; |
|
| 220 | + $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
|
| 221 | 221 | |
| 222 | 222 | if ($action !== 1) { |
| 223 | - if ((int)$itemid <= 0) { |
|
| 223 | + if ((int) $itemid <= 0) { |
|
| 224 | 224 | $itemid = null; |
| 225 | 225 | } |
| 226 | 226 | $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", |
| 227 | 227 | $modx->getFullTableName('active_users') // Table |
| 228 | - , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string)$action, |
|
| 228 | + , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, |
|
| 229 | 229 | $itemid == null ? var_export(null, true) : $itemid); |
| 230 | 230 | $modx->db->query($sql); |
| 231 | 231 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -require_once(dirname(__FILE__) . '/protect.inc.php'); |
|
| 9 | +require_once(dirname(__FILE__).'/protect.inc.php'); |
|
| 10 | 10 | |
| 11 | 11 | $action = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $_POST['action']); |
| 12 | 12 | $lang = preg_replace('/[^A-Za-z0-9_\s\+\-\.\/]/', '', $_POST['lang']); |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | switch (true) { |
| 25 | 25 | case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/', |
| 26 | - $lang) && file_exists(dirname(__FILE__) . '/lang/' . $lang . '.inc.php')): { |
|
| 27 | - include(dirname(__FILE__) . '/lang/' . $lang . '.inc.php'); |
|
| 26 | + $lang) && file_exists(dirname(__FILE__).'/lang/'.$lang.'.inc.php')): { |
|
| 27 | + include(dirname(__FILE__).'/lang/'.$lang.'.inc.php'); |
|
| 28 | 28 | $str = isset($key, $_lang, $_lang[$key]) ? $_lang[$key] : ""; |
| 29 | 29 | break; |
| 30 | 30 | } |
| 31 | 31 | case ($action == 'setsetting' && !empty($key) && !empty($value)): { |
| 32 | - $sql = "REPLACE INTO " . $modx->getFullTableName("system_settings") . " (setting_name, setting_value) VALUES('{$key}', '{$value}');"; |
|
| 32 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) VALUES('{$key}', '{$value}');"; |
|
| 33 | 33 | $str = "true"; |
| 34 | 34 | $modx->db->query($sql); |
| 35 | 35 | $emptyCache = true; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | ---------------------------------------------- */ |
| 28 | 28 | |
| 29 | 29 | // include MagPieRSS |
| 30 | -require_once(MODX_MANAGER_PATH . 'media/rss/rss_fetch.inc'); |
|
| 30 | +require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
|
| 31 | 31 | /** |
| 32 | 32 | * Convert relative path into absolute url |
| 33 | 33 | * |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $tmp = parse_url($base); |
| 42 | 42 | extract($tmp); |
| 43 | 43 | if (strpos($rel, "//") === 0) { |
| 44 | - return $scheme . ':' . $rel; |
|
| 44 | + return $scheme.':'.$rel; |
|
| 45 | 45 | } |
| 46 | 46 | // return if already absolute URL |
| 47 | 47 | if (parse_url($rel, PHP_URL_SCHEME) != '') { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | // queries and anchors |
| 51 | 51 | if ($rel[0] == '#' || $rel[0] == '?') { |
| 52 | - return $base . $rel; |
|
| 52 | + return $base.$rel; |
|
| 53 | 53 | } |
| 54 | 54 | // remove non-directory element from path |
| 55 | 55 | $path = preg_replace('#/[^/]*$#', '', $path); |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | $path = ''; |
| 59 | 59 | } |
| 60 | 60 | // dirty absolute URL |
| 61 | - $abs = $host . $path . "/" . $rel; |
|
| 61 | + $abs = $host.$path."/".$rel; |
|
| 62 | 62 | // replace '//' or '/./' or '/foo/../' with '/' |
| 63 | 63 | $abs = preg_replace("/(\/\.?\/)/", "/", $abs); |
| 64 | 64 | $abs = preg_replace("/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs); |
| 65 | 65 | |
| 66 | 66 | // absolute URL is ready! |
| 67 | - return $scheme . '://' . $abs; |
|
| 67 | + return $scheme.'://'.$abs; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $feedData = array(); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $output = ''; |
| 75 | 75 | $rss = @fetch_rss($url); |
| 76 | 76 | if (!$rss) { |
| 77 | - $feedData[$section] = 'Failed to retrieve ' . $url; |
|
| 77 | + $feedData[$section] = 'Failed to retrieve '.$url; |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | $output .= '<ul>'; |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | $description = strip_tags($item['description']); |
| 89 | 89 | if (strlen($description) > 199) { |
| 90 | 90 | $description = substr($description, 0, 200); |
| 91 | - $description .= '...<br />Read <a href="' . $href . '" target="_blank">more</a>.'; |
|
| 91 | + $description .= '...<br />Read <a href="'.$href.'" target="_blank">more</a>.'; |
|
| 92 | 92 | } |
| 93 | - $output .= '<li><a href="' . $href . '" target="_blank">' . $title . '</a> - <b>' . $pubdate . '</b><br />' . $description . '</li>'; |
|
| 93 | + $output .= '<li><a href="'.$href.'" target="_blank">'.$title.'</a> - <b>'.$pubdate.'</b><br />'.$description.'</li>'; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $output .= '</ul>'; |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $newCat = $modx->db->escape($newCat); |
| 35 | 35 | $cats = $modx->db->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'"); |
| 36 | 36 | if ($cat = $modx->db->getValue($cats)) { |
| 37 | - return (int)$cat; |
|
| 37 | + return (int) $cat; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return 0; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $role = $this->role; |
| 37 | 37 | |
| 38 | 38 | if ($role == 1) { |
| 39 | - return true; // administrator - grant all document permissions |
|
| 39 | + return true; // administrator - grant all document permissions |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) { |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | are private to the manager users will not be private to web users if the |
| 64 | 64 | document group is not assigned to a web user group and visa versa. |
| 65 | 65 | */ |
| 66 | - $permissionsok = false; // set permissions to false |
|
| 66 | + $permissionsok = false; // set permissions to false |
|
| 67 | 67 | |
| 68 | 68 | $rs = $modx->db->select( |
| 69 | 69 | 'count(DISTINCT sc.id)', |
| 70 | 70 | "{$tblsc} AS sc |
| 71 | 71 | LEFT JOIN {$tbldg} AS dg on dg.document = sc.id |
| 72 | 72 | LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group", |
| 73 | - "sc.id='{$this->document}' AND (" . (empty($docgrp) ? '' : "dg.document_group = " . $docgrp . " ||") . " sc.privatemgr = 0)" |
|
| 73 | + "sc.id='{$this->document}' AND (".(empty($docgrp) ? '' : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)" |
|
| 74 | 74 | ); |
| 75 | 75 | $limit = $modx->db->getValue($rs); |
| 76 | 76 | if ($limit == 1) { |
@@ -33,115 +33,115 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | switch ($_POST['mode']) { |
| 36 | - case '19': |
|
| 37 | - |
|
| 38 | - // invoke OnBeforeTempFormSave event |
|
| 39 | - $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
| 40 | - "mode" => "new", |
|
| 41 | - "id" => $id |
|
| 42 | - )); |
|
| 43 | - |
|
| 44 | - // disallow duplicate names for new templates |
|
| 45 | - $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}'"); |
|
| 46 | - $count = $modx->db->getValue($rs); |
|
| 47 | - if ($count > 0) { |
|
| 48 | - $modx->manager->saveFormValues(19); |
|
| 49 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19"); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - //do stuff to save the new doc |
|
| 53 | - $newid = $modx->db->insert(array( |
|
| 54 | - 'templatename' => $templatename, |
|
| 55 | - 'description' => $description, |
|
| 56 | - 'content' => $template, |
|
| 57 | - 'locked' => $locked, |
|
| 58 | - 'selectable' => $selectable, |
|
| 59 | - 'category' => $categoryid, |
|
| 60 | - 'createdon' => $currentdate, |
|
| 61 | - 'editedon' => $currentdate |
|
| 62 | - ), $modx->getFullTableName('site_templates')); |
|
| 63 | - |
|
| 64 | - // invoke OnTempFormSave event |
|
| 65 | - $modx->invokeEvent("OnTempFormSave", array( |
|
| 66 | - "mode" => "new", |
|
| 67 | - "id" => $newid |
|
| 68 | - )); |
|
| 69 | - // Set new assigned Tvs |
|
| 70 | - saveTemplateAccess($newid); |
|
| 71 | - |
|
| 72 | - // Set the item name for logger |
|
| 73 | - $_SESSION['itemname'] = $templatename; |
|
| 74 | - |
|
| 75 | - // empty cache |
|
| 76 | - $modx->clearCache('full'); |
|
| 77 | - |
|
| 78 | - // finished emptying cache - redirect |
|
| 79 | - if ($_POST['stay'] != '') { |
|
| 80 | - $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
|
| 81 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 82 | - header($header); |
|
| 83 | - } else { |
|
| 84 | - $header = "Location: index.php?a=76&r=2"; |
|
| 85 | - header($header); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - break; |
|
| 89 | - case '16': |
|
| 90 | - |
|
| 91 | - // invoke OnBeforeTempFormSave event |
|
| 92 | - $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
| 93 | - "mode" => "upd", |
|
| 94 | - "id" => $id |
|
| 95 | - )); |
|
| 96 | - |
|
| 97 | - // disallow duplicate names for templates |
|
| 98 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'"); |
|
| 99 | - $count = $modx->db->getValue($rs); |
|
| 100 | - if ($count > 0) { |
|
| 101 | - $modx->manager->saveFormValues(16); |
|
| 102 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}"); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - //do stuff to save the edited doc |
|
| 106 | - $modx->db->update(array( |
|
| 107 | - 'templatename' => $templatename, |
|
| 108 | - 'description' => $description, |
|
| 109 | - 'content' => $template, |
|
| 110 | - 'locked' => $locked, |
|
| 111 | - 'selectable' => $selectable, |
|
| 112 | - 'category' => $categoryid, |
|
| 113 | - 'editedon' => $currentdate |
|
| 114 | - ), $modx->getFullTableName('site_templates'), "id='{$id}'"); |
|
| 115 | - // Set new assigned Tvs |
|
| 116 | - saveTemplateAccess($id); |
|
| 117 | - |
|
| 118 | - // invoke OnTempFormSave event |
|
| 119 | - $modx->invokeEvent("OnTempFormSave", array( |
|
| 120 | - "mode" => "upd", |
|
| 121 | - "id" => $id |
|
| 122 | - )); |
|
| 123 | - |
|
| 124 | - // Set the item name for logger |
|
| 125 | - $_SESSION['itemname'] = $templatename; |
|
| 126 | - |
|
| 127 | - // first empty the cache |
|
| 128 | - $modx->clearCache('full'); |
|
| 129 | - |
|
| 130 | - // finished emptying cache - redirect |
|
| 131 | - if ($_POST['stay'] != '') { |
|
| 132 | - $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
|
| 133 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 134 | - header($header); |
|
| 135 | - } else { |
|
| 136 | - $modx->unlockElement(1, $id); |
|
| 137 | - $header = "Location: index.php?a=76&r=2"; |
|
| 138 | - header($header); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - |
|
| 142 | - break; |
|
| 143 | - default: |
|
| 144 | - $modx->webAlertAndQuit("No operation set in request."); |
|
| 36 | + case '19': |
|
| 37 | + |
|
| 38 | + // invoke OnBeforeTempFormSave event |
|
| 39 | + $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
| 40 | + "mode" => "new", |
|
| 41 | + "id" => $id |
|
| 42 | + )); |
|
| 43 | + |
|
| 44 | + // disallow duplicate names for new templates |
|
| 45 | + $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}'"); |
|
| 46 | + $count = $modx->db->getValue($rs); |
|
| 47 | + if ($count > 0) { |
|
| 48 | + $modx->manager->saveFormValues(19); |
|
| 49 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19"); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + //do stuff to save the new doc |
|
| 53 | + $newid = $modx->db->insert(array( |
|
| 54 | + 'templatename' => $templatename, |
|
| 55 | + 'description' => $description, |
|
| 56 | + 'content' => $template, |
|
| 57 | + 'locked' => $locked, |
|
| 58 | + 'selectable' => $selectable, |
|
| 59 | + 'category' => $categoryid, |
|
| 60 | + 'createdon' => $currentdate, |
|
| 61 | + 'editedon' => $currentdate |
|
| 62 | + ), $modx->getFullTableName('site_templates')); |
|
| 63 | + |
|
| 64 | + // invoke OnTempFormSave event |
|
| 65 | + $modx->invokeEvent("OnTempFormSave", array( |
|
| 66 | + "mode" => "new", |
|
| 67 | + "id" => $newid |
|
| 68 | + )); |
|
| 69 | + // Set new assigned Tvs |
|
| 70 | + saveTemplateAccess($newid); |
|
| 71 | + |
|
| 72 | + // Set the item name for logger |
|
| 73 | + $_SESSION['itemname'] = $templatename; |
|
| 74 | + |
|
| 75 | + // empty cache |
|
| 76 | + $modx->clearCache('full'); |
|
| 77 | + |
|
| 78 | + // finished emptying cache - redirect |
|
| 79 | + if ($_POST['stay'] != '') { |
|
| 80 | + $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
|
| 81 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 82 | + header($header); |
|
| 83 | + } else { |
|
| 84 | + $header = "Location: index.php?a=76&r=2"; |
|
| 85 | + header($header); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + break; |
|
| 89 | + case '16': |
|
| 90 | + |
|
| 91 | + // invoke OnBeforeTempFormSave event |
|
| 92 | + $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
| 93 | + "mode" => "upd", |
|
| 94 | + "id" => $id |
|
| 95 | + )); |
|
| 96 | + |
|
| 97 | + // disallow duplicate names for templates |
|
| 98 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'"); |
|
| 99 | + $count = $modx->db->getValue($rs); |
|
| 100 | + if ($count > 0) { |
|
| 101 | + $modx->manager->saveFormValues(16); |
|
| 102 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}"); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + //do stuff to save the edited doc |
|
| 106 | + $modx->db->update(array( |
|
| 107 | + 'templatename' => $templatename, |
|
| 108 | + 'description' => $description, |
|
| 109 | + 'content' => $template, |
|
| 110 | + 'locked' => $locked, |
|
| 111 | + 'selectable' => $selectable, |
|
| 112 | + 'category' => $categoryid, |
|
| 113 | + 'editedon' => $currentdate |
|
| 114 | + ), $modx->getFullTableName('site_templates'), "id='{$id}'"); |
|
| 115 | + // Set new assigned Tvs |
|
| 116 | + saveTemplateAccess($id); |
|
| 117 | + |
|
| 118 | + // invoke OnTempFormSave event |
|
| 119 | + $modx->invokeEvent("OnTempFormSave", array( |
|
| 120 | + "mode" => "upd", |
|
| 121 | + "id" => $id |
|
| 122 | + )); |
|
| 123 | + |
|
| 124 | + // Set the item name for logger |
|
| 125 | + $_SESSION['itemname'] = $templatename; |
|
| 126 | + |
|
| 127 | + // first empty the cache |
|
| 128 | + $modx->clearCache('full'); |
|
| 129 | + |
|
| 130 | + // finished emptying cache - redirect |
|
| 131 | + if ($_POST['stay'] != '') { |
|
| 132 | + $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
|
| 133 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 134 | + header($header); |
|
| 135 | + } else { |
|
| 136 | + $modx->unlockElement(1, $id); |
|
| 137 | + $header = "Location: index.php?a=76&r=2"; |
|
| 138 | + header($header); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + |
|
| 142 | + break; |
|
| 143 | + default: |
|
| 144 | + $modx->webAlertAndQuit("No operation set in request."); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -1,27 +1,27 @@ 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 | if (!$modx->hasPermission('save_template')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $template = $modx->db->escape($_POST['post']); |
| 11 | 11 | $templatename = $modx->db->escape(trim($_POST['templatename'])); |
| 12 | 12 | $description = $modx->db->escape($_POST['description']); |
| 13 | 13 | $locked = $_POST['locked'] == 'on' ? 1 : 0; |
| 14 | -$selectable = $id == $modx->config['default_template'] ? 1 : // Force selectable |
|
| 14 | +$selectable = $id == $modx->config['default_template'] ? 1 : // Force selectable |
|
| 15 | 15 | $_POST['selectable'] == 'on' ? 1 : 0; |
| 16 | 16 | $currentdate = time() + $modx->config['server_offset_time']; |
| 17 | 17 | |
| 18 | 18 | //Kyle Jaebker - added category support |
| 19 | 19 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 20 | - $categoryid = (int)$_POST['categoryid']; |
|
| 20 | + $categoryid = (int) $_POST['categoryid']; |
|
| 21 | 21 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 22 | 22 | $categoryid = 0; |
| 23 | 23 | } else { |
| 24 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 24 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 25 | 25 | $categoryid = checkCategory($_POST['newcategory']); |
| 26 | 26 | if (!$categoryid) { |
| 27 | 27 | $categoryid = newCategory($_POST['newcategory']); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | // finished emptying cache - redirect |
| 79 | 79 | if ($_POST['stay'] != '') { |
| 80 | 80 | $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
| 81 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 81 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 82 | 82 | header($header); |
| 83 | 83 | } else { |
| 84 | 84 | $header = "Location: index.php?a=76&r=2"; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | // finished emptying cache - redirect |
| 131 | 131 | if ($_POST['stay'] != '') { |
| 132 | 132 | $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
| 133 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 133 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 134 | 134 | header($header); |
| 135 | 135 | } else { |
| 136 | 136 | $modx->unlockElement(1, $id); |
@@ -59,125 +59,125 @@ |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | switch ($_POST['mode']) { |
| 62 | - case '107': |
|
| 63 | - // invoke OnBeforeModFormSave event |
|
| 64 | - $modx->invokeEvent("OnBeforeModFormSave", array( |
|
| 65 | - "mode" => "new", |
|
| 66 | - "id" => $id |
|
| 67 | - )); |
|
| 68 | - |
|
| 69 | - // disallow duplicate names for new modules |
|
| 70 | - $rs = $modx->db->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}'"); |
|
| 71 | - $count = $modx->db->getValue($rs); |
|
| 72 | - if ($count > 0) { |
|
| 73 | - $modx->manager->saveFormValues(107); |
|
| 74 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107"); |
|
| 75 | - } |
|
| 62 | + case '107': |
|
| 63 | + // invoke OnBeforeModFormSave event |
|
| 64 | + $modx->invokeEvent("OnBeforeModFormSave", array( |
|
| 65 | + "mode" => "new", |
|
| 66 | + "id" => $id |
|
| 67 | + )); |
|
| 68 | + |
|
| 69 | + // disallow duplicate names for new modules |
|
| 70 | + $rs = $modx->db->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}'"); |
|
| 71 | + $count = $modx->db->getValue($rs); |
|
| 72 | + if ($count > 0) { |
|
| 73 | + $modx->manager->saveFormValues(107); |
|
| 74 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107"); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - // save the new module |
|
| 78 | - $newid = $modx->db->insert(array( |
|
| 79 | - 'name' => $name, |
|
| 80 | - 'description' => $description, |
|
| 81 | - 'disabled' => $disabled, |
|
| 82 | - 'wrap' => $wrap, |
|
| 83 | - 'locked' => $locked, |
|
| 84 | - 'icon' => $icon, |
|
| 85 | - 'resourcefile' => $resourcefile, |
|
| 86 | - 'enable_resource' => $enable_resource, |
|
| 87 | - 'category' => $categoryid, |
|
| 88 | - 'enable_sharedparams' => $enable_sharedparams, |
|
| 89 | - 'guid' => $guid, |
|
| 90 | - 'modulecode' => $modulecode, |
|
| 91 | - 'properties' => $properties, |
|
| 92 | - 'createdon' => $currentdate, |
|
| 93 | - 'editedon' => $currentdate |
|
| 94 | - ), $modx->getFullTableName('site_modules')); |
|
| 95 | - |
|
| 96 | - // save user group access permissions |
|
| 97 | - saveUserGroupAccessPermissons(); |
|
| 98 | - |
|
| 99 | - // invoke OnModFormSave event |
|
| 100 | - $modx->invokeEvent("OnModFormSave", array( |
|
| 101 | - "mode" => "new", |
|
| 102 | - "id" => $newid |
|
| 103 | - )); |
|
| 104 | - |
|
| 105 | - // Set the item name for logger |
|
| 106 | - $_SESSION['itemname'] = $name; |
|
| 107 | - |
|
| 108 | - // empty cache |
|
| 109 | - $modx->clearCache('full'); |
|
| 110 | - |
|
| 111 | - // finished emptying cache - redirect |
|
| 112 | - if ($_POST['stay'] != '') { |
|
| 113 | - $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
|
| 114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 115 | - header($header); |
|
| 116 | - } else { |
|
| 117 | - $header = "Location: index.php?a=106&r=2"; |
|
| 118 | - header($header); |
|
| 119 | - } |
|
| 120 | - break; |
|
| 121 | - case '108': |
|
| 122 | - // invoke OnBeforeModFormSave event |
|
| 123 | - $modx->invokeEvent("OnBeforeModFormSave", array( |
|
| 124 | - "mode" => "upd", |
|
| 125 | - "id" => $id |
|
| 126 | - )); |
|
| 127 | - |
|
| 128 | - // disallow duplicate names for new modules |
|
| 129 | - $rs = $modx->db->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'"); |
|
| 130 | - if ($modx->db->getValue($rs) > 0) { |
|
| 131 | - $modx->manager->saveFormValues(108); |
|
| 132 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}"); |
|
| 133 | - } |
|
| 77 | + // save the new module |
|
| 78 | + $newid = $modx->db->insert(array( |
|
| 79 | + 'name' => $name, |
|
| 80 | + 'description' => $description, |
|
| 81 | + 'disabled' => $disabled, |
|
| 82 | + 'wrap' => $wrap, |
|
| 83 | + 'locked' => $locked, |
|
| 84 | + 'icon' => $icon, |
|
| 85 | + 'resourcefile' => $resourcefile, |
|
| 86 | + 'enable_resource' => $enable_resource, |
|
| 87 | + 'category' => $categoryid, |
|
| 88 | + 'enable_sharedparams' => $enable_sharedparams, |
|
| 89 | + 'guid' => $guid, |
|
| 90 | + 'modulecode' => $modulecode, |
|
| 91 | + 'properties' => $properties, |
|
| 92 | + 'createdon' => $currentdate, |
|
| 93 | + 'editedon' => $currentdate |
|
| 94 | + ), $modx->getFullTableName('site_modules')); |
|
| 95 | + |
|
| 96 | + // save user group access permissions |
|
| 97 | + saveUserGroupAccessPermissons(); |
|
| 98 | + |
|
| 99 | + // invoke OnModFormSave event |
|
| 100 | + $modx->invokeEvent("OnModFormSave", array( |
|
| 101 | + "mode" => "new", |
|
| 102 | + "id" => $newid |
|
| 103 | + )); |
|
| 104 | + |
|
| 105 | + // Set the item name for logger |
|
| 106 | + $_SESSION['itemname'] = $name; |
|
| 107 | + |
|
| 108 | + // empty cache |
|
| 109 | + $modx->clearCache('full'); |
|
| 110 | + |
|
| 111 | + // finished emptying cache - redirect |
|
| 112 | + if ($_POST['stay'] != '') { |
|
| 113 | + $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
|
| 114 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 115 | + header($header); |
|
| 116 | + } else { |
|
| 117 | + $header = "Location: index.php?a=106&r=2"; |
|
| 118 | + header($header); |
|
| 119 | + } |
|
| 120 | + break; |
|
| 121 | + case '108': |
|
| 122 | + // invoke OnBeforeModFormSave event |
|
| 123 | + $modx->invokeEvent("OnBeforeModFormSave", array( |
|
| 124 | + "mode" => "upd", |
|
| 125 | + "id" => $id |
|
| 126 | + )); |
|
| 127 | + |
|
| 128 | + // disallow duplicate names for new modules |
|
| 129 | + $rs = $modx->db->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'"); |
|
| 130 | + if ($modx->db->getValue($rs) > 0) { |
|
| 131 | + $modx->manager->saveFormValues(108); |
|
| 132 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}"); |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - // save the edited module |
|
| 136 | - $modx->db->update(array( |
|
| 137 | - 'name' => $name, |
|
| 138 | - 'description' => $description, |
|
| 139 | - 'icon' => $icon, |
|
| 140 | - 'enable_resource' => $enable_resource, |
|
| 141 | - 'resourcefile' => $resourcefile, |
|
| 142 | - 'disabled' => $disabled, |
|
| 143 | - 'wrap' => $wrap, |
|
| 144 | - 'locked' => $locked, |
|
| 145 | - 'category' => $categoryid, |
|
| 146 | - 'enable_sharedparams' => $enable_sharedparams, |
|
| 147 | - 'guid' => $guid, |
|
| 148 | - 'modulecode' => $modulecode, |
|
| 149 | - 'properties' => $properties, |
|
| 150 | - 'editedon' => $currentdate |
|
| 151 | - ), $modx->getFullTableName('site_modules'), "id='{$id}'"); |
|
| 152 | - |
|
| 153 | - // save user group access permissions |
|
| 154 | - saveUserGroupAccessPermissons(); |
|
| 155 | - |
|
| 156 | - // invoke OnModFormSave event |
|
| 157 | - $modx->invokeEvent("OnModFormSave", array( |
|
| 158 | - "mode" => "upd", |
|
| 159 | - "id" => $id |
|
| 160 | - )); |
|
| 161 | - |
|
| 162 | - // Set the item name for logger |
|
| 163 | - $_SESSION['itemname'] = $name; |
|
| 164 | - |
|
| 165 | - // empty cache |
|
| 166 | - $modx->clearCache('full'); |
|
| 167 | - |
|
| 168 | - // finished emptying cache - redirect |
|
| 169 | - if ($_POST['stay'] != '') { |
|
| 170 | - $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
|
| 171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 172 | - header($header); |
|
| 173 | - } else { |
|
| 174 | - $modx->unlockElement(6, $id); |
|
| 175 | - $header = "Location: index.php?a=106&r=2"; |
|
| 176 | - header($header); |
|
| 177 | - } |
|
| 178 | - break; |
|
| 179 | - default: |
|
| 180 | - $modx->webAlertAndQuit("No operation set in request."); |
|
| 135 | + // save the edited module |
|
| 136 | + $modx->db->update(array( |
|
| 137 | + 'name' => $name, |
|
| 138 | + 'description' => $description, |
|
| 139 | + 'icon' => $icon, |
|
| 140 | + 'enable_resource' => $enable_resource, |
|
| 141 | + 'resourcefile' => $resourcefile, |
|
| 142 | + 'disabled' => $disabled, |
|
| 143 | + 'wrap' => $wrap, |
|
| 144 | + 'locked' => $locked, |
|
| 145 | + 'category' => $categoryid, |
|
| 146 | + 'enable_sharedparams' => $enable_sharedparams, |
|
| 147 | + 'guid' => $guid, |
|
| 148 | + 'modulecode' => $modulecode, |
|
| 149 | + 'properties' => $properties, |
|
| 150 | + 'editedon' => $currentdate |
|
| 151 | + ), $modx->getFullTableName('site_modules'), "id='{$id}'"); |
|
| 152 | + |
|
| 153 | + // save user group access permissions |
|
| 154 | + saveUserGroupAccessPermissons(); |
|
| 155 | + |
|
| 156 | + // invoke OnModFormSave event |
|
| 157 | + $modx->invokeEvent("OnModFormSave", array( |
|
| 158 | + "mode" => "upd", |
|
| 159 | + "id" => $id |
|
| 160 | + )); |
|
| 161 | + |
|
| 162 | + // Set the item name for logger |
|
| 163 | + $_SESSION['itemname'] = $name; |
|
| 164 | + |
|
| 165 | + // empty cache |
|
| 166 | + $modx->clearCache('full'); |
|
| 167 | + |
|
| 168 | + // finished emptying cache - redirect |
|
| 169 | + if ($_POST['stay'] != '') { |
|
| 170 | + $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
|
| 171 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 172 | + header($header); |
|
| 173 | + } else { |
|
| 174 | + $modx->unlockElement(6, $id); |
|
| 175 | + $header = "Location: index.php?a=106&r=2"; |
|
| 176 | + header($header); |
|
| 177 | + } |
|
| 178 | + break; |
|
| 179 | + default: |
|
| 180 | + $modx->webAlertAndQuit("No operation set in request."); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -1,12 +1,12 @@ 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 | if (!$modx->hasPermission('save_module')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
| 11 | 11 | $description = $modx->db->escape($_POST['description']); |
| 12 | 12 | $resourcefile = $modx->db->escape($_POST['resourcefile']); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | //Kyle Jaebker - added category support |
| 27 | 27 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 28 | - $categoryid = (int)$_POST['categoryid']; |
|
| 28 | + $categoryid = (int) $_POST['categoryid']; |
|
| 29 | 29 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 30 | 30 | $categoryid = 0; |
| 31 | 31 | } else { |
| 32 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 32 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 33 | 33 | $categoryid = checkCategory($_POST['newcategory']); |
| 34 | 34 | if (!$categoryid) { |
| 35 | 35 | $categoryid = newCategory($_POST['newcategory']); |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | $name = isset($parsed['name']) ? $parsed['name'] : $name; |
| 46 | 46 | $properties = isset($parsed['properties']) ? $parsed['properties'] : $properties; |
| 47 | 47 | $guid = isset($parsed['guid']) ? $parsed['guid'] : $guid; |
| 48 | - $enable_sharedparams = isset($parsed['shareparams']) ? (int)$parsed['shareparams'] : $enable_sharedparams; |
|
| 48 | + $enable_sharedparams = isset($parsed['shareparams']) ? (int) $parsed['shareparams'] : $enable_sharedparams; |
|
| 49 | 49 | |
| 50 | 50 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
| 51 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
| 51 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
| 52 | 52 | if ($version) { |
| 53 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 53 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 54 | 54 | } |
| 55 | 55 | if (isset($parsed['modx_category'])) { |
| 56 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 56 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 57 | 57 | $categoryid = getCategory($parsed['modx_category']); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // finished emptying cache - redirect |
| 112 | 112 | if ($_POST['stay'] != '') { |
| 113 | 113 | $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
| 114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 114 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 115 | 115 | header($header); |
| 116 | 116 | } else { |
| 117 | 117 | $header = "Location: index.php?a=106&r=2"; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | // finished emptying cache - redirect |
| 169 | 169 | if ($_POST['stay'] != '') { |
| 170 | 170 | $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
| 171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 171 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 172 | 172 | header($header); |
| 173 | 173 | } else { |
| 174 | 174 | $modx->unlockElement(6, $id); |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | foreach ($_ as $collation=>$selected) { |
| 51 | 51 | $collation = htmlentities($collation); |
| 52 | 52 | // if(substr($collation,0,4)!=='utf8') continue; |
| 53 | - if (strpos($collation, 'sjis')===0) { |
|
| 53 | + if (strpos($collation, 'sjis') === 0) { |
|
| 54 | 54 | continue; |
| 55 | 55 | } |
| 56 | - if ($collation=='recommend') { |
|
| 56 | + if ($collation == 'recommend') { |
|
| 57 | 57 | $output .= '<optgroup label="recommend">'; |
| 58 | - } elseif ($collation=='unrecommend') { |
|
| 58 | + } elseif ($collation == 'unrecommend') { |
|
| 59 | 59 | $output .= '</optgroup><optgroup label="unrecommend">'; |
| 60 | 60 | } else { |
| 61 | 61 | $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation); |
@@ -67,18 +67,18 @@ discard block |
||
| 67 | 67 | echo $output; |
| 68 | 68 | exit; |
| 69 | 69 | |
| 70 | -function sortItem($array=array(), $order='utf8mb4,utf8') |
|
| 70 | +function sortItem($array = array(), $order = 'utf8mb4,utf8') |
|
| 71 | 71 | { |
| 72 | 72 | $rs = array('recommend'=>''); |
| 73 | 73 | $order = explode(',', $order); |
| 74 | 74 | foreach ($order as $v) { |
| 75 | 75 | foreach ($array as $name=>$sel) { |
| 76 | - if (strpos($name, $v)!==false) { |
|
| 76 | + if (strpos($name, $v) !== false) { |
|
| 77 | 77 | $rs[$name] = $array[$name]; |
| 78 | 78 | unset($array[$name]); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | - $rs['unrecommend']=''; |
|
| 82 | + $rs['unrecommend'] = ''; |
|
| 83 | 83 | return $rs + $array; |
| 84 | 84 | } |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | exit('send some data'); |
| 19 | 19 | } //?? |
| 20 | 20 | |
| 21 | -$indent = (int)$_REQUEST['indent']; |
|
| 22 | -$parent = (int)$_REQUEST['parent']; |
|
| 23 | -$expandAll = (int)$_REQUEST['expandAll']; |
|
| 21 | +$indent = (int) $_REQUEST['indent']; |
|
| 22 | +$parent = (int) $_REQUEST['parent']; |
|
| 23 | +$expandAll = (int) $_REQUEST['expandAll']; |
|
| 24 | 24 | $output = ''; |
| 25 | 25 | $hereid = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : ''; |
| 26 | 26 | |