@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | <tr> |
| 14 | 14 | <th><?php echo $_lang['sitestatus_title'] ?><br><small>[(site_status)]</small></th> |
| 15 | 15 | <td> |
| 16 | - <?php echo wrap_label($_lang['online'], form_radio('site_status', 1));?><br />
|
|
| 17 | - <?php echo wrap_label($_lang['offline'], form_radio('site_status', 0));?>
|
|
| 16 | + <?php echo wrap_label($_lang['online'], form_radio('site_status', 1)); ?><br />
|
|
| 17 | + <?php echo wrap_label($_lang['offline'], form_radio('site_status', 0)); ?>
|
|
| 18 | 18 | </td> |
| 19 | 19 | </tr> |
| 20 | 20 | <tr> |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | <br /> |
| 59 | 59 | <p><?php echo $_lang['update_settings_from_language']; ?></p> |
| 60 | 60 | <select name="reload_site_unavailable" id="reload_site_unavailable_select" onchange="confirmLangChange(this, 'siteunavailable_message_default', 'site_unavailable_message_textarea');"> |
| 61 | -<?php echo get_lang_options('siteunavailable_message_default');?>
|
|
| 61 | +<?php echo get_lang_options('siteunavailable_message_default'); ?>
|
|
| 62 | 62 | </select> |
| 63 | 63 | </th> |
| 64 | 64 | <td> <textarea name="site_unavailable_message" id="site_unavailable_message_textarea" style="width:100%; height: 120px;"><?php echo $site_unavailable_message_view; ?></textarea> |
| 65 | - <input type="hidden" name="siteunavailable_message_default" id="siteunavailable_message_default_hidden" value="<?php echo addslashes($_lang['siteunavailable_message_default']);?>" /> |
|
| 66 | - <div class="comment"><?php echo $_lang['siteunavailable_message'];?></div> |
|
| 65 | + <input type="hidden" name="siteunavailable_message_default" id="siteunavailable_message_default_hidden" value="<?php echo addslashes($_lang['siteunavailable_message_default']); ?>" /> |
|
| 66 | + <div class="comment"><?php echo $_lang['siteunavailable_message']; ?></div> |
|
| 67 | 67 | </td> |
| 68 | 68 | </tr> |
| 69 | 69 | <tr> |
@@ -78,17 +78,17 @@ discard block |
||
| 78 | 78 | 'c.category, t.templatename ASC' |
| 79 | 79 | ); |
| 80 | 80 | ?> |
| 81 | - <select name="default_template" class="inputBox" onchange="documentDirty=true;wrap=document.getElementById('template_reset_options_wrapper');if(this.options[this.selectedIndex].value != '<?php echo $default_template;?>'){wrap.style.display='block';}else{wrap.style.display='none';}" style="width:150px">
|
|
| 81 | + <select name="default_template" class="inputBox" onchange="documentDirty=true;wrap=document.getElementById('template_reset_options_wrapper');if(this.options[this.selectedIndex].value != '<?php echo $default_template; ?>'){wrap.style.display='block';}else{wrap.style.display='none';}" style="width:150px">
|
|
| 82 | 82 | <?php |
| 83 | 83 | |
| 84 | 84 | $currentCategory = ''; |
| 85 | 85 | while ($row = $modx->db->getRow($rs)) {
|
| 86 | 86 | $thisCategory = $row['category']; |
| 87 | - if($thisCategory == null) {
|
|
| 87 | + if ($thisCategory == null) {
|
|
| 88 | 88 | $thisCategory = $_lang['no_category']; |
| 89 | 89 | } |
| 90 | - if($thisCategory != $currentCategory) {
|
|
| 91 | - if($closeOptGroup) {
|
|
| 90 | + if ($thisCategory != $currentCategory) {
|
|
| 91 | + if ($closeOptGroup) {
|
|
| 92 | 92 | echo "\t\t\t\t\t</optgroup>\n"; |
| 93 | 93 | } |
| 94 | 94 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
| 107 | 107 | $currentCategory = $thisCategory; |
| 108 | 108 | } |
| 109 | - if($thisCategory != '') {
|
|
| 109 | + if ($thisCategory != '') {
|
|
| 110 | 110 | echo "\t\t\t\t\t</optgroup>\n"; |
| 111 | 111 | } |
| 112 | 112 | ?> |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | <br /> |
| 115 | 115 | <div id="template_reset_options_wrapper" style="display:none;"> |
| 116 | 116 | <label><input type="radio" name="reset_template" value="1" /> <?php echo $_lang['template_reset_all']; ?></label><br /> |
| 117 | - <label><input type="radio" name="reset_template" value="2" /> <?php echo sprintf($_lang['template_reset_specific'],$oldTmpName); ?></label> |
|
| 117 | + <label><input type="radio" name="reset_template" value="2" /> <?php echo sprintf($_lang['template_reset_specific'], $oldTmpName); ?></label> |
|
| 118 | 118 | </div> |
| 119 | 119 | <input type="hidden" name="old_template" value="<?php echo $oldTmpId; ?>" /> |
| 120 | 120 | <div class="comment"><?php echo $_lang['defaulttemplate_message'] ?></div> |
| 121 | 121 | </td> |
| 122 | 122 | </tr> |
| 123 | 123 | <tr> |
| 124 | - <th><?php echo $_lang['defaulttemplate_logic_title'];?><br><small>[(auto_template_logic)]</small></th> |
|
| 124 | + <th><?php echo $_lang['defaulttemplate_logic_title']; ?><br><small>[(auto_template_logic)]</small></th> |
|
| 125 | 125 | <td> |
| 126 | - <p><?php echo $_lang['defaulttemplate_logic_general_message'];?></p> |
|
| 127 | - <label><input type="radio" name="auto_template_logic" value="system"<?php if($auto_template_logic == 'system') {echo " checked='checked'";}?>/> <?php echo $_lang['defaulttemplate_logic_system_message']; ?></label><br />
|
|
| 128 | - <label><input type="radio" name="auto_template_logic" value="parent"<?php if($auto_template_logic == 'parent') {echo " checked='checked'";}?>/> <?php echo $_lang['defaulttemplate_logic_parent_message']; ?></label><br />
|
|
| 129 | - <label><input type="radio" name="auto_template_logic" value="sibling"<?php if($auto_template_logic == 'sibling') {echo " checked='checked'";}?>/> <?php echo $_lang['defaulttemplate_logic_sibling_message']; ?></label><br />
|
|
| 126 | + <p><?php echo $_lang['defaulttemplate_logic_general_message']; ?></p> |
|
| 127 | + <label><input type="radio" name="auto_template_logic" value="system"<?php if ($auto_template_logic == 'system') {echo " checked='checked'"; }?>/> <?php echo $_lang['defaulttemplate_logic_system_message']; ?></label><br />
|
|
| 128 | + <label><input type="radio" name="auto_template_logic" value="parent"<?php if ($auto_template_logic == 'parent') {echo " checked='checked'"; }?>/> <?php echo $_lang['defaulttemplate_logic_parent_message']; ?></label><br />
|
|
| 129 | + <label><input type="radio" name="auto_template_logic" value="sibling"<?php if ($auto_template_logic == 'sibling') {echo " checked='checked'"; }?>/> <?php echo $_lang['defaulttemplate_logic_sibling_message']; ?></label><br />
|
|
| 130 | 130 | </td> |
| 131 | 131 | </tr> |
| 132 | 132 | <tr> |
@@ -138,22 +138,22 @@ discard block |
||
| 138 | 138 | $modx->db->select('id', '[+prefix+]site_plugins',
|
| 139 | 139 | "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
| 140 | 140 | ); |
| 141 | - if($count) {
|
|
| 141 | + if ($count) {
|
|
| 142 | 142 | $disabledFilters = 1; |
| 143 | 143 | echo '<b>'.$_lang['enable_filter_phx_warning'].'</b><br/>'; |
| 144 | 144 | } |
| 145 | 145 | else $disabledFilters = false; |
| 146 | 146 | ?> |
| 147 | - <?php echo wrap_label($_lang['yes'],form_radio('enable_filter', 1, '', $disabledFilters));?><br />
|
|
| 148 | - <?php echo wrap_label($_lang['no'], form_radio('enable_filter', 0, '', $disabledFilters));?>
|
|
| 147 | + <?php echo wrap_label($_lang['yes'], form_radio('enable_filter', 1, '', $disabledFilters)); ?><br />
|
|
| 148 | + <?php echo wrap_label($_lang['no'], form_radio('enable_filter', 0, '', $disabledFilters)); ?>
|
|
| 149 | 149 | <div class="comment"><?php echo $_lang['enable_filter_message']; ?></div> |
| 150 | 150 | </td> |
| 151 | 151 | </tr> |
| 152 | 152 | <tr> |
| 153 | 153 | <th><?php echo $_lang['enable_at_syntax_title'] ?><br><small>[(enable_at_syntax)]</small></th> |
| 154 | 154 | <td > |
| 155 | - <?php echo wrap_label($_lang['yes'],form_radio('enable_at_syntax', 1));?><br />
|
|
| 156 | - <?php echo wrap_label($_lang['no'], form_radio('enable_at_syntax', 0));?>
|
|
| 155 | + <?php echo wrap_label($_lang['yes'], form_radio('enable_at_syntax', 1)); ?><br />
|
|
| 156 | + <?php echo wrap_label($_lang['no'], form_radio('enable_at_syntax', 0)); ?>
|
|
| 157 | 157 | <div class="comment"> |
| 158 | 158 | <?php echo $_lang['enable_at_syntax_message']; ?> |
| 159 | 159 | <ul> |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | <tr> |
| 168 | 168 | <th><?php echo $_lang['defaultpublish_title'] ?><br><small>[(publish_default)]</small></th> |
| 169 | 169 | <td> |
| 170 | - <?php echo wrap_label($_lang['yes'],form_radio('publish_default', 1));?><br />
|
|
| 171 | - <?php echo wrap_label($_lang['no'],form_radio('publish_default', 0));?>
|
|
| 170 | + <?php echo wrap_label($_lang['yes'], form_radio('publish_default', 1)); ?><br />
|
|
| 171 | + <?php echo wrap_label($_lang['no'], form_radio('publish_default', 0)); ?>
|
|
| 172 | 172 | <div class="comment"><?php echo $_lang['defaultpublish_message'] ?></div> |
| 173 | 173 | </td> |
| 174 | 174 | </tr> |
@@ -176,24 +176,24 @@ discard block |
||
| 176 | 176 | <tr> |
| 177 | 177 | <th><?php echo $_lang['defaultcache_title'] ?><br><small>[(cache_default)]</small></th> |
| 178 | 178 | <td> |
| 179 | - <?php echo wrap_label($_lang['yes'],form_radio('cache_default', 1));?><br />
|
|
| 180 | - <?php echo wrap_label($_lang['no'],form_radio('cache_default', 0));?>
|
|
| 179 | + <?php echo wrap_label($_lang['yes'], form_radio('cache_default', 1)); ?><br />
|
|
| 180 | + <?php echo wrap_label($_lang['no'], form_radio('cache_default', 0)); ?>
|
|
| 181 | 181 | <div class="comment"><?php echo $_lang['defaultcache_message'] ?></div> |
| 182 | 182 | </td> |
| 183 | 183 | </tr> |
| 184 | 184 | <tr> |
| 185 | 185 | <th><?php echo $_lang['defaultsearch_title'] ?><br><small>[(search_default)]</small></th> |
| 186 | 186 | <td> |
| 187 | - <?php echo wrap_label($_lang['yes'],form_radio('search_default', 1));?><br />
|
|
| 188 | - <?php echo wrap_label($_lang['no'],form_radio('search_default', 0));?>
|
|
| 187 | + <?php echo wrap_label($_lang['yes'], form_radio('search_default', 1)); ?><br />
|
|
| 188 | + <?php echo wrap_label($_lang['no'], form_radio('search_default', 0)); ?>
|
|
| 189 | 189 | <div class="comment"><?php echo $_lang['defaultsearch_message'] ?></div> |
| 190 | 190 | </td> |
| 191 | 191 | </tr> |
| 192 | 192 | <tr> |
| 193 | 193 | <th><?php echo $_lang['defaultmenuindex_title'] ?><br><small>[(auto_menuindex)]</small></th> |
| 194 | 194 | <td> |
| 195 | - <?php echo wrap_label($_lang['yes'],form_radio('auto_menuindex', 1));?><br />
|
|
| 196 | - <?php echo wrap_label($_lang['no'],form_radio('auto_menuindex', 0));?>
|
|
| 195 | + <?php echo wrap_label($_lang['yes'], form_radio('auto_menuindex', 1)); ?><br />
|
|
| 196 | + <?php echo wrap_label($_lang['no'], form_radio('auto_menuindex', 0)); ?>
|
|
| 197 | 197 | <div class="comment"><?php echo $_lang['defaultmenuindex_message'] ?></div> |
| 198 | 198 | </td> |
| 199 | 199 | </tr> |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | <table border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"> |
| 204 | 204 | <select name="lst_custom_contenttype" style="width:200px;height:100px;" size="5"> |
| 205 | 205 | <?php |
| 206 | - $ct = explode(",",$custom_contenttype);
|
|
| 207 | - for($i=0;$i<count($ct);$i++) {
|
|
| 206 | + $ct = explode(",", $custom_contenttype);
|
|
| 207 | + for ($i = 0; $i < count($ct); $i++) {
|
|
| 208 | 208 | echo "<option value=\"".$ct[$i]."\">".$ct[$i]."</option>"; |
| 209 | 209 | } |
| 210 | 210 | ?> |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | <th><?php echo $_lang['docid_incrmnt_method_title'] ?><br><small>[(docid_incrmnt_method)]</small></th> |
| 219 | 219 | <td> |
| 220 | 220 | <label><input type="radio" name="docid_incrmnt_method" value="0" |
| 221 | - <?php echo ($docid_incrmnt_method=='0') ? 'checked="checked"' : "" ; ?> /> |
|
| 221 | + <?php echo ($docid_incrmnt_method == '0') ? 'checked="checked"' : ""; ?> /> |
|
| 222 | 222 | <?php echo $_lang['docid_incrmnt_method_0']?></label><br /> |
| 223 | 223 | |
| 224 | 224 | <label><input type="radio" name="docid_incrmnt_method" value="1" |
| 225 | - <?php echo ($docid_incrmnt_method=='1') ? 'checked="checked"' : "" ; ?> /> |
|
| 225 | + <?php echo ($docid_incrmnt_method == '1') ? 'checked="checked"' : ""; ?> /> |
|
| 226 | 226 | <?php echo $_lang['docid_incrmnt_method_1']?></label><br /> |
| 227 | 227 | <label><input type="radio" name="docid_incrmnt_method" value="2" |
| 228 | - <?php echo ($docid_incrmnt_method=='2') ? 'checked="checked"' : "" ; ?> /> |
|
| 228 | + <?php echo ($docid_incrmnt_method == '2') ? 'checked="checked"' : ""; ?> /> |
|
| 229 | 229 | <?php echo $_lang['docid_incrmnt_method_2']?></label><br /> |
| 230 | 230 | </td> |
| 231 | 231 | </tr> |
@@ -233,24 +233,24 @@ discard block |
||
| 233 | 233 | <tr> |
| 234 | 234 | <th><?php echo $_lang['enable_cache_title'] ?><br><small>[(enable_cache)]</small></th> |
| 235 | 235 | <td> |
| 236 | - <?php echo wrap_label($_lang['enabled'],form_radio('enable_cache', 1));?><br />
|
|
| 237 | - <?php echo wrap_label($_lang['disabled'], form_radio('enable_cache', 0));?><br />
|
|
| 238 | - <?php echo wrap_label($_lang['disabled_at_login'], form_radio('enable_cache', 2));?>
|
|
| 236 | + <?php echo wrap_label($_lang['enabled'], form_radio('enable_cache', 1)); ?><br />
|
|
| 237 | + <?php echo wrap_label($_lang['disabled'], form_radio('enable_cache', 0)); ?><br />
|
|
| 238 | + <?php echo wrap_label($_lang['disabled_at_login'], form_radio('enable_cache', 2)); ?>
|
|
| 239 | 239 | </td> |
| 240 | 240 | </tr> |
| 241 | 241 | |
| 242 | 242 | <tr> |
| 243 | 243 | <th><?php echo $_lang['cache_type_title'] ?><br><small>[(cache_type)]</small></th> |
| 244 | 244 | <td> |
| 245 | -<?php echo wrap_label($_lang['cache_type_1'],form_radio('cache_type', 1));?><br />
|
|
| 246 | -<?php echo wrap_label($_lang['cache_type_2'], form_radio('cache_type', 2));?>
|
|
| 245 | +<?php echo wrap_label($_lang['cache_type_1'], form_radio('cache_type', 1)); ?><br />
|
|
| 246 | +<?php echo wrap_label($_lang['cache_type_2'], form_radio('cache_type', 2)); ?>
|
|
| 247 | 247 | </td> |
| 248 | 248 | </tr> |
| 249 | 249 | <tr> |
| 250 | 250 | <th><?php echo $_lang['minifyphp_incache_title'] ?><br><small>[(minifyphp_incache)]</small></th> |
| 251 | 251 | <td> |
| 252 | -<?php echo wrap_label($_lang['enabled'],form_radio('minifyphp_incache', 1));?><br />
|
|
| 253 | -<?php echo wrap_label($_lang['disabled'], form_radio('minifyphp_incache', 0));?>
|
|
| 252 | +<?php echo wrap_label($_lang['enabled'], form_radio('minifyphp_incache', 1)); ?><br />
|
|
| 253 | +<?php echo wrap_label($_lang['disabled'], form_radio('minifyphp_incache', 0)); ?>
|
|
| 254 | 254 | <div class="comment"><?php echo $_lang['minifyphp_incache_message'] ?></div> |
| 255 | 255 | </td> |
| 256 | 256 | </tr> |
@@ -259,23 +259,23 @@ discard block |
||
| 259 | 259 | <th><?php echo $_lang['serveroffset_title'] ?><br><small>[(server_offset_time)]</small></th> |
| 260 | 260 | <td> <select name="server_offset_time" size="1" class="inputBox"> |
| 261 | 261 | <?php |
| 262 | - for($i=-24; $i<25; $i++) {
|
|
| 263 | - $seconds = $i*60*60; |
|
| 264 | - $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
|
| 262 | + for ($i = -24; $i < 25; $i++) {
|
|
| 263 | + $seconds = $i * 60 * 60; |
|
| 264 | + $selectedtext = $seconds == $server_offset_time ? "selected='selected'" : ""; |
|
| 265 | 265 | ?> |
| 266 | 266 | <option value="<?php echo $seconds; ?>" <?php echo $selectedtext; ?>><?php echo $i; ?></option> |
| 267 | 267 | <?php |
| 268 | 268 | } |
| 269 | 269 | ?> |
| 270 | 270 | </select> |
| 271 | - <div class="comment"><?php printf($_lang['serveroffset_message'], strftime('%H:%M:%S', time()), strftime('%H:%M:%S', time()+$server_offset_time)); ?></div>
|
|
| 271 | + <div class="comment"><?php printf($_lang['serveroffset_message'], strftime('%H:%M:%S', time()), strftime('%H:%M:%S', time() + $server_offset_time)); ?></div>
|
|
| 272 | 272 | </td> |
| 273 | 273 | </tr> |
| 274 | 274 | <tr> |
| 275 | 275 | <th><?php echo $_lang['server_protocol_title'] ?><br><small>[(server_protocol)]</small></th> |
| 276 | 276 | <td> |
| 277 | - <?php echo wrap_label($_lang['server_protocol_http'],form_radio('server_protocol', 'http'));?><br />
|
|
| 278 | - <?php echo wrap_label($_lang['server_protocol_https'], form_radio('server_protocol', 'https'));?>
|
|
| 277 | + <?php echo wrap_label($_lang['server_protocol_http'], form_radio('server_protocol', 'http')); ?><br />
|
|
| 278 | + <?php echo wrap_label($_lang['server_protocol_https'], form_radio('server_protocol', 'https')); ?>
|
|
| 279 | 279 | <div class="comment"><?php echo $_lang['server_protocol_message'] ?></div> |
| 280 | 280 | </td> |
| 281 | 281 | </tr> |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | <?php |
| 297 | 297 | // invoke OnSiteSettingsRender event |
| 298 | 298 | $evtOut = $modx->invokeEvent('OnSiteSettingsRender');
|
| 299 | - if(is_array($evtOut)) echo implode("",$evtOut);
|
|
| 299 | + if (is_array($evtOut)) echo implode("", $evtOut);
|
|
| 300 | 300 | ?> |
| 301 | 301 | </td> |
| 302 | 302 | </tr> |
@@ -4,9 +4,9 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | * @return array of keys from a language file |
| 6 | 6 | */ |
| 7 | -function get_lang_keys($filename) {
|
|
| 8 | - $file = MODX_MANAGER_PATH.'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
|
| 9 | - if(is_file($file) && is_readable($file)) {
|
|
| 7 | +function get_lang_keys($filename){
|
|
| 8 | + $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename; |
|
| 9 | + if (is_file($file) && is_readable($file)) {
|
|
| 10 | 10 | include($file); |
| 11 | 11 | return array_keys($_lang); |
| 12 | 12 | } else {
|
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return array of languages that define the key in their file |
| 20 | 20 | */ |
| 21 | -function get_langs_by_key($key) {
|
|
| 21 | +function get_langs_by_key($key){
|
|
| 22 | 22 | global $lang_keys; |
| 23 | 23 | $lang_return = array(); |
| 24 | - foreach($lang_keys as $lang=>$keys) {
|
|
| 25 | - if(in_array($key, $keys)) {
|
|
| 24 | + foreach ($lang_keys as $lang=>$keys) {
|
|
| 25 | + if (in_array($key, $keys)) {
|
|
| 26 | 26 | $lang_return[] = $lang; |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | * @param string $selected_lang specify language to select in option list, default none |
| 39 | 39 | * @return html option list |
| 40 | 40 | */ |
| 41 | -function get_lang_options($key=null, $selected_lang=null) {
|
|
| 41 | +function get_lang_options($key = null, $selected_lang = null){
|
|
| 42 | 42 | global $lang_keys, $_lang; |
| 43 | 43 | $lang_options = ''; |
| 44 | - if($key) {
|
|
| 44 | + if ($key) {
|
|
| 45 | 45 | $languages = get_langs_by_key($key); |
| 46 | 46 | sort($languages); |
| 47 | 47 | $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
| 48 | 48 | |
| 49 | - foreach($languages as $language_name) {
|
|
| 49 | + foreach ($languages as $language_name) {
|
|
| 50 | 50 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
|
| 51 | 51 | $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
| 52 | 52 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } else {
|
| 55 | 55 | $languages = array_keys($lang_keys); |
| 56 | 56 | sort($languages); |
| 57 | - foreach($languages as $language_name) {
|
|
| 57 | + foreach ($languages as $language_name) {
|
|
| 58 | 58 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
|
| 59 | 59 | $sel = $language_name == $selected_lang ? ' selected="selected"' : ''; |
| 60 | 60 | $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
@@ -63,23 +63,23 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -function form_radio($name,$value,$add='',$disabled=false) {
|
|
| 66 | +function form_radio($name, $value, $add = '', $disabled = false){
|
|
| 67 | 67 | global ${$name};
|
| 68 | 68 | $var = ${$name};
|
| 69 | - $checked = ($var==$value) ? ' checked="checked"' : ''; |
|
| 70 | - if($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
| 71 | - if($add) $add = ' ' . $add; |
|
| 69 | + $checked = ($var == $value) ? ' checked="checked"' : ''; |
|
| 70 | + if ($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
| 71 | + if ($add) $add = ' '.$add; |
|
| 72 | 72 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add);
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -function wrap_label($str='',$object) {
|
|
| 75 | +function wrap_label($str = '', $object){
|
|
| 76 | 76 | return "<label>{$object}\n{$str}</label>";
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -function parseText($tpl='', $ph=array()) {
|
|
| 80 | - if(empty($ph) || empty($tpl)) return $tpl; |
|
| 79 | +function parseText($tpl = '', $ph = array()){
|
|
| 80 | + if (empty($ph) || empty($tpl)) return $tpl; |
|
| 81 | 81 | |
| 82 | - foreach($ph as $k=>$v) |
|
| 82 | + foreach ($ph as $k=>$v) |
|
| 83 | 83 | {
|
| 84 | 84 | $k = "[+{$k}+]";
|
| 85 | 85 | $tpl = str_replace($k, $v, $tpl); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | return $tpl; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | -function showHide($cond=true) {
|
|
| 90 | +function showHide($cond = true){
|
|
| 91 | 91 | global $displayStyle; |
| 92 | 92 | $showHide = $cond ? $displayStyle : 'none'; |
| 93 | 93 | return sprintf('style="display:%s"', $showHide);
|
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | <tr> |
| 3 | 3 | <td><?php echo $_lang['smtp_auth_title'] ?></td> |
| 4 | 4 | <td> |
| 5 | - <?php echo wrap_label($_lang['yes'],form_radio('smtp_auth','1' ));?><br />
|
|
| 6 | - <?php echo wrap_label($_lang['no'],form_radio('smtp_auth','0' ));?>
|
|
| 5 | + <?php echo wrap_label($_lang['yes'], form_radio('smtp_auth', '1')); ?><br />
|
|
| 6 | + <?php echo wrap_label($_lang['no'], form_radio('smtp_auth', '0')); ?>
|
|
| 7 | 7 | </td> |
| 8 | 8 | </tr> |
| 9 | 9 | <tr> |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | <td > |
| 16 | 16 | <select name="smtp_secure" size="1" class="inputBox"> |
| 17 | 17 | <option value="none" ><?php echo $_lang['no'] ?></option> |
| 18 | - <option value="ssl" <?php if($smtp_secure == 'ssl') echo "selected='selected'"; ?> >SSL</option> |
|
| 19 | - <option value="tls" <?php if($smtp_secure == 'tls') echo "selected='selected'"; ?> >TLS</option> |
|
| 18 | + <option value="ssl" <?php if ($smtp_secure == 'ssl') echo "selected='selected'"; ?> >SSL</option> |
|
| 19 | + <option value="tls" <?php if ($smtp_secure == 'tls') echo "selected='selected'"; ?> >TLS</option> |
|
| 20 | 20 | </select> |
| 21 | 21 | <br /> |
| 22 | 22 | </td> |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | <tr> |
| 7 | 7 | <td nowrap class="warning" valign="top"><?php echo $_lang['friendlyurls_title'] ?><br><small>[(friendly_urls)]</small></td> |
| 8 | 8 | <td> |
| 9 | - <?php echo wrap_label($_lang['yes'],form_radio('friendly_urls', 1, 'id="furlRowOn"'));?><br />
|
|
| 10 | - <?php echo wrap_label($_lang['no'], form_radio('friendly_urls', 0, 'id="furlRowOff"'));?>
|
|
| 9 | + <?php echo wrap_label($_lang['yes'], form_radio('friendly_urls', 1, 'id="furlRowOn"')); ?><br />
|
|
| 10 | + <?php echo wrap_label($_lang['no'], form_radio('friendly_urls', 0, 'id="furlRowOff"')); ?>
|
|
| 11 | 11 | </td> |
| 12 | 12 | </tr> |
| 13 | 13 | <tr> |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | <tr> |
| 21 | 21 | <td nowrap class="warning"><?php echo $_lang['xhtml_urls_title'] ?><br><small>[(xhtml_urls)]</small></td> |
| 22 | 22 | <td> |
| 23 | - <?php echo wrap_label($_lang['yes'],form_radio('xhtml_urls', 1));?><br />
|
|
| 24 | - <?php echo wrap_label($_lang['no'], form_radio('xhtml_urls', 0));?>
|
|
| 23 | + <?php echo wrap_label($_lang['yes'], form_radio('xhtml_urls', 1)); ?><br />
|
|
| 24 | + <?php echo wrap_label($_lang['no'], form_radio('xhtml_urls', 0)); ?>
|
|
| 25 | 25 | </td> |
| 26 | 26 | </tr> |
| 27 | 27 | <tr> |
@@ -31,135 +31,135 @@ discard block |
||
| 31 | 31 | <tr> |
| 32 | 32 | <td colspan="2"><div class="split"></div></td> |
| 33 | 33 | </tr> |
| 34 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 34 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 35 | 35 | <td nowrap class="warning" valign="top"><?php echo $_lang['friendlyurlsprefix_title'] ?><br><small>[(friendly_url_prefix)]</small></td> |
| 36 | 36 | <td><input onchange="documentDirty=true;" type="text" maxlength="50" style="width: 200px;" name="friendly_url_prefix" value="<?php echo $friendly_url_prefix; ?>" /></td> |
| 37 | 37 | </tr> |
| 38 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 38 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 39 | 39 | <td width="200"> </td> |
| 40 | 40 | <td class="comment"><?php echo $_lang['friendlyurlsprefix_message'] ?></td> |
| 41 | 41 | </tr> |
| 42 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 42 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 43 | 43 | <td colspan="2"><div class="split"></div></td> |
| 44 | 44 | </tr> |
| 45 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 45 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 46 | 46 | <td nowrap class="warning" valign="top"><?php echo $_lang['friendlyurlsuffix_title'] ?><br><small>[(friendly_url_suffix)]</small></td> |
| 47 | 47 | <td><input onchange="documentDirty=true;" type="text" maxlength="50" style="width: 200px;" name="friendly_url_suffix" value="<?php echo $friendly_url_suffix; ?>" /></td> |
| 48 | 48 | </tr> |
| 49 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 49 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 50 | 50 | <td width="200"> </td> |
| 51 | 51 | <td class="comment"><?php echo $_lang['friendlyurlsuffix_message'] ?></td> |
| 52 | 52 | </tr> |
| 53 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 53 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 54 | 54 | <td colspan="2"><div class="split"></div></td> |
| 55 | 55 | </tr> |
| 56 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 56 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 57 | 57 | <th><?php echo $_lang['make_folders_title'] ?><br><small>[(make_folders)]</small></th> |
| 58 | 58 | <td> |
| 59 | - <?php echo wrap_label($_lang['yes'],form_radio('make_folders','1'));?><br />
|
|
| 60 | - <?php echo wrap_label($_lang['no'],form_radio('make_folders','0'));?>
|
|
| 59 | + <?php echo wrap_label($_lang['yes'], form_radio('make_folders', '1')); ?><br />
|
|
| 60 | + <?php echo wrap_label($_lang['no'], form_radio('make_folders', '0')); ?>
|
|
| 61 | 61 | </td> |
| 62 | 62 | </tr> |
| 63 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 63 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 64 | 64 | <td width="200"> </td> |
| 65 | 65 | <td class="comment"><?php echo $_lang['make_folders_message'] ?></td> |
| 66 | 66 | </tr> |
| 67 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 67 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 68 | 68 | <td colspan="2"><div class="split"></div></td> |
| 69 | 69 | </tr> |
| 70 | 70 | |
| 71 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 71 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 72 | 72 | <th><?php echo $_lang['seostrict_title'] ?><br><small>[(seostrict)]</small></th> |
| 73 | 73 | <td> |
| 74 | - <?php echo wrap_label($_lang['yes'],form_radio('seostrict','1'));?><br />
|
|
| 75 | - <?php echo wrap_label($_lang['no'],form_radio('seostrict','0'));?>
|
|
| 74 | + <?php echo wrap_label($_lang['yes'], form_radio('seostrict', '1')); ?><br />
|
|
| 75 | + <?php echo wrap_label($_lang['no'], form_radio('seostrict', '0')); ?>
|
|
| 76 | 76 | </td> |
| 77 | 77 | </tr> |
| 78 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 78 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 79 | 79 | <td width="200"> </td> |
| 80 | 80 | <td class="comment"><?php echo $_lang['seostrict_message'] ?></td> |
| 81 | 81 | </tr> |
| 82 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 82 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 83 | 83 | <td colspan="2"><div class="split"></div></td> |
| 84 | 84 | </tr> |
| 85 | 85 | |
| 86 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 86 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 87 | 87 | <th><?php echo $_lang['aliaslistingfolder_title'] ?><br><small>[(aliaslistingfolder)]</small></th> |
| 88 | 88 | <td> |
| 89 | - <?php echo wrap_label($_lang['yes'],form_radio('aliaslistingfolder','1'));?><br />
|
|
| 90 | - <?php echo wrap_label($_lang['no'],form_radio('aliaslistingfolder','0'));?>
|
|
| 89 | + <?php echo wrap_label($_lang['yes'], form_radio('aliaslistingfolder', '1')); ?><br />
|
|
| 90 | + <?php echo wrap_label($_lang['no'], form_radio('aliaslistingfolder', '0')); ?>
|
|
| 91 | 91 | </td> |
| 92 | 92 | </tr> |
| 93 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 93 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 94 | 94 | <td width="200"> </td> |
| 95 | 95 | <td class="comment"><?php echo $_lang['aliaslistingfolder_message'] ?></td> |
| 96 | 96 | </tr> |
| 97 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 97 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 98 | 98 | <td colspan="2"><div class="split"></div></td> |
| 99 | 99 | </tr> |
| 100 | 100 | |
| 101 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 101 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 102 | 102 | <td nowrap class="warning" valign="top"><?php echo $_lang['friendly_alias_title'] ?><br><small>[(friendly_alias_urls)]</small></td> |
| 103 | 103 | <td> |
| 104 | - <?php echo wrap_label($_lang['yes'],form_radio('friendly_alias_urls','1'));?><br />
|
|
| 105 | - <?php echo wrap_label($_lang['no'],form_radio('friendly_alias_urls','0'));?>
|
|
| 104 | + <?php echo wrap_label($_lang['yes'], form_radio('friendly_alias_urls', '1')); ?><br />
|
|
| 105 | + <?php echo wrap_label($_lang['no'], form_radio('friendly_alias_urls', '0')); ?>
|
|
| 106 | 106 | </td> |
| 107 | 107 | </tr> |
| 108 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 108 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 109 | 109 | <td width="200"> </td> |
| 110 | 110 | <td class="comment"><?php echo $_lang['friendly_alias_message'] ?></td> |
| 111 | 111 | </tr> |
| 112 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 112 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 113 | 113 | <td colspan="2"><div class="split"></div></td> |
| 114 | 114 | </tr> |
| 115 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 115 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 116 | 116 | <td nowrap class="warning" valign="top"><?php echo $_lang['use_alias_path_title'] ?><br><small>[(use_alias_path)]</small></td> |
| 117 | 117 | <td> |
| 118 | - <?php echo wrap_label($_lang['yes'],form_radio('use_alias_path','1'));?><br />
|
|
| 119 | - <?php echo wrap_label($_lang['no'],form_radio('use_alias_path','0'));?>
|
|
| 118 | + <?php echo wrap_label($_lang['yes'], form_radio('use_alias_path', '1')); ?><br />
|
|
| 119 | + <?php echo wrap_label($_lang['no'], form_radio('use_alias_path', '0')); ?>
|
|
| 120 | 120 | </td> |
| 121 | 121 | </tr> |
| 122 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 122 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 123 | 123 | <td width="200"> </td> |
| 124 | 124 | <td class="comment"><?php echo $_lang['use_alias_path_message'] ?></td> |
| 125 | 125 | </tr> |
| 126 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 126 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 127 | 127 | <td colspan="2"><div class="split"></div></td> |
| 128 | 128 | </tr> |
| 129 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 129 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 130 | 130 | <td nowrap class="warning" valign="top"><?php echo $_lang['duplicate_alias_title'] ?><br><small>[(allow_duplicate_alias)]</small></td> |
| 131 | 131 | <td> |
| 132 | - <?php echo wrap_label($_lang['yes'],form_radio('allow_duplicate_alias','1'));?><br />
|
|
| 133 | - <?php echo wrap_label($_lang['no'],form_radio('allow_duplicate_alias','0'));?>
|
|
| 132 | + <?php echo wrap_label($_lang['yes'], form_radio('allow_duplicate_alias', '1')); ?><br />
|
|
| 133 | + <?php echo wrap_label($_lang['no'], form_radio('allow_duplicate_alias', '0')); ?>
|
|
| 134 | 134 | </td> |
| 135 | 135 | </tr> |
| 136 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 136 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 137 | 137 | <td width="200"> </td> |
| 138 | 138 | <td class="comment"><?php echo $_lang['duplicate_alias_message'] ?></td> |
| 139 | 139 | </tr> |
| 140 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 140 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 141 | 141 | <td colspan="2"><div class="split"></div></td> |
| 142 | 142 | </tr> |
| 143 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 143 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 144 | 144 | <td nowrap class="warning" valign="top"><?php echo $_lang['automatic_alias_title'] ?><br><small>[(automatic_alias)]</small></td> |
| 145 | 145 | <td> |
| 146 | - <?php echo wrap_label($_lang['yes'],form_radio('automatic_alias','1'));?><br />
|
|
| 147 | - <?php echo wrap_label($_lang['no'],form_radio('automatic_alias','0'));?>
|
|
| 146 | + <?php echo wrap_label($_lang['yes'], form_radio('automatic_alias', '1')); ?><br />
|
|
| 147 | + <?php echo wrap_label($_lang['no'], form_radio('automatic_alias', '0')); ?>
|
|
| 148 | 148 | </td> |
| 149 | 149 | </tr> |
| 150 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 150 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 151 | 151 | <td width="200"> </td> |
| 152 | 152 | <td class="comment"><?php echo $_lang['automatic_alias_message'] ?></td> |
| 153 | 153 | </tr> |
| 154 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 154 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 155 | 155 | <td colspan="2"><div class="split"></div></td> |
| 156 | 156 | </tr> |
| 157 | -<tr class="furlRow" <?php echo showHide($friendly_urls==1);?>> |
|
| 157 | +<tr class="furlRow" <?php echo showHide($friendly_urls == 1); ?>> |
|
| 158 | 158 | <td colspan="2"> |
| 159 | 159 | <?php |
| 160 | 160 | // invoke OnFriendlyURLSettingsRender event |
| 161 | 161 | $evtOut = $modx->invokeEvent('OnFriendlyURLSettingsRender');
|
| 162 | - if(is_array($evtOut)) echo implode("",$evtOut);
|
|
| 162 | + if (is_array($evtOut)) echo implode("", $evtOut);
|
|
| 163 | 163 | ?> |
| 164 | 164 | </td> |
| 165 | 165 | </tr> |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | var $role; |
| 8 | 8 | var $duplicateDoc = false; |
| 9 | 9 | |
| 10 | - function checkPermissions() { |
|
| 10 | + function checkPermissions(){ |
|
| 11 | 11 | |
| 12 | 12 | global $udperms_allowroot; |
| 13 | 13 | global $modx; |
@@ -19,23 +19,23 @@ discard block |
||
| 19 | 19 | $document = $this->document; |
| 20 | 20 | $role = $this->role; |
| 21 | 21 | |
| 22 | - if($role==1) { |
|
| 23 | - return true; // administrator - grant all document permissions |
|
| 22 | + if ($role == 1) { |
|
| 23 | + return true; // administrator - grant all document permissions |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - if($modx->config['use_udperms']==0 || $modx->config['use_udperms']=="" || !isset($modx->config['use_udperms'])) { |
|
| 26 | + if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) { |
|
| 27 | 27 | return true; // permissions aren't in use |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'")); |
| 31 | - if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root |
|
| 32 | - if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) { |
|
| 31 | + if ($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root |
|
| 32 | + if (($this->duplicateDoc == true || $document == 0) && $parent == 0 && $udperms_allowroot == 0) { |
|
| 33 | 33 | return false; // deny duplicate || create new document at root if Allow Root is No |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // get document groups for current user |
| 37 | - if($_SESSION['mgrDocgroups']) { |
|
| 38 | - $docgrp = implode(" || dg.document_group = ",$_SESSION['mgrDocgroups']); |
|
| 37 | + if ($_SESSION['mgrDocgroups']) { |
|
| 38 | + $docgrp = implode(" || dg.document_group = ", $_SESSION['mgrDocgroups']); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /* Note: |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | are private to the manager users will not be private to web users if the |
| 47 | 47 | document group is not assigned to a web user group and visa versa. |
| 48 | 48 | */ |
| 49 | - $permissionsok = false; // set permissions to false |
|
| 49 | + $permissionsok = false; // set permissions to false |
|
| 50 | 50 | |
| 51 | 51 | $rs = $modx->db->select( |
| 52 | 52 | 'count(DISTINCT sc.id)', |
| 53 | 53 | "{$tblsc} AS sc |
| 54 | 54 | LEFT JOIN {$tbldg} AS dg on dg.document = sc.id |
| 55 | 55 | LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group", |
| 56 | - "sc.id='{$this->document}' AND (". ( (!$docgrp) ? null : "dg.document_group = ".$docgrp." ||" ) . " sc.privatemgr = 0)" |
|
| 56 | + "sc.id='{$this->document}' AND (".((!$docgrp) ? null : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)" |
|
| 57 | 57 | ); |
| 58 | 58 | $limit = $modx->db->getValue($rs); |
| 59 | - if($limit==1) $permissionsok = true; |
|
| 59 | + if ($limit == 1) $permissionsok = true; |
|
| 60 | 60 | |
| 61 | 61 | return $permissionsok; |
| 62 | 62 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | if (isset($this->aliases[$id])) { |
| 62 | 62 | if ($this->aliasVisible[$id] == 1) { |
| 63 | 63 | if ($path != '') { |
| 64 | - $path = $this->aliases[$id] . '/' . $path; |
|
| 64 | + $path = $this->aliases[$id].'/'.$path; |
|
| 65 | 65 | } else { |
| 66 | 66 | $path = $this->aliases[$id]; |
| 67 | 67 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $modx->messageQuit("Cache path not set."); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $files = glob(realpath($this->cachePath) . '/*.pageCache.php'); |
|
| 83 | + $files = glob(realpath($this->cachePath).'/*.pageCache.php'); |
|
| 84 | 84 | $filesincache = count($files); |
| 85 | 85 | $deletedfiles = array(); |
| 86 | 86 | while ($file = array_shift($files)) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if(function_exists('opcache_get_status')) { |
|
| 96 | + if (function_exists('opcache_get_status')) { |
|
| 97 | 97 | $opcache = opcache_get_status(); |
| 98 | 98 | if (!empty($opcache['opcache_enabled'])) { |
| 99 | 99 | opcache_reset(); |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | if (isset($opcache)) { |
| 114 | 114 | echo '<p>Opcache empty.</p>'; |
| 115 | 115 | } |
| 116 | - echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>'; |
|
| 116 | + echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>'; |
|
| 117 | 117 | foreach ($deletedfiles as $deletedfile) { |
| 118 | - echo '<li>' . $deletedfile . '</li>'; |
|
| 118 | + echo '<li>'.$deletedfile.'</li>'; |
|
| 119 | 119 | } |
| 120 | 120 | echo '</ul>'; |
| 121 | 121 | } |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | // write the file |
| 134 | - $content = '<?php' . "\n"; |
|
| 135 | - $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n"; |
|
| 136 | - $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n"; |
|
| 134 | + $content = '<?php'."\n"; |
|
| 135 | + $content .= '$recent_update=\''.$this->request_time.'\';'."\n"; |
|
| 136 | + $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n"; |
|
| 137 | 137 | |
| 138 | - $filename = $this->cachePath . '/sitePublishing.idx.php'; |
|
| 138 | + $filename = $this->cachePath.'/sitePublishing.idx.php'; |
|
| 139 | 139 | if (!$handle = fopen($filename, 'w')) { |
| 140 | 140 | exit("Cannot open file ({$filename}"); |
| 141 | 141 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | // update publish time file |
| 156 | 156 | $timesArr = array(); |
| 157 | 157 | |
| 158 | - $result = $modx->db->select('MIN(pub_date) AS minpub', '[+prefix+]site_content', 'pub_date>' . $this->request_time); |
|
| 158 | + $result = $modx->db->select('MIN(pub_date) AS minpub', '[+prefix+]site_content', 'pub_date>'.$this->request_time); |
|
| 159 | 159 | if (!$result) { |
| 160 | 160 | echo "Couldn't determine next publish event!"; |
| 161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $timesArr[] = $minpub; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $result = $modx->db->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content', 'unpub_date>' . $this->request_time); |
|
| 168 | + $result = $modx->db->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content', 'unpub_date>'.$this->request_time); |
|
| 169 | 169 | if (!$result) { |
| 170 | 170 | echo "Couldn't determine next unpublish event!"; |
| 171 | 171 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $config = array(); |
| 204 | 204 | $content .= '$c=&$this->config;'; |
| 205 | 205 | while (list($key, $value) = $modx->db->getRow($rs, 'num')) { |
| 206 | - $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";'; |
|
| 206 | + $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";'; |
|
| 207 | 207 | $config[$key] = $value; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -241,23 +241,23 @@ discard block |
||
| 241 | 241 | $docid = $doc['id']; |
| 242 | 242 | if ($use_alias_path) { |
| 243 | 243 | $tmpPath = $this->getParents($doc['parent']); |
| 244 | - $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias']; |
|
| 244 | + $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias']; |
|
| 245 | 245 | $key = $alias; |
| 246 | 246 | } else { |
| 247 | 247 | $key = $doc['alias']; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $doc['path'] = $tmpPath; |
| 251 | - $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');'; |
|
| 252 | - $content .= '$d[\'' . $key . '\']=' . $docid . ';'; |
|
| 253 | - $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');'; |
|
| 251 | + $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');'; |
|
| 252 | + $content .= '$d[\''.$key.'\']='.$docid.';'; |
|
| 253 | + $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');'; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // get content types |
| 257 | 257 | $rs = $modx->db->select('id, contentType', '[+prefix+]site_content', "contentType!='text/html'"); |
| 258 | 258 | $content .= '$c=&$this->contentTypes;'; |
| 259 | 259 | while ($doc = $modx->db->getRow($rs)) { |
| 260 | - $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';'; |
|
| 260 | + $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';'; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // WRITE Chunks to cache file |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | if ($modx->config['minifyphp_incache']) { |
| 268 | 268 | $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']); |
| 269 | 269 | } |
| 270 | - $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';'; |
|
| 270 | + $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';'; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // WRITE snippets to cache file |
@@ -278,18 +278,18 @@ discard block |
||
| 278 | 278 | while ($row = $modx->db->getRow($rs)) { |
| 279 | 279 | $key = $row['name']; |
| 280 | 280 | if ($row['disabled']) { |
| 281 | - $content .= '$s[\'' . $key . '\']=\'return false;\';'; |
|
| 281 | + $content .= '$s[\''.$key.'\']=\'return false;\';'; |
|
| 282 | 282 | } else { |
| 283 | 283 | $value = trim($row['snippet']); |
| 284 | 284 | if ($modx->config['minifyphp_incache']) { |
| 285 | 285 | $value = $this->php_strip_whitespace($value); |
| 286 | 286 | } |
| 287 | - $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
| 287 | + $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
| 288 | 288 | $properties = $modx->parseProperties($row['properties']); |
| 289 | 289 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
| 290 | 290 | $properties = array_merge($sharedproperties, $properties); |
| 291 | 291 | if (0 < count($properties)) { |
| 292 | - $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
| 292 | + $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | } |
@@ -307,13 +307,13 @@ discard block |
||
| 307 | 307 | if ($modx->config['minifyphp_incache']) { |
| 308 | 308 | $value = $this->php_strip_whitespace($value); |
| 309 | 309 | } |
| 310 | - $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
| 310 | + $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
| 311 | 311 | if ($row['properties'] != '' || $row['sharedproperties'] != '') { |
| 312 | 312 | $properties = $modx->parseProperties($row['properties']); |
| 313 | 313 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
| 314 | 314 | $properties = array_merge($sharedproperties, $properties); |
| 315 | 315 | if (0 < count($properties)) { |
| 316 | - $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
| 316 | + $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | } |
@@ -336,13 +336,13 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | foreach ($events as $evtname => $pluginnames) { |
| 338 | 338 | $events[$evtname] = $pluginnames; |
| 339 | - $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'', $this->escapeSingleQuotes($pluginnames)) . '\');'; |
|
| 339 | + $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'', $this->escapeSingleQuotes($pluginnames)).'\');'; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $content .= "\n"; |
| 343 | 343 | |
| 344 | 344 | // close and write the file |
| 345 | - $filename = $this->cachePath . 'siteCache.idx.php'; |
|
| 345 | + $filename = $this->cachePath.'siteCache.idx.php'; |
|
| 346 | 346 | |
| 347 | 347 | // invoke OnBeforeCacheUpdate event |
| 348 | 348 | if ($modx) { |
@@ -353,8 +353,8 @@ discard block |
||
| 353 | 353 | exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!"); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if (!is_file($this->cachePath . '/.htaccess')) { |
|
| 357 | - file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n"); |
|
| 356 | + if (!is_file($this->cachePath.'/.htaccess')) { |
|
| 357 | + file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n"); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | // invoke OnCacheUpdate event |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | $source = trim($source); |
| 373 | 373 | if (substr($source, 0, 5) !== '<?php') { |
| 374 | - $source = '<?php ' . $source; |
|
| 374 | + $source = '<?php '.$source; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | $tokens = token_get_all($source); |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $_ .= $text; |
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | - $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_); |
|
| 430 | + $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_); |
|
| 431 | 431 | $source = trim($source); |
| 432 | 432 | return $source; |
| 433 | 433 | } |
@@ -12,25 +12,25 @@ |
||
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -$msg =''; |
|
| 15 | +$msg = ''; |
|
| 16 | 16 | $pth = dirname(dirname(dirname(__FILE__)))."/install/"; |
| 17 | -$pth = str_replace("\\","/",$pth); |
|
| 18 | -if(isset($_GET["rminstall"])) { |
|
| 19 | - if(is_dir($pth)) { |
|
| 20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
| 17 | +$pth = str_replace("\\", "/", $pth); |
|
| 18 | +if (isset($_GET["rminstall"])) { |
|
| 19 | + if (is_dir($pth)) { |
|
| 20 | + if (!rmdirRecursive($pth)) $msg = "An error occured while attempting to remove the install folder"; |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | -if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
| 23 | +if ($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
| 24 | 24 | echo "<script>window.location='../index.php?a=2';</script>"; |
| 25 | 25 | |
| 26 | 26 | // rmdirRecursive - detects symbollic links on unix |
| 27 | -function rmdirRecursive($path,$followLinks=false) { |
|
| 28 | - $dir = opendir($path) ; |
|
| 27 | +function rmdirRecursive($path, $followLinks = false){ |
|
| 28 | + $dir = opendir($path); |
|
| 29 | 29 | while ($entry = readdir($dir)) { |
| 30 | 30 | if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
| 31 | - @unlink( "$path/$entry" ); |
|
| 31 | + @unlink("$path/$entry"); |
|
| 32 | 32 | } |
| 33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
| 33 | + elseif (is_dir("$path/$entry") && $entry != '.' && $entry != '..') { |
|
| 34 | 34 | rmdirRecursive("$path/$entry"); // recursive |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -1,23 +1,23 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 2 | +if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 3 | 3 | header('HTTP/1.0 404 Not Found'); |
| 4 | 4 | exit('error'); |
| 5 | 5 | } |
| 6 | -define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
| 6 | +define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
| 7 | 7 | define('MODX_API_MODE', true); |
| 8 | -include_once(__DIR__ . '/../../index.php'); |
|
| 8 | +include_once(__DIR__.'/../../index.php'); |
|
| 9 | 9 | $modx->db->connect(); |
| 10 | 10 | $modx->getSettings(); |
| 11 | 11 | $modx->invokeEvent('OnManagerPageInit'); |
| 12 | 12 | $modx->loadExtension('ManagerAPI'); |
| 13 | 13 | $modx->loadExtension('phpass'); |
| 14 | 14 | |
| 15 | -$core_path = MODX_MANAGER_PATH . 'includes/'; |
|
| 15 | +$core_path = MODX_MANAGER_PATH.'includes/'; |
|
| 16 | 16 | // include_once the language file |
| 17 | 17 | $_lang = array(); |
| 18 | 18 | include_once("{$core_path}lang/english.inc.php"); |
| 19 | 19 | |
| 20 | -if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
| 20 | +if ($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
| 21 | 21 | include_once("{$core_path}lang/{$manager_language}.inc.php"); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | include_once("{$core_path}log.class.inc.php"); |
| 26 | 26 | |
| 27 | 27 | // Initialize System Alert Message Queque |
| 28 | -if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
| 28 | +if (!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
| 29 | 29 | $_SESSION['SystemAlertMsgQueque'] = array(); |
| 30 | 30 | } |
| 31 | 31 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $rs = $modx->db->select($fields, $from, $where); |
| 52 | 52 | $limit = $modx->db->getRecordCount($rs); |
| 53 | 53 | |
| 54 | -if($limit == 0 || $limit > 1) { |
|
| 54 | +if ($limit == 0 || $limit > 1) { |
|
| 55 | 55 | jsAlert($_lang['login_processor_unknown_user']); |
| 56 | 56 | return; |
| 57 | 57 | } |
@@ -73,32 +73,32 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // get the user settings from the database |
| 75 | 75 | $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
| 76 | -while($row = $modx->db->getRow($rs)) { |
|
| 76 | +while ($row = $modx->db->getRow($rs)) { |
|
| 77 | 77 | extract($row); |
| 78 | 78 | ${$setting_name} = $setting_value; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // blocked due to number of login errors. |
| 82 | -if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
| 82 | +if ($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
| 83 | 83 | @session_destroy(); |
| 84 | 84 | session_unset(); |
| 85 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
| 85 | + if ($cip = getenv("HTTP_CLIENT_IP")) { |
|
| 86 | 86 | $ip = $cip; |
| 87 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
| 87 | + } elseif ($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
| 88 | 88 | $ip = $cip; |
| 89 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
| 89 | + } elseif ($cip = getenv("REMOTE_ADDR")) { |
|
| 90 | 90 | $ip = $cip; |
| 91 | 91 | } else { |
| 92 | 92 | $ip = "UNKNOWN"; |
| 93 | 93 | } |
| 94 | 94 | $log = new logHandler; |
| 95 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
| 95 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: ".$ip); |
|
| 96 | 96 | jsAlert($_lang['login_processor_many_failed_logins']); |
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // blocked due to number of login errors, but get to try again |
| 101 | -if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
| 101 | +if ($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
| 102 | 102 | $fields = array(); |
| 103 | 103 | $fields['failedlogincount'] = '0'; |
| 104 | 104 | $fields['blockeduntil'] = time() - 1; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // this user has been blocked by an admin, so no way he's loggin in! |
| 109 | -if($blocked == '1') { |
|
| 109 | +if ($blocked == '1') { |
|
| 110 | 110 | @session_destroy(); |
| 111 | 111 | session_unset(); |
| 112 | 112 | jsAlert($_lang['login_processor_blocked1']); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // blockuntil: this user has a block until date |
| 117 | -if($blockeduntildate > time()) { |
|
| 117 | +if ($blockeduntildate > time()) { |
|
| 118 | 118 | @session_destroy(); |
| 119 | 119 | session_unset(); |
| 120 | 120 | jsAlert($_lang['login_processor_blocked2']); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // blockafter: this user has a block after date |
| 125 | -if($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
| 125 | +if ($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
| 126 | 126 | @session_destroy(); |
| 127 | 127 | session_unset(); |
| 128 | 128 | jsAlert($_lang['login_processor_blocked3']); |
@@ -130,24 +130,24 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // allowed ip |
| 133 | -if($allowed_ip) { |
|
| 134 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 135 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 133 | +if ($allowed_ip) { |
|
| 134 | + if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 135 | + if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 136 | 136 | jsAlert($_lang['login_processor_remotehost_ip']); |
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 140 | + if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 141 | 141 | jsAlert($_lang['login_processor_remote_ip']); |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // allowed days |
| 147 | -if($allowed_days) { |
|
| 147 | +if ($allowed_days) { |
|
| 148 | 148 | $date = getdate(); |
| 149 | 149 | $day = $date['wday'] + 1; |
| 150 | - if(strpos($allowed_days, $day) === false) { |
|
| 150 | + if (strpos($allowed_days, $day) === false) { |
|
| 151 | 151 | jsAlert($_lang['login_processor_date']); |
| 152 | 152 | return; |
| 153 | 153 | } |
@@ -164,33 +164,33 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | // check if plugin authenticated the user |
| 166 | 166 | $matchPassword = false; |
| 167 | -if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
| 167 | +if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
| 168 | 168 | // check user password - local authentication |
| 169 | 169 | $hashType = $modx->manager->getHashType($dbasePassword); |
| 170 | - if($hashType == 'phpass') { |
|
| 170 | + if ($hashType == 'phpass') { |
|
| 171 | 171 | $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
| 172 | - } elseif($hashType == 'md5') { |
|
| 172 | + } elseif ($hashType == 'md5') { |
|
| 173 | 173 | $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
| 174 | - } elseif($hashType == 'v1') { |
|
| 174 | + } elseif ($hashType == 'v1') { |
|
| 175 | 175 | $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
| 176 | 176 | } else { |
| 177 | 177 | $matchPassword = false; |
| 178 | 178 | } |
| 179 | -} else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
| 179 | +} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
| 180 | 180 | $matchPassword = true; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | -if(!$matchPassword) { |
|
| 183 | +if (!$matchPassword) { |
|
| 184 | 184 | jsAlert($_lang['login_processor_wrong_password']); |
| 185 | 185 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
| 186 | 186 | return; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | -if($modx->config['use_captcha'] == 1) { |
|
| 190 | - if(!isset ($_SESSION['veriword'])) { |
|
| 189 | +if ($modx->config['use_captcha'] == 1) { |
|
| 190 | + if (!isset ($_SESSION['veriword'])) { |
|
| 191 | 191 | jsAlert($_lang['login_processor_captcha_config']); |
| 192 | 192 | return; |
| 193 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
| 193 | + } elseif ($_SESSION['veriword'] != $captcha_code) { |
|
| 194 | 194 | jsAlert($_lang['login_processor_bad_code']); |
| 195 | 195 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
| 196 | 196 | return; |
@@ -218,17 +218,17 @@ discard block |
||
| 218 | 218 | $_SESSION['mgrPermissions'] = $modx->db->getRow($rs); |
| 219 | 219 | |
| 220 | 220 | // successful login so reset fail count and update key values |
| 221 | -$modx->db->update('failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
| 221 | +$modx->db->update('failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
| 222 | 222 | |
| 223 | 223 | // get user's document groups |
| 224 | 224 | $i = 0; |
| 225 | -$rs = $modx->db->select('uga.documentgroup', $modx->getFullTableName('member_groups') . ' ug |
|
| 226 | - INNER JOIN ' . $modx->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
| 225 | +$rs = $modx->db->select('uga.documentgroup', $modx->getFullTableName('member_groups').' ug |
|
| 226 | + INNER JOIN ' . $modx->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
| 227 | 227 | $_SESSION['mgrDocgroups'] = $modx->db->getColumn('documentgroup', $rs); |
| 228 | 228 | |
| 229 | 229 | $_SESSION['mgrToken'] = md5($currentsessionid); |
| 230 | 230 | |
| 231 | -if($rememberme == '1') { |
|
| 231 | +if ($rememberme == '1') { |
|
| 232 | 232 | $_SESSION['modx.mgr.session.cookie.lifetime'] = intval($modx->config['session.cookie.lifetime']); |
| 233 | 233 | |
| 234 | 234 | // Set a cookie separate from the session cookie with the username in it. |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | global $https_port; |
| 237 | 237 | |
| 238 | 238 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
| 239 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 239 | + if (version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 240 | 240 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
| 241 | 241 | } else { |
| 242 | 242 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | // Check if user already has an active session, if not check if user pressed logout end of last session |
| 252 | 252 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
| 253 | 253 | $activeSession = $modx->db->getValue($rs); |
| 254 | -if(!$activeSession) { |
|
| 254 | +if (!$activeSession) { |
|
| 255 | 255 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
| 256 | - if($lastHit = $modx->db->getValue($rs)) { |
|
| 256 | + if ($lastHit = $modx->db->getValue($rs)) { |
|
| 257 | 257 | $_SESSION['show_logout_reminder'] = array( |
| 258 | 258 | 'type' => 'logout_reminder', |
| 259 | 259 | 'lastHit' => $lastHit |
@@ -275,16 +275,16 @@ discard block |
||
| 275 | 275 | // check if we should redirect user to a web page |
| 276 | 276 | $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
| 277 | 277 | $id = intval($modx->db->getValue($rs)); |
| 278 | -if($id > 0) { |
|
| 279 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
| 280 | - if($_POST['ajax'] == 1) { |
|
| 278 | +if ($id > 0) { |
|
| 279 | + $header = 'Location: '.$modx->makeUrl($id, '', '', 'full'); |
|
| 280 | + if ($_POST['ajax'] == 1) { |
|
| 281 | 281 | echo $header; |
| 282 | 282 | } else { |
| 283 | 283 | header($header); |
| 284 | 284 | } |
| 285 | 285 | } else { |
| 286 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
| 287 | - if($_POST['ajax'] == 1) { |
|
| 286 | + $header = 'Location: '.MODX_MANAGER_URL; |
|
| 287 | + if ($_POST['ajax'] == 1) { |
|
| 288 | 288 | echo $header; |
| 289 | 289 | } else { |
| 290 | 290 | header($header); |
@@ -292,35 +292,35 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // show javascript alert |
| 295 | -function jsAlert($msg) { |
|
| 295 | +function jsAlert($msg){ |
|
| 296 | 296 | global $modx; |
| 297 | - if($_POST['ajax'] != 1) { |
|
| 298 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
| 297 | + if ($_POST['ajax'] != 1) { |
|
| 298 | + echo "<script>window.setTimeout(\"alert('".addslashes($modx->db->escape($msg))."')\",10);history.go(-1)</script>"; |
|
| 299 | 299 | } else { |
| 300 | - echo $msg . "\n"; |
|
| 300 | + echo $msg."\n"; |
|
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | -function login($username, $givenPassword, $dbasePassword) { |
|
| 304 | +function login($username, $givenPassword, $dbasePassword){ |
|
| 305 | 305 | global $modx; |
| 306 | 306 | return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | -function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
|
| 309 | +function loginV1($internalKey, $givenPassword, $dbasePassword, $username){ |
|
| 310 | 310 | global $modx; |
| 311 | 311 | |
| 312 | 312 | $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
| 313 | 313 | |
| 314 | - if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
| 314 | + if (!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
| 315 | 315 | $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
| 318 | + if ($user_algo !== $modx->config['pwd_hash_algo']) { |
|
| 319 | 319 | $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
| 320 | 320 | $modx->config['pwd_hash_algo'] = $user_algo; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
| 323 | + if ($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
| 324 | 324 | return false; |
| 325 | 325 | } |
| 326 | 326 | |
@@ -329,17 +329,17 @@ discard block |
||
| 329 | 329 | return true; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | -function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
|
| 332 | +function loginMD5($internalKey, $givenPassword, $dbasePassword, $username){ |
|
| 333 | 333 | global $modx; |
| 334 | 334 | |
| 335 | - if($dbasePassword != md5($givenPassword)) { |
|
| 335 | + if ($dbasePassword != md5($givenPassword)) { |
|
| 336 | 336 | return false; |
| 337 | 337 | } |
| 338 | 338 | updateNewHash($username, $givenPassword); |
| 339 | 339 | return true; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | -function updateNewHash($username, $password) { |
|
| 342 | +function updateNewHash($username, $password){ |
|
| 343 | 343 | global $modx; |
| 344 | 344 | |
| 345 | 345 | $field = array(); |
@@ -347,23 +347,23 @@ discard block |
||
| 347 | 347 | $modx->db->update($field, '[+prefix+]manager_users', "username='{$username}'"); |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | -function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
|
| 350 | +function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes){ |
|
| 351 | 351 | global $modx; |
| 352 | 352 | |
| 353 | 353 | $failedlogins += 1; |
| 354 | 354 | |
| 355 | 355 | $fields = array('failedlogincount' => $failedlogins); |
| 356 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
| 356 | + if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
| 357 | 357 | { |
| 358 | 358 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
| 362 | 362 | |
| 363 | - if($failedlogins < $failed_allowed) { |
|
| 363 | + if ($failedlogins < $failed_allowed) { |
|
| 364 | 364 | //sleep to help prevent brute force attacks |
| 365 | 365 | $sleep = (int) $failedlogins / 2; |
| 366 | - if($sleep > 5) { |
|
| 366 | + if ($sleep > 5) { |
|
| 367 | 367 | $sleep = 5; |
| 368 | 368 | } |
| 369 | 369 | sleep($sleep); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $sitemenu['site'] = array( |
| 22 | 22 | 'site', |
| 23 | 23 | 'main', |
| 24 | - '<i class="fa fa-home"></i>' . $_lang['home'], |
|
| 24 | + '<i class="fa fa-home"></i>'.$_lang['home'], |
|
| 25 | 25 | 'index.php?a=2', |
| 26 | 26 | $_lang['home'], |
| 27 | 27 | '', |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | 'active' |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | -if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
|
|
| 35 | +if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
|
|
| 36 | 36 | $sitemenu['elements'] = array( |
| 37 | 37 | 'elements', |
| 38 | 38 | 'main', |
| 39 | - '<i class="fa fa-th"></i>' . $_lang['elements'], |
|
| 39 | + '<i class="fa fa-th"></i>'.$_lang['elements'], |
|
| 40 | 40 | 'javascript:;', |
| 41 | 41 | $_lang['elements'], |
| 42 | 42 | ' return false;', |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | ); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if($modx->hasPermission('exec_module')) {
|
|
| 51 | +if ($modx->hasPermission('exec_module')) {
|
|
| 52 | 52 | $sitemenu['modules'] = array( |
| 53 | 53 | 'modules', |
| 54 | 54 | 'main', |
| 55 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['modules'], |
|
| 55 | + '<i class="'.$_style['icons_modules'].'"></i>'.$_lang['modules'], |
|
| 56 | 56 | 'javascript:;', |
| 57 | 57 | $_lang['modules'], |
| 58 | 58 | ' return false;', |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | ); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | -if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
|
|
| 67 | +if ($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
|
|
| 68 | 68 | $sitemenu['users'] = array( |
| 69 | 69 | 'users', |
| 70 | 70 | 'main', |
| 71 | - '<i class="fa fa-users"></i>' . $_lang['users'], |
|
| 71 | + '<i class="fa fa-users"></i>'.$_lang['users'], |
|
| 72 | 72 | 'javascript:;', |
| 73 | 73 | $_lang['users'], |
| 74 | 74 | ' return false;', |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | ); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
|
|
| 83 | +if ($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
|
|
| 84 | 84 | $sitemenu['tools'] = array( |
| 85 | 85 | 'tools', |
| 86 | 86 | 'main', |
| 87 | - '<i class="fa fa-wrench"></i>' . $_lang['tools'], |
|
| 87 | + '<i class="fa fa-wrench"></i>'.$_lang['tools'], |
|
| 88 | 88 | 'javascript:;', |
| 89 | 89 | $_lang['tools'], |
| 90 | 90 | ' return false;', |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $tab = 0; |
| 100 | -if($modx->hasPermission('edit_template')) {
|
|
| 100 | +if ($modx->hasPermission('edit_template')) {
|
|
| 101 | 101 | $sitemenu['element_templates'] = array( |
| 102 | 102 | 'element_templates', |
| 103 | 103 | 'elements', |
| 104 | - '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 105 | - 'index.php?a=76&tab=' . $tab++, |
|
| 104 | + '<i class="fa fa-newspaper-o"></i>'.$_lang['manage_templates'].'<i class="fa fa-angle-right toggle"></i>', |
|
| 105 | + 'index.php?a=76&tab='.$tab++, |
|
| 106 | 106 | $_lang['manage_templates'], |
| 107 | 107 | '', |
| 108 | 108 | 'new_template,edit_template', |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | 'dropdown-toggle' |
| 113 | 113 | ); |
| 114 | 114 | } |
| 115 | -if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
|
|
| 115 | +if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
|
|
| 116 | 116 | $sitemenu['element_tplvars'] = array( |
| 117 | 117 | 'element_tplvars', |
| 118 | 118 | 'elements', |
| 119 | - '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 120 | - 'index.php?a=76&tab=' . $tab++, |
|
| 119 | + '<i class="fa fa-list-alt"></i>'.$_lang['tmplvars'].'<i class="fa fa-angle-right toggle"></i>', |
|
| 120 | + 'index.php?a=76&tab='.$tab++, |
|
| 121 | 121 | $_lang['tmplvars'], |
| 122 | 122 | '', |
| 123 | 123 | 'new_template,edit_template', |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | 'dropdown-toggle' |
| 128 | 128 | ); |
| 129 | 129 | } |
| 130 | -if($modx->hasPermission('edit_chunk')) {
|
|
| 130 | +if ($modx->hasPermission('edit_chunk')) {
|
|
| 131 | 131 | $sitemenu['element_htmlsnippets'] = array( |
| 132 | 132 | 'element_htmlsnippets', |
| 133 | 133 | 'elements', |
| 134 | - '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 135 | - 'index.php?a=76&tab=' . $tab++, |
|
| 134 | + '<i class="fa fa-th-large"></i>'.$_lang['manage_htmlsnippets'].'<i class="fa fa-angle-right toggle"></i>', |
|
| 135 | + 'index.php?a=76&tab='.$tab++, |
|
| 136 | 136 | $_lang['manage_htmlsnippets'], |
| 137 | 137 | '', |
| 138 | 138 | 'new_chunk,edit_chunk', |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | 'dropdown-toggle' |
| 143 | 143 | ); |
| 144 | 144 | } |
| 145 | -if($modx->hasPermission('edit_snippet')) {
|
|
| 145 | +if ($modx->hasPermission('edit_snippet')) {
|
|
| 146 | 146 | $sitemenu['element_snippets'] = array( |
| 147 | 147 | 'element_snippets', |
| 148 | 148 | 'elements', |
| 149 | - '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 150 | - 'index.php?a=76&tab=' . $tab++, |
|
| 149 | + '<i class="fa fa-code"></i>'.$_lang['manage_snippets'].'<i class="fa fa-angle-right toggle"></i>', |
|
| 150 | + 'index.php?a=76&tab='.$tab++, |
|
| 151 | 151 | $_lang['manage_snippets'], |
| 152 | 152 | '', |
| 153 | 153 | 'new_snippet,edit_snippet', |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | 'dropdown-toggle' |
| 158 | 158 | ); |
| 159 | 159 | } |
| 160 | -if($modx->hasPermission('edit_plugin')) {
|
|
| 160 | +if ($modx->hasPermission('edit_plugin')) {
|
|
| 161 | 161 | $sitemenu['element_plugins'] = array( |
| 162 | 162 | 'element_plugins', |
| 163 | 163 | 'elements', |
| 164 | - '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 165 | - 'index.php?a=76&tab=' . $tab++, |
|
| 164 | + '<i class="fa fa-plug"></i>'.$_lang['manage_plugins'].'<i class="fa fa-angle-right toggle"></i>', |
|
| 165 | + 'index.php?a=76&tab='.$tab++, |
|
| 166 | 166 | $_lang['manage_plugins'], |
| 167 | 167 | '', |
| 168 | 168 | 'new_plugin,edit_plugin', |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | //$sitemenu['element_categories'] = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,'');
|
| 176 | 176 | |
| 177 | -if($modx->hasPermission('file_manager')) {
|
|
| 177 | +if ($modx->hasPermission('file_manager')) {
|
|
| 178 | 178 | $sitemenu['manage_files'] = array( |
| 179 | 179 | 'manage_files', |
| 180 | 180 | 'elements', |
| 181 | - '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
| 181 | + '<i class="fa fa-folder-open-o"></i>'.$_lang['manage_files'], |
|
| 182 | 182 | 'index.php?a=31', |
| 183 | 183 | $_lang['manage_files'], |
| 184 | 184 | '', |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | '' |
| 190 | 190 | ); |
| 191 | 191 | } |
| 192 | -if($modx->hasPermission('category_manager')) {
|
|
| 192 | +if ($modx->hasPermission('category_manager')) {
|
|
| 193 | 193 | $sitemenu['manage_categories'] = array( |
| 194 | 194 | 'manage_categories', |
| 195 | 195 | 'elements', |
| 196 | - '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
| 196 | + '<i class="fa fa-object-group"></i>'.$_lang['manage_categories'], |
|
| 197 | 197 | 'index.php?a=120', |
| 198 | 198 | $_lang['manage_categories'], |
| 199 | 199 | '', |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // Modules Menu Items |
| 209 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
|
|
| 209 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
|
|
| 210 | 210 | $sitemenu['new_module'] = array( |
| 211 | 211 | 'new_module', |
| 212 | 212 | 'modules', |
| 213 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
| 213 | + '<i class="'.$_style['icons_modules'].'"></i>'.$_lang['module_management'], |
|
| 214 | 214 | 'index.php?a=106', |
| 215 | 215 | $_lang['module_management'], |
| 216 | 216 | '', |
@@ -222,24 +222,24 @@ discard block |
||
| 222 | 222 | ); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | -if($modx->hasPermission('exec_module')) {
|
|
| 226 | - if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
|
|
| 225 | +if ($modx->hasPermission('exec_module')) {
|
|
| 226 | + if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
|
|
| 227 | 227 | $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
|
| 228 | - FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
|
|
| 229 | - LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
|
|
| 230 | - LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
|
|
| 231 | - WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
|
| 228 | + FROM ' . $modx->getFullTableName('site_modules').' AS sm
|
|
| 229 | + LEFT JOIN ' . $modx->getFullTableName('site_module_access').' AS sma ON sma.module = sm.id
|
|
| 230 | + LEFT JOIN ' . $modx->getFullTableName('member_groups').' AS mg ON sma.usergroup = mg.user_group
|
|
| 231 | + WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID().') AND sm.disabled != 1 AND sm.locked != 1 |
|
| 232 | 232 | ORDER BY sm.name'); |
| 233 | 233 | } else {
|
| 234 | 234 | $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
|
| 235 | 235 | } |
| 236 | - if($modx->db->getRecordCount($rs)) {
|
|
| 236 | + if ($modx->db->getRecordCount($rs)) {
|
|
| 237 | 237 | while ($row = $modx->db->getRow($rs)) {
|
| 238 | - $sitemenu['module' . $row['id']] = array( |
|
| 239 | - 'module' . $row['id'], |
|
| 238 | + $sitemenu['module'.$row['id']] = array( |
|
| 239 | + 'module'.$row['id'], |
|
| 240 | 240 | 'modules', |
| 241 | - ($row['icon'] != '' ? '<i class="'.$row['icon'].'"></i>' : '<i class="'.$_style['icons_module'].'"></i>') . $row['name'], |
|
| 242 | - 'index.php?a=112&id=' . $row['id'], |
|
| 241 | + ($row['icon'] != '' ? '<i class="'.$row['icon'].'"></i>' : '<i class="'.$_style['icons_module'].'"></i>').$row['name'], |
|
| 242 | + 'index.php?a=112&id='.$row['id'], |
|
| 243 | 243 | $row['name'], |
| 244 | 244 | '', |
| 245 | 245 | '', |
@@ -254,11 +254,11 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | // security menu items (users) |
| 256 | 256 | |
| 257 | -if($modx->hasPermission('edit_user')) {
|
|
| 257 | +if ($modx->hasPermission('edit_user')) {
|
|
| 258 | 258 | $sitemenu['user_management_title'] = array( |
| 259 | 259 | 'user_management_title', |
| 260 | 260 | 'users', |
| 261 | - '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 261 | + '<i class="fa fa fa-user"></i>'.$_lang['user_management_title'].'<i class="fa fa-angle-right toggle"></i>', |
|
| 262 | 262 | 'index.php?a=75', |
| 263 | 263 | $_lang['user_management_title'], |
| 264 | 264 | '', |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | ); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | -if($modx->hasPermission('edit_web_user')) {
|
|
| 273 | +if ($modx->hasPermission('edit_web_user')) {
|
|
| 274 | 274 | $sitemenu['web_user_management_title'] = array( |
| 275 | 275 | 'web_user_management_title', |
| 276 | 276 | 'users', |
| 277 | - '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 277 | + '<i class="fa fa-users"></i>'.$_lang['web_user_management_title'].'<i class="fa fa-angle-right toggle"></i>', |
|
| 278 | 278 | 'index.php?a=99', |
| 279 | 279 | $_lang['web_user_management_title'], |
| 280 | 280 | '', |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | ); |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | -if($modx->hasPermission('edit_role')) {
|
|
| 289 | +if ($modx->hasPermission('edit_role')) {
|
|
| 290 | 290 | $sitemenu['role_management_title'] = array( |
| 291 | 291 | 'role_management_title', |
| 292 | 292 | 'users', |
| 293 | - '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
| 293 | + '<i class="fa fa-legal"></i>'.$_lang['role_management_title'], |
|
| 294 | 294 | 'index.php?a=86', |
| 295 | 295 | $_lang['role_management_title'], |
| 296 | 296 | '', |
@@ -302,11 +302,11 @@ discard block |
||
| 302 | 302 | ); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | -if($modx->hasPermission('access_permissions')) {
|
|
| 305 | +if ($modx->hasPermission('access_permissions')) {
|
|
| 306 | 306 | $sitemenu['manager_permissions'] = array( |
| 307 | 307 | 'manager_permissions', |
| 308 | 308 | 'users', |
| 309 | - '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
| 309 | + '<i class="fa fa-male"></i>'.$_lang['manager_permissions'], |
|
| 310 | 310 | 'index.php?a=40', |
| 311 | 311 | $_lang['manager_permissions'], |
| 312 | 312 | '', |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | ); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | -if($modx->hasPermission('web_access_permissions')) {
|
|
| 321 | +if ($modx->hasPermission('web_access_permissions')) {
|
|
| 322 | 322 | $sitemenu['web_permissions'] = array( |
| 323 | 323 | 'web_permissions', |
| 324 | 324 | 'users', |
| 325 | - '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
| 325 | + '<i class="fa fa-universal-access"></i>'.$_lang['web_permissions'], |
|
| 326 | 326 | 'index.php?a=91', |
| 327 | 327 | $_lang['web_permissions'], |
| 328 | 328 | '', |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $sitemenu['refresh_site'] = array( |
| 340 | 340 | 'refresh_site', |
| 341 | 341 | 'tools', |
| 342 | - '<i class="fa fa-recycle"></i>' . $_lang['refresh_site'], |
|
| 342 | + '<i class="fa fa-recycle"></i>'.$_lang['refresh_site'], |
|
| 343 | 343 | 'index.php?a=26', |
| 344 | 344 | $_lang['refresh_site'], |
| 345 | 345 | '', |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | 'a', // tag |
| 354 | 354 | 'javascript:;', // href |
| 355 | 355 | 'btn btn-secondary', // class or btn-success |
| 356 | - 'modx.popup({url:\'index.php?a=26\', title:\'' . $_lang['refresh_site'] . '\', icon: \'fa-recycle\', iframe: \'ajax\', selector: \'.tab-page>.container\', position: \'right top\', width: \'auto\', maxheight: \'50%\', wrap: \'body\' })', // onclick
|
|
| 356 | + 'modx.popup({url:\'index.php?a=26\', title:\''.$_lang['refresh_site'].'\', icon: \'fa-recycle\', iframe: \'ajax\', selector: \'.tab-page>.container\', position: \'right top\', width: \'auto\', maxheight: \'50%\', wrap: \'body\' })', // onclick
|
|
| 357 | 357 | $_lang['refresh_site'], // title |
| 358 | 358 | '<i class="fa fa-recycle"></i>' // innerHTML |
| 359 | 359 | ) |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $sitemenu['search'] = array( |
| 364 | 364 | 'search', |
| 365 | 365 | 'tools', |
| 366 | - '<i class="fa fa-search"></i>' . $_lang['search'], |
|
| 366 | + '<i class="fa fa-search"></i>'.$_lang['search'], |
|
| 367 | 367 | 'index.php?a=71', |
| 368 | 368 | $_lang['search'], |
| 369 | 369 | '', |
@@ -374,11 +374,11 @@ discard block |
||
| 374 | 374 | '' |
| 375 | 375 | ); |
| 376 | 376 | |
| 377 | -if($modx->hasPermission('bk_manager')) {
|
|
| 377 | +if ($modx->hasPermission('bk_manager')) {
|
|
| 378 | 378 | $sitemenu['bk_manager'] = array( |
| 379 | 379 | 'bk_manager', |
| 380 | 380 | 'tools', |
| 381 | - '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
| 381 | + '<i class="fa fa-database"></i>'.$_lang['bk_manager'], |
|
| 382 | 382 | 'index.php?a=93', |
| 383 | 383 | $_lang['bk_manager'], |
| 384 | 384 | '', |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | ); |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | -if($modx->hasPermission('remove_locks')) {
|
|
| 393 | +if ($modx->hasPermission('remove_locks')) {
|
|
| 394 | 394 | $sitemenu['remove_locks'] = array( |
| 395 | 395 | 'remove_locks', |
| 396 | 396 | 'tools', |
| 397 | - '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
| 397 | + '<i class="fa fa-hourglass"></i>'.$_lang['remove_locks'], |
|
| 398 | 398 | 'javascript:modx.removeLocks();', |
| 399 | 399 | $_lang['remove_locks'], |
| 400 | 400 | '', |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | ); |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | -if($modx->hasPermission('import_static')) {
|
|
| 409 | +if ($modx->hasPermission('import_static')) {
|
|
| 410 | 410 | $sitemenu['import_site'] = array( |
| 411 | 411 | 'import_site', |
| 412 | 412 | 'tools', |
| 413 | - '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
| 413 | + '<i class="fa fa-upload"></i>'.$_lang['import_site'], |
|
| 414 | 414 | 'index.php?a=95', |
| 415 | 415 | $_lang['import_site'], |
| 416 | 416 | '', |
@@ -422,11 +422,11 @@ discard block |
||
| 422 | 422 | ); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | -if($modx->hasPermission('export_static')) {
|
|
| 425 | +if ($modx->hasPermission('export_static')) {
|
|
| 426 | 426 | $sitemenu['export_site'] = array( |
| 427 | 427 | 'export_site', |
| 428 | 428 | 'tools', |
| 429 | - '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
| 429 | + '<i class="fa fa-download"></i>'.$_lang['export_site'], |
|
| 430 | 430 | 'index.php?a=83', |
| 431 | 431 | $_lang['export_site'], |
| 432 | 432 | '', |
@@ -439,20 +439,20 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu));
|
| 442 | -if(is_array($menu)) {
|
|
| 442 | +if (is_array($menu)) {
|
|
| 443 | 443 | $newmenu = array(); |
| 444 | - foreach($menu as $item){
|
|
| 445 | - if(is_array(unserialize($item))){
|
|
| 444 | + foreach ($menu as $item) {
|
|
| 445 | + if (is_array(unserialize($item))) {
|
|
| 446 | 446 | $newmenu = array_merge($newmenu, unserialize($item)); |
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | - if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
| 449 | + if (count($newmenu) > 0) $sitemenu = $newmenu; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | -if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) {
|
|
| 453 | - include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
| 452 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/includes/menu.class.inc.php')) {
|
|
| 453 | + include_once(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/includes/menu.class.inc.php'); |
|
| 454 | 454 | } else {
|
| 455 | - include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
| 455 | + include_once(MODX_MANAGER_PATH.'includes/menu.class.inc.php'); |
|
| 456 | 456 | } |
| 457 | 457 | $menu = new EVOmenu(); |
| 458 | 458 | $menu->Build($sitemenu, array( |