@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - $site_unavailable_message_view = isset($site_unavailable_message) ? $site_unavailable_message : $_lang['siteunavailable_message_default']; |
|
| 2 | + $site_unavailable_message_view = isset($site_unavailable_message) ? $site_unavailable_message : $_lang['siteunavailable_message_default']; |
|
| 3 | 3 | ?> |
| 4 | 4 | <style> |
| 5 | 5 | table.sysSettings > tbody td, table.sysSettings > tbody th {border-bottom:1px dotted #ccc;padding:10px;}
|
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | <?php |
| 136 | 136 | // Check if PHX is enabled |
| 137 | 137 | $count = $modx->getDatabase()->getRecordCount( |
| 138 | - $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_plugins'),
|
|
| 139 | - "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
|
| 138 | + $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_plugins'),
|
|
| 139 | + "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
|
| 140 | 140 | ); |
| 141 | 141 | if($count) {
|
| 142 | 142 | $disabledFilters = 1; |
@@ -259,14 +259,14 @@ 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'" : "" ; |
|
| 265 | - ?> |
|
| 262 | + for($i=-24; $i<25; $i++) {
|
|
| 263 | + $seconds = $i*60*60; |
|
| 264 | + $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
|
| 265 | + ?> |
|
| 266 | 266 | <option value="<?php echo $seconds; ?>" <?php echo $selectedtext; ?>><?php echo $i; ?></option> |
| 267 | 267 | <?php |
| 268 | - } |
|
| 269 | - ?> |
|
| 268 | + } |
|
| 269 | + ?> |
|
| 270 | 270 | </select> |
| 271 | 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> |
@@ -1,32 +1,32 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 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('web_access_permissions')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // find all document groups, for the select :) |
| 10 | 10 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('documentgroup_names'), '', 'name'); |
| 11 | 11 | if($modx->getDatabase()->getRecordCount($rs) < 1) { |
| 12 | - $docgroupselector = "[no groups to add]"; |
|
| 12 | + $docgroupselector = "[no groups to add]"; |
|
| 13 | 13 | } else { |
| 14 | - $docgroupselector = '<select name="docgroup">' . "\n"; |
|
| 15 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 16 | - $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
| 17 | - } |
|
| 18 | - $docgroupselector .= "</select>\n"; |
|
| 14 | + $docgroupselector = '<select name="docgroup">' . "\n"; |
|
| 15 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 16 | + $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
| 17 | + } |
|
| 18 | + $docgroupselector .= "</select>\n"; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('webgroup_names'), '', 'name'); |
| 22 | 22 | if($modx->getDatabase()->getRecordCount($rs) < 1) { |
| 23 | - $usrgroupselector = '[no user groups]'; |
|
| 23 | + $usrgroupselector = '[no user groups]'; |
|
| 24 | 24 | } else { |
| 25 | - $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
| 26 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 27 | - $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
| 28 | - } |
|
| 29 | - $usrgroupselector .= "</select>\n"; |
|
| 25 | + $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
| 26 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 27 | + $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
| 28 | + } |
|
| 29 | + $usrgroupselector .= "</select>\n"; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | ?> |
@@ -88,24 +88,24 @@ discard block |
||
| 88 | 88 | </form> |
| 89 | 89 | </div> |
| 90 | 90 | <?php |
| 91 | - $rs = $modx->getDatabase()->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getDatabase()->getFullTableName('webgroup_names') . " AS groupnames |
|
| 91 | + $rs = $modx->getDatabase()->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getDatabase()->getFullTableName('webgroup_names') . " AS groupnames |
|
| 92 | 92 | LEFT JOIN " . $modx->getDatabase()->getFullTableName('web_groups') . " AS groups ON groups.webgroup = groupnames.id |
| 93 | 93 | LEFT JOIN " . $modx->getDatabase()->getFullTableName('web_users') . " AS users ON users.id = groups.webuser", '', 'groupnames.name, user_name'); |
| 94 | - if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
| 95 | - ?> |
|
| 94 | + if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
| 95 | + ?> |
|
| 96 | 96 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
| 97 | 97 | <?php |
| 98 | - } else { |
|
| 99 | - ?> |
|
| 98 | + } else { |
|
| 99 | + ?> |
|
| 100 | 100 | <div class="form-group"> |
| 101 | 101 | <?php |
| 102 | - $pid = ''; |
|
| 103 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 104 | - if($pid != $row['id']) { |
|
| 105 | - if($pid != '') { |
|
| 106 | - echo '</div><div class="form-group">'; |
|
| 107 | - } |
|
| 108 | - ?> |
|
| 102 | + $pid = ''; |
|
| 103 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 104 | + if($pid != $row['id']) { |
|
| 105 | + if($pid != '') { |
|
| 106 | + echo '</div><div class="form-group">'; |
|
| 107 | + } |
|
| 108 | + ?> |
|
| 109 | 109 | <form method="post" action="index.php" name="accesspermissions"> |
| 110 | 110 | <input type="hidden" name="a" value="92" /> |
| 111 | 111 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -120,21 +120,21 @@ discard block |
||
| 120 | 120 | </form> |
| 121 | 121 | <?= $_lang['web_access_permissions_users_in_group'] ?> |
| 122 | 122 | <?php |
| 123 | - } |
|
| 124 | - if(!$row['user_id']) { |
|
| 125 | - ?> |
|
| 123 | + } |
|
| 124 | + if(!$row['user_id']) { |
|
| 125 | + ?> |
|
| 126 | 126 | <i><?= $_lang['access_permissions_no_users_in_group'] ?></i> |
| 127 | 127 | <?php |
| 128 | - $pid = $row['id']; |
|
| 129 | - continue; |
|
| 130 | - } |
|
| 131 | - ?> |
|
| 128 | + $pid = $row['id']; |
|
| 129 | + continue; |
|
| 130 | + } |
|
| 131 | + ?> |
|
| 132 | 132 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=88&id=<?= $row['user_id'] ?>"><?= $row['user_name'] ?></a> |
| 133 | 133 | <?php |
| 134 | - $pid = $row['id']; |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - ?> |
|
| 134 | + $pid = $row['id']; |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + ?> |
|
| 138 | 138 | </div> |
| 139 | 139 | </div> |
| 140 | 140 | </div> |
@@ -159,24 +159,24 @@ discard block |
||
| 159 | 159 | </form> |
| 160 | 160 | </div> |
| 161 | 161 | <?php |
| 162 | - $rs = $modx->getDatabase()->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getDatabase()->getFullTableName('documentgroup_names') . " AS dgnames |
|
| 162 | + $rs = $modx->getDatabase()->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getDatabase()->getFullTableName('documentgroup_names') . " AS dgnames |
|
| 163 | 163 | LEFT JOIN " . $modx->getDatabase()->getFullTableName('document_groups') . " AS dg ON dg.document_group = dgnames.id |
| 164 | 164 | LEFT JOIN " . $modx->getDatabase()->getFullTableName('site_content') . " AS sc ON sc.id = dg.document", '', 'dgnames.name, sc.id'); |
| 165 | - if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
| 166 | - ?> |
|
| 165 | + if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
| 166 | + ?> |
|
| 167 | 167 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
| 168 | 168 | <?php |
| 169 | - } else { |
|
| 170 | - ?> |
|
| 169 | + } else { |
|
| 170 | + ?> |
|
| 171 | 171 | <div class="form-group"> |
| 172 | 172 | <?php |
| 173 | - $pid = ''; |
|
| 174 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 175 | - if($pid != $row['id']) { |
|
| 176 | - if($pid != '') { |
|
| 177 | - echo '</div><div class="form-group">'; |
|
| 178 | - } |
|
| 179 | - ?> |
|
| 173 | + $pid = ''; |
|
| 174 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 175 | + if($pid != $row['id']) { |
|
| 176 | + if($pid != '') { |
|
| 177 | + echo '</div><div class="form-group">'; |
|
| 178 | + } |
|
| 179 | + ?> |
|
| 180 | 180 | <form method="post" action="index.php" name="accesspermissions"> |
| 181 | 181 | <input type="hidden" name="a" value="92" /> |
| 182 | 182 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -191,21 +191,21 @@ discard block |
||
| 191 | 191 | </form> |
| 192 | 192 | <?= $_lang['access_permissions_resources_in_group'] ?> |
| 193 | 193 | <?php |
| 194 | - } |
|
| 195 | - if(!$row['doc_id']) { |
|
| 196 | - ?> |
|
| 194 | + } |
|
| 195 | + if(!$row['doc_id']) { |
|
| 196 | + ?> |
|
| 197 | 197 | <i><?= $_lang['access_permissions_no_resources_in_group'] ?></i> |
| 198 | 198 | <?php |
| 199 | - $pid = $row['id']; |
|
| 200 | - continue; |
|
| 201 | - } |
|
| 202 | - ?> |
|
| 199 | + $pid = $row['id']; |
|
| 200 | + continue; |
|
| 201 | + } |
|
| 202 | + ?> |
|
| 203 | 203 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=3&id=<?= $row['doc_id'] ?>" title="<?= $modx->getPhpCompat()->htmlspecialchars($row['doc_title']) ?>"><?= $row['doc_id'] ?></a> |
| 204 | 204 | <?php |
| 205 | - $pid = $row['id']; |
|
| 206 | - } |
|
| 207 | - } |
|
| 208 | - ?> |
|
| 205 | + $pid = $row['id']; |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | + ?> |
|
| 209 | 209 | </div> |
| 210 | 210 | </div> |
| 211 | 211 | </div> |
@@ -217,15 +217,15 @@ discard block |
||
| 217 | 217 | <div class="container container-body"> |
| 218 | 218 | <p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p> |
| 219 | 219 | <?php |
| 220 | - $rs = $modx->getDatabase()->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getDatabase()->getFullTableName('webgroup_names') . " AS groupnames |
|
| 220 | + $rs = $modx->getDatabase()->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getDatabase()->getFullTableName('webgroup_names') . " AS groupnames |
|
| 221 | 221 | LEFT JOIN " . $modx->getDatabase()->getFullTableName('webgroup_access') . " AS groupacc ON groupacc.webgroup = groupnames.id |
| 222 | 222 | LEFT JOIN " . $modx->getDatabase()->getFullTableName('documentgroup_names') . " AS dgnames ON dgnames.id = groupacc.documentgroup", '', 'name, dg_name'); |
| 223 | - if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
| 224 | - ?> |
|
| 223 | + if($modx->getDatabase()->getRecordCount($rs) < 1) { |
|
| 224 | + ?> |
|
| 225 | 225 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
| 226 | 226 | <?php |
| 227 | - } else { |
|
| 228 | - ?> |
|
| 227 | + } else { |
|
| 228 | + ?> |
|
| 229 | 229 | <div class="form-group"> |
| 230 | 230 | <b><?= $_lang["access_permissions_group_link"] ?></b> |
| 231 | 231 | <form method="post" action="index.php" name="accesspermissions"> |
@@ -241,38 +241,38 @@ discard block |
||
| 241 | 241 | <hr> |
| 242 | 242 | <ul> |
| 243 | 243 | <?php |
| 244 | - $pid = ''; |
|
| 245 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 246 | - if($row['id'] != $pid) { |
|
| 247 | - if($pid != '') { |
|
| 248 | - echo '</ul></li>'; |
|
| 249 | - } // close previous one |
|
| 250 | - ?> |
|
| 244 | + $pid = ''; |
|
| 245 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 246 | + if($row['id'] != $pid) { |
|
| 247 | + if($pid != '') { |
|
| 248 | + echo '</ul></li>'; |
|
| 249 | + } // close previous one |
|
| 250 | + ?> |
|
| 251 | 251 | <li><b><?= $row['name'] ?></b></li> |
| 252 | 252 | <?php |
| 253 | - if(!$row['dg_id']) { |
|
| 254 | - echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
| 255 | - $pid = ''; |
|
| 256 | - continue; |
|
| 257 | - } else { |
|
| 258 | - echo '<ul>'; |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - if(!$row['dg_id']) { |
|
| 262 | - continue; |
|
| 263 | - } |
|
| 264 | - ?> |
|
| 253 | + if(!$row['dg_id']) { |
|
| 254 | + echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
| 255 | + $pid = ''; |
|
| 256 | + continue; |
|
| 257 | + } else { |
|
| 258 | + echo '<ul>'; |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + if(!$row['dg_id']) { |
|
| 262 | + continue; |
|
| 263 | + } |
|
| 264 | + ?> |
|
| 265 | 265 | <li><?= $row['dg_name'] ?> |
| 266 | 266 | <small><i>(<a class="text-danger" href="index.php?a=92&coupling=<?= $row['link_id'] ?>&operation=remove_document_group_from_user_group"><?= $_lang['remove'] ?></a>)</i></small> |
| 267 | 267 | </li> |
| 268 | 268 | <?php |
| 269 | - $pid = $row['id']; |
|
| 270 | - } |
|
| 271 | - ?> |
|
| 269 | + $pid = $row['id']; |
|
| 270 | + } |
|
| 271 | + ?> |
|
| 272 | 272 | </ul> |
| 273 | 273 | <?php |
| 274 | - } |
|
| 275 | - ?> |
|
| 274 | + } |
|
| 275 | + ?> |
|
| 276 | 276 | </div> |
| 277 | 277 | </div> |
| 278 | 278 | |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('settings')) {
|
| 6 | - $modx->webAlertAndQuit($_lang['error_no_privileges']); |
|
| 6 | + $modx->webAlertAndQuit($_lang['error_no_privileges']); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // check to see the edit settings page isn't locked |
| 10 | 10 | $rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=17 AND internalKey!='" . $modx->getLoginUserID() . "'");
|
| 11 | 11 | if($username = $modx->getDatabase()->getValue($rs)) {
|
| 12 | - $modx->webAlertAndQuit(sprintf($_lang['lock_settings_msg'], $username)); |
|
| 12 | + $modx->webAlertAndQuit(sprintf($_lang['lock_settings_msg'], $username)); |
|
| 13 | 13 | } |
| 14 | 14 | // end check for lock |
| 15 | 15 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | include_once(MODX_MANAGER_PATH . 'includes/default_config.php'); |
| 20 | 20 | $rs = $modx->getDatabase()->select('setting_name, setting_value', $modx->getDatabase()->getFullTableName('system_settings'));
|
| 21 | 21 | while($row = $modx->getDatabase()->getRow($rs)) {
|
| 22 | - $settings[$row['setting_name']] = $row['setting_value']; |
|
| 22 | + $settings[$row['setting_name']] = $row['setting_value']; |
|
| 23 | 23 | } |
| 24 | 24 | $settings['filemanager_path'] = preg_replace('@^' . preg_quote(MODX_BASE_PATH) . '@', '[(base_path)]', $settings['filemanager_path']);
|
| 25 | 25 | $settings['rb_base_dir'] = preg_replace('@^' . preg_quote(MODX_BASE_PATH) . '@', '[(base_path)]', $settings['rb_base_dir']);
|
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | $lang_keys = array(); |
| 31 | 31 | $dir = dir('includes/lang');
|
| 32 | 32 | while($file = $dir->read()) {
|
| 33 | - if(strpos($file, '.inc.php') > 0) {
|
|
| 34 | - $endpos = strpos($file, '.'); |
|
| 35 | - $languagename = substr($file, 0, $endpos); |
|
| 36 | - $lang_keys[$languagename] = get_lang_keys($file); |
|
| 37 | - } |
|
| 33 | + if(strpos($file, '.inc.php') > 0) {
|
|
| 34 | + $endpos = strpos($file, '.'); |
|
| 35 | + $languagename = substr($file, 0, $endpos); |
|
| 36 | + $lang_keys[$languagename] = get_lang_keys($file); |
|
| 37 | + } |
|
| 38 | 38 | } |
| 39 | 39 | $dir->close(); |
| 40 | 40 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | </script> |
| 77 | 77 | |
| 78 | 78 | <?php |
| 79 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab1_site_settings.inc.php'); |
|
| 80 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab2_furl_settings.inc.php'); |
|
| 81 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab3_user_settings.inc.php'); |
|
| 82 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab4_manager_settings.inc.php'); |
|
| 83 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab5_security_settings.inc.php'); |
|
| 84 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab6_filemanager_settings.inc.php'); |
|
| 85 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab7_filebrowser_settings.inc.php'); |
|
| 86 | - ?> |
|
| 79 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab1_site_settings.inc.php'); |
|
| 80 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab2_furl_settings.inc.php'); |
|
| 81 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab3_user_settings.inc.php'); |
|
| 82 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab4_manager_settings.inc.php'); |
|
| 83 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab5_security_settings.inc.php'); |
|
| 84 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab6_filemanager_settings.inc.php'); |
|
| 85 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab7_filebrowser_settings.inc.php'); |
|
| 86 | + ?> |
|
| 87 | 87 | </div> |
| 88 | 88 | </div> |
| 89 | 89 | </form> |
@@ -130,5 +130,5 @@ discard block |
||
| 130 | 130 | </script> |
| 131 | 131 | <?php |
| 132 | 132 | if(is_numeric($_GET['tab'])) {
|
| 133 | - echo '<script type="text/javascript">tpSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
| 133 | + echo '<script type="text/javascript">tpSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
| 134 | 134 | } |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 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('view_eventlog')) {
|
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | ?> |
| 9 | 9 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | <div class="form-group" id="lyr1"> |
| 18 | 18 | <b><?= $_lang["publish_events"] ?></b> |
| 19 | 19 | <?php |
| 20 | - $rs = $modx->getDatabase()->select('id, pagetitle, pub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC');
|
|
| 21 | - $limit = $modx->getDatabase()->getRecordCount($rs); |
|
| 22 | - if($limit < 1) {
|
|
| 23 | - ?> |
|
| 20 | + $rs = $modx->getDatabase()->select('id, pagetitle, pub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC');
|
|
| 21 | + $limit = $modx->getDatabase()->getRecordCount($rs); |
|
| 22 | + if($limit < 1) {
|
|
| 23 | + ?> |
|
| 24 | 24 | <p><?= $_lang["no_docs_pending_publishing"] ?></p> |
| 25 | 25 | <?php |
| 26 | - } else {
|
|
| 27 | - ?> |
|
| 26 | + } else {
|
|
| 27 | + ?> |
|
| 28 | 28 | <div class="table-responsive"> |
| 29 | 29 | <table class="grid sortabletable" id="table-1"> |
| 30 | 30 | <thead> |
@@ -36,34 +36,34 @@ discard block |
||
| 36 | 36 | </thead> |
| 37 | 37 | <tbody> |
| 38 | 38 | <?php |
| 39 | - while($row = $modx->getDatabase()->getRow($rs)) {
|
|
| 40 | - ?> |
|
| 39 | + while($row = $modx->getDatabase()->getRow($rs)) {
|
|
| 40 | + ?> |
|
| 41 | 41 | <tr> |
| 42 | 42 | <td class="text-right"><?= $row['id'] ?></td> |
| 43 | 43 | <td><a href="index.php?a=3&id=<?= $row['id'] ?>"><?= $row['pagetitle'] ?></a></td> |
| 44 | 44 | <td class="text-nowrap text-right"><?= $modx->toDateFormat($row['pub_date'] + $server_offset_time) ?></td> |
| 45 | 45 | </tr> |
| 46 | 46 | <?php |
| 47 | - } |
|
| 48 | - ?> |
|
| 47 | + } |
|
| 48 | + ?> |
|
| 49 | 49 | </tbody> |
| 50 | 50 | </table> |
| 51 | 51 | </div> |
| 52 | 52 | <?php |
| 53 | - } |
|
| 54 | - ?> |
|
| 53 | + } |
|
| 54 | + ?> |
|
| 55 | 55 | </div> |
| 56 | 56 | <div class="form-group" id="lyr2"> |
| 57 | 57 | <b><?= $_lang["unpublish_events"] ?></b> |
| 58 | 58 | <?php |
| 59 | - $rs = $modx->getDatabase()->select('id, pagetitle, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC');
|
|
| 60 | - $limit = $modx->getDatabase()->getRecordCount($rs); |
|
| 61 | - if($limit < 1) {
|
|
| 62 | - ?> |
|
| 59 | + $rs = $modx->getDatabase()->select('id, pagetitle, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC');
|
|
| 60 | + $limit = $modx->getDatabase()->getRecordCount($rs); |
|
| 61 | + if($limit < 1) {
|
|
| 62 | + ?> |
|
| 63 | 63 | <p><?= $_lang["no_docs_pending_unpublishing"] ?></p> |
| 64 | 64 | <?php |
| 65 | - } else {
|
|
| 66 | - ?> |
|
| 65 | + } else {
|
|
| 66 | + ?> |
|
| 67 | 67 | <div class="table-responsive"> |
| 68 | 68 | <table class="grid sortabletable" id="table-2"> |
| 69 | 69 | <thead> |
@@ -75,34 +75,34 @@ discard block |
||
| 75 | 75 | </thead> |
| 76 | 76 | <tbody> |
| 77 | 77 | <?php |
| 78 | - while($row = $modx->getDatabase()->getRow($rs)) {
|
|
| 79 | - ?> |
|
| 78 | + while($row = $modx->getDatabase()->getRow($rs)) {
|
|
| 79 | + ?> |
|
| 80 | 80 | <tr> |
| 81 | 81 | <td class="text-right"><?= $row['id'] ?></td> |
| 82 | 82 | <td><a href="index.php?a=3&id=<?= $row['id'] ?>"><?= $row['pagetitle'] ?></a></td> |
| 83 | 83 | <td class="text-nowrap text-right"><?= $modx->toDateFormat($row['unpub_date'] + $server_offset_time) ?></td> |
| 84 | 84 | </tr> |
| 85 | 85 | <?php |
| 86 | - } |
|
| 87 | - ?> |
|
| 86 | + } |
|
| 87 | + ?> |
|
| 88 | 88 | </tbody> |
| 89 | 89 | </table> |
| 90 | 90 | </div> |
| 91 | 91 | <?php |
| 92 | - } |
|
| 93 | - ?> |
|
| 92 | + } |
|
| 93 | + ?> |
|
| 94 | 94 | </div> |
| 95 | 95 | <div class="form-group"> |
| 96 | 96 | <b><?= $_lang["all_events"] ?></b> |
| 97 | 97 | <?php |
| 98 | - $rs = $modx->getDatabase()->select('id, pagetitle, pub_date, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC");
|
|
| 99 | - $limit = $modx->getDatabase()->getRecordCount($rs); |
|
| 100 | - if($limit < 1) {
|
|
| 101 | - ?> |
|
| 98 | + $rs = $modx->getDatabase()->select('id, pagetitle, pub_date, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC");
|
|
| 99 | + $limit = $modx->getDatabase()->getRecordCount($rs); |
|
| 100 | + if($limit < 1) {
|
|
| 101 | + ?> |
|
| 102 | 102 | <p><?= $_lang["no_docs_pending_pubunpub"] ?></p> |
| 103 | 103 | <?php |
| 104 | - } else {
|
|
| 105 | - ?> |
|
| 104 | + } else {
|
|
| 105 | + ?> |
|
| 106 | 106 | <div class="table-responsive"> |
| 107 | 107 | <table class="grid sortabletable" id="table-3"> |
| 108 | 108 | <thead> |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | </thead> |
| 116 | 116 | <tbody> |
| 117 | 117 | <?php |
| 118 | - while($row = $modx->getDatabase()->getRow($rs)) {
|
|
| 119 | - ?> |
|
| 118 | + while($row = $modx->getDatabase()->getRow($rs)) {
|
|
| 119 | + ?> |
|
| 120 | 120 | <tr> |
| 121 | 121 | <td class="text-right"><?= $row['id'] ?></td> |
| 122 | 122 | <td><a href="index.php?a=3&id=<?= $row['id'] ?>"><?= $row['pagetitle'] ?></a></td> |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | <td class="text-nowrap text-right"><?= $row['unpub_date'] == 0 ? "" : $modx->toDateFormat($row['unpub_date'] + $server_offset_time) ?></td> |
| 125 | 125 | </tr> |
| 126 | 126 | <?php |
| 127 | - } |
|
| 128 | - ?> |
|
| 127 | + } |
|
| 128 | + ?> |
|
| 129 | 129 | </tbody> |
| 130 | 130 | </table> |
| 131 | 131 | </div> |
| 132 | 132 | <?php |
| 133 | - } |
|
| 134 | - ?> |
|
| 133 | + } |
|
| 134 | + ?> |
|
| 135 | 135 | </div> |
| 136 | 136 | </div> |
| 137 | 137 | </div> |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 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('edit_web_user')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // initialize page view state - the $_PAGE object |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // get and save search string |
| 13 | 13 | if($_REQUEST['op'] == 'reset') { |
| 14 | - $query = ''; |
|
| 15 | - $_PAGE['vs']['search'] = ''; |
|
| 14 | + $query = ''; |
|
| 15 | + $_PAGE['vs']['search'] = ''; |
|
| 16 | 16 | } else { |
| 17 | - $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
| 18 | - $sqlQuery = $modx->getDatabase()->escape($query); |
|
| 19 | - $_PAGE['vs']['search'] = $query; |
|
| 17 | + $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
| 18 | + $sqlQuery = $modx->getDatabase()->escape($query); |
|
| 19 | + $_PAGE['vs']['search'] = $query; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // get & save listmode |
@@ -119,29 +119,29 @@ discard block |
||
| 119 | 119 | <div class="row"> |
| 120 | 120 | <div class="table-responsive"> |
| 121 | 121 | <?php |
| 122 | - $ds = $modx->getDatabase()->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getDatabase()->getFullTableName("web_users") . " wu |
|
| 122 | + $ds = $modx->getDatabase()->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getDatabase()->getFullTableName("web_users") . " wu |
|
| 123 | 123 | INNER JOIN " . $modx->getDatabase()->getFullTableName("web_user_attributes") . " wua ON wua.internalKey=wu.id", ($sqlQuery ? "(wu.username LIKE '{$sqlQuery}%') OR (wua.fullname LIKE '%{$sqlQuery}%') OR (wua.email LIKE '%{$sqlQuery}%')" : ""), 'username'); |
| 124 | - $grd = new \EvolutionCMS\Support\DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
|
| 125 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 126 | - $grd->cssClass = "table data"; |
|
| 127 | - $grd->columnHeaderClass = "tableHeader"; |
|
| 128 | - $grd->itemClass = "tableItem"; |
|
| 129 | - $grd->altItemClass = "tableAltItem"; |
|
| 130 | - $grd->fields = "id,username,fullname,email,lastlogin,logincount,blocked"; |
|
| 131 | - $grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["user_full_name"] . " ," . $_lang["email"] . " ," . $_lang["user_prevlogin"] . " ," . $_lang["user_logincount"] . " ," . $_lang["user_block"]; |
|
| 132 | - $grd->colWidths = "1%,,,,1%,1%,1%"; |
|
| 133 | - $grd->colAligns = "center,,,,right' nowrap='nowrap,right,center"; |
|
| 134 | - $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='" . $_style["icons_user"] . "'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='" . $_lang["click_to_edit_title"] . "'>[+value+]</a>||template:[+fullname+]||template:[+email+]||date: " . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . |
|
| 135 | - " %H:%M"; |
|
| 136 | - if($listmode == '1') { |
|
| 137 | - $grd->pageSize = 0; |
|
| 138 | - } |
|
| 139 | - if($_REQUEST['op'] == 'reset') { |
|
| 140 | - $grd->pageNumber = 1; |
|
| 141 | - } |
|
| 142 | - // render grid |
|
| 143 | - echo $grd->render(); |
|
| 144 | - ?> |
|
| 124 | + $grd = new \EvolutionCMS\Support\DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
|
| 125 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 126 | + $grd->cssClass = "table data"; |
|
| 127 | + $grd->columnHeaderClass = "tableHeader"; |
|
| 128 | + $grd->itemClass = "tableItem"; |
|
| 129 | + $grd->altItemClass = "tableAltItem"; |
|
| 130 | + $grd->fields = "id,username,fullname,email,lastlogin,logincount,blocked"; |
|
| 131 | + $grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["user_full_name"] . " ," . $_lang["email"] . " ," . $_lang["user_prevlogin"] . " ," . $_lang["user_logincount"] . " ," . $_lang["user_block"]; |
|
| 132 | + $grd->colWidths = "1%,,,,1%,1%,1%"; |
|
| 133 | + $grd->colAligns = "center,,,,right' nowrap='nowrap,right,center"; |
|
| 134 | + $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='" . $_style["icons_user"] . "'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='" . $_lang["click_to_edit_title"] . "'>[+value+]</a>||template:[+fullname+]||template:[+email+]||date: " . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . |
|
| 135 | + " %H:%M"; |
|
| 136 | + if($listmode == '1') { |
|
| 137 | + $grd->pageSize = 0; |
|
| 138 | + } |
|
| 139 | + if($_REQUEST['op'] == 'reset') { |
|
| 140 | + $grd->pageNumber = 1; |
|
| 141 | + } |
|
| 142 | + // render grid |
|
| 143 | + echo $grd->render(); |
|
| 144 | + ?> |
|
| 145 | 145 | </div> |
| 146 | 146 | </div> |
| 147 | 147 | </div> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /********************/ |
@@ -12,29 +12,29 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | 14 | switch($modx->getManagerApi()->action) { |
| 15 | - case 27: |
|
| 16 | - if(!$modx->hasPermission('edit_document')) { |
|
| 17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | - } |
|
| 19 | - break; |
|
| 20 | - case 85: |
|
| 21 | - case 72: |
|
| 22 | - case 4: |
|
| 23 | - if(!$modx->hasPermission('new_document')) { |
|
| 24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | - // check user has permissions for parent |
|
| 27 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 28 | - $udperms->user = $modx->getLoginUserID(); |
|
| 29 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 30 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 31 | - if(!$udperms->checkPermissions()) { |
|
| 32 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - break; |
|
| 36 | - default: |
|
| 37 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + case 27: |
|
| 16 | + if(!$modx->hasPermission('edit_document')) { |
|
| 17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | + } |
|
| 19 | + break; |
|
| 20 | + case 85: |
|
| 21 | + case 72: |
|
| 22 | + case 4: |
|
| 23 | + if(!$modx->hasPermission('new_document')) { |
|
| 24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | + // check user has permissions for parent |
|
| 27 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 28 | + $udperms->user = $modx->getLoginUserID(); |
|
| 29 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 30 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 31 | + if(!$udperms->checkPermissions()) { |
|
| 32 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + break; |
|
| 36 | + default: |
|
| 37 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -53,21 +53,21 @@ discard block |
||
| 53 | 53 | $tbl_site_tmplvars = $modx->getDatabase()->getFullTableName('site_tmplvars'); |
| 54 | 54 | |
| 55 | 55 | if($modx->getManagerApi()->action == 27) { |
| 56 | - //editing an existing document |
|
| 57 | - // check permissions on the document |
|
| 58 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 59 | - $udperms->user = $modx->getLoginUserID(); |
|
| 60 | - $udperms->document = $id; |
|
| 61 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 62 | - |
|
| 63 | - if(!$udperms->checkPermissions()) { |
|
| 64 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 65 | - } |
|
| 56 | + //editing an existing document |
|
| 57 | + // check permissions on the document |
|
| 58 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 59 | + $udperms->user = $modx->getLoginUserID(); |
|
| 60 | + $udperms->document = $id; |
|
| 61 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 62 | + |
|
| 63 | + if(!$udperms->checkPermissions()) { |
|
| 64 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // check to see if resource isn't locked |
| 69 | 69 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
| 70 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 70 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 71 | 71 | } |
| 72 | 72 | // end check for lock |
| 73 | 73 | |
@@ -76,74 +76,74 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // get document groups for current user |
| 78 | 78 | if($_SESSION['mgrDocgroups']) { |
| 79 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 79 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | if(!empty ($id)) { |
| 83 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 84 | - if($docgrp) { |
|
| 85 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 86 | - } |
|
| 87 | - $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 88 | - $content = array(); |
|
| 89 | - $content = $modx->getDatabase()->getRow($rs); |
|
| 90 | - $modx->documentObject = &$content; |
|
| 91 | - if(!$content) { |
|
| 92 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 93 | - } |
|
| 94 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
| 83 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 84 | + if($docgrp) { |
|
| 85 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 86 | + } |
|
| 87 | + $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 88 | + $content = array(); |
|
| 89 | + $content = $modx->getDatabase()->getRow($rs); |
|
| 90 | + $modx->documentObject = &$content; |
|
| 91 | + if(!$content) { |
|
| 92 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 93 | + } |
|
| 94 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
| 95 | 95 | } else { |
| 96 | - $content = array(); |
|
| 96 | + $content = array(); |
|
| 97 | 97 | |
| 98 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 99 | - $content['template'] = $_REQUEST['newtemplate']; |
|
| 100 | - } else { |
|
| 101 | - $content['template'] = getDefaultTemplate(); |
|
| 102 | - } |
|
| 98 | + if(isset($_REQUEST['newtemplate'])) { |
|
| 99 | + $content['template'] = $_REQUEST['newtemplate']; |
|
| 100 | + } else { |
|
| 101 | + $content['template'] = getDefaultTemplate(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 104 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // restore saved form |
| 108 | 108 | $formRestored = $modx->getManagerApi()->loadFormValues(); |
| 109 | 109 | if(isset($_REQUEST['newtemplate'])) { |
| 110 | - $formRestored = true; |
|
| 110 | + $formRestored = true; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // retain form values if template was changed |
| 114 | 114 | // edited to convert pub_date and unpub_date |
| 115 | 115 | // sottwell 02-09-2006 |
| 116 | 116 | if($formRestored == true) { |
| 117 | - $content = array_merge($content, $_POST); |
|
| 118 | - $content['content'] = $_POST['ta']; |
|
| 119 | - if(empty ($content['pub_date'])) { |
|
| 120 | - unset ($content['pub_date']); |
|
| 121 | - } else { |
|
| 122 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 123 | - } |
|
| 124 | - if(empty ($content['unpub_date'])) { |
|
| 125 | - unset ($content['unpub_date']); |
|
| 126 | - } else { |
|
| 127 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 128 | - } |
|
| 117 | + $content = array_merge($content, $_POST); |
|
| 118 | + $content['content'] = $_POST['ta']; |
|
| 119 | + if(empty ($content['pub_date'])) { |
|
| 120 | + unset ($content['pub_date']); |
|
| 121 | + } else { |
|
| 122 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 123 | + } |
|
| 124 | + if(empty ($content['unpub_date'])) { |
|
| 125 | + unset ($content['unpub_date']); |
|
| 126 | + } else { |
|
| 127 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 128 | + } |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // increase menu index if this is a new document |
| 132 | 132 | if(!isset ($_REQUEST['id'])) { |
| 133 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | - $modx->config['auto_menuindex'] = 1; |
|
| 135 | - } |
|
| 136 | - if($modx->config['auto_menuindex']) { |
|
| 137 | - $pid = (int)$_REQUEST['pid']; |
|
| 138 | - $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 139 | - $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
|
| 140 | - } else { |
|
| 141 | - $content['menuindex'] = 0; |
|
| 142 | - } |
|
| 133 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | + $modx->config['auto_menuindex'] = 1; |
|
| 135 | + } |
|
| 136 | + if($modx->config['auto_menuindex']) { |
|
| 137 | + $pid = (int)$_REQUEST['pid']; |
|
| 138 | + $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 139 | + $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
|
| 140 | + } else { |
|
| 141 | + $content['menuindex'] = 0; |
|
| 142 | + } |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if(isset ($_POST['which_editor'])) { |
| 146 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 146 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // Add lock-element JS-Script |
@@ -543,23 +543,23 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
| 545 | 545 | <?php |
| 546 | - // invoke OnDocFormPrerender event |
|
| 547 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 548 | - 'id' => $id, |
|
| 549 | - 'template' => $content['template'] |
|
| 550 | - )); |
|
| 551 | - |
|
| 552 | - if(is_array($evtOut)) { |
|
| 553 | - echo implode('', $evtOut); |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - /*************************/ |
|
| 557 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 558 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 559 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 560 | - /*************************/ |
|
| 561 | - |
|
| 562 | - ?> |
|
| 546 | + // invoke OnDocFormPrerender event |
|
| 547 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 548 | + 'id' => $id, |
|
| 549 | + 'template' => $content['template'] |
|
| 550 | + )); |
|
| 551 | + |
|
| 552 | + if(is_array($evtOut)) { |
|
| 553 | + echo implode('', $evtOut); |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + /*************************/ |
|
| 557 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 558 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 559 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 560 | + /*************************/ |
|
| 561 | + |
|
| 562 | + ?> |
|
| 563 | 563 | <input type="hidden" name="a" value="5" /> |
| 564 | 564 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
| 565 | 565 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>" /> |
@@ -574,54 +574,54 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | <h1> |
| 576 | 576 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
| 577 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 578 | - } else { |
|
| 579 | - if ($modx->getManagerApi()->action == '4') { |
|
| 577 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 578 | + } else { |
|
| 579 | + if ($modx->getManagerApi()->action == '4') { |
|
| 580 | 580 | echo $_lang['add_resource']; |
| 581 | 581 | } else if ($modx->getManagerApi()->action == '72') { |
| 582 | 582 | echo $_lang['add_weblink']; |
| 583 | 583 | } else { |
| 584 | 584 | echo $_lang['create_resource_title']; |
| 585 | 585 | } |
| 586 | - } ?> |
|
| 586 | + } ?> |
|
| 587 | 587 | </h1> |
| 588 | 588 | |
| 589 | 589 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
| 590 | 590 | |
| 591 | 591 | <?php |
| 592 | - // breadcrumbs |
|
| 593 | - if($modx->config['use_breadcrumbs']) { |
|
| 594 | - $temp = array(); |
|
| 595 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 596 | - |
|
| 597 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 598 | - $bID = (int) $_REQUEST['id']; |
|
| 599 | - $temp = $modx->getParentIds($bID); |
|
| 600 | - } else if(isset($_REQUEST['pid'])) { |
|
| 601 | - $bID = (int) $_REQUEST['pid']; |
|
| 602 | - $temp = $modx->getParentIds($bID); |
|
| 603 | - array_unshift($temp, $bID); |
|
| 604 | - } |
|
| 605 | - |
|
| 606 | - if($temp) { |
|
| 607 | - $parents = implode(',', $temp); |
|
| 608 | - |
|
| 609 | - if(!empty($parents)) { |
|
| 610 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 611 | - $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 612 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 613 | - $out .= '<li class="breadcrumbs__li"> |
|
| 592 | + // breadcrumbs |
|
| 593 | + if($modx->config['use_breadcrumbs']) { |
|
| 594 | + $temp = array(); |
|
| 595 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 596 | + |
|
| 597 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 598 | + $bID = (int) $_REQUEST['id']; |
|
| 599 | + $temp = $modx->getParentIds($bID); |
|
| 600 | + } else if(isset($_REQUEST['pid'])) { |
|
| 601 | + $bID = (int) $_REQUEST['pid']; |
|
| 602 | + $temp = $modx->getParentIds($bID); |
|
| 603 | + array_unshift($temp, $bID); |
|
| 604 | + } |
|
| 605 | + |
|
| 606 | + if($temp) { |
|
| 607 | + $parents = implode(',', $temp); |
|
| 608 | + |
|
| 609 | + if(!empty($parents)) { |
|
| 610 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 611 | + $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 612 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 613 | + $out .= '<li class="breadcrumbs__li"> |
|
| 614 | 614 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
| 615 | 615 | <span class="breadcrumbs__sep">></span> |
| 616 | 616 | </li>'; |
| 617 | - } |
|
| 618 | - } |
|
| 619 | - } |
|
| 617 | + } |
|
| 618 | + } |
|
| 619 | + } |
|
| 620 | 620 | |
| 621 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 622 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 623 | - } |
|
| 624 | - ?> |
|
| 621 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 622 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 623 | + } |
|
| 624 | + ?> |
|
| 625 | 625 | |
| 626 | 626 | <!-- start main wrapper --> |
| 627 | 627 | <div class="sectionBody"> |
@@ -633,13 +633,13 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | <!-- General --> |
| 635 | 635 | <?php |
| 636 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 637 | - 'id' => $id |
|
| 638 | - )); |
|
| 639 | - if(is_array($evtOut)) { |
|
| 640 | - echo implode('', $evtOut); |
|
| 641 | - } else { |
|
| 642 | - ?> |
|
| 636 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 637 | + 'id' => $id |
|
| 638 | + )); |
|
| 639 | + if(is_array($evtOut)) { |
|
| 640 | + echo implode('', $evtOut); |
|
| 641 | + } else { |
|
| 642 | + ?> |
|
| 643 | 643 | <div class="tab-page" id="tabGeneral"> |
| 644 | 644 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
| 645 | 645 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -724,36 +724,36 @@ discard block |
||
| 724 | 724 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
| 725 | 725 | <option value="0">(blank)</option> |
| 726 | 726 | <?php |
| 727 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 728 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 729 | - $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 730 | - $currentCategory = ''; |
|
| 731 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 732 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | - continue; |
|
| 734 | - }; |
|
| 735 | - // Skip if not selectable but show if selected! |
|
| 736 | - $thisCategory = $row['category']; |
|
| 737 | - if($thisCategory == null) { |
|
| 738 | - $thisCategory = $_lang["no_category"]; |
|
| 739 | - } |
|
| 740 | - if($thisCategory != $currentCategory) { |
|
| 741 | - if($closeOptGroup) { |
|
| 742 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 743 | - } |
|
| 744 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 745 | - $closeOptGroup = true; |
|
| 746 | - } |
|
| 727 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 728 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 729 | + $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 730 | + $currentCategory = ''; |
|
| 731 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 732 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | + continue; |
|
| 734 | + }; |
|
| 735 | + // Skip if not selectable but show if selected! |
|
| 736 | + $thisCategory = $row['category']; |
|
| 737 | + if($thisCategory == null) { |
|
| 738 | + $thisCategory = $_lang["no_category"]; |
|
| 739 | + } |
|
| 740 | + if($thisCategory != $currentCategory) { |
|
| 741 | + if($closeOptGroup) { |
|
| 742 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 743 | + } |
|
| 744 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 745 | + $closeOptGroup = true; |
|
| 746 | + } |
|
| 747 | 747 | |
| 748 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 748 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 749 | 749 | |
| 750 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 751 | - $currentCategory = $thisCategory; |
|
| 752 | - } |
|
| 753 | - if($thisCategory != '') { |
|
| 754 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 755 | - } |
|
| 756 | - ?> |
|
| 750 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 751 | + $currentCategory = $thisCategory; |
|
| 752 | + } |
|
| 753 | + if($thisCategory != '') { |
|
| 754 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 755 | + } |
|
| 756 | + ?> |
|
| 757 | 757 | </select> |
| 758 | 758 | </td> |
| 759 | 759 | </tr> |
@@ -793,37 +793,37 @@ discard block |
||
| 793 | 793 | </td> |
| 794 | 794 | <td valign="top"> |
| 795 | 795 | <?php |
| 796 | - $parentlookup = false; |
|
| 797 | - if(isset ($_REQUEST['id'])) { |
|
| 798 | - if($content['parent'] == 0) { |
|
| 799 | - $parentname = $site_name; |
|
| 800 | - } else { |
|
| 801 | - $parentlookup = $content['parent']; |
|
| 802 | - } |
|
| 803 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 804 | - if($_REQUEST['pid'] == 0) { |
|
| 805 | - $parentname = $site_name; |
|
| 806 | - } else { |
|
| 807 | - $parentlookup = $_REQUEST['pid']; |
|
| 808 | - } |
|
| 809 | - } elseif(isset($_POST['parent'])) { |
|
| 810 | - if($_POST['parent'] == 0) { |
|
| 811 | - $parentname = $site_name; |
|
| 812 | - } else { |
|
| 813 | - $parentlookup = $_POST['parent']; |
|
| 814 | - } |
|
| 815 | - } else { |
|
| 816 | - $parentname = $site_name; |
|
| 817 | - $content['parent'] = 0; |
|
| 818 | - } |
|
| 819 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 820 | - $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 821 | - $parentname = $modx->getDatabase()->getValue($rs); |
|
| 822 | - if(!$parentname) { |
|
| 823 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 824 | - } |
|
| 825 | - } |
|
| 826 | - ?> |
|
| 796 | + $parentlookup = false; |
|
| 797 | + if(isset ($_REQUEST['id'])) { |
|
| 798 | + if($content['parent'] == 0) { |
|
| 799 | + $parentname = $site_name; |
|
| 800 | + } else { |
|
| 801 | + $parentlookup = $content['parent']; |
|
| 802 | + } |
|
| 803 | + } elseif(isset ($_REQUEST['pid'])) { |
|
| 804 | + if($_REQUEST['pid'] == 0) { |
|
| 805 | + $parentname = $site_name; |
|
| 806 | + } else { |
|
| 807 | + $parentlookup = $_REQUEST['pid']; |
|
| 808 | + } |
|
| 809 | + } elseif(isset($_POST['parent'])) { |
|
| 810 | + if($_POST['parent'] == 0) { |
|
| 811 | + $parentname = $site_name; |
|
| 812 | + } else { |
|
| 813 | + $parentlookup = $_POST['parent']; |
|
| 814 | + } |
|
| 815 | + } else { |
|
| 816 | + $parentname = $site_name; |
|
| 817 | + $content['parent'] = 0; |
|
| 818 | + } |
|
| 819 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 820 | + $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 821 | + $parentname = $modx->getDatabase()->getValue($rs); |
|
| 822 | + if(!$parentname) { |
|
| 823 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 824 | + } |
|
| 825 | + } |
|
| 826 | + ?> |
|
| 827 | 827 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
| 828 | 828 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $modx->getPhpCompat()->entities($parentname) ?>)</span></b> |
| 829 | 829 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | </tr> |
| 832 | 832 | <tr></tr> |
| 833 | 833 | <?php |
| 834 | - /* |
|
| 834 | + /* |
|
| 835 | 835 | if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { |
| 836 | 836 | ?> |
| 837 | 837 | <tr> |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | </tr> |
| 860 | 860 | <?php |
| 861 | 861 | }*/ |
| 862 | - ?> |
|
| 862 | + ?> |
|
| 863 | 863 | |
| 864 | 864 | <?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?> |
| 865 | 865 | <tr> |
@@ -872,36 +872,36 @@ discard block |
||
| 872 | 872 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
| 873 | 873 | <option value="none"><?= $_lang['none'] ?></option> |
| 874 | 874 | <?php |
| 875 | - // invoke OnRichTextEditorRegister event |
|
| 876 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 877 | - if(is_array($evtOut)) { |
|
| 878 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | - $editor = $evtOut[$i]; |
|
| 880 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 881 | - } |
|
| 882 | - } |
|
| 883 | - ?> |
|
| 875 | + // invoke OnRichTextEditorRegister event |
|
| 876 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 877 | + if(is_array($evtOut)) { |
|
| 878 | + for($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | + $editor = $evtOut[$i]; |
|
| 880 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 881 | + } |
|
| 882 | + } |
|
| 883 | + ?> |
|
| 884 | 884 | </select> |
| 885 | 885 | </label> |
| 886 | 886 | </div> |
| 887 | 887 | <div id="content_body"> |
| 888 | 888 | <?php |
| 889 | - if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
| 890 | - $htmlContent = $content['content']; |
|
| 891 | - ?> |
|
| 889 | + if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
| 890 | + $htmlContent = $content['content']; |
|
| 891 | + ?> |
|
| 892 | 892 | <div class="section-editor clearfix"> |
| 893 | 893 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->getPhpCompat()->htmlspecialchars($htmlContent) ?></textarea> |
| 894 | 894 | </div> |
| 895 | 895 | <?php |
| 896 | - // Richtext-[*content*] |
|
| 897 | - $richtexteditorIds = array(); |
|
| 898 | - $richtexteditorOptions = array(); |
|
| 899 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 900 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 901 | - } else { |
|
| 902 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 903 | - } |
|
| 904 | - ?> |
|
| 896 | + // Richtext-[*content*] |
|
| 897 | + $richtexteditorIds = array(); |
|
| 898 | + $richtexteditorOptions = array(); |
|
| 899 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 900 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 901 | + } else { |
|
| 902 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 903 | + } |
|
| 904 | + ?> |
|
| 905 | 905 | </div> |
| 906 | 906 | </td> |
| 907 | 907 | </tr> |
@@ -1208,8 +1208,8 @@ discard block |
||
| 1208 | 1208 | |
| 1209 | 1209 | <?php |
| 1210 | 1210 | |
| 1211 | - if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1212 | - ?> |
|
| 1211 | + if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1212 | + ?> |
|
| 1213 | 1213 | <tr> |
| 1214 | 1214 | <td> |
| 1215 | 1215 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1231,15 +1231,15 @@ discard block |
||
| 1231 | 1231 | <td> |
| 1232 | 1232 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1233 | 1233 | <?php |
| 1234 | - if(!$content['contentType']) { |
|
| 1235 | - $content['contentType'] = 'text/html'; |
|
| 1236 | - } |
|
| 1237 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1238 | - $ct = explode(",", $custom_contenttype); |
|
| 1239 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1240 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1241 | - } |
|
| 1242 | - ?> |
|
| 1234 | + if(!$content['contentType']) { |
|
| 1235 | + $content['contentType'] = 'text/html'; |
|
| 1236 | + } |
|
| 1237 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1238 | + $ct = explode(",", $custom_contenttype); |
|
| 1239 | + for($i = 0; $i < count($ct); $i++) { |
|
| 1240 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1241 | + } |
|
| 1242 | + ?> |
|
| 1243 | 1243 | </select> |
| 1244 | 1244 | </td> |
| 1245 | 1245 | </tr> |
@@ -1262,23 +1262,23 @@ discard block |
||
| 1262 | 1262 | </td> |
| 1263 | 1263 | </tr> |
| 1264 | 1264 | <?php |
| 1265 | - } else { |
|
| 1266 | - if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
| 1267 | - // non-admin managers creating or editing a document resource |
|
| 1268 | - ?> |
|
| 1265 | + } else { |
|
| 1266 | + if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
| 1267 | + // non-admin managers creating or editing a document resource |
|
| 1268 | + ?> |
|
| 1269 | 1269 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
| 1270 | 1270 | <input type="hidden" name="type" value="document" /> |
| 1271 | 1271 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
| 1272 | 1272 | <?php |
| 1273 | - } else { |
|
| 1274 | - // non-admin managers creating or editing a reference (weblink) resource |
|
| 1275 | - ?> |
|
| 1273 | + } else { |
|
| 1274 | + // non-admin managers creating or editing a reference (weblink) resource |
|
| 1275 | + ?> |
|
| 1276 | 1276 | <input type="hidden" name="type" value="reference" /> |
| 1277 | 1277 | <input type="hidden" name="contentType" value="text/html" /> |
| 1278 | 1278 | <?php |
| 1279 | - } |
|
| 1280 | - }//if mgrRole |
|
| 1281 | - ?> |
|
| 1279 | + } |
|
| 1280 | + }//if mgrRole |
|
| 1281 | + ?> |
|
| 1282 | 1282 | |
| 1283 | 1283 | <tr> |
| 1284 | 1284 | <td> |
@@ -1361,112 +1361,112 @@ discard block |
||
| 1361 | 1361 | ?> |
| 1362 | 1362 | |
| 1363 | 1363 | <?php |
| 1364 | - /******************************* |
|
| 1364 | + /******************************* |
|
| 1365 | 1365 | * Document Access Permissions */ |
| 1366 | - if($use_udperms == 1) { |
|
| 1367 | - $groupsarray = array(); |
|
| 1368 | - $sql = ''; |
|
| 1369 | - |
|
| 1370 | - $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1371 | - if($documentId > 0) { |
|
| 1372 | - // Load up, the permissions from the parent (if new document) or existing document |
|
| 1373 | - $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1374 | - while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1375 | - |
|
| 1376 | - // Load up the current permissions and names |
|
| 1377 | - $vs = array( |
|
| 1378 | - $tbl_document_group_names, |
|
| 1379 | - $tbl_document_groups, |
|
| 1380 | - $documentId |
|
| 1381 | - ); |
|
| 1382 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1383 | - $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1384 | - } else { |
|
| 1385 | - // Just load up the names, we're starting clean |
|
| 1386 | - $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1387 | - } |
|
| 1388 | - |
|
| 1389 | - // retain selected doc groups between post |
|
| 1390 | - if(isset($_POST['docgroups'])) { |
|
| 1391 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1392 | - } |
|
| 1366 | + if($use_udperms == 1) { |
|
| 1367 | + $groupsarray = array(); |
|
| 1368 | + $sql = ''; |
|
| 1369 | + |
|
| 1370 | + $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1371 | + if($documentId > 0) { |
|
| 1372 | + // Load up, the permissions from the parent (if new document) or existing document |
|
| 1373 | + $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1374 | + while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1375 | + |
|
| 1376 | + // Load up the current permissions and names |
|
| 1377 | + $vs = array( |
|
| 1378 | + $tbl_document_group_names, |
|
| 1379 | + $tbl_document_groups, |
|
| 1380 | + $documentId |
|
| 1381 | + ); |
|
| 1382 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1383 | + $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1384 | + } else { |
|
| 1385 | + // Just load up the names, we're starting clean |
|
| 1386 | + $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1387 | + } |
|
| 1388 | + |
|
| 1389 | + // retain selected doc groups between post |
|
| 1390 | + if(isset($_POST['docgroups'])) { |
|
| 1391 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1392 | + } |
|
| 1393 | + |
|
| 1394 | + $isManager = $modx->hasPermission('access_permissions'); |
|
| 1395 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1396 | + |
|
| 1397 | + // Setup Basic attributes for each Input box |
|
| 1398 | + $inputAttributes = array( |
|
| 1399 | + 'type' => 'checkbox', |
|
| 1400 | + 'class' => 'checkbox', |
|
| 1401 | + 'name' => 'docgroups[]', |
|
| 1402 | + 'onclick' => 'makePublic(false);', |
|
| 1403 | + ); |
|
| 1404 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1405 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1406 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1407 | + |
|
| 1408 | + // Loop through the permissions list |
|
| 1409 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 1410 | + |
|
| 1411 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1412 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1413 | + $inputId = 'group-' . $row['id']; |
|
| 1414 | + |
|
| 1415 | + $checked = in_array($inputValue, $groupsarray); |
|
| 1416 | + if($checked) { |
|
| 1417 | + $notPublic = true; |
|
| 1418 | + } // Mark as private access (either web or manager) |
|
| 1419 | + |
|
| 1420 | + // Skip the access permission if the user doesn't have access... |
|
| 1421 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1422 | + continue; |
|
| 1423 | + } |
|
| 1393 | 1424 | |
| 1394 | - $isManager = $modx->hasPermission('access_permissions'); |
|
| 1395 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1396 | - |
|
| 1397 | - // Setup Basic attributes for each Input box |
|
| 1398 | - $inputAttributes = array( |
|
| 1399 | - 'type' => 'checkbox', |
|
| 1400 | - 'class' => 'checkbox', |
|
| 1401 | - 'name' => 'docgroups[]', |
|
| 1402 | - 'onclick' => 'makePublic(false);', |
|
| 1403 | - ); |
|
| 1404 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1405 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1406 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1407 | - |
|
| 1408 | - // Loop through the permissions list |
|
| 1409 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 1410 | - |
|
| 1411 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1412 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1413 | - $inputId = 'group-' . $row['id']; |
|
| 1414 | - |
|
| 1415 | - $checked = in_array($inputValue, $groupsarray); |
|
| 1416 | - if($checked) { |
|
| 1417 | - $notPublic = true; |
|
| 1418 | - } // Mark as private access (either web or manager) |
|
| 1419 | - |
|
| 1420 | - // Skip the access permission if the user doesn't have access... |
|
| 1421 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1422 | - continue; |
|
| 1423 | - } |
|
| 1424 | - |
|
| 1425 | - // Setup attributes for this Input box |
|
| 1426 | - $inputAttributes['id'] = $inputId; |
|
| 1427 | - $inputAttributes['value'] = $inputValue; |
|
| 1428 | - if($checked) { |
|
| 1429 | - $inputAttributes['checked'] = 'checked'; |
|
| 1430 | - } else { |
|
| 1431 | - unset($inputAttributes['checked']); |
|
| 1432 | - } |
|
| 1433 | - |
|
| 1434 | - // Create attribute string list |
|
| 1435 | - $inputString = array(); |
|
| 1436 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1437 | - |
|
| 1438 | - // Make the <input> HTML |
|
| 1439 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1440 | - |
|
| 1441 | - // does user have this permission? |
|
| 1442 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1443 | - $vs = array( |
|
| 1444 | - $row['id'], |
|
| 1445 | - $_SESSION['mgrInternalKey'] |
|
| 1446 | - ); |
|
| 1447 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1448 | - $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
|
| 1449 | - $count = $modx->getDatabase()->getValue($rsp); |
|
| 1450 | - if($count > 0) { |
|
| 1451 | - ++$permissions_yes; |
|
| 1452 | - } else { |
|
| 1453 | - ++$permissions_no; |
|
| 1454 | - } |
|
| 1455 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1456 | - } |
|
| 1457 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1458 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1459 | - $permissions = array(); |
|
| 1460 | - } |
|
| 1425 | + // Setup attributes for this Input box |
|
| 1426 | + $inputAttributes['id'] = $inputId; |
|
| 1427 | + $inputAttributes['value'] = $inputValue; |
|
| 1428 | + if($checked) { |
|
| 1429 | + $inputAttributes['checked'] = 'checked'; |
|
| 1430 | + } else { |
|
| 1431 | + unset($inputAttributes['checked']); |
|
| 1432 | + } |
|
| 1461 | 1433 | |
| 1462 | - // See if the Access Permissions section is worth displaying... |
|
| 1463 | - if(!empty($permissions)) { |
|
| 1464 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1465 | - if($isManager && $isWeb) { |
|
| 1466 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1467 | - } |
|
| 1468 | - // Output the permissions list... |
|
| 1469 | - ?> |
|
| 1434 | + // Create attribute string list |
|
| 1435 | + $inputString = array(); |
|
| 1436 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1437 | + |
|
| 1438 | + // Make the <input> HTML |
|
| 1439 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1440 | + |
|
| 1441 | + // does user have this permission? |
|
| 1442 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1443 | + $vs = array( |
|
| 1444 | + $row['id'], |
|
| 1445 | + $_SESSION['mgrInternalKey'] |
|
| 1446 | + ); |
|
| 1447 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1448 | + $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
|
| 1449 | + $count = $modx->getDatabase()->getValue($rsp); |
|
| 1450 | + if($count > 0) { |
|
| 1451 | + ++$permissions_yes; |
|
| 1452 | + } else { |
|
| 1453 | + ++$permissions_no; |
|
| 1454 | + } |
|
| 1455 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1456 | + } |
|
| 1457 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1458 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1459 | + $permissions = array(); |
|
| 1460 | + } |
|
| 1461 | + |
|
| 1462 | + // See if the Access Permissions section is worth displaying... |
|
| 1463 | + if(!empty($permissions)) { |
|
| 1464 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1465 | + if($isManager && $isWeb) { |
|
| 1466 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1467 | + } |
|
| 1468 | + // Output the permissions list... |
|
| 1469 | + ?> |
|
| 1470 | 1470 | <!-- Access Permissions --> |
| 1471 | 1471 | <div class="tab-page" id="tabAccess"> |
| 1472 | 1472 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1500,31 +1500,31 @@ discard block |
||
| 1500 | 1500 | </ul> |
| 1501 | 1501 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1502 | 1502 | <?php |
| 1503 | - } // !empty($permissions) |
|
| 1504 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1505 | - ?> |
|
| 1503 | + } // !empty($permissions) |
|
| 1504 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1505 | + ?> |
|
| 1506 | 1506 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1507 | 1507 | <?php |
| 1508 | 1508 | |
| 1509 | - } |
|
| 1510 | - } |
|
| 1511 | - /* End Document Access Permissions * |
|
| 1509 | + } |
|
| 1510 | + } |
|
| 1511 | + /* End Document Access Permissions * |
|
| 1512 | 1512 | ***********************************/ |
| 1513 | - ?> |
|
| 1513 | + ?> |
|
| 1514 | 1514 | |
| 1515 | 1515 | <input type="submit" name="save" style="display:none" /> |
| 1516 | 1516 | <?php |
| 1517 | 1517 | |
| 1518 | - // invoke OnDocFormRender event |
|
| 1519 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1520 | - 'id' => $id, |
|
| 1521 | - 'template' => $content['template'] |
|
| 1522 | - )); |
|
| 1518 | + // invoke OnDocFormRender event |
|
| 1519 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1520 | + 'id' => $id, |
|
| 1521 | + 'template' => $content['template'] |
|
| 1522 | + )); |
|
| 1523 | 1523 | |
| 1524 | - if(is_array($evtOut)) { |
|
| 1525 | - echo implode('', $evtOut); |
|
| 1526 | - } |
|
| 1527 | - ?> |
|
| 1524 | + if(is_array($evtOut)) { |
|
| 1525 | + echo implode('', $evtOut); |
|
| 1526 | + } |
|
| 1527 | + ?> |
|
| 1528 | 1528 | </div><!--div class="tab-pane" id="documentPane"--> |
| 1529 | 1529 | </div><!--div class="sectionBody"--> |
| 1530 | 1530 | </fieldset> |
@@ -1535,17 +1535,17 @@ discard block |
||
| 1535 | 1535 | </script> |
| 1536 | 1536 | <?php |
| 1537 | 1537 | if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) { |
| 1538 | - if(is_array($richtexteditorIds)) { |
|
| 1539 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1540 | - // invoke OnRichTextEditorInit event |
|
| 1541 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1542 | - 'editor' => $editor, |
|
| 1543 | - 'elements' => $elements, |
|
| 1544 | - 'options' => $richtexteditorOptions[$editor] |
|
| 1545 | - )); |
|
| 1546 | - if(is_array($evtOut)) { |
|
| 1547 | - echo implode('', $evtOut); |
|
| 1548 | - } |
|
| 1549 | - } |
|
| 1550 | - } |
|
| 1538 | + if(is_array($richtexteditorIds)) { |
|
| 1539 | + foreach($richtexteditorIds as $editor => $elements) { |
|
| 1540 | + // invoke OnRichTextEditorInit event |
|
| 1541 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1542 | + 'editor' => $editor, |
|
| 1543 | + 'elements' => $elements, |
|
| 1544 | + 'options' => $richtexteditorOptions[$editor] |
|
| 1545 | + )); |
|
| 1546 | + if(is_array($evtOut)) { |
|
| 1547 | + echo implode('', $evtOut); |
|
| 1548 | + } |
|
| 1549 | + } |
|
| 1550 | + } |
|
| 1551 | 1551 | } |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->getManagerApi()->action) { |
| 7 | - case 16: |
|
| 8 | - if(!$modx->hasPermission('edit_template')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 19: |
|
| 13 | - if(!$modx->hasPermission('new_template')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 16: |
|
| 8 | + if(!$modx->hasPermission('edit_template')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 19: |
|
| 13 | + if(!$modx->hasPermission('new_template')) { |
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // check to see the snippet editor isn't locked |
| 26 | 26 | if($lockedEl = $modx->elementIsLocked(1, $id)) { |
| 27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
| 27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
@@ -33,23 +33,23 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $content = array(); |
| 35 | 35 | if(!empty($id)) { |
| 36 | - $rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'"); |
|
| 37 | - $content = $modx->getDatabase()->getRow($rs); |
|
| 38 | - if(!$content) { |
|
| 39 | - $modx->webAlertAndQuit("No database record has been found for this template."); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - $_SESSION['itemname'] = $content['templatename']; |
|
| 43 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 44 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 45 | - } |
|
| 36 | + $rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'"); |
|
| 37 | + $content = $modx->getDatabase()->getRow($rs); |
|
| 38 | + if(!$content) { |
|
| 39 | + $modx->webAlertAndQuit("No database record has been found for this template."); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + $_SESSION['itemname'] = $content['templatename']; |
|
| 43 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 44 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 45 | + } |
|
| 46 | 46 | } else { |
| 47 | - $_SESSION['itemname'] = $_lang["new_template"]; |
|
| 48 | - $content['category'] = (int)$_REQUEST['catid']; |
|
| 47 | + $_SESSION['itemname'] = $_lang["new_template"]; |
|
| 48 | + $content['category'] = (int)$_REQUEST['catid']; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if($modx->getManagerApi()->hasFormValues()) { |
| 52 | - $modx->getManagerApi()->loadFormValues(); |
|
| 52 | + $modx->getManagerApi()->loadFormValues(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $content = array_merge($content, $_POST); |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | <form name="mutate" method="post" action="index.php"> |
| 100 | 100 | <?php |
| 101 | - // invoke OnTempFormPrerender event |
|
| 102 | - $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
| 103 | - if(is_array($evtOut)) { |
|
| 104 | - echo implode("", $evtOut); |
|
| 105 | - } |
|
| 106 | - ?> |
|
| 101 | + // invoke OnTempFormPrerender event |
|
| 102 | + $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
| 103 | + if(is_array($evtOut)) { |
|
| 104 | + echo implode("", $evtOut); |
|
| 105 | + } |
|
| 106 | + ?> |
|
| 107 | 107 | <input type="hidden" name="a" value="20"> |
| 108 | 108 | <input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>"> |
| 109 | 109 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>"> |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | <label class="col-md-3 col-lg-2"> |
| 134 | 134 | <?= $_lang['template_name'] ?> |
| 135 | 135 | <?php if($id == $modx->config['default_template']) { |
| 136 | - echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
| 137 | - } ?> |
|
| 136 | + echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
| 137 | + } ?> |
|
| 138 | 138 | </label> |
| 139 | 139 | <div class="col-md-9 col-lg-10"> |
| 140 | 140 | <div class="form-control-name clearfix"> |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
| 163 | 163 | <option> </option> |
| 164 | 164 | <?php |
| 165 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 166 | - foreach(getCategories() as $n => $v) { |
|
| 167 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>"; |
|
| 168 | - } |
|
| 169 | - ?> |
|
| 165 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 166 | + foreach(getCategories() as $n => $v) { |
|
| 167 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>"; |
|
| 168 | + } |
|
| 169 | + ?> |
|
| 170 | 170 | </select> |
| 171 | 171 | </div> |
| 172 | 172 | </div> |
@@ -197,38 +197,38 @@ discard block |
||
| 197 | 197 | <input type="submit" name="save" style="display:none"> |
| 198 | 198 | |
| 199 | 199 | <?php |
| 200 | - $selectedTvs = array(); |
|
| 201 | - if(!isset($_POST['assignedTv'])) { |
|
| 202 | - $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
| 200 | + $selectedTvs = array(); |
|
| 201 | + if(!isset($_POST['assignedTv'])) { |
|
| 202 | + $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
| 203 | 203 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
| 204 | 204 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC" // workaround for correct sort of none-existing ranks |
| 205 | - ); |
|
| 206 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 207 | - $selectedTvs[$row['tvid']] = $row; |
|
| 208 | - } |
|
| 209 | - $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - $unselectedTvs = array(); |
|
| 213 | - $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
| 205 | + ); |
|
| 206 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 207 | + $selectedTvs[$row['tvid']] = $row; |
|
| 208 | + } |
|
| 209 | + $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + $unselectedTvs = array(); |
|
| 213 | + $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
| 214 | 214 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
| 215 | 215 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "", "category, tvcaption"); |
| 216 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 217 | - $unselectedTvs[$row['tvid']] = $row; |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - // Catch checkboxes if form not validated |
|
| 221 | - if(isset($_POST['assignedTv'])) { |
|
| 222 | - $selectedTvs = array(); |
|
| 223 | - foreach($_POST['assignedTv'] as $tvid) { |
|
| 224 | - if(isset($unselectedTvs[$tvid])) { |
|
| 225 | - $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
| 226 | - } |
|
| 227 | - }; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - $total = count($selectedTvs); |
|
| 231 | - ?> |
|
| 216 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 217 | + $unselectedTvs[$row['tvid']] = $row; |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + // Catch checkboxes if form not validated |
|
| 221 | + if(isset($_POST['assignedTv'])) { |
|
| 222 | + $selectedTvs = array(); |
|
| 223 | + foreach($_POST['assignedTv'] as $tvid) { |
|
| 224 | + if(isset($unselectedTvs[$tvid])) { |
|
| 225 | + $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
| 226 | + } |
|
| 227 | + }; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + $total = count($selectedTvs); |
|
| 231 | + ?> |
|
| 232 | 232 | </div> |
| 233 | 233 | |
| 234 | 234 | <div class="tab-page" id="tabAssignedTVs"> |
@@ -238,65 +238,65 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | <div class="container container-body"> |
| 240 | 240 | <?php |
| 241 | - if($total > 0) { |
|
| 242 | - echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
| 243 | - } |
|
| 244 | - if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
| 245 | - echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - // Selected TVs |
|
| 249 | - $tvList = ''; |
|
| 250 | - if($total > 0) { |
|
| 251 | - $tvList .= '<ul>'; |
|
| 252 | - foreach($selectedTvs as $row) { |
|
| 253 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 254 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 255 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']); |
|
| 256 | - } |
|
| 257 | - $tvList .= '</ul>'; |
|
| 258 | - |
|
| 259 | - } else { |
|
| 260 | - echo $_lang['template_no_tv']; |
|
| 261 | - } |
|
| 262 | - echo $tvList; |
|
| 263 | - |
|
| 264 | - // Unselected TVs |
|
| 265 | - $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
| 266 | - $preCat = ''; |
|
| 267 | - $insideUl = 0; |
|
| 268 | - while($row = array_shift($unselectedTvs)) { |
|
| 269 | - if(isset($selectedTvs[$row['tvid']])) { |
|
| 270 | - continue; |
|
| 271 | - } // Skip selected |
|
| 272 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
| 273 | - if($preCat !== $row['category']) { |
|
| 274 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
| 275 | - $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 276 | - $insideUl = 1; |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 280 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 281 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']); |
|
| 282 | - $tvList .= '</li>'; |
|
| 283 | - |
|
| 284 | - $preCat = $row['category']; |
|
| 285 | - } |
|
| 286 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
| 287 | - $tvList .= '</ul>'; |
|
| 288 | - echo $tvList; |
|
| 289 | - |
|
| 290 | - ?> |
|
| 241 | + if($total > 0) { |
|
| 242 | + echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
| 243 | + } |
|
| 244 | + if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
| 245 | + echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + // Selected TVs |
|
| 249 | + $tvList = ''; |
|
| 250 | + if($total > 0) { |
|
| 251 | + $tvList .= '<ul>'; |
|
| 252 | + foreach($selectedTvs as $row) { |
|
| 253 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 254 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 255 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']); |
|
| 256 | + } |
|
| 257 | + $tvList .= '</ul>'; |
|
| 258 | + |
|
| 259 | + } else { |
|
| 260 | + echo $_lang['template_no_tv']; |
|
| 261 | + } |
|
| 262 | + echo $tvList; |
|
| 263 | + |
|
| 264 | + // Unselected TVs |
|
| 265 | + $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
| 266 | + $preCat = ''; |
|
| 267 | + $insideUl = 0; |
|
| 268 | + while($row = array_shift($unselectedTvs)) { |
|
| 269 | + if(isset($selectedTvs[$row['tvid']])) { |
|
| 270 | + continue; |
|
| 271 | + } // Skip selected |
|
| 272 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
| 273 | + if($preCat !== $row['category']) { |
|
| 274 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
| 275 | + $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 276 | + $insideUl = 1; |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 280 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 281 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']); |
|
| 282 | + $tvList .= '</li>'; |
|
| 283 | + |
|
| 284 | + $preCat = $row['category']; |
|
| 285 | + } |
|
| 286 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
| 287 | + $tvList .= '</ul>'; |
|
| 288 | + echo $tvList; |
|
| 289 | + |
|
| 290 | + ?> |
|
| 291 | 291 | </div> |
| 292 | 292 | </div> |
| 293 | 293 | |
| 294 | 294 | <?php |
| 295 | - // invoke OnTempFormRender event |
|
| 296 | - $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
| 297 | - if(is_array($evtOut)) { |
|
| 298 | - echo implode("", $evtOut); |
|
| 299 | - } |
|
| 300 | - ?> |
|
| 295 | + // invoke OnTempFormRender event |
|
| 296 | + $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
| 297 | + if(is_array($evtOut)) { |
|
| 298 | + echo implode("", $evtOut); |
|
| 299 | + } |
|
| 300 | + ?> |
|
| 301 | 301 | </div> |
| 302 | 302 | </form> |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->getManagerApi()->action) { |
| 7 | - case 12: |
|
| 8 | - if(!$modx->hasPermission('edit_user')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 11: |
|
| 13 | - if(!$modx->hasPermission('new_user')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 12: |
|
| 8 | + if(!$modx->hasPermission('edit_user')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 11: |
|
| 13 | + if(!$modx->hasPermission('new_user')) { |
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -23,79 +23,79 @@ discard block |
||
| 23 | 23 | // check to see the snippet editor isn't locked |
| 24 | 24 | $rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
| 25 | 25 | if($username = $modx->getDatabase()->getValue($rs)) { |
| 26 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
| 26 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
| 27 | 27 | } |
| 28 | 28 | // end check for lock |
| 29 | 29 | |
| 30 | 30 | if($modx->getManagerApi()->action == '12') { |
| 31 | - // get user attribute |
|
| 32 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
|
| 33 | - $userdata = $modx->getDatabase()->getRow($rs); |
|
| 34 | - if(!$userdata) { |
|
| 35 | - $modx->webAlertAndQuit("No user returned!"); |
|
| 36 | - } |
|
| 31 | + // get user attribute |
|
| 32 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
|
| 33 | + $userdata = $modx->getDatabase()->getRow($rs); |
|
| 34 | + if(!$userdata) { |
|
| 35 | + $modx->webAlertAndQuit("No user returned!"); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | if($_SESSION['mgrRole'] != 1 && $userdata['role'] == 1) { |
| 39 | 39 | $modx->webAlertAndQuit('Illegal attempt to create/modify administrator by non-administrator!'); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | - // get user settings |
|
| 44 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'"); |
|
| 45 | - $usersettings = array(); |
|
| 46 | - while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 47 | - // manually extract so that user display settings are not overwritten |
|
| 48 | - foreach($usersettings as $k => $v) { |
|
| 49 | - if($k != 'manager_language' && $k != 'manager_theme') { |
|
| 50 | - ${$k} = $v; |
|
| 51 | - } |
|
| 52 | - } |
|
| 43 | + // get user settings |
|
| 44 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'"); |
|
| 45 | + $usersettings = array(); |
|
| 46 | + while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 47 | + // manually extract so that user display settings are not overwritten |
|
| 48 | + foreach($usersettings as $k => $v) { |
|
| 49 | + if($k != 'manager_language' && $k != 'manager_theme') { |
|
| 50 | + ${$k} = $v; |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - // get user name |
|
| 55 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_users'), "id = '{$user}'"); |
|
| 56 | - $usernamedata = $modx->getDatabase()->getRow($rs); |
|
| 57 | - if(!$usernamedata) { |
|
| 58 | - $modx->webAlertAndQuit("No user returned while getting username!"); |
|
| 59 | - } |
|
| 60 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
| 54 | + // get user name |
|
| 55 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_users'), "id = '{$user}'"); |
|
| 56 | + $usernamedata = $modx->getDatabase()->getRow($rs); |
|
| 57 | + if(!$usernamedata) { |
|
| 58 | + $modx->webAlertAndQuit("No user returned while getting username!"); |
|
| 59 | + } |
|
| 60 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
| 61 | 61 | } else { |
| 62 | - $userdata = array(); |
|
| 63 | - $usersettings = array(); |
|
| 64 | - $usernamedata = array(); |
|
| 65 | - $_SESSION['itemname'] = $_lang["new_user"]; |
|
| 62 | + $userdata = array(); |
|
| 63 | + $usersettings = array(); |
|
| 64 | + $usernamedata = array(); |
|
| 65 | + $_SESSION['itemname'] = $_lang["new_user"]; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 69 | 69 | foreach($userdata as $key => $val) { |
| 70 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 70 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 71 | 71 | }; |
| 72 | 72 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 73 | 73 | |
| 74 | 74 | // restore saved form |
| 75 | 75 | $formRestored = false; |
| 76 | 76 | if($modx->getManagerApi()->hasFormValues()) { |
| 77 | - $modx->getManagerApi()->loadFormValues(); |
|
| 78 | - // restore post values |
|
| 79 | - $userdata = array_merge($userdata, $_POST); |
|
| 80 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 81 | - $usernamedata['username'] = $userdata['newusername']; |
|
| 82 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 83 | - $usersettings = array_merge($usersettings, $userdata); |
|
| 84 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
| 85 | - extract($usersettings, EXTR_OVERWRITE); |
|
| 77 | + $modx->getManagerApi()->loadFormValues(); |
|
| 78 | + // restore post values |
|
| 79 | + $userdata = array_merge($userdata, $_POST); |
|
| 80 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 81 | + $usernamedata['username'] = $userdata['newusername']; |
|
| 82 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 83 | + $usersettings = array_merge($usersettings, $userdata); |
|
| 84 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
| 85 | + extract($usersettings, EXTR_OVERWRITE); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // include the country list language file |
| 89 | 89 | $_country_lang = array(); |
| 90 | 90 | include_once "lang/country/english_country.inc.php"; |
| 91 | 91 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
| 92 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 92 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 93 | 93 | } |
| 94 | 94 | asort($_country_lang); |
| 95 | 95 | |
| 96 | 96 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
| 97 | 97 | if($which_browser == 'default') { |
| 98 | - $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
| 98 | + $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
| 99 | 99 | } |
| 100 | 100 | ?> |
| 101 | 101 | <script type="text/javascript"> |
@@ -205,14 +205,14 @@ discard block |
||
| 205 | 205 | <form action="index.php?a=32" method="post" name="userform"> |
| 206 | 206 | <?php |
| 207 | 207 | |
| 208 | - // invoke OnUserFormPrerender event |
|
| 209 | - $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
|
| 210 | - "id" => $user |
|
| 211 | - )); |
|
| 212 | - if(is_array($evtOut)) { |
|
| 213 | - echo implode("", $evtOut); |
|
| 214 | - } |
|
| 215 | - ?> |
|
| 208 | + // invoke OnUserFormPrerender event |
|
| 209 | + $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
|
| 210 | + "id" => $user |
|
| 211 | + )); |
|
| 212 | + if(is_array($evtOut)) { |
|
| 213 | + echo implode("", $evtOut); |
|
| 214 | + } |
|
| 215 | + ?> |
|
| 216 | 216 | <input type="hidden" name="mode" value="<?php echo $modx->getManagerApi()->action; ?>"> |
| 217 | 217 | <input type="hidden" name="id" value="<?php echo $user ?>"> |
| 218 | 218 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -305,25 +305,25 @@ discard block |
||
| 305 | 305 | <td> </td> |
| 306 | 306 | <td><?php |
| 307 | 307 | |
| 308 | - $rs = $modx->getDatabase()->select( |
|
| 309 | - 'name, id', |
|
| 308 | + $rs = $modx->getDatabase()->select( |
|
| 309 | + 'name, id', |
|
| 310 | 310 | $modx->getDatabase()->getFullTableName('user_roles'), |
| 311 | 311 | ($modx->hasPermission('save_role')) ? '' : 'id != 1' |
| 312 | 312 | ); |
| 313 | - ?> |
|
| 313 | + ?> |
|
| 314 | 314 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
| 315 | 315 | <?php |
| 316 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 317 | - if($modx->getManagerApi()->action == '11') { |
|
| 318 | - $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
| 319 | - } else { |
|
| 320 | - $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
| 321 | - } |
|
| 322 | - ?> |
|
| 316 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 317 | + if($modx->getManagerApi()->action == '11') { |
|
| 318 | + $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
| 319 | + } else { |
|
| 320 | + $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
| 321 | + } |
|
| 322 | + ?> |
|
| 323 | 323 | <option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option> |
| 324 | 324 | <?php |
| 325 | - } |
|
| 326 | - ?> |
|
| 325 | + } |
|
| 326 | + ?> |
|
| 327 | 327 | </select></td> |
| 328 | 328 | </tr> |
| 329 | 329 | <tr> |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 369 | 369 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 370 | 370 | <?php |
| 371 | - foreach($_country_lang as $key => $country) { |
|
| 372 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 373 | - } |
|
| 374 | - ?> |
|
| 371 | + foreach($_country_lang as $key => $country) { |
|
| 372 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 373 | + } |
|
| 374 | + ?> |
|
| 375 | 375 | </select></td> |
| 376 | 376 | </tr> |
| 377 | 377 | <tr> |
@@ -447,21 +447,21 @@ discard block |
||
| 447 | 447 | <td><select name="manager_language" class="inputBox" onChange="documentDirty=true"> |
| 448 | 448 | <option value=""></option> |
| 449 | 449 | <?php |
| 450 | - $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
| 451 | - $dir = dir("includes/lang"); |
|
| 452 | - while($file = $dir->read()) { |
|
| 453 | - if(strpos($file, ".inc.php") > 0) { |
|
| 454 | - $endpos = strpos($file, "."); |
|
| 455 | - $languagename = substr($file, 0, $endpos); |
|
| 456 | - $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
| 457 | - ?> |
|
| 450 | + $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
| 451 | + $dir = dir("includes/lang"); |
|
| 452 | + while($file = $dir->read()) { |
|
| 453 | + if(strpos($file, ".inc.php") > 0) { |
|
| 454 | + $endpos = strpos($file, "."); |
|
| 455 | + $languagename = substr($file, 0, $endpos); |
|
| 456 | + $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
| 457 | + ?> |
|
| 458 | 458 | <option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option> |
| 459 | 459 | <?php |
| 460 | 460 | |
| 461 | - } |
|
| 462 | - } |
|
| 463 | - $dir->close(); |
|
| 464 | - ?> |
|
| 461 | + } |
|
| 462 | + } |
|
| 463 | + $dir->close(); |
|
| 464 | + ?> |
|
| 465 | 465 | </select></td> |
| 466 | 466 | </tr> |
| 467 | 467 | <tr> |
@@ -536,22 +536,22 @@ discard block |
||
| 536 | 536 | <td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());"> |
| 537 | 537 | <option value=""></option> |
| 538 | 538 | <?php |
| 539 | - $dir = dir("media/style/"); |
|
| 540 | - while($file = $dir->read()) { |
|
| 541 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
| 542 | - $themename = $file; |
|
| 543 | - if($themename === 'common') { |
|
| 544 | - continue; |
|
| 545 | - } |
|
| 546 | - $attr = 'value="' . $themename . '" '; |
|
| 547 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
| 548 | - $attr .= 'selected="selected" '; |
|
| 549 | - } |
|
| 550 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
| 551 | - } |
|
| 552 | - } |
|
| 553 | - $dir->close(); |
|
| 554 | - ?> |
|
| 539 | + $dir = dir("media/style/"); |
|
| 540 | + while($file = $dir->read()) { |
|
| 541 | + if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
| 542 | + $themename = $file; |
|
| 543 | + if($themename === 'common') { |
|
| 544 | + continue; |
|
| 545 | + } |
|
| 546 | + $attr = 'value="' . $themename . '" '; |
|
| 547 | + if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
| 548 | + $attr .= 'selected="selected" '; |
|
| 549 | + } |
|
| 550 | + echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
| 551 | + } |
|
| 552 | + } |
|
| 553 | + $dir->close(); |
|
| 554 | + ?> |
|
| 555 | 555 | </select> |
| 556 | 556 | <input type="hidden" name="theme_refresher" value=""></td> |
| 557 | 557 | </tr> |
@@ -587,15 +587,15 @@ discard block |
||
| 587 | 587 | <th><?php echo $_lang["which_browser_title"] ?></th> |
| 588 | 588 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
| 589 | 589 | <?php |
| 590 | - $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 591 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
| 592 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
| 593 | - $dir = str_replace('\\', '/', $dir); |
|
| 594 | - $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
| 595 | - $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 596 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
| 597 | - } |
|
| 598 | - ?> |
|
| 590 | + $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 591 | + echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
| 592 | + foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
| 593 | + $dir = str_replace('\\', '/', $dir); |
|
| 594 | + $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
| 595 | + $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 596 | + echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
| 597 | + } |
|
| 598 | + ?> |
|
| 599 | 599 | </select></td> |
| 600 | 600 | </tr> |
| 601 | 601 | <tr> |
@@ -672,17 +672,17 @@ discard block |
||
| 672 | 672 | <option value=""></option> |
| 673 | 673 | <?php |
| 674 | 674 | |
| 675 | - $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
| 676 | - // invoke OnRichTextEditorRegister event |
|
| 677 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 678 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
| 679 | - if(is_array($evtOut)) { |
|
| 680 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 681 | - $editor = $evtOut[$i]; |
|
| 682 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
| 683 | - } |
|
| 684 | - } |
|
| 685 | - ?> |
|
| 675 | + $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
| 676 | + // invoke OnRichTextEditorRegister event |
|
| 677 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 678 | + echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
| 679 | + if(is_array($evtOut)) { |
|
| 680 | + for($i = 0; $i < count($evtOut); $i++) { |
|
| 681 | + $editor = $evtOut[$i]; |
|
| 682 | + echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
| 683 | + } |
|
| 684 | + } |
|
| 685 | + ?> |
|
| 686 | 686 | </select></td> |
| 687 | 687 | </tr> |
| 688 | 688 | <tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>"> |
@@ -715,12 +715,12 @@ discard block |
||
| 715 | 715 | </tr> |
| 716 | 716 | </table> |
| 717 | 717 | <?php |
| 718 | - // invoke OnInterfaceSettingsRender event |
|
| 719 | - $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
|
| 720 | - if(is_array($evtOut)) { |
|
| 721 | - echo implode("", $evtOut); |
|
| 722 | - } |
|
| 723 | - ?> |
|
| 718 | + // invoke OnInterfaceSettingsRender event |
|
| 719 | + $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
|
| 720 | + if(is_array($evtOut)) { |
|
| 721 | + echo implode("", $evtOut); |
|
| 722 | + } |
|
| 723 | + ?> |
|
| 724 | 724 | </div> |
| 725 | 725 | |
| 726 | 726 | <!-- Photo --> |
@@ -769,39 +769,39 @@ discard block |
||
| 769 | 769 | </div> |
| 770 | 770 | <?php if($use_udperms == 1) { |
| 771 | 771 | |
| 772 | - $groupsarray = array(); |
|
| 773 | - |
|
| 774 | - if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited |
|
| 775 | - $rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'"); |
|
| 776 | - $groupsarray = $modx->getDatabase()->getColumn('user_group', $rs); |
|
| 777 | - } |
|
| 778 | - // retain selected doc groups between post |
|
| 779 | - if(is_array($_POST['user_groups'])) { |
|
| 780 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 781 | - } |
|
| 782 | - ?> |
|
| 772 | + $groupsarray = array(); |
|
| 773 | + |
|
| 774 | + if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited |
|
| 775 | + $rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'"); |
|
| 776 | + $groupsarray = $modx->getDatabase()->getColumn('user_group', $rs); |
|
| 777 | + } |
|
| 778 | + // retain selected doc groups between post |
|
| 779 | + if(is_array($_POST['user_groups'])) { |
|
| 780 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 781 | + } |
|
| 782 | + ?> |
|
| 783 | 783 | <div class="tab-page" id="tabAccess"> |
| 784 | 784 | <h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2> |
| 785 | 785 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script> |
| 786 | 786 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 787 | 787 | <?php |
| 788 | - $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('membergroup_names'), '', 'name'); |
|
| 789 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 790 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
| 791 | - } |
|
| 792 | - } |
|
| 793 | - ?> |
|
| 788 | + $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('membergroup_names'), '', 'name'); |
|
| 789 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 790 | + echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
| 791 | + } |
|
| 792 | + } |
|
| 793 | + ?> |
|
| 794 | 794 | </div> |
| 795 | 795 | </div> |
| 796 | 796 | </div> |
| 797 | 797 | <input type="submit" name="save" style="display:none"> |
| 798 | 798 | <?php |
| 799 | - // invoke OnUserFormRender event |
|
| 800 | - $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
|
| 801 | - "id" => $user |
|
| 802 | - )); |
|
| 803 | - if(is_array($evtOut)) { |
|
| 804 | - echo implode("", $evtOut); |
|
| 805 | - } |
|
| 806 | - ?> |
|
| 799 | + // invoke OnUserFormRender event |
|
| 800 | + $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
|
| 801 | + "id" => $user |
|
| 802 | + )); |
|
| 803 | + if(is_array($evtOut)) { |
|
| 804 | + echo implode("", $evtOut); |
|
| 805 | + } |
|
| 806 | + ?> |
|
| 807 | 807 | </form> |
@@ -113,31 +113,31 @@ |
||
| 113 | 113 | // Handle Input "Search in main fields" |
| 114 | 114 | if ($searchfields != '') { |
| 115 | 115 | |
| 116 | - /*start search by TV. Added Rising13*/ |
|
| 117 | - $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
|
| 118 | - $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
| 119 | - $articul_result = $modx->getDatabase()->query($articul_query); |
|
| 120 | - $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
|
| 121 | - if(count($articul_id_array)>0){ |
|
| 122 | - $articul_id = ''; |
|
| 123 | - $i = 1; |
|
| 124 | - foreach( $articul_id_array as $articul ) { |
|
| 125 | - $articul_id.=$articul['contentid']; |
|
| 126 | - if($i !== count($articul_id_array)){ |
|
| 127 | - $articul_id.=','; |
|
| 128 | - } |
|
| 129 | - $i++; |
|
| 130 | - } |
|
| 131 | - $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
| 132 | - }else{ |
|
| 133 | - $articul_id_query = ''; |
|
| 134 | - } |
|
| 135 | - /*end search by TV*/ |
|
| 116 | + /*start search by TV. Added Rising13*/ |
|
| 117 | + $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
|
| 118 | + $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
| 119 | + $articul_result = $modx->getDatabase()->query($articul_query); |
|
| 120 | + $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
|
| 121 | + if(count($articul_id_array)>0){ |
|
| 122 | + $articul_id = ''; |
|
| 123 | + $i = 1; |
|
| 124 | + foreach( $articul_id_array as $articul ) { |
|
| 125 | + $articul_id.=$articul['contentid']; |
|
| 126 | + if($i !== count($articul_id_array)){ |
|
| 127 | + $articul_id.=','; |
|
| 128 | + } |
|
| 129 | + $i++; |
|
| 130 | + } |
|
| 131 | + $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
| 132 | + }else{ |
|
| 133 | + $articul_id_query = ''; |
|
| 134 | + } |
|
| 135 | + /*end search by TV*/ |
|
| 136 | 136 | |
| 137 | 137 | if (ctype_digit($searchfields)) { |
| 138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
| 139 | 139 | if (strlen($searchfields) > 3) { |
| 140 | - $sqladd .= $articul_id_query;//search by TV |
|
| 140 | + $sqladd .= $articul_id_query;//search by TV |
|
| 141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
| 142 | 142 | } |
| 143 | 143 | } |