@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class DATEPICKER {
|
| 4 | - function __construct() {
|
|
| 5 | - } |
|
| 4 | + function __construct() {
|
|
| 5 | + } |
|
| 6 | 6 | |
| 7 | - function getDP() {
|
|
| 8 | - $modx = DocumentParser::getInstance(); global $_lang; |
|
| 7 | + function getDP() {
|
|
| 8 | + $modx = DocumentParser::getInstance(); global $_lang; |
|
| 9 | 9 | |
| 10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
| 11 | - return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 12 | - } |
|
| 10 | + $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
| 11 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 12 | + } |
|
| 13 | 13 | } |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class DATEPICKER {
|
|
| 4 | - function __construct() {
|
|
| 3 | +class DATEPICKER{
|
|
| 4 | + function __construct(){
|
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | - function getDP() {
|
|
| 7 | + function getDP(){
|
|
| 8 | 8 | $modx = DocumentParser::getInstance(); global $_lang; |
| 9 | 9 | |
| 10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
| 10 | + $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
|
| 11 | 11 | return $modx->parseText($tpl, $_lang, '[%', '%]'); |
| 12 | 12 | } |
| 13 | 13 | } |
@@ -1,10 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class DATEPICKER {
|
|
| 4 | - function __construct() {
|
|
| 3 | +class DATEPICKER |
|
| 4 | +{ |
|
| 5 | + function __construct() |
|
| 6 | + { |
|
| 5 | 7 | } |
| 6 | 8 | |
| 7 | - function getDP() {
|
|
| 9 | + function getDP() |
|
| 10 | + { |
|
| 8 | 11 | $modx = DocumentParser::getInstance(); global $_lang; |
| 9 | 12 | |
| 10 | 13 | $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
@@ -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((int) $modx->manager->action) { |
| 7 | - case 35: |
|
| 8 | - if(!$modx->hasPermission('edit_role')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 38: |
|
| 13 | - if(!$modx->hasPermission('new_role')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 35: |
|
| 8 | + if(!$modx->hasPermission('edit_role')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 38: |
|
| 13 | + if(!$modx->hasPermission('new_role')) { |
|
| 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 | $role = 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(8, $role)) { |
| 27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
|
| 27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
|
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | $modx->lockElement(8, $role); |
| 33 | 33 | |
| 34 | 34 | if($modx->manager->action == '35') { |
| 35 | - $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
|
| 36 | - $roledata = $modx->db->getRow($rs); |
|
| 37 | - if(!$roledata) { |
|
| 38 | - $modx->webAlertAndQuit("No role returned!"); |
|
| 39 | - } |
|
| 40 | - $_SESSION['itemname'] = $roledata['name']; |
|
| 35 | + $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
|
| 36 | + $roledata = $modx->db->getRow($rs); |
|
| 37 | + if(!$roledata) { |
|
| 38 | + $modx->webAlertAndQuit("No role returned!"); |
|
| 39 | + } |
|
| 40 | + $_SESSION['itemname'] = $roledata['name']; |
|
| 41 | 41 | } else { |
| 42 | - $roledata = 0; |
|
| 43 | - $_SESSION['itemname'] = $_lang["new_role"]; |
|
| 42 | + $roledata = 0; |
|
| 43 | + $_SESSION['itemname'] = $_lang["new_role"]; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Add lock-element JS-Script |
@@ -107,63 +107,63 @@ discard block |
||
| 107 | 107 | <div class="form-group"> |
| 108 | 108 | <h3><?= $_lang['page_data_general'] ?></h3> |
| 109 | 109 | <?php |
| 110 | - echo render_form('frames', $_lang['role_frames'], 'disabled'); |
|
| 111 | - echo render_form('home', $_lang['role_home'], 'disabled'); |
|
| 112 | - echo render_form('messages', $_lang['role_messages']); |
|
| 113 | - echo render_form('logout', $_lang['role_logout'], 'disabled'); |
|
| 114 | - echo render_form('help', $_lang['role_help']); |
|
| 115 | - echo render_form('action_ok', $_lang['role_actionok'], 'disabled'); |
|
| 116 | - echo render_form('error_dialog', $_lang['role_errors'], 'disabled'); |
|
| 117 | - echo render_form('about', $_lang['role_about'], 'disabled'); |
|
| 118 | - echo render_form('credits', $_lang['role_credits'], 'disabled'); |
|
| 119 | - echo render_form('change_password', $_lang['role_change_password']); |
|
| 120 | - echo render_form('save_password', $_lang['role_save_password']); |
|
| 121 | - ?> |
|
| 110 | + echo render_form('frames', $_lang['role_frames'], 'disabled'); |
|
| 111 | + echo render_form('home', $_lang['role_home'], 'disabled'); |
|
| 112 | + echo render_form('messages', $_lang['role_messages']); |
|
| 113 | + echo render_form('logout', $_lang['role_logout'], 'disabled'); |
|
| 114 | + echo render_form('help', $_lang['role_help']); |
|
| 115 | + echo render_form('action_ok', $_lang['role_actionok'], 'disabled'); |
|
| 116 | + echo render_form('error_dialog', $_lang['role_errors'], 'disabled'); |
|
| 117 | + echo render_form('about', $_lang['role_about'], 'disabled'); |
|
| 118 | + echo render_form('credits', $_lang['role_credits'], 'disabled'); |
|
| 119 | + echo render_form('change_password', $_lang['role_change_password']); |
|
| 120 | + echo render_form('save_password', $_lang['role_save_password']); |
|
| 121 | + ?> |
|
| 122 | 122 | </div> |
| 123 | 123 | </div> |
| 124 | 124 | <div class="col-sm-6 col-lg-3"> |
| 125 | 125 | <div class="form-group"> |
| 126 | 126 | <h3><?= $_lang['role_content_management'] ?></h3> |
| 127 | 127 | <?php |
| 128 | - echo render_form('view_document', $_lang['role_view_docdata'], 'disabled'); |
|
| 129 | - echo render_form('new_document', $_lang['role_create_doc']); |
|
| 130 | - echo render_form('edit_document', $_lang['role_edit_doc']); |
|
| 131 | - echo render_form('change_resourcetype', $_lang['role_change_resourcetype']); |
|
| 132 | - echo render_form('save_document', $_lang['role_save_doc']); |
|
| 133 | - echo render_form('publish_document', $_lang['role_publish_doc']); |
|
| 134 | - echo render_form('delete_document', $_lang['role_delete_doc']); |
|
| 135 | - echo render_form('empty_trash', $_lang['role_empty_trash']); |
|
| 136 | - echo render_form('empty_cache', $_lang['role_cache_refresh']); |
|
| 137 | - echo render_form('view_unpublished', $_lang['role_view_unpublished']); |
|
| 138 | - ?> |
|
| 128 | + echo render_form('view_document', $_lang['role_view_docdata'], 'disabled'); |
|
| 129 | + echo render_form('new_document', $_lang['role_create_doc']); |
|
| 130 | + echo render_form('edit_document', $_lang['role_edit_doc']); |
|
| 131 | + echo render_form('change_resourcetype', $_lang['role_change_resourcetype']); |
|
| 132 | + echo render_form('save_document', $_lang['role_save_doc']); |
|
| 133 | + echo render_form('publish_document', $_lang['role_publish_doc']); |
|
| 134 | + echo render_form('delete_document', $_lang['role_delete_doc']); |
|
| 135 | + echo render_form('empty_trash', $_lang['role_empty_trash']); |
|
| 136 | + echo render_form('empty_cache', $_lang['role_cache_refresh']); |
|
| 137 | + echo render_form('view_unpublished', $_lang['role_view_unpublished']); |
|
| 138 | + ?> |
|
| 139 | 139 | </div> |
| 140 | 140 | </div> |
| 141 | 141 | <div class="col-sm-6 col-lg-3 form-group"> |
| 142 | 142 | <div class="form-group"> |
| 143 | 143 | <h3><?= $_lang['role_file_management'] ?></h3> |
| 144 | 144 | <?php |
| 145 | - echo render_form('file_manager', $_lang['role_file_manager']); |
|
| 146 | - echo render_form('assets_files', $_lang['role_assets_files']); |
|
| 147 | - echo render_form('assets_images', $_lang['role_assets_images']); |
|
| 148 | - ?> |
|
| 145 | + echo render_form('file_manager', $_lang['role_file_manager']); |
|
| 146 | + echo render_form('assets_files', $_lang['role_assets_files']); |
|
| 147 | + echo render_form('assets_images', $_lang['role_assets_images']); |
|
| 148 | + ?> |
|
| 149 | 149 | </div> |
| 150 | 150 | <div class="form-group"> |
| 151 | 151 | <h3><?= $_lang['category_management'] ?></h3> |
| 152 | 152 | <?php |
| 153 | - echo render_form('category_manager', $_lang['role_category_manager']); |
|
| 154 | - ?> |
|
| 153 | + echo render_form('category_manager', $_lang['role_category_manager']); |
|
| 154 | + ?> |
|
| 155 | 155 | </div> |
| 156 | 156 | </div> |
| 157 | 157 | <div class="col-sm-6 col-lg-3"> |
| 158 | 158 | <div class="form-group"> |
| 159 | 159 | <h3><?= $_lang['role_module_management'] ?></h3> |
| 160 | 160 | <?php |
| 161 | - echo render_form('new_module', $_lang['role_new_module']); |
|
| 162 | - echo render_form('edit_module', $_lang['role_edit_module']); |
|
| 163 | - echo render_form('save_module', $_lang['role_save_module']); |
|
| 164 | - echo render_form('delete_module', $_lang['role_delete_module']); |
|
| 165 | - echo render_form('exec_module', $_lang['role_run_module']); |
|
| 166 | - ?> |
|
| 161 | + echo render_form('new_module', $_lang['role_new_module']); |
|
| 162 | + echo render_form('edit_module', $_lang['role_edit_module']); |
|
| 163 | + echo render_form('save_module', $_lang['role_save_module']); |
|
| 164 | + echo render_form('delete_module', $_lang['role_delete_module']); |
|
| 165 | + echo render_form('exec_module', $_lang['role_run_module']); |
|
| 166 | + ?> |
|
| 167 | 167 | </div> |
| 168 | 168 | </div> |
| 169 | 169 | </div> |
@@ -173,44 +173,44 @@ discard block |
||
| 173 | 173 | <div class="form-group"> |
| 174 | 174 | <h3><?= $_lang['role_template_management'] ?></h3> |
| 175 | 175 | <?php |
| 176 | - echo render_form('new_template', $_lang['role_create_template']); |
|
| 177 | - echo render_form('edit_template', $_lang['role_edit_template']); |
|
| 178 | - echo render_form('save_template', $_lang['role_save_template']); |
|
| 179 | - echo render_form('delete_template', $_lang['role_delete_template']); |
|
| 180 | - ?> |
|
| 176 | + echo render_form('new_template', $_lang['role_create_template']); |
|
| 177 | + echo render_form('edit_template', $_lang['role_edit_template']); |
|
| 178 | + echo render_form('save_template', $_lang['role_save_template']); |
|
| 179 | + echo render_form('delete_template', $_lang['role_delete_template']); |
|
| 180 | + ?> |
|
| 181 | 181 | </div> |
| 182 | 182 | </div> |
| 183 | 183 | <div class="col-sm-6 col-lg-3"> |
| 184 | 184 | <div class="form-group"> |
| 185 | 185 | <h3><?= $_lang['role_snippet_management'] ?></h3> |
| 186 | 186 | <?php |
| 187 | - echo render_form('new_snippet', $_lang['role_create_snippet']); |
|
| 188 | - echo render_form('edit_snippet', $_lang['role_edit_snippet']); |
|
| 189 | - echo render_form('save_snippet', $_lang['role_save_snippet']); |
|
| 190 | - echo render_form('delete_snippet', $_lang['role_delete_snippet']); |
|
| 191 | - ?> |
|
| 187 | + echo render_form('new_snippet', $_lang['role_create_snippet']); |
|
| 188 | + echo render_form('edit_snippet', $_lang['role_edit_snippet']); |
|
| 189 | + echo render_form('save_snippet', $_lang['role_save_snippet']); |
|
| 190 | + echo render_form('delete_snippet', $_lang['role_delete_snippet']); |
|
| 191 | + ?> |
|
| 192 | 192 | </div> |
| 193 | 193 | </div> |
| 194 | 194 | <div class="col-sm-6 col-lg-3"> |
| 195 | 195 | <div class="form-group"> |
| 196 | 196 | <h3><?= $_lang['role_chunk_management'] ?></h3> |
| 197 | 197 | <?php |
| 198 | - echo render_form('new_chunk', $_lang['role_create_chunk']); |
|
| 199 | - echo render_form('edit_chunk', $_lang['role_edit_chunk']); |
|
| 200 | - echo render_form('save_chunk', $_lang['role_save_chunk']); |
|
| 201 | - echo render_form('delete_chunk', $_lang['role_delete_chunk']); |
|
| 202 | - ?> |
|
| 198 | + echo render_form('new_chunk', $_lang['role_create_chunk']); |
|
| 199 | + echo render_form('edit_chunk', $_lang['role_edit_chunk']); |
|
| 200 | + echo render_form('save_chunk', $_lang['role_save_chunk']); |
|
| 201 | + echo render_form('delete_chunk', $_lang['role_delete_chunk']); |
|
| 202 | + ?> |
|
| 203 | 203 | </div> |
| 204 | 204 | </div> |
| 205 | 205 | <div class="col-sm-6 col-lg-3"> |
| 206 | 206 | <div class="form-group"> |
| 207 | 207 | <h3><?= $_lang['role_plugin_management'] ?></h3> |
| 208 | 208 | <?php |
| 209 | - echo render_form('new_plugin', $_lang['role_create_plugin']); |
|
| 210 | - echo render_form('edit_plugin', $_lang['role_edit_plugin']); |
|
| 211 | - echo render_form('save_plugin', $_lang['role_save_plugin']); |
|
| 212 | - echo render_form('delete_plugin', $_lang['role_delete_plugin']); |
|
| 213 | - ?> |
|
| 209 | + echo render_form('new_plugin', $_lang['role_create_plugin']); |
|
| 210 | + echo render_form('edit_plugin', $_lang['role_edit_plugin']); |
|
| 211 | + echo render_form('save_plugin', $_lang['role_save_plugin']); |
|
| 212 | + echo render_form('delete_plugin', $_lang['role_delete_plugin']); |
|
| 213 | + ?> |
|
| 214 | 214 | </div> |
| 215 | 215 | </div> |
| 216 | 216 | </div> |
@@ -220,42 +220,42 @@ discard block |
||
| 220 | 220 | <div class="form-group"> |
| 221 | 221 | <h3><?= $_lang['role_user_management'] ?></h3> |
| 222 | 222 | <?php |
| 223 | - echo render_form('new_user', $_lang['role_new_user']); |
|
| 224 | - echo render_form('edit_user', $_lang['role_edit_user']); |
|
| 225 | - echo render_form('save_user', $_lang['role_save_user']); |
|
| 226 | - echo render_form('delete_user', $_lang['role_delete_user']); |
|
| 227 | - ?> |
|
| 223 | + echo render_form('new_user', $_lang['role_new_user']); |
|
| 224 | + echo render_form('edit_user', $_lang['role_edit_user']); |
|
| 225 | + echo render_form('save_user', $_lang['role_save_user']); |
|
| 226 | + echo render_form('delete_user', $_lang['role_delete_user']); |
|
| 227 | + ?> |
|
| 228 | 228 | </div> |
| 229 | 229 | </div> |
| 230 | 230 | <div class="col-sm-6 col-lg-3"> |
| 231 | 231 | <div class="form-group"> |
| 232 | 232 | <h3><?= $_lang['role_web_user_management'] ?></h3> |
| 233 | 233 | <?php |
| 234 | - echo render_form('new_web_user', $_lang['role_new_web_user']); |
|
| 235 | - echo render_form('edit_web_user', $_lang['role_edit_web_user']); |
|
| 236 | - echo render_form('save_web_user', $_lang['role_save_web_user']); |
|
| 237 | - echo render_form('delete_web_user', $_lang['role_delete_web_user']); |
|
| 238 | - ?> |
|
| 234 | + echo render_form('new_web_user', $_lang['role_new_web_user']); |
|
| 235 | + echo render_form('edit_web_user', $_lang['role_edit_web_user']); |
|
| 236 | + echo render_form('save_web_user', $_lang['role_save_web_user']); |
|
| 237 | + echo render_form('delete_web_user', $_lang['role_delete_web_user']); |
|
| 238 | + ?> |
|
| 239 | 239 | </div> |
| 240 | 240 | </div> |
| 241 | 241 | <div class="col-sm-6 col-lg-3"> |
| 242 | 242 | <div class="form-group"> |
| 243 | 243 | <h3><?= $_lang['role_udperms'] ?></h3> |
| 244 | 244 | <?php |
| 245 | - echo render_form('access_permissions', $_lang['role_access_persmissions']); |
|
| 246 | - echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']); |
|
| 247 | - ?> |
|
| 245 | + echo render_form('access_permissions', $_lang['role_access_persmissions']); |
|
| 246 | + echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']); |
|
| 247 | + ?> |
|
| 248 | 248 | </div> |
| 249 | 249 | </div> |
| 250 | 250 | <div class="col-sm-6 col-lg-3"> |
| 251 | 251 | <div class="form-group"> |
| 252 | 252 | <h3><?= $_lang['role_role_management'] ?></h3> |
| 253 | 253 | <?php |
| 254 | - echo render_form('new_role', $_lang['role_new_role']); |
|
| 255 | - echo render_form('edit_role', $_lang['role_edit_role']); |
|
| 256 | - echo render_form('save_role', $_lang['role_save_role']); |
|
| 257 | - echo render_form('delete_role', $_lang['role_delete_role']); |
|
| 258 | - ?> |
|
| 254 | + echo render_form('new_role', $_lang['role_new_role']); |
|
| 255 | + echo render_form('edit_role', $_lang['role_edit_role']); |
|
| 256 | + echo render_form('save_role', $_lang['role_save_role']); |
|
| 257 | + echo render_form('delete_role', $_lang['role_delete_role']); |
|
| 258 | + ?> |
|
| 259 | 259 | </div> |
| 260 | 260 | </div> |
| 261 | 261 | </div> |
@@ -265,23 +265,23 @@ discard block |
||
| 265 | 265 | <div class="form-group"> |
| 266 | 266 | <h3><?= $_lang['role_eventlog_management'] ?></h3> |
| 267 | 267 | <?php |
| 268 | - echo render_form('view_eventlog', $_lang['role_view_eventlog']); |
|
| 269 | - echo render_form('delete_eventlog', $_lang['role_delete_eventlog']); |
|
| 270 | - ?> |
|
| 268 | + echo render_form('view_eventlog', $_lang['role_view_eventlog']); |
|
| 269 | + echo render_form('delete_eventlog', $_lang['role_delete_eventlog']); |
|
| 270 | + ?> |
|
| 271 | 271 | </div> |
| 272 | 272 | </div> |
| 273 | 273 | <div class="col-sm-6 col-lg-3"> |
| 274 | 274 | <div class="form-group"> |
| 275 | 275 | <h3><?= $_lang['role_config_management'] ?></h3> |
| 276 | 276 | <?php |
| 277 | - echo render_form('logs', $_lang['role_view_logs']); |
|
| 278 | - echo render_form('settings', $_lang['role_edit_settings']); |
|
| 279 | - echo render_form('bk_manager', $_lang['role_bk_manager']); |
|
| 280 | - echo render_form('import_static', $_lang['role_import_static']); |
|
| 281 | - echo render_form('export_static', $_lang['role_export_static']); |
|
| 282 | - echo render_form('remove_locks', $_lang['role_remove_locks']); |
|
| 283 | - echo render_form('display_locks', $_lang['role_display_locks']); |
|
| 284 | - ?> |
|
| 277 | + echo render_form('logs', $_lang['role_view_logs']); |
|
| 278 | + echo render_form('settings', $_lang['role_edit_settings']); |
|
| 279 | + echo render_form('bk_manager', $_lang['role_bk_manager']); |
|
| 280 | + echo render_form('import_static', $_lang['role_import_static']); |
|
| 281 | + echo render_form('export_static', $_lang['role_export_static']); |
|
| 282 | + echo render_form('remove_locks', $_lang['role_remove_locks']); |
|
| 283 | + echo render_form('display_locks', $_lang['role_display_locks']); |
|
| 284 | + ?> |
|
| 285 | 285 | </div> |
| 286 | 286 | </div> |
| 287 | 287 | </div> |
@@ -300,32 +300,32 @@ discard block |
||
| 300 | 300 | * @return string |
| 301 | 301 | */ |
| 302 | 302 | function render_form($name, $label, $status = '') { |
| 303 | - $modx = DocumentParser::getInstance(); global $roledata; |
|
| 303 | + $modx = DocumentParser::getInstance(); global $roledata; |
|
| 304 | 304 | |
| 305 | - $tpl = '<label class="d-block" for="[+name+]check"> |
|
| 305 | + $tpl = '<label class="d-block" for="[+name+]check"> |
|
| 306 | 306 | <input name="[+name+]check" id="[+name+]check" class="click" type="checkbox" onchange="changestate(document.userform.[+name+])" [+checked+] [+status+]> |
| 307 | 307 | <input type="hidden" class="[+set+]" name="[+name+]" value="[+value+]"> |
| 308 | 308 | [+label+] |
| 309 | 309 | </label>'; |
| 310 | 310 | |
| 311 | - $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
| 312 | - $value = ($roledata[$name] == 1) ? 1 : 0; |
|
| 313 | - if($status == 'disabled') { |
|
| 314 | - $checked = 'checked'; |
|
| 315 | - $value = 1; |
|
| 316 | - $set = 'fix'; |
|
| 317 | - } else { |
|
| 318 | - $set = 'set'; |
|
| 319 | - } |
|
| 311 | + $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
| 312 | + $value = ($roledata[$name] == 1) ? 1 : 0; |
|
| 313 | + if($status == 'disabled') { |
|
| 314 | + $checked = 'checked'; |
|
| 315 | + $value = 1; |
|
| 316 | + $set = 'fix'; |
|
| 317 | + } else { |
|
| 318 | + $set = 'set'; |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - $ph = array( |
|
| 322 | - 'name' => $name, |
|
| 323 | - 'checked' => $checked, |
|
| 324 | - 'status' => $status, |
|
| 325 | - 'value' => $value, |
|
| 326 | - 'label' => $label, |
|
| 327 | - 'set' => $set |
|
| 328 | - ); |
|
| 321 | + $ph = array( |
|
| 322 | + 'name' => $name, |
|
| 323 | + 'checked' => $checked, |
|
| 324 | + 'status' => $status, |
|
| 325 | + 'value' => $value, |
|
| 326 | + 'label' => $label, |
|
| 327 | + 'set' => $set |
|
| 328 | + ); |
|
| 329 | 329 | |
| 330 | - return $modx->parseText($tpl, $ph); |
|
| 330 | + return $modx->parseText($tpl, $ph); |
|
| 331 | 331 | } |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -switch((int) $modx->manager->action) { |
|
| 6 | +switch ((int) $modx->manager->action) { |
|
| 7 | 7 | case 35: |
| 8 | - if(!$modx->hasPermission('edit_role')) { |
|
| 8 | + if (!$modx->hasPermission('edit_role')) { |
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | 10 | } |
| 11 | 11 | break; |
| 12 | 12 | case 38: |
| 13 | - if(!$modx->hasPermission('new_role')) { |
|
| 13 | + if (!$modx->hasPermission('new_role')) { |
|
| 14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 15 | 15 | } |
| 16 | 16 | break; |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -$role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 21 | +$role = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 22 | 22 | |
| 23 | 23 | $tbl_user_roles = $modx->getFullTableName('user_roles'); |
| 24 | 24 | |
| 25 | 25 | // check to see the snippet editor isn't locked |
| 26 | -if($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
| 26 | +if ($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
| 27 | 27 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | // Lock snippet for other users to edit |
| 32 | 32 | $modx->lockElement(8, $role); |
| 33 | 33 | |
| 34 | -if($modx->manager->action == '35') { |
|
| 34 | +if ($modx->manager->action == '35') { |
|
| 35 | 35 | $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
| 36 | 36 | $roledata = $modx->db->getRow($rs); |
| 37 | - if(!$roledata) { |
|
| 37 | + if (!$roledata) { |
|
| 38 | 38 | $modx->webAlertAndQuit("No role returned!"); |
| 39 | 39 | } |
| 40 | 40 | $_SESSION['itemname'] = $roledata['name']; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | // Add lock-element JS-Script |
| 47 | 47 | $lockElementId = $role; |
| 48 | 48 | $lockElementType = 8; |
| 49 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
| 49 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
| 50 | 50 | ?> |
| 51 | 51 | <script type="text/javascript"> |
| 52 | 52 | function changestate(element) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | <input type="hidden" name="id" value="<?= $_GET['id'] ?>"> |
| 83 | 83 | |
| 84 | 84 | <h1> |
| 85 | - <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'] . '<small>(' . $roledata['id'] . ')</small>' : $_lang['role_title']) ?> |
|
| 85 | + <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'].'<small>('.$roledata['id'].')</small>' : $_lang['role_title']) ?> |
|
| 86 | 86 | </h1> |
| 87 | 87 | |
| 88 | 88 | <?= $_style['actionbuttons']['dynamic']['savedelete'] ?> |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @param string $status |
| 300 | 300 | * @return string |
| 301 | 301 | */ |
| 302 | -function render_form($name, $label, $status = '') { |
|
| 302 | +function render_form($name, $label, $status = ''){ |
|
| 303 | 303 | $modx = DocumentParser::getInstance(); global $roledata; |
| 304 | 304 | |
| 305 | 305 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
| 312 | 312 | $value = ($roledata[$name] == 1) ? 1 : 0; |
| 313 | - if($status == 'disabled') { |
|
| 313 | + if ($status == 'disabled') { |
|
| 314 | 314 | $checked = 'checked'; |
| 315 | 315 | $value = 1; |
| 316 | 316 | $set = 'fix'; |
@@ -299,7 +299,8 @@ |
||
| 299 | 299 | * @param string $status |
| 300 | 300 | * @return string |
| 301 | 301 | */ |
| 302 | -function render_form($name, $label, $status = '') { |
|
| 302 | +function render_form($name, $label, $status = '') |
|
| 303 | +{ |
|
| 303 | 304 | $modx = DocumentParser::getInstance(); global $roledata; |
| 304 | 305 | |
| 305 | 306 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -893,7 +893,9 @@ |
||
| 893 | 893 | $modx = DocumentParser::getInstance(); global $_lang, $startpath, $filemanager_path, $uploadablefiles, $new_file_permissions; |
| 894 | 894 | $msg = ''; |
| 895 | 895 | foreach ($_FILES['userfile']['name'] as $i => $name) { |
| 896 | - if (empty($_FILES['userfile']['tmp_name'][$i])) continue; |
|
| 896 | + if (empty($_FILES['userfile']['tmp_name'][$i])) { |
|
| 897 | + continue; |
|
| 898 | + } |
|
| 897 | 899 | $userfile= array(); |
| 898 | 900 | |
| 899 | 901 | $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i]; |
@@ -1,17 +1,17 @@ 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('import_static')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // Files to upload |
| 10 | 10 | $allowedfiles = array( |
| 11 | - 'html', |
|
| 12 | - 'htm', |
|
| 13 | - 'shtml', |
|
| 14 | - 'xml' |
|
| 11 | + 'html', |
|
| 12 | + 'htm', |
|
| 13 | + 'shtml', |
|
| 14 | + 'xml' |
|
| 15 | 15 | ); |
| 16 | 16 | ?> |
| 17 | 17 | <script language="javascript"> |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | <div class="tab-page"> |
| 44 | 44 | <div class="container container-body"> |
| 45 | 45 | <?php |
| 46 | - if(!isset($_POST['import'])) { |
|
| 47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
| 48 | - ?> |
|
| 46 | + if(!isset($_POST['import'])) { |
|
| 47 | + echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
| 48 | + ?> |
|
| 49 | 49 | <form action="index.php" method="post" name="importFrm"> |
| 50 | 50 | <input type="hidden" name="import" value="import" /> |
| 51 | 51 | <input type="hidden" name="a" value="95" /> |
@@ -85,18 +85,18 @@ discard block |
||
| 85 | 85 | <a href="javascript:;" class="btn btn-primary" onclick="window.importFrm.submit();"><i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang["import_site_start"] ?></a> |
| 86 | 86 | </form> |
| 87 | 87 | <?php |
| 88 | - } else { |
|
| 89 | - run(); |
|
| 90 | - $modx->clearCache('full'); |
|
| 91 | - ?> |
|
| 88 | + } else { |
|
| 89 | + run(); |
|
| 90 | + $modx->clearCache('full'); |
|
| 91 | + ?> |
|
| 92 | 92 | <a href="javascript:;" class="btn btn-primary" onclick="window.location.href='index.php?a=2';"><i class="<?= $_style["actions_close"] ?>"></i> <?= $_lang["close"] ?></a> |
| 93 | 93 | <script type="text/javascript"> |
| 94 | 94 | top.mainMenu.reloadtree(); |
| 95 | 95 | parent.tree.ca = 'open'; |
| 96 | 96 | </script> |
| 97 | 97 | <?php |
| 98 | - } |
|
| 99 | - ?> |
|
| 98 | + } |
|
| 99 | + ?> |
|
| 100 | 100 | </div> |
| 101 | 101 | </div> |
| 102 | 102 | |
@@ -105,64 +105,64 @@ discard block |
||
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | 107 | function run() { |
| 108 | - $modx = DocumentParser::getInstance(); global $_lang; |
|
| 108 | + $modx = DocumentParser::getInstance(); global $_lang; |
|
| 109 | 109 | |
| 110 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 111 | - $output = ''; |
|
| 112 | - $maxtime = $_POST['maxtime']; |
|
| 110 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 111 | + $output = ''; |
|
| 112 | + $maxtime = $_POST['maxtime']; |
|
| 113 | 113 | |
| 114 | - if(!is_numeric($maxtime)) { |
|
| 115 | - $maxtime = 30; |
|
| 116 | - } |
|
| 114 | + if(!is_numeric($maxtime)) { |
|
| 115 | + $maxtime = 30; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - @set_time_limit($maxtime); |
|
| 118 | + @set_time_limit($maxtime); |
|
| 119 | 119 | |
| 120 | - $mtime = microtime(); |
|
| 121 | - $mtime = explode(' ', $mtime); |
|
| 122 | - $mtime = $mtime[1] + $mtime[0]; |
|
| 123 | - $importstart = $mtime; |
|
| 120 | + $mtime = microtime(); |
|
| 121 | + $mtime = explode(' ', $mtime); |
|
| 122 | + $mtime = $mtime[1] + $mtime[0]; |
|
| 123 | + $importstart = $mtime; |
|
| 124 | 124 | |
| 125 | - if($_POST['reset'] == 'on') { |
|
| 126 | - $modx->db->truncate($tbl_site_content); |
|
| 127 | - $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
| 128 | - } |
|
| 125 | + if($_POST['reset'] == 'on') { |
|
| 126 | + $modx->db->truncate($tbl_site_content); |
|
| 127 | + $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - $parent = (int)$_POST['parent']; |
|
| 130 | + $parent = (int)$_POST['parent']; |
|
| 131 | 131 | |
| 132 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 133 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 134 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 135 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 136 | - } else { |
|
| 132 | + if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 133 | + $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 134 | + } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 135 | + $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 136 | + } else { |
|
| 137 | 137 | $filedir = ''; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $filesfound = 0; |
|
| 140 | + $filesfound = 0; |
|
| 141 | 141 | |
| 142 | - $files = getFiles($filedir); |
|
| 143 | - $files = pop_index($files); |
|
| 142 | + $files = getFiles($filedir); |
|
| 143 | + $files = pop_index($files); |
|
| 144 | 144 | |
| 145 | - // no. of files to import |
|
| 146 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 145 | + // no. of files to import |
|
| 146 | + $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 147 | 147 | |
| 148 | - // import files |
|
| 149 | - if(0 < count($files)) { |
|
| 150 | - $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
| 151 | - importFiles($parent, $filedir, $files, 'root'); |
|
| 152 | - } |
|
| 148 | + // import files |
|
| 149 | + if(0 < count($files)) { |
|
| 150 | + $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
| 151 | + importFiles($parent, $filedir, $files, 'root'); |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - $mtime = microtime(); |
|
| 155 | - $mtime = explode(' ', $mtime); |
|
| 156 | - $mtime = $mtime[1] + $mtime[0]; |
|
| 157 | - $importend = $mtime; |
|
| 158 | - $totaltime = ($importend - $importstart); |
|
| 159 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 154 | + $mtime = microtime(); |
|
| 155 | + $mtime = explode(' ', $mtime); |
|
| 156 | + $mtime = $mtime[1] + $mtime[0]; |
|
| 157 | + $importend = $mtime; |
|
| 158 | + $totaltime = ($importend - $importstart); |
|
| 159 | + $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 160 | 160 | |
| 161 | - if($_POST['convert_link'] == 'on') { |
|
| 162 | - convertLink(); |
|
| 163 | - } |
|
| 161 | + if($_POST['convert_link'] == 'on') { |
|
| 162 | + convertLink(); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - return $output; |
|
| 165 | + return $output; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -172,144 +172,144 @@ discard block |
||
| 172 | 172 | * @param string $mode |
| 173 | 173 | */ |
| 174 | 174 | function importFiles($parent, $filedir, $files, $mode) { |
| 175 | - $modx = DocumentParser::getInstance(); |
|
| 176 | - global $_lang, $allowedfiles; |
|
| 177 | - global $search_default, $cache_default, $publish_default; |
|
| 178 | - |
|
| 179 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 180 | - $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
| 181 | - |
|
| 182 | - $createdby = $modx->getLoginUserID(); |
|
| 183 | - if(!is_array($files)) { |
|
| 184 | - return; |
|
| 185 | - } |
|
| 186 | - if($_POST['object'] === 'all') { |
|
| 187 | - $modx->config['default_template'] = '0'; |
|
| 188 | - $richtext = '0'; |
|
| 189 | - } else { |
|
| 190 | - $richtext = '1'; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - foreach($files as $id => $value) { |
|
| 194 | - if(is_array($value)) { |
|
| 195 | - // create folder |
|
| 196 | - $alias = $id; |
|
| 197 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 198 | - $field = array(); |
|
| 199 | - $field['type'] = 'document'; |
|
| 200 | - $field['contentType'] = 'text/html'; |
|
| 201 | - $field['published'] = $publish_default; |
|
| 202 | - $field['parent'] = $parent; |
|
| 203 | - $field['alias'] = $modx->stripAlias($alias); |
|
| 204 | - $field['richtext'] = $richtext; |
|
| 205 | - $field['template'] = $modx->config['default_template']; |
|
| 206 | - $field['searchable'] = $search_default; |
|
| 207 | - $field['cacheable'] = $cache_default; |
|
| 208 | - $field['createdby'] = $createdby; |
|
| 209 | - $field['isfolder'] = 1; |
|
| 210 | - $field['menuindex'] = 1; |
|
| 211 | - $find = false; |
|
| 212 | - foreach(array( |
|
| 213 | - 'index.html', |
|
| 214 | - 'index.htm' |
|
| 215 | - ) as $filename) { |
|
| 216 | - $filepath = $filedir . $alias . '/' . $filename; |
|
| 217 | - if($find === false && file_exists($filepath)) { |
|
| 218 | - $file = getFileContent($filepath); |
|
| 219 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 220 | - |
|
| 221 | - $date = filemtime($filepath); |
|
| 222 | - $field['pagetitle'] = $pagetitle; |
|
| 223 | - $field['longtitle'] = $pagetitle; |
|
| 224 | - $field['description'] = $description; |
|
| 225 | - $field['content'] = $modx->db->escape($content); |
|
| 226 | - $field['createdon'] = $date; |
|
| 227 | - $field['editedon'] = $date; |
|
| 228 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 229 | - if($newid) { |
|
| 230 | - $find = true; |
|
| 231 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 232 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 233 | - } else { |
|
| 234 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 235 | - exit; |
|
| 236 | - } |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - if($find === false) { |
|
| 240 | - $date = time(); |
|
| 241 | - $field['pagetitle'] = '---'; |
|
| 242 | - $field['content'] = ''; |
|
| 243 | - $field['createdon'] = $date; |
|
| 244 | - $field['editedon'] = $date; |
|
| 245 | - $field['hidemenu'] = '1'; |
|
| 246 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 247 | - if($newid) { |
|
| 248 | - $find = true; |
|
| 249 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 250 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 251 | - } else { |
|
| 252 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 253 | - exit; |
|
| 254 | - } |
|
| 255 | - } |
|
| 256 | - } else { |
|
| 257 | - // create document |
|
| 258 | - if($mode == 'sub' && $value == 'index.html') { |
|
| 259 | - continue; |
|
| 260 | - } |
|
| 261 | - $filename = $value; |
|
| 262 | - $fparts = explode('.', $value); |
|
| 263 | - $alias = $fparts[0]; |
|
| 264 | - $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
| 265 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 266 | - |
|
| 267 | - if(!in_array($ext, $allowedfiles)) { |
|
| 268 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 269 | - } else { |
|
| 270 | - $filepath = $filedir . $filename; |
|
| 271 | - $file = getFileContent($filepath); |
|
| 272 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 273 | - |
|
| 274 | - $date = filemtime($filepath); |
|
| 275 | - $field = array(); |
|
| 276 | - $field['type'] = 'document'; |
|
| 277 | - $field['contentType'] = 'text/html'; |
|
| 278 | - $field['pagetitle'] = $pagetitle; |
|
| 279 | - $field['longtitle'] = $pagetitle; |
|
| 280 | - $field['description'] = $description; |
|
| 281 | - $field['alias'] = $modx->stripAlias($alias); |
|
| 282 | - $field['published'] = $publish_default; |
|
| 283 | - $field['parent'] = $parent; |
|
| 284 | - $field['content'] = $modx->db->escape($content); |
|
| 285 | - $field['richtext'] = $richtext; |
|
| 286 | - $field['template'] = $modx->config['default_template']; |
|
| 287 | - $field['searchable'] = $search_default; |
|
| 288 | - $field['cacheable'] = $cache_default; |
|
| 289 | - $field['createdby'] = $createdby; |
|
| 290 | - $field['createdon'] = $date; |
|
| 291 | - $field['editedon'] = $date; |
|
| 292 | - $field['isfolder'] = 0; |
|
| 293 | - $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
| 294 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 295 | - if($newid) { |
|
| 296 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 297 | - } else { |
|
| 298 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 299 | - exit; |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - $is_site_start = false; |
|
| 303 | - if($filename == 'index.html') { |
|
| 304 | - $is_site_start = true; |
|
| 305 | - } |
|
| 306 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 307 | - $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
| 308 | - $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - } |
|
| 312 | - } |
|
| 175 | + $modx = DocumentParser::getInstance(); |
|
| 176 | + global $_lang, $allowedfiles; |
|
| 177 | + global $search_default, $cache_default, $publish_default; |
|
| 178 | + |
|
| 179 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 180 | + $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
| 181 | + |
|
| 182 | + $createdby = $modx->getLoginUserID(); |
|
| 183 | + if(!is_array($files)) { |
|
| 184 | + return; |
|
| 185 | + } |
|
| 186 | + if($_POST['object'] === 'all') { |
|
| 187 | + $modx->config['default_template'] = '0'; |
|
| 188 | + $richtext = '0'; |
|
| 189 | + } else { |
|
| 190 | + $richtext = '1'; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + foreach($files as $id => $value) { |
|
| 194 | + if(is_array($value)) { |
|
| 195 | + // create folder |
|
| 196 | + $alias = $id; |
|
| 197 | + printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 198 | + $field = array(); |
|
| 199 | + $field['type'] = 'document'; |
|
| 200 | + $field['contentType'] = 'text/html'; |
|
| 201 | + $field['published'] = $publish_default; |
|
| 202 | + $field['parent'] = $parent; |
|
| 203 | + $field['alias'] = $modx->stripAlias($alias); |
|
| 204 | + $field['richtext'] = $richtext; |
|
| 205 | + $field['template'] = $modx->config['default_template']; |
|
| 206 | + $field['searchable'] = $search_default; |
|
| 207 | + $field['cacheable'] = $cache_default; |
|
| 208 | + $field['createdby'] = $createdby; |
|
| 209 | + $field['isfolder'] = 1; |
|
| 210 | + $field['menuindex'] = 1; |
|
| 211 | + $find = false; |
|
| 212 | + foreach(array( |
|
| 213 | + 'index.html', |
|
| 214 | + 'index.htm' |
|
| 215 | + ) as $filename) { |
|
| 216 | + $filepath = $filedir . $alias . '/' . $filename; |
|
| 217 | + if($find === false && file_exists($filepath)) { |
|
| 218 | + $file = getFileContent($filepath); |
|
| 219 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 220 | + |
|
| 221 | + $date = filemtime($filepath); |
|
| 222 | + $field['pagetitle'] = $pagetitle; |
|
| 223 | + $field['longtitle'] = $pagetitle; |
|
| 224 | + $field['description'] = $description; |
|
| 225 | + $field['content'] = $modx->db->escape($content); |
|
| 226 | + $field['createdon'] = $date; |
|
| 227 | + $field['editedon'] = $date; |
|
| 228 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 229 | + if($newid) { |
|
| 230 | + $find = true; |
|
| 231 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 232 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 233 | + } else { |
|
| 234 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 235 | + exit; |
|
| 236 | + } |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | + if($find === false) { |
|
| 240 | + $date = time(); |
|
| 241 | + $field['pagetitle'] = '---'; |
|
| 242 | + $field['content'] = ''; |
|
| 243 | + $field['createdon'] = $date; |
|
| 244 | + $field['editedon'] = $date; |
|
| 245 | + $field['hidemenu'] = '1'; |
|
| 246 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 247 | + if($newid) { |
|
| 248 | + $find = true; |
|
| 249 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 250 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 251 | + } else { |
|
| 252 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 253 | + exit; |
|
| 254 | + } |
|
| 255 | + } |
|
| 256 | + } else { |
|
| 257 | + // create document |
|
| 258 | + if($mode == 'sub' && $value == 'index.html') { |
|
| 259 | + continue; |
|
| 260 | + } |
|
| 261 | + $filename = $value; |
|
| 262 | + $fparts = explode('.', $value); |
|
| 263 | + $alias = $fparts[0]; |
|
| 264 | + $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
| 265 | + printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 266 | + |
|
| 267 | + if(!in_array($ext, $allowedfiles)) { |
|
| 268 | + echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 269 | + } else { |
|
| 270 | + $filepath = $filedir . $filename; |
|
| 271 | + $file = getFileContent($filepath); |
|
| 272 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 273 | + |
|
| 274 | + $date = filemtime($filepath); |
|
| 275 | + $field = array(); |
|
| 276 | + $field['type'] = 'document'; |
|
| 277 | + $field['contentType'] = 'text/html'; |
|
| 278 | + $field['pagetitle'] = $pagetitle; |
|
| 279 | + $field['longtitle'] = $pagetitle; |
|
| 280 | + $field['description'] = $description; |
|
| 281 | + $field['alias'] = $modx->stripAlias($alias); |
|
| 282 | + $field['published'] = $publish_default; |
|
| 283 | + $field['parent'] = $parent; |
|
| 284 | + $field['content'] = $modx->db->escape($content); |
|
| 285 | + $field['richtext'] = $richtext; |
|
| 286 | + $field['template'] = $modx->config['default_template']; |
|
| 287 | + $field['searchable'] = $search_default; |
|
| 288 | + $field['cacheable'] = $cache_default; |
|
| 289 | + $field['createdby'] = $createdby; |
|
| 290 | + $field['createdon'] = $date; |
|
| 291 | + $field['editedon'] = $date; |
|
| 292 | + $field['isfolder'] = 0; |
|
| 293 | + $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
| 294 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 295 | + if($newid) { |
|
| 296 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 297 | + } else { |
|
| 298 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 299 | + exit; |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + $is_site_start = false; |
|
| 303 | + if($filename == 'index.html') { |
|
| 304 | + $is_site_start = true; |
|
| 305 | + } |
|
| 306 | + if($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 307 | + $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
| 308 | + $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -319,27 +319,27 @@ discard block |
||
| 319 | 319 | * @return array |
| 320 | 320 | */ |
| 321 | 321 | function getFiles($directory, $listing = array(), $count = 0) { |
| 322 | - global $_lang; |
|
| 323 | - global $filesfound; |
|
| 324 | - $dummy = $count; |
|
| 325 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
| 326 | - foreach($files as $file) { |
|
| 327 | - if($file == '.' || $file == '..') { |
|
| 328 | - continue; |
|
| 329 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
| 330 | - closedir($h); |
|
| 331 | - $count = -1; |
|
| 332 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 333 | - } elseif(strpos($file, '.htm') !== false) { |
|
| 334 | - $listing[$dummy] = $file; |
|
| 335 | - $dummy = $dummy + 1; |
|
| 336 | - $filesfound++; |
|
| 337 | - } |
|
| 338 | - } |
|
| 339 | - } else { |
|
| 340 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 341 | - } |
|
| 342 | - return ($listing); |
|
| 322 | + global $_lang; |
|
| 323 | + global $filesfound; |
|
| 324 | + $dummy = $count; |
|
| 325 | + if( ! empty($directory) && $files = scandir($directory)) { |
|
| 326 | + foreach($files as $file) { |
|
| 327 | + if($file == '.' || $file == '..') { |
|
| 328 | + continue; |
|
| 329 | + } elseif($h = @opendir($directory . $file . "/")) { |
|
| 330 | + closedir($h); |
|
| 331 | + $count = -1; |
|
| 332 | + $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 333 | + } elseif(strpos($file, '.htm') !== false) { |
|
| 334 | + $listing[$dummy] = $file; |
|
| 335 | + $dummy = $dummy + 1; |
|
| 336 | + $filesfound++; |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | + } else { |
|
| 340 | + echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 341 | + } |
|
| 342 | + return ($listing); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /** |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | * @return bool|string |
| 348 | 348 | */ |
| 349 | 349 | function getFileContent($filepath) { |
| 350 | - global $_lang; |
|
| 351 | - // get the file |
|
| 352 | - if(!$buffer = file_get_contents($filepath)) { |
|
| 353 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 354 | - } else { |
|
| 355 | - return $buffer; |
|
| 356 | - } |
|
| 350 | + global $_lang; |
|
| 351 | + // get the file |
|
| 352 | + if(!$buffer = file_get_contents($filepath)) { |
|
| 353 | + echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 354 | + } else { |
|
| 355 | + return $buffer; |
|
| 356 | + } |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -361,20 +361,20 @@ discard block |
||
| 361 | 361 | * @return array |
| 362 | 362 | */ |
| 363 | 363 | function pop_index($array) { |
| 364 | - $new_array = array(); |
|
| 365 | - foreach($array as $k => $v) { |
|
| 366 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
| 367 | - $new_array[$k] = $v; |
|
| 368 | - } else { |
|
| 369 | - array_unshift($new_array, $v); |
|
| 370 | - } |
|
| 371 | - } |
|
| 372 | - foreach($array as $k => $v) { |
|
| 373 | - if(is_array($v)) { |
|
| 374 | - $new_array[$k] = $v; |
|
| 375 | - } |
|
| 376 | - } |
|
| 377 | - return $new_array; |
|
| 364 | + $new_array = array(); |
|
| 365 | + foreach($array as $k => $v) { |
|
| 366 | + if($v !== 'index.html' && $v !== 'index.htm') { |
|
| 367 | + $new_array[$k] = $v; |
|
| 368 | + } else { |
|
| 369 | + array_unshift($new_array, $v); |
|
| 370 | + } |
|
| 371 | + } |
|
| 372 | + foreach($array as $k => $v) { |
|
| 373 | + if(is_array($v)) { |
|
| 374 | + $new_array[$k] = $v; |
|
| 375 | + } |
|
| 376 | + } |
|
| 377 | + return $new_array; |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
@@ -384,108 +384,108 @@ discard block |
||
| 384 | 384 | * @return array |
| 385 | 385 | */ |
| 386 | 386 | function treatContent($src, $filename, $alias) { |
| 387 | - $modx = DocumentParser::getInstance(); |
|
| 388 | - |
|
| 389 | - $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
| 390 | - |
|
| 391 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 392 | - $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 393 | - $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
| 394 | - } else { |
|
| 395 | - $pagetitle = $alias; |
|
| 396 | - } |
|
| 397 | - if(!$pagetitle) { |
|
| 398 | - $pagetitle = $alias; |
|
| 399 | - } |
|
| 400 | - |
|
| 401 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 402 | - $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 403 | - $description = str_replace('[*description*]', '', $description); |
|
| 404 | - } else { |
|
| 405 | - $description = ''; |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 409 | - $content = $matches[1]; |
|
| 410 | - } else { |
|
| 411 | - $content = $src; |
|
| 412 | - $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
| 413 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 414 | - $content = preg_replace($s, $r, $content); |
|
| 415 | - $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
| 416 | - } |
|
| 417 | - $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
| 418 | - $content = trim($content); |
|
| 419 | - $pagetitle = $modx->db->escape($pagetitle); |
|
| 420 | - return array( |
|
| 421 | - $pagetitle, |
|
| 422 | - $content, |
|
| 423 | - $description |
|
| 424 | - ); |
|
| 387 | + $modx = DocumentParser::getInstance(); |
|
| 388 | + |
|
| 389 | + $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
| 390 | + |
|
| 391 | + if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 392 | + $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 393 | + $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
| 394 | + } else { |
|
| 395 | + $pagetitle = $alias; |
|
| 396 | + } |
|
| 397 | + if(!$pagetitle) { |
|
| 398 | + $pagetitle = $alias; |
|
| 399 | + } |
|
| 400 | + |
|
| 401 | + if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 402 | + $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 403 | + $description = str_replace('[*description*]', '', $description); |
|
| 404 | + } else { |
|
| 405 | + $description = ''; |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 409 | + $content = $matches[1]; |
|
| 410 | + } else { |
|
| 411 | + $content = $src; |
|
| 412 | + $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
| 413 | + $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 414 | + $content = preg_replace($s, $r, $content); |
|
| 415 | + $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
| 416 | + } |
|
| 417 | + $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
| 418 | + $content = trim($content); |
|
| 419 | + $pagetitle = $modx->db->escape($pagetitle); |
|
| 420 | + return array( |
|
| 421 | + $pagetitle, |
|
| 422 | + $content, |
|
| 423 | + $description |
|
| 424 | + ); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
| 428 | 428 | * @return void |
| 429 | 429 | */ |
| 430 | 430 | function convertLink() { |
| 431 | - $modx = DocumentParser::getInstance(); |
|
| 432 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 431 | + $modx = DocumentParser::getInstance(); |
|
| 432 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 433 | 433 | |
| 434 | - $rs = $modx->db->select('id,content', $tbl_site_content); |
|
| 435 | - $p = array(); |
|
| 434 | + $rs = $modx->db->select('id,content', $tbl_site_content); |
|
| 435 | + $p = array(); |
|
| 436 | 436 | $target = array(); |
| 437 | - $dir = ''; |
|
| 438 | - while($row = $modx->db->getRow($rs)) { |
|
| 439 | - $id = $row['id']; |
|
| 440 | - $array = explode('<a href=', $row['content']); |
|
| 441 | - $c = 0; |
|
| 442 | - foreach($array as $v) { |
|
| 443 | - if($v[0] === '"') { |
|
| 444 | - $v = substr($v, 1); |
|
| 445 | - list($href, $v) = explode('"', $v, 2); |
|
| 446 | - $_ = $href; |
|
| 447 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
| 448 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 449 | - } |
|
| 450 | - if($_[0] === '/') { |
|
| 451 | - $_ = substr($_, 1); |
|
| 452 | - } |
|
| 453 | - $_ = str_replace('/index.html', '.html', $_); |
|
| 454 | - $level = substr_count($_, '../'); |
|
| 455 | - if(1 < $level) { |
|
| 456 | - if(!isset($p[$id])) { |
|
| 457 | - $p[$id] = $modx->getParentIds($id); |
|
| 458 | - } |
|
| 459 | - $k = array_keys($p[$id]); |
|
| 460 | - while(0 < $level) { |
|
| 461 | - $dir = array_shift($k); |
|
| 462 | - $level--; |
|
| 463 | - } |
|
| 464 | - if($dir != '') { |
|
| 465 | - $dir .= '/'; |
|
| 466 | - } |
|
| 467 | - } else { |
|
| 468 | - $dir = ''; |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - $_ = trim($_, './'); |
|
| 472 | - if(strpos($_, '/') !== false) { |
|
| 473 | - $_ = substr($_, strrpos($_, '/')); |
|
| 474 | - } |
|
| 475 | - $_ = $dir . str_replace('.html', '', $_); |
|
| 476 | - if(!isset($target[$_])) { |
|
| 477 | - $target[$_] = $modx->getIdFromAlias($_); |
|
| 478 | - } |
|
| 479 | - $target[$_] = trim($target[$_]); |
|
| 480 | - if(!empty($target[$_])) { |
|
| 481 | - $href = '[~' . $target[$_] . '~]'; |
|
| 482 | - } |
|
| 483 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 484 | - } |
|
| 485 | - $c++; |
|
| 486 | - } |
|
| 487 | - $content = implode('', $array); |
|
| 488 | - $f['content'] = $modx->db->escape($content); |
|
| 489 | - $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
| 490 | - } |
|
| 437 | + $dir = ''; |
|
| 438 | + while($row = $modx->db->getRow($rs)) { |
|
| 439 | + $id = $row['id']; |
|
| 440 | + $array = explode('<a href=', $row['content']); |
|
| 441 | + $c = 0; |
|
| 442 | + foreach($array as $v) { |
|
| 443 | + if($v[0] === '"') { |
|
| 444 | + $v = substr($v, 1); |
|
| 445 | + list($href, $v) = explode('"', $v, 2); |
|
| 446 | + $_ = $href; |
|
| 447 | + if(strpos($_, $modx->config['site_url']) !== false) { |
|
| 448 | + $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 449 | + } |
|
| 450 | + if($_[0] === '/') { |
|
| 451 | + $_ = substr($_, 1); |
|
| 452 | + } |
|
| 453 | + $_ = str_replace('/index.html', '.html', $_); |
|
| 454 | + $level = substr_count($_, '../'); |
|
| 455 | + if(1 < $level) { |
|
| 456 | + if(!isset($p[$id])) { |
|
| 457 | + $p[$id] = $modx->getParentIds($id); |
|
| 458 | + } |
|
| 459 | + $k = array_keys($p[$id]); |
|
| 460 | + while(0 < $level) { |
|
| 461 | + $dir = array_shift($k); |
|
| 462 | + $level--; |
|
| 463 | + } |
|
| 464 | + if($dir != '') { |
|
| 465 | + $dir .= '/'; |
|
| 466 | + } |
|
| 467 | + } else { |
|
| 468 | + $dir = ''; |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + $_ = trim($_, './'); |
|
| 472 | + if(strpos($_, '/') !== false) { |
|
| 473 | + $_ = substr($_, strrpos($_, '/')); |
|
| 474 | + } |
|
| 475 | + $_ = $dir . str_replace('.html', '', $_); |
|
| 476 | + if(!isset($target[$_])) { |
|
| 477 | + $target[$_] = $modx->getIdFromAlias($_); |
|
| 478 | + } |
|
| 479 | + $target[$_] = trim($target[$_]); |
|
| 480 | + if(!empty($target[$_])) { |
|
| 481 | + $href = '[~' . $target[$_] . '~]'; |
|
| 482 | + } |
|
| 483 | + $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 484 | + } |
|
| 485 | + $c++; |
|
| 486 | + } |
|
| 487 | + $content = implode('', $array); |
|
| 488 | + $f['content'] = $modx->db->escape($content); |
|
| 489 | + $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
| 490 | + } |
|
| 491 | 491 | } |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('import_static')) { |
|
| 5 | +if (!$modx->hasPermission('import_static')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | <div class="tab-page"> |
| 44 | 44 | <div class="container container-body"> |
| 45 | 45 | <?php |
| 46 | - if(!isset($_POST['import'])) { |
|
| 47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
| 46 | + if (!isset($_POST['import'])) { |
|
| 47 | + echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>"; |
|
| 48 | 48 | ?> |
| 49 | 49 | <form action="index.php" method="post" name="importFrm"> |
| 50 | 50 | <input type="hidden" name="import" value="import" /> |
@@ -104,14 +104,14 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | -function run() { |
|
| 107 | +function run(){ |
|
| 108 | 108 | $modx = DocumentParser::getInstance(); global $_lang; |
| 109 | 109 | |
| 110 | 110 | $tbl_site_content = $modx->getFullTableName('site_content'); |
| 111 | 111 | $output = ''; |
| 112 | 112 | $maxtime = $_POST['maxtime']; |
| 113 | 113 | |
| 114 | - if(!is_numeric($maxtime)) { |
|
| 114 | + if (!is_numeric($maxtime)) { |
|
| 115 | 115 | $maxtime = 30; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -122,17 +122,17 @@ discard block |
||
| 122 | 122 | $mtime = $mtime[1] + $mtime[0]; |
| 123 | 123 | $importstart = $mtime; |
| 124 | 124 | |
| 125 | - if($_POST['reset'] == 'on') { |
|
| 125 | + if ($_POST['reset'] == 'on') { |
|
| 126 | 126 | $modx->db->truncate($tbl_site_content); |
| 127 | 127 | $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $parent = (int)$_POST['parent']; |
|
| 130 | + $parent = (int) $_POST['parent']; |
|
| 131 | 131 | |
| 132 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 133 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 134 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 135 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 132 | + if (is_dir(MODX_BASE_PATH.'temp/import')) { |
|
| 133 | + $filedir = MODX_BASE_PATH.'temp/import/'; |
|
| 134 | + } elseif (is_dir(MODX_BASE_PATH.'assets/import')) { |
|
| 135 | + $filedir = MODX_BASE_PATH.'assets/import/'; |
|
| 136 | 136 | } else { |
| 137 | 137 | $filedir = ''; |
| 138 | 138 | } |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | $files = pop_index($files); |
| 144 | 144 | |
| 145 | 145 | // no. of files to import |
| 146 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 146 | + $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound); |
|
| 147 | 147 | |
| 148 | 148 | // import files |
| 149 | - if(0 < count($files)) { |
|
| 149 | + if (0 < count($files)) { |
|
| 150 | 150 | $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
| 151 | 151 | importFiles($parent, $filedir, $files, 'root'); |
| 152 | 152 | } |
@@ -156,9 +156,9 @@ discard block |
||
| 156 | 156 | $mtime = $mtime[1] + $mtime[0]; |
| 157 | 157 | $importend = $mtime; |
| 158 | 158 | $totaltime = ($importend - $importstart); |
| 159 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 159 | + $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3)); |
|
| 160 | 160 | |
| 161 | - if($_POST['convert_link'] == 'on') { |
|
| 161 | + if ($_POST['convert_link'] == 'on') { |
|
| 162 | 162 | convertLink(); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param array $files |
| 172 | 172 | * @param string $mode |
| 173 | 173 | */ |
| 174 | -function importFiles($parent, $filedir, $files, $mode) { |
|
| 174 | +function importFiles($parent, $filedir, $files, $mode){ |
|
| 175 | 175 | $modx = DocumentParser::getInstance(); |
| 176 | 176 | global $_lang, $allowedfiles; |
| 177 | 177 | global $search_default, $cache_default, $publish_default; |
@@ -180,21 +180,21 @@ discard block |
||
| 180 | 180 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
| 181 | 181 | |
| 182 | 182 | $createdby = $modx->getLoginUserID(); |
| 183 | - if(!is_array($files)) { |
|
| 183 | + if (!is_array($files)) { |
|
| 184 | 184 | return; |
| 185 | 185 | } |
| 186 | - if($_POST['object'] === 'all') { |
|
| 186 | + if ($_POST['object'] === 'all') { |
|
| 187 | 187 | $modx->config['default_template'] = '0'; |
| 188 | 188 | $richtext = '0'; |
| 189 | 189 | } else { |
| 190 | 190 | $richtext = '1'; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - foreach($files as $id => $value) { |
|
| 194 | - if(is_array($value)) { |
|
| 193 | + foreach ($files as $id => $value) { |
|
| 194 | + if (is_array($value)) { |
|
| 195 | 195 | // create folder |
| 196 | 196 | $alias = $id; |
| 197 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 197 | + printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias); |
|
| 198 | 198 | $field = array(); |
| 199 | 199 | $field['type'] = 'document'; |
| 200 | 200 | $field['contentType'] = 'text/html'; |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | $field['isfolder'] = 1; |
| 210 | 210 | $field['menuindex'] = 1; |
| 211 | 211 | $find = false; |
| 212 | - foreach(array( |
|
| 212 | + foreach (array( |
|
| 213 | 213 | 'index.html', |
| 214 | 214 | 'index.htm' |
| 215 | 215 | ) as $filename) { |
| 216 | - $filepath = $filedir . $alias . '/' . $filename; |
|
| 217 | - if($find === false && file_exists($filepath)) { |
|
| 216 | + $filepath = $filedir.$alias.'/'.$filename; |
|
| 217 | + if ($find === false && file_exists($filepath)) { |
|
| 218 | 218 | $file = getFileContent($filepath); |
| 219 | 219 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
| 220 | 220 | |
@@ -226,17 +226,17 @@ discard block |
||
| 226 | 226 | $field['createdon'] = $date; |
| 227 | 227 | $field['editedon'] = $date; |
| 228 | 228 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 229 | - if($newid) { |
|
| 229 | + if ($newid) { |
|
| 230 | 230 | $find = true; |
| 231 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 232 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 231 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 232 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
| 233 | 233 | } else { |
| 234 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 234 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 235 | 235 | exit; |
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | - if($find === false) { |
|
| 239 | + if ($find === false) { |
|
| 240 | 240 | $date = time(); |
| 241 | 241 | $field['pagetitle'] = '---'; |
| 242 | 242 | $field['content'] = ''; |
@@ -244,30 +244,30 @@ discard block |
||
| 244 | 244 | $field['editedon'] = $date; |
| 245 | 245 | $field['hidemenu'] = '1'; |
| 246 | 246 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 247 | - if($newid) { |
|
| 247 | + if ($newid) { |
|
| 248 | 248 | $find = true; |
| 249 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 250 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 249 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 250 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
| 251 | 251 | } else { |
| 252 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 252 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 253 | 253 | exit; |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | } else { |
| 257 | 257 | // create document |
| 258 | - if($mode == 'sub' && $value == 'index.html') { |
|
| 258 | + if ($mode == 'sub' && $value == 'index.html') { |
|
| 259 | 259 | continue; |
| 260 | 260 | } |
| 261 | 261 | $filename = $value; |
| 262 | 262 | $fparts = explode('.', $value); |
| 263 | 263 | $alias = $fparts[0]; |
| 264 | 264 | $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
| 265 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 265 | + printf("<span>".$_lang['import_site_importing_document']."</span>", $filename); |
|
| 266 | 266 | |
| 267 | - if(!in_array($ext, $allowedfiles)) { |
|
| 268 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 267 | + if (!in_array($ext, $allowedfiles)) { |
|
| 268 | + echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n"; |
|
| 269 | 269 | } else { |
| 270 | - $filepath = $filedir . $filename; |
|
| 270 | + $filepath = $filedir.$filename; |
|
| 271 | 271 | $file = getFileContent($filepath); |
| 272 | 272 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
| 273 | 273 | |
@@ -292,18 +292,18 @@ discard block |
||
| 292 | 292 | $field['isfolder'] = 0; |
| 293 | 293 | $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
| 294 | 294 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 295 | - if($newid) { |
|
| 296 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 295 | + if ($newid) { |
|
| 296 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 297 | 297 | } else { |
| 298 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 298 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 299 | 299 | exit; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $is_site_start = false; |
| 303 | - if($filename == 'index.html') { |
|
| 303 | + if ($filename == 'index.html') { |
|
| 304 | 304 | $is_site_start = true; |
| 305 | 305 | } |
| 306 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 306 | + if ($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 307 | 307 | $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
| 308 | 308 | $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
| 309 | 309 | } |
@@ -318,26 +318,26 @@ discard block |
||
| 318 | 318 | * @param int $count |
| 319 | 319 | * @return array |
| 320 | 320 | */ |
| 321 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
| 321 | +function getFiles($directory, $listing = array(), $count = 0){ |
|
| 322 | 322 | global $_lang; |
| 323 | 323 | global $filesfound; |
| 324 | 324 | $dummy = $count; |
| 325 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
| 326 | - foreach($files as $file) { |
|
| 327 | - if($file == '.' || $file == '..') { |
|
| 325 | + if (!empty($directory) && $files = scandir($directory)) { |
|
| 326 | + foreach ($files as $file) { |
|
| 327 | + if ($file == '.' || $file == '..') { |
|
| 328 | 328 | continue; |
| 329 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
| 329 | + } elseif ($h = @opendir($directory.$file."/")) { |
|
| 330 | 330 | closedir($h); |
| 331 | 331 | $count = -1; |
| 332 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 333 | - } elseif(strpos($file, '.htm') !== false) { |
|
| 332 | + $listing[$file] = getFiles($directory.$file."/", array(), $count + 1); |
|
| 333 | + } elseif (strpos($file, '.htm') !== false) { |
|
| 334 | 334 | $listing[$dummy] = $file; |
| 335 | 335 | $dummy = $dummy + 1; |
| 336 | 336 | $filesfound++; |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | } else { |
| 340 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 340 | + echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>"; |
|
| 341 | 341 | } |
| 342 | 342 | return ($listing); |
| 343 | 343 | } |
@@ -346,11 +346,11 @@ discard block |
||
| 346 | 346 | * @param string $filepath |
| 347 | 347 | * @return bool|string |
| 348 | 348 | */ |
| 349 | -function getFileContent($filepath) { |
|
| 349 | +function getFileContent($filepath){ |
|
| 350 | 350 | global $_lang; |
| 351 | 351 | // get the file |
| 352 | - if(!$buffer = file_get_contents($filepath)) { |
|
| 353 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 352 | + if (!$buffer = file_get_contents($filepath)) { |
|
| 353 | + echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>"; |
|
| 354 | 354 | } else { |
| 355 | 355 | return $buffer; |
| 356 | 356 | } |
@@ -360,17 +360,17 @@ discard block |
||
| 360 | 360 | * @param array $array |
| 361 | 361 | * @return array |
| 362 | 362 | */ |
| 363 | -function pop_index($array) { |
|
| 363 | +function pop_index($array){ |
|
| 364 | 364 | $new_array = array(); |
| 365 | - foreach($array as $k => $v) { |
|
| 366 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
| 365 | + foreach ($array as $k => $v) { |
|
| 366 | + if ($v !== 'index.html' && $v !== 'index.htm') { |
|
| 367 | 367 | $new_array[$k] = $v; |
| 368 | 368 | } else { |
| 369 | 369 | array_unshift($new_array, $v); |
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | - foreach($array as $k => $v) { |
|
| 373 | - if(is_array($v)) { |
|
| 372 | + foreach ($array as $k => $v) { |
|
| 373 | + if (is_array($v)) { |
|
| 374 | 374 | $new_array[$k] = $v; |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -383,34 +383,34 @@ discard block |
||
| 383 | 383 | * @param string $alias |
| 384 | 384 | * @return array |
| 385 | 385 | */ |
| 386 | -function treatContent($src, $filename, $alias) { |
|
| 386 | +function treatContent($src, $filename, $alias){ |
|
| 387 | 387 | $modx = DocumentParser::getInstance(); |
| 388 | 388 | |
| 389 | 389 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
| 390 | 390 | |
| 391 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 391 | + if (preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 392 | 392 | $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
| 393 | 393 | $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
| 394 | 394 | } else { |
| 395 | 395 | $pagetitle = $alias; |
| 396 | 396 | } |
| 397 | - if(!$pagetitle) { |
|
| 397 | + if (!$pagetitle) { |
|
| 398 | 398 | $pagetitle = $alias; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 401 | + if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 402 | 402 | $description = ($matches[1] !== '') ? $matches[1] : $filename; |
| 403 | 403 | $description = str_replace('[*description*]', '', $description); |
| 404 | 404 | } else { |
| 405 | 405 | $description = ''; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 408 | + if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 409 | 409 | $content = $matches[1]; |
| 410 | 410 | } else { |
| 411 | 411 | $content = $src; |
| 412 | 412 | $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
| 413 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 413 | + $r = '$1'.$modx->config['modx_charset'].'$2'; |
|
| 414 | 414 | $content = preg_replace($s, $r, $content); |
| 415 | 415 | $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
| 416 | 416 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | /** |
| 428 | 428 | * @return void |
| 429 | 429 | */ |
| 430 | -function convertLink() { |
|
| 430 | +function convertLink(){ |
|
| 431 | 431 | $modx = DocumentParser::getInstance(); |
| 432 | 432 | $tbl_site_content = $modx->getFullTableName('site_content'); |
| 433 | 433 | |
@@ -435,33 +435,33 @@ discard block |
||
| 435 | 435 | $p = array(); |
| 436 | 436 | $target = array(); |
| 437 | 437 | $dir = ''; |
| 438 | - while($row = $modx->db->getRow($rs)) { |
|
| 438 | + while ($row = $modx->db->getRow($rs)) { |
|
| 439 | 439 | $id = $row['id']; |
| 440 | 440 | $array = explode('<a href=', $row['content']); |
| 441 | 441 | $c = 0; |
| 442 | - foreach($array as $v) { |
|
| 443 | - if($v[0] === '"') { |
|
| 442 | + foreach ($array as $v) { |
|
| 443 | + if ($v[0] === '"') { |
|
| 444 | 444 | $v = substr($v, 1); |
| 445 | 445 | list($href, $v) = explode('"', $v, 2); |
| 446 | 446 | $_ = $href; |
| 447 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
| 448 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 447 | + if (strpos($_, $modx->config['site_url']) !== false) { |
|
| 448 | + $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_); |
|
| 449 | 449 | } |
| 450 | - if($_[0] === '/') { |
|
| 450 | + if ($_[0] === '/') { |
|
| 451 | 451 | $_ = substr($_, 1); |
| 452 | 452 | } |
| 453 | 453 | $_ = str_replace('/index.html', '.html', $_); |
| 454 | 454 | $level = substr_count($_, '../'); |
| 455 | - if(1 < $level) { |
|
| 456 | - if(!isset($p[$id])) { |
|
| 455 | + if (1 < $level) { |
|
| 456 | + if (!isset($p[$id])) { |
|
| 457 | 457 | $p[$id] = $modx->getParentIds($id); |
| 458 | 458 | } |
| 459 | 459 | $k = array_keys($p[$id]); |
| 460 | - while(0 < $level) { |
|
| 460 | + while (0 < $level) { |
|
| 461 | 461 | $dir = array_shift($k); |
| 462 | 462 | $level--; |
| 463 | 463 | } |
| 464 | - if($dir != '') { |
|
| 464 | + if ($dir != '') { |
|
| 465 | 465 | $dir .= '/'; |
| 466 | 466 | } |
| 467 | 467 | } else { |
@@ -469,18 +469,18 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | $_ = trim($_, './'); |
| 472 | - if(strpos($_, '/') !== false) { |
|
| 472 | + if (strpos($_, '/') !== false) { |
|
| 473 | 473 | $_ = substr($_, strrpos($_, '/')); |
| 474 | 474 | } |
| 475 | - $_ = $dir . str_replace('.html', '', $_); |
|
| 476 | - if(!isset($target[$_])) { |
|
| 475 | + $_ = $dir.str_replace('.html', '', $_); |
|
| 476 | + if (!isset($target[$_])) { |
|
| 477 | 477 | $target[$_] = $modx->getIdFromAlias($_); |
| 478 | 478 | } |
| 479 | 479 | $target[$_] = trim($target[$_]); |
| 480 | - if(!empty($target[$_])) { |
|
| 481 | - $href = '[~' . $target[$_] . '~]'; |
|
| 480 | + if (!empty($target[$_])) { |
|
| 481 | + $href = '[~'.$target[$_].'~]'; |
|
| 482 | 482 | } |
| 483 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 483 | + $array[$c] = '<a href="'.$href.'"'.$v; |
|
| 484 | 484 | } |
| 485 | 485 | $c++; |
| 486 | 486 | } |
@@ -104,7 +104,8 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | -function run() { |
|
| 107 | +function run() |
|
| 108 | +{ |
|
| 108 | 109 | $modx = DocumentParser::getInstance(); global $_lang; |
| 109 | 110 | |
| 110 | 111 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -171,7 +172,8 @@ discard block |
||
| 171 | 172 | * @param array $files |
| 172 | 173 | * @param string $mode |
| 173 | 174 | */ |
| 174 | -function importFiles($parent, $filedir, $files, $mode) { |
|
| 175 | +function importFiles($parent, $filedir, $files, $mode) |
|
| 176 | +{ |
|
| 175 | 177 | $modx = DocumentParser::getInstance(); |
| 176 | 178 | global $_lang, $allowedfiles; |
| 177 | 179 | global $search_default, $cache_default, $publish_default; |
@@ -318,7 +320,8 @@ discard block |
||
| 318 | 320 | * @param int $count |
| 319 | 321 | * @return array |
| 320 | 322 | */ |
| 321 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
| 323 | +function getFiles($directory, $listing = array(), $count = 0) |
|
| 324 | +{ |
|
| 322 | 325 | global $_lang; |
| 323 | 326 | global $filesfound; |
| 324 | 327 | $dummy = $count; |
@@ -346,7 +349,8 @@ discard block |
||
| 346 | 349 | * @param string $filepath |
| 347 | 350 | * @return bool|string |
| 348 | 351 | */ |
| 349 | -function getFileContent($filepath) { |
|
| 352 | +function getFileContent($filepath) |
|
| 353 | +{ |
|
| 350 | 354 | global $_lang; |
| 351 | 355 | // get the file |
| 352 | 356 | if(!$buffer = file_get_contents($filepath)) { |
@@ -360,7 +364,8 @@ discard block |
||
| 360 | 364 | * @param array $array |
| 361 | 365 | * @return array |
| 362 | 366 | */ |
| 363 | -function pop_index($array) { |
|
| 367 | +function pop_index($array) |
|
| 368 | +{ |
|
| 364 | 369 | $new_array = array(); |
| 365 | 370 | foreach($array as $k => $v) { |
| 366 | 371 | if($v !== 'index.html' && $v !== 'index.htm') { |
@@ -383,7 +388,8 @@ discard block |
||
| 383 | 388 | * @param string $alias |
| 384 | 389 | * @return array |
| 385 | 390 | */ |
| 386 | -function treatContent($src, $filename, $alias) { |
|
| 391 | +function treatContent($src, $filename, $alias) |
|
| 392 | +{ |
|
| 387 | 393 | $modx = DocumentParser::getInstance(); |
| 388 | 394 | |
| 389 | 395 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
@@ -427,7 +433,8 @@ discard block |
||
| 427 | 433 | /** |
| 428 | 434 | * @return void |
| 429 | 435 | */ |
| 430 | -function convertLink() { |
|
| 436 | +function convertLink() |
|
| 437 | +{ |
|
| 431 | 438 | $modx = DocumentParser::getInstance(); |
| 432 | 439 | $tbl_site_content = $modx->getFullTableName('site_content'); |
| 433 | 440 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | /** |
| 8 | 8 | * @var array |
| 9 | 9 | */ |
| 10 | - public $types = array(); |
|
| 10 | + public $types = array(); |
|
| 11 | 11 | /** |
| 12 | 12 | * @var array |
| 13 | 13 | */ |
@@ -25,73 +25,73 @@ discard block |
||
| 25 | 25 | * mgrResources constructor. |
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | - $this->setTypes(); |
|
| 29 | - $this->queryItemsFromDB(); |
|
| 30 | - $this->prepareCategoryArrays(); |
|
| 31 | - } |
|
| 28 | + $this->setTypes(); |
|
| 29 | + $this->queryItemsFromDB(); |
|
| 30 | + $this->prepareCategoryArrays(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | 36 | public function setTypes() { |
| 37 | - global $_lang; |
|
| 38 | - $this->types['site_templates'] = array( |
|
| 39 | - 'title'=>$_lang["manage_templates"], |
|
| 40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 41 | - 'permissions'=>array('new_template','edit_template'), |
|
| 42 | - 'name'=>'templatename' |
|
| 43 | - ); |
|
| 44 | - $this->types['site_tmplvars'] = array( |
|
| 45 | - 'title'=>$_lang["tmplvars"], |
|
| 46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 47 | - 'permissions'=>array('new_template','edit_template'), |
|
| 48 | - ); |
|
| 49 | - $this->types['site_htmlsnippets'] = array( |
|
| 50 | - 'title'=>$_lang["manage_htmlsnippets"], |
|
| 51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 53 | - ); |
|
| 54 | - $this->types['site_snippets'] = array( |
|
| 55 | - 'title'=>$_lang["manage_snippets"], |
|
| 56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 58 | - ); |
|
| 59 | - $this->types['site_plugins'] = array( |
|
| 60 | - 'title'=>$_lang["manage_plugins"], |
|
| 61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 63 | - ); |
|
| 64 | - $this->types['site_modules'] = array( |
|
| 65 | - 'title'=>$_lang["manage_modules"], |
|
| 66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 67 | - 'permissions'=>array('new_module','edit_module'), |
|
| 68 | - ); |
|
| 69 | - } |
|
| 37 | + global $_lang; |
|
| 38 | + $this->types['site_templates'] = array( |
|
| 39 | + 'title'=>$_lang["manage_templates"], |
|
| 40 | + 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 41 | + 'permissions'=>array('new_template','edit_template'), |
|
| 42 | + 'name'=>'templatename' |
|
| 43 | + ); |
|
| 44 | + $this->types['site_tmplvars'] = array( |
|
| 45 | + 'title'=>$_lang["tmplvars"], |
|
| 46 | + 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 47 | + 'permissions'=>array('new_template','edit_template'), |
|
| 48 | + ); |
|
| 49 | + $this->types['site_htmlsnippets'] = array( |
|
| 50 | + 'title'=>$_lang["manage_htmlsnippets"], |
|
| 51 | + 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 52 | + 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 53 | + ); |
|
| 54 | + $this->types['site_snippets'] = array( |
|
| 55 | + 'title'=>$_lang["manage_snippets"], |
|
| 56 | + 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 57 | + 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 58 | + ); |
|
| 59 | + $this->types['site_plugins'] = array( |
|
| 60 | + 'title'=>$_lang["manage_plugins"], |
|
| 61 | + 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 62 | + 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 63 | + ); |
|
| 64 | + $this->types['site_modules'] = array( |
|
| 65 | + 'title'=>$_lang["manage_modules"], |
|
| 66 | + 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 67 | + 'permissions'=>array('new_module','edit_module'), |
|
| 68 | + ); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * @return void |
| 73 | 73 | */ |
| 74 | 74 | public function queryItemsFromDB() { |
| 75 | - foreach($this->types as $resourceTable=>$type) { |
|
| 76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
| 77 | - $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
| 78 | - $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - } |
|
| 75 | + foreach($this->types as $resourceTable=>$type) { |
|
| 76 | + if($this->hasAnyPermissions($type['permissions'])) { |
|
| 77 | + $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
| 78 | + $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * @param array $permissions |
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | 87 | public function hasAnyPermissions($permissions) { |
| 88 | - $modx = DocumentParser::getInstance(); |
|
| 88 | + $modx = DocumentParser::getInstance(); |
|
| 89 | 89 | |
| 90 | - foreach($permissions as $p) |
|
| 91 | - if($modx->hasPermission($p)) return true; |
|
| 90 | + foreach($permissions as $p) |
|
| 91 | + if($modx->hasPermission($p)) return true; |
|
| 92 | 92 | |
| 93 | - return false; |
|
| 94 | - } |
|
| 93 | + return false; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * @param string $resourceTable |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return array|bool |
| 100 | 100 | */ |
| 101 | 101 | public function queryResources($resourceTable, $nameField = 'name') { |
| 102 | - $modx = DocumentParser::getInstance(); global $_lang; |
|
| 102 | + $modx = DocumentParser::getInstance(); global $_lang; |
|
| 103 | 103 | |
| 104 | 104 | $allowed = array( |
| 105 | 105 | 'site_htmlsnippets', |
@@ -107,59 +107,59 @@ discard block |
||
| 107 | 107 | 'site_plugins', |
| 108 | 108 | 'site_modules' |
| 109 | 109 | ); |
| 110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
| 111 | - |
|
| 112 | - $tvsql = ''; |
|
| 113 | - $tvjoin = ''; |
|
| 114 | - if ($resourceTable === 'site_tmplvars') { |
|
| 115 | - $tvsql = 'site_tmplvars.caption, '; |
|
| 116 | - $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
| 117 | - $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
| 118 | - } |
|
| 119 | - else $sttfield = ''; |
|
| 120 | - |
|
| 121 | - $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
| 122 | - |
|
| 123 | - $rs = $modx->db->select( |
|
| 124 | - "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
| 125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
| 111 | + |
|
| 112 | + $tvsql = ''; |
|
| 113 | + $tvjoin = ''; |
|
| 114 | + if ($resourceTable === 'site_tmplvars') { |
|
| 115 | + $tvsql = 'site_tmplvars.caption, '; |
|
| 116 | + $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
| 117 | + $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
| 118 | + } |
|
| 119 | + else $sttfield = ''; |
|
| 120 | + |
|
| 121 | + $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
| 122 | + |
|
| 123 | + $rs = $modx->db->select( |
|
| 124 | + "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
| 125 | + $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 126 | 126 | LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
| 127 | - "", |
|
| 128 | - "category,name" |
|
| 129 | - ); |
|
| 130 | - $limit = $modx->db->getRecordCount($rs); |
|
| 127 | + "", |
|
| 128 | + "category,name" |
|
| 129 | + ); |
|
| 130 | + $limit = $modx->db->getRecordCount($rs); |
|
| 131 | 131 | |
| 132 | - if($limit < 1) return false; |
|
| 132 | + if($limit < 1) return false; |
|
| 133 | 133 | |
| 134 | - $result = array(); |
|
| 135 | - while ($row = $modx->db->getRow($rs)) { |
|
| 136 | - $result[] = $row; |
|
| 137 | - } |
|
| 138 | - return $result; |
|
| 139 | - } |
|
| 134 | + $result = array(); |
|
| 135 | + while ($row = $modx->db->getRow($rs)) { |
|
| 136 | + $result[] = $row; |
|
| 137 | + } |
|
| 138 | + return $result; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * @return void |
| 143 | 143 | */ |
| 144 | 144 | public function prepareCategoryArrays() { |
| 145 | - foreach($this->items as $type=>$items) { |
|
| 146 | - foreach((array)$items as $item) { |
|
| 147 | - $catid = $item['catid'] ? $item['catid'] : 0; |
|
| 148 | - $this->categories[$catid] = $item['category']; |
|
| 149 | - |
|
| 150 | - $item['type'] = $type; |
|
| 151 | - $this->itemsPerCategory[$catid][] = $item; |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - // Sort categories by name |
|
| 156 | - natcasesort($this->categories); |
|
| 157 | - |
|
| 158 | - // Now sort by name |
|
| 159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 161 | - return strcasecmp($a['name'], $b['name']); |
|
| 162 | - }); |
|
| 163 | - } |
|
| 164 | - } |
|
| 145 | + foreach($this->items as $type=>$items) { |
|
| 146 | + foreach((array)$items as $item) { |
|
| 147 | + $catid = $item['catid'] ? $item['catid'] : 0; |
|
| 148 | + $this->categories[$catid] = $item['category']; |
|
| 149 | + |
|
| 150 | + $item['type'] = $type; |
|
| 151 | + $this->itemsPerCategory[$catid][] = $item; |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + // Sort categories by name |
|
| 156 | + natcasesort($this->categories); |
|
| 157 | + |
|
| 158 | + // Now sort by name |
|
| 159 | + foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 160 | + usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 161 | + return strcasecmp($a['name'], $b['name']); |
|
| 162 | + }); |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | 165 | } |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -class mgrResources { |
|
| 6 | +class mgrResources{ |
|
| 7 | 7 | /** |
| 8 | 8 | * @var array |
| 9 | 9 | */ |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * mgrResources constructor. |
| 26 | 26 | */ |
| 27 | - public function __construct() { |
|
| 27 | + public function __construct(){ |
|
| 28 | 28 | $this->setTypes(); |
| 29 | 29 | $this->queryItemsFromDB(); |
| 30 | 30 | $this->prepareCategoryArrays(); |
@@ -33,47 +33,47 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | - public function setTypes() { |
|
| 36 | + public function setTypes(){ |
|
| 37 | 37 | global $_lang; |
| 38 | - $this->types['site_templates'] = array( |
|
| 38 | + $this->types['site_templates'] = array( |
|
| 39 | 39 | 'title'=>$_lang["manage_templates"], |
| 40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 41 | - 'permissions'=>array('new_template','edit_template'), |
|
| 40 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
| 41 | + 'permissions'=>array('new_template', 'edit_template'), |
|
| 42 | 42 | 'name'=>'templatename' |
| 43 | 43 | ); |
| 44 | - $this->types['site_tmplvars'] = array( |
|
| 44 | + $this->types['site_tmplvars'] = array( |
|
| 45 | 45 | 'title'=>$_lang["tmplvars"], |
| 46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 47 | - 'permissions'=>array('new_template','edit_template'), |
|
| 46 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
| 47 | + 'permissions'=>array('new_template', 'edit_template'), |
|
| 48 | 48 | ); |
| 49 | 49 | $this->types['site_htmlsnippets'] = array( |
| 50 | 50 | 'title'=>$_lang["manage_htmlsnippets"], |
| 51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 51 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
| 52 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
| 53 | 53 | ); |
| 54 | - $this->types['site_snippets'] = array( |
|
| 54 | + $this->types['site_snippets'] = array( |
|
| 55 | 55 | 'title'=>$_lang["manage_snippets"], |
| 56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 56 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
| 57 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
| 58 | 58 | ); |
| 59 | - $this->types['site_plugins'] = array( |
|
| 59 | + $this->types['site_plugins'] = array( |
|
| 60 | 60 | 'title'=>$_lang["manage_plugins"], |
| 61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 61 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
| 62 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
| 63 | 63 | ); |
| 64 | - $this->types['site_modules'] = array( |
|
| 64 | + $this->types['site_modules'] = array( |
|
| 65 | 65 | 'title'=>$_lang["manage_modules"], |
| 66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 67 | - 'permissions'=>array('new_module','edit_module'), |
|
| 66 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
| 67 | + 'permissions'=>array('new_module', 'edit_module'), |
|
| 68 | 68 | ); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * @return void |
| 73 | 73 | */ |
| 74 | - public function queryItemsFromDB() { |
|
| 75 | - foreach($this->types as $resourceTable=>$type) { |
|
| 76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
| 74 | + public function queryItemsFromDB(){ |
|
| 75 | + foreach ($this->types as $resourceTable=>$type) { |
|
| 76 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
| 77 | 77 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
| 78 | 78 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
| 79 | 79 | } |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | * @param array $permissions |
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | - public function hasAnyPermissions($permissions) { |
|
| 87 | + public function hasAnyPermissions($permissions){ |
|
| 88 | 88 | $modx = DocumentParser::getInstance(); |
| 89 | 89 | |
| 90 | - foreach($permissions as $p) |
|
| 91 | - if($modx->hasPermission($p)) return true; |
|
| 90 | + foreach ($permissions as $p) |
|
| 91 | + if ($modx->hasPermission($p)) return true; |
|
| 92 | 92 | |
| 93 | 93 | return false; |
| 94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param string $nameField |
| 99 | 99 | * @return array|bool |
| 100 | 100 | */ |
| 101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
| 101 | + public function queryResources($resourceTable, $nameField = 'name'){ |
|
| 102 | 102 | $modx = DocumentParser::getInstance(); global $_lang; |
| 103 | 103 | |
| 104 | 104 | $allowed = array( |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | 'site_plugins', |
| 108 | 108 | 'site_modules' |
| 109 | 109 | ); |
| 110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
| 110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : ''; |
|
| 111 | 111 | |
| 112 | 112 | $tvsql = ''; |
| 113 | 113 | $tvjoin = ''; |
@@ -122,14 +122,14 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $rs = $modx->db->select( |
| 124 | 124 | "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
| 125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 126 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
| 125 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
| 126 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
| 127 | 127 | "", |
| 128 | 128 | "category,name" |
| 129 | 129 | ); |
| 130 | 130 | $limit = $modx->db->getRecordCount($rs); |
| 131 | 131 | |
| 132 | - if($limit < 1) return false; |
|
| 132 | + if ($limit < 1) return false; |
|
| 133 | 133 | |
| 134 | 134 | $result = array(); |
| 135 | 135 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * @return void |
| 143 | 143 | */ |
| 144 | - public function prepareCategoryArrays() { |
|
| 145 | - foreach($this->items as $type=>$items) { |
|
| 146 | - foreach((array)$items as $item) { |
|
| 144 | + public function prepareCategoryArrays(){ |
|
| 145 | + foreach ($this->items as $type=>$items) { |
|
| 146 | + foreach ((array) $items as $item) { |
|
| 147 | 147 | $catid = $item['catid'] ? $item['catid'] : 0; |
| 148 | 148 | $this->categories[$catid] = $item['category']; |
| 149 | 149 | |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | natcasesort($this->categories); |
| 157 | 157 | |
| 158 | 158 | // Now sort by name |
| 159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 159 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
| 160 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
| 161 | 161 | return strcasecmp($a['name'], $b['name']); |
| 162 | 162 | }); |
| 163 | 163 | } |
@@ -3,7 +3,8 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -class mgrResources { |
|
| 6 | +class mgrResources |
|
| 7 | +{ |
|
| 7 | 8 | /** |
| 8 | 9 | * @var array |
| 9 | 10 | */ |
@@ -24,7 +25,8 @@ discard block |
||
| 24 | 25 | /** |
| 25 | 26 | * mgrResources constructor. |
| 26 | 27 | */ |
| 27 | - public function __construct() { |
|
| 28 | + public function __construct() |
|
| 29 | + { |
|
| 28 | 30 | $this->setTypes(); |
| 29 | 31 | $this->queryItemsFromDB(); |
| 30 | 32 | $this->prepareCategoryArrays(); |
@@ -33,7 +35,8 @@ discard block |
||
| 33 | 35 | /** |
| 34 | 36 | * @return void |
| 35 | 37 | */ |
| 36 | - public function setTypes() { |
|
| 38 | + public function setTypes() |
|
| 39 | + { |
|
| 37 | 40 | global $_lang; |
| 38 | 41 | $this->types['site_templates'] = array( |
| 39 | 42 | 'title'=>$_lang["manage_templates"], |
@@ -71,7 +74,8 @@ discard block |
||
| 71 | 74 | /** |
| 72 | 75 | * @return void |
| 73 | 76 | */ |
| 74 | - public function queryItemsFromDB() { |
|
| 77 | + public function queryItemsFromDB() |
|
| 78 | + { |
|
| 75 | 79 | foreach($this->types as $resourceTable=>$type) { |
| 76 | 80 | if($this->hasAnyPermissions($type['permissions'])) { |
| 77 | 81 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -84,11 +88,13 @@ discard block |
||
| 84 | 88 | * @param array $permissions |
| 85 | 89 | * @return bool |
| 86 | 90 | */ |
| 87 | - public function hasAnyPermissions($permissions) { |
|
| 91 | + public function hasAnyPermissions($permissions) |
|
| 92 | + { |
|
| 88 | 93 | $modx = DocumentParser::getInstance(); |
| 89 | 94 | |
| 90 | - foreach($permissions as $p) |
|
| 91 | - if($modx->hasPermission($p)) return true; |
|
| 95 | + foreach($permissions as $p) { |
|
| 96 | + if($modx->hasPermission($p)) return true; |
|
| 97 | + } |
|
| 92 | 98 | |
| 93 | 99 | return false; |
| 94 | 100 | } |
@@ -98,7 +104,8 @@ discard block |
||
| 98 | 104 | * @param string $nameField |
| 99 | 105 | * @return array|bool |
| 100 | 106 | */ |
| 101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
| 107 | + public function queryResources($resourceTable, $nameField = 'name') |
|
| 108 | + { |
|
| 102 | 109 | $modx = DocumentParser::getInstance(); global $_lang; |
| 103 | 110 | |
| 104 | 111 | $allowed = array( |
@@ -115,8 +122,9 @@ discard block |
||
| 115 | 122 | $tvsql = 'site_tmplvars.caption, '; |
| 116 | 123 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
| 117 | 124 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
| 125 | + } else { |
|
| 126 | + $sttfield = ''; |
|
| 118 | 127 | } |
| 119 | - else $sttfield = ''; |
|
| 120 | 128 | |
| 121 | 129 | $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
| 122 | 130 | |
@@ -129,7 +137,9 @@ discard block |
||
| 129 | 137 | ); |
| 130 | 138 | $limit = $modx->db->getRecordCount($rs); |
| 131 | 139 | |
| 132 | - if($limit < 1) return false; |
|
| 140 | + if($limit < 1) { |
|
| 141 | + return false; |
|
| 142 | + } |
|
| 133 | 143 | |
| 134 | 144 | $result = array(); |
| 135 | 145 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,7 +151,8 @@ discard block |
||
| 141 | 151 | /** |
| 142 | 152 | * @return void |
| 143 | 153 | */ |
| 144 | - public function prepareCategoryArrays() { |
|
| 154 | + public function prepareCategoryArrays() |
|
| 155 | + { |
|
| 145 | 156 | foreach($this->items as $type=>$items) { |
| 146 | 157 | foreach((array)$items as $item) { |
| 147 | 158 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -157,7 +168,7 @@ discard block |
||
| 157 | 168 | |
| 158 | 169 | // Now sort by name |
| 159 | 170 | foreach($this->itemsPerCategory as $catid=>$items) { |
| 160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 171 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
| 161 | 172 | return strcasecmp($a['name'], $b['name']); |
| 162 | 173 | }); |
| 163 | 174 | } |
@@ -1,14 +1,14 @@ 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 | $tpl = array( |
| 7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
| 8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
| 7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
| 8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
| 12 | 12 | ); |
| 13 | 13 | |
| 14 | 14 | /** |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | 19 | function parsePh($tpl, $ph) {
|
| 20 | - $modx = DocumentParser::getInstance(); global $_lang; |
|
| 21 | - $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 22 | - return $modx->parseText($tpl, $ph); |
|
| 20 | + $modx = DocumentParser::getInstance(); global $_lang; |
|
| 21 | + $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 22 | + return $modx->parseText($tpl, $ph); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | * @return string |
| 28 | 28 | */ |
| 29 | 29 | function renderViewSwitchButtons($cssId) {
|
| 30 | - $modx = DocumentParser::getInstance(); global $_lang, $tpl; |
|
| 30 | + $modx = DocumentParser::getInstance(); global $_lang, $tpl; |
|
| 31 | 31 | |
| 32 | - return parsePh($tpl['viewForm'], array( |
|
| 33 | - 'cssId' => $cssId |
|
| 34 | - )); |
|
| 32 | + return parsePh($tpl['viewForm'], array( |
|
| 33 | + 'cssId' => $cssId |
|
| 34 | + )); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -40,52 +40,52 @@ discard block |
||
| 40 | 40 | * @return string |
| 41 | 41 | */ |
| 42 | 42 | function createResourceList($resourceTable, $resources) {
|
| 43 | - $modx = DocumentParser::getInstance(); global $_lang, $_style, $modx_textdir, $tpl; |
|
| 43 | + $modx = DocumentParser::getInstance(); global $_lang, $_style, $modx_textdir, $tpl; |
|
| 44 | 44 | |
| 45 | - $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
| 45 | + $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
| 46 | 46 | |
| 47 | - if( ! is_array($items) || empty($items)) {
|
|
| 48 | - return $_lang['no_results']; |
|
| 49 | - } |
|
| 47 | + if( ! is_array($items) || empty($items)) {
|
|
| 48 | + return $_lang['no_results']; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - // Prepare elements- and categories-list |
|
| 52 | - $elements = array(); |
|
| 53 | - $categories = array(); |
|
| 54 | - foreach($items as $row) {
|
|
| 55 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 56 | - $categories[$catid] = array('name' => stripslashes($row['category']));
|
|
| 57 | - $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
| 58 | - } |
|
| 51 | + // Prepare elements- and categories-list |
|
| 52 | + $elements = array(); |
|
| 53 | + $categories = array(); |
|
| 54 | + foreach($items as $row) {
|
|
| 55 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 56 | + $categories[$catid] = array('name' => stripslashes($row['category']));
|
|
| 57 | + $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - // Now render categories / panel-collapse |
|
| 61 | - $panelGroup = ''; |
|
| 62 | - foreach($elements as $catid => $elList) {
|
|
| 63 | - // Add panel-heading / category-collapse to output |
|
| 64 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 65 | - 'tab' => $resourceTable, |
|
| 66 | - 'category' => $categories[$catid]['name'], |
|
| 67 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 68 | - 'catid' => $catid, |
|
| 69 | - )); |
|
| 60 | + // Now render categories / panel-collapse |
|
| 61 | + $panelGroup = ''; |
|
| 62 | + foreach($elements as $catid => $elList) {
|
|
| 63 | + // Add panel-heading / category-collapse to output |
|
| 64 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 65 | + 'tab' => $resourceTable, |
|
| 66 | + 'category' => $categories[$catid]['name'], |
|
| 67 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 68 | + 'catid' => $catid, |
|
| 69 | + )); |
|
| 70 | 70 | |
| 71 | - // Prepare content for panel-collapse |
|
| 72 | - $panelCollapse = ''; |
|
| 73 | - foreach($elList as $el) {
|
|
| 74 | - $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
| 75 | - } |
|
| 71 | + // Prepare content for panel-collapse |
|
| 72 | + $panelCollapse = ''; |
|
| 73 | + foreach($elList as $el) {
|
|
| 74 | + $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - // Add panel-collapse with elements to output |
|
| 78 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 79 | - 'tab' => $resourceTable, |
|
| 80 | - 'catid' => $catid, |
|
| 81 | - 'wrapper' => $panelCollapse, |
|
| 82 | - )); |
|
| 83 | - } |
|
| 77 | + // Add panel-collapse with elements to output |
|
| 78 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 79 | + 'tab' => $resourceTable, |
|
| 80 | + 'catid' => $catid, |
|
| 81 | + 'wrapper' => $panelCollapse, |
|
| 82 | + )); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - return parsePh($tpl['panelGroup'], array( |
|
| 86 | - 'resourceTable' => $resourceTable, |
|
| 87 | - 'wrapper' => $panelGroup |
|
| 88 | - )); |
|
| 85 | + return parsePh($tpl['panelGroup'], array( |
|
| 86 | + 'resourceTable' => $resourceTable, |
|
| 87 | + 'wrapper' => $panelGroup |
|
| 88 | + )); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -93,54 +93,54 @@ discard block |
||
| 93 | 93 | * @return string |
| 94 | 94 | */ |
| 95 | 95 | function createCombinedView($resources) {
|
| 96 | - $modx = DocumentParser::getInstance(); global $_lang, $_style, $modx_textdir; |
|
| 96 | + $modx = DocumentParser::getInstance(); global $_lang, $_style, $modx_textdir; |
|
| 97 | 97 | |
| 98 | - $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
| 99 | - $types = isset($resources->types) ? $resources->types : false; |
|
| 100 | - $categories = isset($resources->categories) ? $resources->categories : false; |
|
| 98 | + $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
| 99 | + $types = isset($resources->types) ? $resources->types : false; |
|
| 100 | + $categories = isset($resources->categories) ? $resources->categories : false; |
|
| 101 | 101 | |
| 102 | - if(!$itemsPerCategory) {
|
|
| 103 | - return $_lang['no_results']; |
|
| 104 | - } |
|
| 102 | + if(!$itemsPerCategory) {
|
|
| 103 | + return $_lang['no_results']; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - $tpl = array( |
|
| 107 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 108 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 109 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 110 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 111 | - ); |
|
| 106 | + $tpl = array( |
|
| 107 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 108 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 109 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 110 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 111 | + ); |
|
| 112 | 112 | |
| 113 | - // Easily loop through $itemsPerCategory-Array |
|
| 114 | - $panelGroup = ''; |
|
| 115 | - foreach($categories as $catid => $category) {
|
|
| 116 | - // Prepare collapse content / elements-list |
|
| 117 | - $panelCollapse = ''; |
|
| 118 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 119 | - $resourceTable = $el['type']; |
|
| 120 | - $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
| 121 | - $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
| 122 | - } |
|
| 113 | + // Easily loop through $itemsPerCategory-Array |
|
| 114 | + $panelGroup = ''; |
|
| 115 | + foreach($categories as $catid => $category) {
|
|
| 116 | + // Prepare collapse content / elements-list |
|
| 117 | + $panelCollapse = ''; |
|
| 118 | + foreach($itemsPerCategory[$catid] as $el) {
|
|
| 119 | + $resourceTable = $el['type']; |
|
| 120 | + $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
| 121 | + $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - // Add panel-heading / button |
|
| 125 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 126 | - 'tab' => 'categories_list', |
|
| 127 | - 'category' => $categories[$catid], |
|
| 128 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 129 | - 'catid' => $catid, |
|
| 130 | - )); |
|
| 124 | + // Add panel-heading / button |
|
| 125 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 126 | + 'tab' => 'categories_list', |
|
| 127 | + 'category' => $categories[$catid], |
|
| 128 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 129 | + 'catid' => $catid, |
|
| 130 | + )); |
|
| 131 | 131 | |
| 132 | - // Add panel |
|
| 133 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 134 | - 'tab' => 'categories_list', |
|
| 135 | - 'catid' => $catid, |
|
| 136 | - 'wrapper' => $panelCollapse, |
|
| 137 | - )); |
|
| 138 | - } |
|
| 132 | + // Add panel |
|
| 133 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 134 | + 'tab' => 'categories_list', |
|
| 135 | + 'catid' => $catid, |
|
| 136 | + 'wrapper' => $panelCollapse, |
|
| 137 | + )); |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - return parsePh($tpl['panelGroup'], array( |
|
| 141 | - 'resourceTable' => 'categories_list', |
|
| 142 | - 'wrapper' => $panelGroup |
|
| 143 | - )); |
|
| 140 | + return parsePh($tpl['panelGroup'], array( |
|
| 141 | + 'resourceTable' => 'categories_list', |
|
| 142 | + 'wrapper' => $panelGroup |
|
| 143 | + )); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | * @return array |
| 151 | 151 | */ |
| 152 | 152 | function prepareElementRowPh($row, $resourceTable, $resources) {
|
| 153 | - $modx = DocumentParser::getInstance(); global $modx_textdir, $_style, $_lang; |
|
| 153 | + $modx = DocumentParser::getInstance(); global $modx_textdir, $_style, $_lang; |
|
| 154 | 154 | |
| 155 | - $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
| 155 | + $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
| 156 | 156 | |
| 157 | - $_lang["confirm_delete"] = $_lang["delete"]; |
|
| 157 | + $_lang["confirm_delete"] = $_lang["delete"]; |
|
| 158 | 158 | |
| 159 | - switch($resourceTable){
|
|
| 159 | + switch($resourceTable){
|
|
| 160 | 160 | case 'site_templates': |
| 161 | 161 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 162 | 162 | $lockElementType = 1; |
@@ -190,77 +190,77 @@ discard block |
||
| 190 | 190 | return array(); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - // Prepare displaying user-locks |
|
| 194 | - $lockedByUser = ''; |
|
| 195 | - $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
| 196 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 197 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 198 | - $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
| 199 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 200 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 201 | - )); |
|
| 202 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 203 | - } else {
|
|
| 204 | - $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
| 205 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 206 | - 'username' => $rowLock['username'], |
|
| 207 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 208 | - )); |
|
| 209 | - if($modx->hasPermission('remove_locks')) {
|
|
| 210 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 211 | - } else {
|
|
| 212 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - } |
|
| 216 | - if($lockedByUser) {
|
|
| 217 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 218 | - } |
|
| 193 | + // Prepare displaying user-locks |
|
| 194 | + $lockedByUser = ''; |
|
| 195 | + $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
| 196 | + if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 197 | + if($rowLock['sid'] == $modx->sid) {
|
|
| 198 | + $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
| 199 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 200 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 201 | + )); |
|
| 202 | + $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 203 | + } else {
|
|
| 204 | + $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
| 205 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 206 | + 'username' => $rowLock['username'], |
|
| 207 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 208 | + )); |
|
| 209 | + if($modx->hasPermission('remove_locks')) {
|
|
| 210 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 211 | + } else {
|
|
| 212 | + $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | + if($lockedByUser) {
|
|
| 217 | + $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - // Caption |
|
| 221 | - if($resourceTable == 'site_tmplvars') {
|
|
| 222 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 223 | - } else {
|
|
| 224 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 225 | - } |
|
| 220 | + // Caption |
|
| 221 | + if($resourceTable == 'site_tmplvars') {
|
|
| 222 | + $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 223 | + } else {
|
|
| 224 | + $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - // Special marks |
|
| 228 | - $tplInfo = array(); |
|
| 229 | - if($row['locked']) {
|
|
| 230 | - $tplInfo[] = $_lang['locked']; |
|
| 231 | - } |
|
| 232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 233 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
| 234 | - } |
|
| 235 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
|
|
| 227 | + // Special marks |
|
| 228 | + $tplInfo = array(); |
|
| 229 | + if($row['locked']) {
|
|
| 230 | + $tplInfo[] = $_lang['locked']; |
|
| 231 | + } |
|
| 232 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 233 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
| 234 | + } |
|
| 235 | + $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
|
|
| 236 | 236 | |
| 237 | - /* row buttons */ |
|
| 238 | - $buttons = ''; |
|
| 239 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 240 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
| 241 | - } |
|
| 242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 243 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
| 244 | - } |
|
| 245 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 246 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
| 247 | - } |
|
| 248 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 237 | + /* row buttons */ |
|
| 238 | + $buttons = ''; |
|
| 239 | + if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 240 | + $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
| 241 | + } |
|
| 242 | + if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 243 | + $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
| 244 | + } |
|
| 245 | + if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 246 | + $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
| 247 | + } |
|
| 248 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 249 | 249 | |
| 250 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 250 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 251 | 251 | |
| 252 | - // Placeholders for elements-row |
|
| 253 | - return array( |
|
| 254 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 255 | - 'lockedByUser' => $lockedByUser, |
|
| 256 | - 'name' => $row['name'], |
|
| 257 | - 'caption' => $caption, |
|
| 258 | - 'buttons' => $buttons, |
|
| 259 | - 'marks' => $marks, |
|
| 260 | - 'id' => $row['id'], |
|
| 261 | - 'resourceTable' => $resourceTable, |
|
| 262 | - 'actionEdit' => $types['actions']['edit'][0], |
|
| 263 | - 'catid' => $catid, |
|
| 264 | - 'textdir' => $modx_textdir ? '‏' : '', |
|
| 265 | - ); |
|
| 252 | + // Placeholders for elements-row |
|
| 253 | + return array( |
|
| 254 | + 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 255 | + 'lockedByUser' => $lockedByUser, |
|
| 256 | + 'name' => $row['name'], |
|
| 257 | + 'caption' => $caption, |
|
| 258 | + 'buttons' => $buttons, |
|
| 259 | + 'marks' => $marks, |
|
| 260 | + 'id' => $row['id'], |
|
| 261 | + 'resourceTable' => $resourceTable, |
|
| 262 | + 'actionEdit' => $types['actions']['edit'][0], |
|
| 263 | + 'catid' => $catid, |
|
| 264 | + 'textdir' => $modx_textdir ? '‏' : '', |
|
| 265 | + ); |
|
| 266 | 266 | } |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | $tpl = array( |
| 7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
| 8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
| 7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_viewForm.tpl'), |
|
| 8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
| 9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
| 10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
| 11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl') |
|
| 12 | 12 | ); |
| 13 | 13 | |
| 14 | 14 | /** |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @param array $ph |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | -function parsePh($tpl, $ph) {
|
|
| 19 | +function parsePh($tpl, $ph){
|
|
| 20 | 20 | $modx = DocumentParser::getInstance(); global $_lang; |
| 21 | 21 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
| 22 | 22 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param string|int $cssId |
| 27 | 27 | * @return string |
| 28 | 28 | */ |
| 29 | -function renderViewSwitchButtons($cssId) {
|
|
| 29 | +function renderViewSwitchButtons($cssId){
|
|
| 30 | 30 | $modx = DocumentParser::getInstance(); global $_lang, $tpl; |
| 31 | 31 | |
| 32 | 32 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +39,19 @@ discard block |
||
| 39 | 39 | * @param mgrResources $resources |
| 40 | 40 | * @return string |
| 41 | 41 | */ |
| 42 | -function createResourceList($resourceTable, $resources) {
|
|
| 42 | +function createResourceList($resourceTable, $resources){
|
|
| 43 | 43 | $modx = DocumentParser::getInstance(); global $_lang, $_style, $modx_textdir, $tpl; |
| 44 | 44 | |
| 45 | 45 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
| 46 | 46 | |
| 47 | - if( ! is_array($items) || empty($items)) {
|
|
| 47 | + if (!is_array($items) || empty($items)) {
|
|
| 48 | 48 | return $_lang['no_results']; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Prepare elements- and categories-list |
| 52 | 52 | $elements = array(); |
| 53 | 53 | $categories = array(); |
| 54 | - foreach($items as $row) {
|
|
| 54 | + foreach ($items as $row) {
|
|
| 55 | 55 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 56 | 56 | $categories[$catid] = array('name' => stripslashes($row['category']));
|
| 57 | 57 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,18 +59,18 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // Now render categories / panel-collapse |
| 61 | 61 | $panelGroup = ''; |
| 62 | - foreach($elements as $catid => $elList) {
|
|
| 62 | + foreach ($elements as $catid => $elList) {
|
|
| 63 | 63 | // Add panel-heading / category-collapse to output |
| 64 | 64 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 65 | 65 | 'tab' => $resourceTable, |
| 66 | 66 | 'category' => $categories[$catid]['name'], |
| 67 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 67 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '',
|
|
| 68 | 68 | 'catid' => $catid, |
| 69 | 69 | )); |
| 70 | 70 | |
| 71 | 71 | // Prepare content for panel-collapse |
| 72 | 72 | $panelCollapse = ''; |
| 73 | - foreach($elList as $el) {
|
|
| 73 | + foreach ($elList as $el) {
|
|
| 74 | 74 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -92,30 +92,30 @@ discard block |
||
| 92 | 92 | * @param mgrResources $resources |
| 93 | 93 | * @return string |
| 94 | 94 | */ |
| 95 | -function createCombinedView($resources) {
|
|
| 95 | +function createCombinedView($resources){
|
|
| 96 | 96 | $modx = DocumentParser::getInstance(); global $_lang, $_style, $modx_textdir; |
| 97 | 97 | |
| 98 | 98 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
| 99 | 99 | $types = isset($resources->types) ? $resources->types : false; |
| 100 | 100 | $categories = isset($resources->categories) ? $resources->categories : false; |
| 101 | 101 | |
| 102 | - if(!$itemsPerCategory) {
|
|
| 102 | + if (!$itemsPerCategory) {
|
|
| 103 | 103 | return $_lang['no_results']; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $tpl = array( |
| 107 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 108 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 109 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 110 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 107 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
| 108 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
| 109 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
| 110 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | // Easily loop through $itemsPerCategory-Array |
| 114 | 114 | $panelGroup = ''; |
| 115 | - foreach($categories as $catid => $category) {
|
|
| 115 | + foreach ($categories as $catid => $category) {
|
|
| 116 | 116 | // Prepare collapse content / elements-list |
| 117 | 117 | $panelCollapse = ''; |
| 118 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 118 | + foreach ($itemsPerCategory[$catid] as $el) {
|
|
| 119 | 119 | $resourceTable = $el['type']; |
| 120 | 120 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
| 121 | 121 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 126 | 126 | 'tab' => 'categories_list', |
| 127 | 127 | 'category' => $categories[$catid], |
| 128 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 128 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '',
|
|
| 129 | 129 | 'catid' => $catid, |
| 130 | 130 | )); |
| 131 | 131 | |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | * @param mgrResources $resources |
| 150 | 150 | * @return array |
| 151 | 151 | */ |
| 152 | -function prepareElementRowPh($row, $resourceTable, $resources) {
|
|
| 152 | +function prepareElementRowPh($row, $resourceTable, $resources){
|
|
| 153 | 153 | $modx = DocumentParser::getInstance(); global $modx_textdir, $_style, $_lang; |
| 154 | 154 | |
| 155 | 155 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
| 156 | 156 | |
| 157 | 157 | $_lang["confirm_delete"] = $_lang["delete"]; |
| 158 | 158 | |
| 159 | - switch($resourceTable){
|
|
| 159 | + switch ($resourceTable) {
|
|
| 160 | 160 | case 'site_templates': |
| 161 | 161 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 162 | 162 | $lockElementType = 1; |
@@ -193,65 +193,65 @@ discard block |
||
| 193 | 193 | // Prepare displaying user-locks |
| 194 | 194 | $lockedByUser = ''; |
| 195 | 195 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
| 196 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 197 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 196 | + if ($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 197 | + if ($rowLock['sid'] == $modx->sid) {
|
|
| 198 | 198 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
| 199 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 199 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
| 200 | 200 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 201 | 201 | )); |
| 202 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 202 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
| 203 | 203 | } else {
|
| 204 | 204 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
| 205 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 205 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
| 206 | 206 | 'username' => $rowLock['username'], |
| 207 | 207 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 208 | 208 | )); |
| 209 | - if($modx->hasPermission('remove_locks')) {
|
|
| 210 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 209 | + if ($modx->hasPermission('remove_locks')) {
|
|
| 210 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>';
|
|
| 211 | 211 | } else {
|
| 212 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 212 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | - if($lockedByUser) {
|
|
| 217 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 216 | + if ($lockedByUser) {
|
|
| 217 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Caption |
| 221 | - if($resourceTable == 'site_tmplvars') {
|
|
| 222 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 221 | + if ($resourceTable == 'site_tmplvars') {
|
|
| 222 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption'];
|
|
| 223 | 223 | } else {
|
| 224 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 224 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // Special marks |
| 228 | 228 | $tplInfo = array(); |
| 229 | - if($row['locked']) {
|
|
| 229 | + if ($row['locked']) {
|
|
| 230 | 230 | $tplInfo[] = $_lang['locked']; |
| 231 | 231 | } |
| 232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 232 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 233 | 233 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 234 | 234 | } |
| 235 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
|
|
| 235 | + $marks = !empty($tplInfo) ? ' <em>('.implode(', ', $tplInfo).')</em>' : '';
|
|
| 236 | 236 | |
| 237 | 237 | /* row buttons */ |
| 238 | 238 | $buttons = ''; |
| 239 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 240 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
| 239 | + if ($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 240 | + $buttons .= '<li><a title="'.$_lang["edit_resource"].'" href="index.php?a='.$types['actions']['edit'][0].'&id='.$row['id'].'"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
| 241 | 241 | } |
| 242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 243 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
| 242 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 243 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_duplicate_record"].'\')" title="'.$_lang["resource_duplicate"].'" href="index.php?a='.$types['actions']['duplicate'][0].'&id='.$row['id'].'"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
| 244 | 244 | } |
| 245 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 246 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
| 245 | + if ($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 246 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_delete"].'\')" title="'.$_lang["delete"].'" href="index.php?a='.$types['actions']['remove'][0].'&id='.$row['id'].'"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
| 247 | 247 | } |
| 248 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 248 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
| 249 | 249 | |
| 250 | 250 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 251 | 251 | |
| 252 | 252 | // Placeholders for elements-row |
| 253 | 253 | return array( |
| 254 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 254 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
| 255 | 255 | 'lockedByUser' => $lockedByUser, |
| 256 | 256 | 'name' => $row['name'], |
| 257 | 257 | 'caption' => $caption, |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | |
@@ -16,7 +16,8 @@ discard block |
||
| 16 | 16 | * @param array $ph |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | -function parsePh($tpl, $ph) {
|
|
| 19 | +function parsePh($tpl, $ph) |
|
| 20 | +{ |
|
| 20 | 21 | $modx = DocumentParser::getInstance(); global $_lang; |
| 21 | 22 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
| 22 | 23 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +27,8 @@ discard block |
||
| 26 | 27 | * @param string|int $cssId |
| 27 | 28 | * @return string |
| 28 | 29 | */ |
| 29 | -function renderViewSwitchButtons($cssId) {
|
|
| 30 | +function renderViewSwitchButtons($cssId) |
|
| 31 | +{ |
|
| 30 | 32 | $modx = DocumentParser::getInstance(); global $_lang, $tpl; |
| 31 | 33 | |
| 32 | 34 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +41,20 @@ discard block |
||
| 39 | 41 | * @param mgrResources $resources |
| 40 | 42 | * @return string |
| 41 | 43 | */ |
| 42 | -function createResourceList($resourceTable, $resources) {
|
|
| 44 | +function createResourceList($resourceTable, $resources) |
|
| 45 | +{ |
|
| 43 | 46 | $modx = DocumentParser::getInstance(); global $_lang, $_style, $modx_textdir, $tpl; |
| 44 | 47 | |
| 45 | 48 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
| 46 | 49 | |
| 47 | - if( ! is_array($items) || empty($items)) {
|
|
| 50 | + if( ! is_array($items) || empty($items)) { |
|
| 48 | 51 | return $_lang['no_results']; |
| 49 | 52 | } |
| 50 | 53 | |
| 51 | 54 | // Prepare elements- and categories-list |
| 52 | 55 | $elements = array(); |
| 53 | 56 | $categories = array(); |
| 54 | - foreach($items as $row) {
|
|
| 57 | + foreach($items as $row) { |
|
| 55 | 58 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 56 | 59 | $categories[$catid] = array('name' => stripslashes($row['category']));
|
| 57 | 60 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,7 +62,7 @@ discard block |
||
| 59 | 62 | |
| 60 | 63 | // Now render categories / panel-collapse |
| 61 | 64 | $panelGroup = ''; |
| 62 | - foreach($elements as $catid => $elList) {
|
|
| 65 | + foreach($elements as $catid => $elList) { |
|
| 63 | 66 | // Add panel-heading / category-collapse to output |
| 64 | 67 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 65 | 68 | 'tab' => $resourceTable, |
@@ -70,7 +73,7 @@ discard block |
||
| 70 | 73 | |
| 71 | 74 | // Prepare content for panel-collapse |
| 72 | 75 | $panelCollapse = ''; |
| 73 | - foreach($elList as $el) {
|
|
| 76 | + foreach($elList as $el) { |
|
| 74 | 77 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
| 75 | 78 | } |
| 76 | 79 | |
@@ -92,14 +95,15 @@ discard block |
||
| 92 | 95 | * @param mgrResources $resources |
| 93 | 96 | * @return string |
| 94 | 97 | */ |
| 95 | -function createCombinedView($resources) {
|
|
| 98 | +function createCombinedView($resources) |
|
| 99 | +{ |
|
| 96 | 100 | $modx = DocumentParser::getInstance(); global $_lang, $_style, $modx_textdir; |
| 97 | 101 | |
| 98 | 102 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
| 99 | 103 | $types = isset($resources->types) ? $resources->types : false; |
| 100 | 104 | $categories = isset($resources->categories) ? $resources->categories : false; |
| 101 | 105 | |
| 102 | - if(!$itemsPerCategory) {
|
|
| 106 | + if(!$itemsPerCategory) { |
|
| 103 | 107 | return $_lang['no_results']; |
| 104 | 108 | } |
| 105 | 109 | |
@@ -112,10 +116,10 @@ discard block |
||
| 112 | 116 | |
| 113 | 117 | // Easily loop through $itemsPerCategory-Array |
| 114 | 118 | $panelGroup = ''; |
| 115 | - foreach($categories as $catid => $category) {
|
|
| 119 | + foreach($categories as $catid => $category) { |
|
| 116 | 120 | // Prepare collapse content / elements-list |
| 117 | 121 | $panelCollapse = ''; |
| 118 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 122 | + foreach($itemsPerCategory[$catid] as $el) { |
|
| 119 | 123 | $resourceTable = $el['type']; |
| 120 | 124 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
| 121 | 125 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -149,14 +153,15 @@ discard block |
||
| 149 | 153 | * @param mgrResources $resources |
| 150 | 154 | * @return array |
| 151 | 155 | */ |
| 152 | -function prepareElementRowPh($row, $resourceTable, $resources) {
|
|
| 156 | +function prepareElementRowPh($row, $resourceTable, $resources) |
|
| 157 | +{ |
|
| 153 | 158 | $modx = DocumentParser::getInstance(); global $modx_textdir, $_style, $_lang; |
| 154 | 159 | |
| 155 | 160 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
| 156 | 161 | |
| 157 | 162 | $_lang["confirm_delete"] = $_lang["delete"]; |
| 158 | 163 | |
| 159 | - switch($resourceTable){
|
|
| 164 | + switch($resourceTable) { |
|
| 160 | 165 | case 'site_templates': |
| 161 | 166 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 162 | 167 | $lockElementType = 1; |
@@ -193,56 +198,56 @@ discard block |
||
| 193 | 198 | // Prepare displaying user-locks |
| 194 | 199 | $lockedByUser = ''; |
| 195 | 200 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
| 196 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 197 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 201 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
| 202 | + if($rowLock['sid'] == $modx->sid) { |
|
| 198 | 203 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
| 199 | 204 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
| 200 | 205 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 201 | 206 | )); |
| 202 | 207 | $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
| 203 | - } else {
|
|
| 208 | + } else { |
|
| 204 | 209 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
| 205 | 210 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
| 206 | 211 | 'username' => $rowLock['username'], |
| 207 | 212 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 208 | 213 | )); |
| 209 | - if($modx->hasPermission('remove_locks')) {
|
|
| 214 | + if($modx->hasPermission('remove_locks')) { |
|
| 210 | 215 | $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
| 211 | - } else {
|
|
| 216 | + } else { |
|
| 212 | 217 | $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
| 213 | 218 | } |
| 214 | 219 | } |
| 215 | 220 | } |
| 216 | - if($lockedByUser) {
|
|
| 221 | + if($lockedByUser) { |
|
| 217 | 222 | $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
| 218 | 223 | } |
| 219 | 224 | |
| 220 | 225 | // Caption |
| 221 | - if($resourceTable == 'site_tmplvars') {
|
|
| 226 | + if($resourceTable == 'site_tmplvars') { |
|
| 222 | 227 | $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
| 223 | - } else {
|
|
| 228 | + } else { |
|
| 224 | 229 | $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
| 225 | 230 | } |
| 226 | 231 | |
| 227 | 232 | // Special marks |
| 228 | 233 | $tplInfo = array(); |
| 229 | - if($row['locked']) {
|
|
| 234 | + if($row['locked']) { |
|
| 230 | 235 | $tplInfo[] = $_lang['locked']; |
| 231 | 236 | } |
| 232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 237 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
| 233 | 238 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 234 | 239 | } |
| 235 | 240 | $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
|
| 236 | 241 | |
| 237 | 242 | /* row buttons */ |
| 238 | 243 | $buttons = ''; |
| 239 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 244 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
| 240 | 245 | $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
| 241 | 246 | } |
| 242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 247 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
| 243 | 248 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
| 244 | 249 | } |
| 245 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 250 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
| 246 | 251 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
| 247 | 252 | } |
| 248 | 253 | $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
@@ -1,13 +1,13 @@ 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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
| 9 | - // seems to be a new install - send the user to the configuration page |
|
| 10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
|
| 9 | + // seems to be a new install - send the user to the configuration page |
|
| 10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // set placeholders |
@@ -17,70 +17,70 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | 19 | if($modx->hasPermission('messages')) {
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
| 22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
| 23 | - |
|
| 24 | - $msg = array(); |
|
| 25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
| 30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
|
| 31 | - $ph['MessageInfo'] = implode("\n", $msg);
|
|
| 20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
| 22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
| 23 | + |
|
| 24 | + $msg = array(); |
|
| 25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
| 30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
|
| 31 | + $ph['MessageInfo'] = implode("\n", $msg);
|
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | 35 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
| 36 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
| 37 | - $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
| 36 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
| 37 | + $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
| 38 | 38 | } |
| 39 | 39 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
| 40 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
| 41 | - $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
| 40 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
| 41 | + $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
| 42 | 42 | } |
| 43 | 43 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
| 44 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
| 45 | - $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
| 44 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
| 45 | + $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
| 46 | 46 | } |
| 47 | 47 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
| 48 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
| 49 | - $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
| 48 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
| 49 | + $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
| 50 | 50 | } |
| 51 | 51 | if($modx->hasPermission('bk_manager')) {
|
| 52 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
| 53 | - $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
| 52 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
| 53 | + $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
| 54 | 54 | } |
| 55 | 55 | if($modx->hasPermission('help')) {
|
| 56 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
| 57 | - $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
| 56 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
| 57 | + $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | 60 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
| 61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | - $ph['config_check_results'] = $config_check_results; |
|
| 64 | - $ph['config_display'] = 'block'; |
|
| 65 | - } else {
|
|
| 66 | - $ph['config_display'] = 'none'; |
|
| 67 | - } |
|
| 61 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | + if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | + $ph['config_check_results'] = $config_check_results; |
|
| 64 | + $ph['config_display'] = 'block'; |
|
| 65 | + } else {
|
|
| 66 | + $ph['config_display'] = 'none'; |
|
| 67 | + } |
|
| 68 | 68 | } else {
|
| 69 | - $ph['config_display'] = 'none'; |
|
| 69 | + $ph['config_display'] = 'none'; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | 73 | if(isset($_SESSION['show_logout_reminder'])) {
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | - case 'logout_reminder': |
|
| 76 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
| 77 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
|
| 78 | - break; |
|
| 79 | - } |
|
| 80 | - $ph['show_logout_reminder'] = 'block'; |
|
| 81 | - unset($_SESSION['show_logout_reminder']); |
|
| 74 | + switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | + case 'logout_reminder': |
|
| 76 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
| 77 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
|
| 78 | + break; |
|
| 79 | + } |
|
| 80 | + $ph['show_logout_reminder'] = 'block'; |
|
| 81 | + unset($_SESSION['show_logout_reminder']); |
|
| 82 | 82 | } else {
|
| 83 | - $ph['show_logout_reminder'] = 'none'; |
|
| 83 | + $ph['show_logout_reminder'] = 'none'; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Check multiple sessions |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
| 129 | 129 | |
| 130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 131 | - 'username' => $modx->getLoginUserName(), |
|
| 132 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
| 133 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
| 134 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
| 135 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
| 131 | + 'username' => $modx->getLoginUserName(), |
|
| 132 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
| 133 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
| 134 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
| 135 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
| 136 | 136 | )); |
| 137 | 137 | |
| 138 | 138 | $from = array(); |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | 143 | if($modx->db->getRecordCount($rs) < 1) {
|
| 144 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
| 144 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
| 145 | 145 | } else {
|
| 146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 147 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
| 148 | - $ph['now'] = strftime('%H:%M:%S', $now);
|
|
| 149 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
| 150 | - $html = ' |
|
| 146 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 147 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
| 148 | + $ph['now'] = strftime('%H:%M:%S', $now);
|
|
| 149 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
| 150 | + $html = ' |
|
| 151 | 151 | <div class="card-body"> |
| 152 | 152 | [%onlineusers_message%] |
| 153 | 153 | <b>[+now+]</b>): |
@@ -165,33 +165,33 @@ discard block |
||
| 165 | 165 | </thead> |
| 166 | 166 | <tbody>'; |
| 167 | 167 | |
| 168 | - $userList = array(); |
|
| 169 | - $userCount = array(); |
|
| 170 | - // Create userlist with session-count first before output |
|
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
| 173 | - |
|
| 174 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
| 175 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
| 176 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
| 177 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
| 178 | - $userList[] = array( |
|
| 179 | - $idle, |
|
| 180 | - '', |
|
| 181 | - $activeusers['username'], |
|
| 182 | - $webicon, |
|
| 183 | - abs($activeusers['internalKey']), |
|
| 184 | - $ip, |
|
| 185 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
|
| 186 | - $currentaction |
|
| 187 | - ); |
|
| 188 | - } |
|
| 189 | - foreach($userList as $params) {
|
|
| 190 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
| 191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - $html .= ' |
|
| 168 | + $userList = array(); |
|
| 169 | + $userCount = array(); |
|
| 170 | + // Create userlist with session-count first before output |
|
| 171 | + while($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
| 173 | + |
|
| 174 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
| 175 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
| 176 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
| 177 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
| 178 | + $userList[] = array( |
|
| 179 | + $idle, |
|
| 180 | + '', |
|
| 181 | + $activeusers['username'], |
|
| 182 | + $webicon, |
|
| 183 | + abs($activeusers['internalKey']), |
|
| 184 | + $ip, |
|
| 185 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
|
| 186 | + $currentaction |
|
| 187 | + ); |
|
| 188 | + } |
|
| 189 | + foreach($userList as $params) {
|
|
| 190 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
| 191 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + $html .= ' |
|
| 195 | 195 | </tbody> |
| 196 | 196 | </table> |
| 197 | 197 | </div> |
@@ -232,17 +232,17 @@ discard block |
||
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | 234 | if(is_array($evtOut)) {
|
| 235 | - $output = implode('', $evtOut);
|
|
| 236 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
| 235 | + $output = implode('', $evtOut);
|
|
| 236 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $widgets['welcome'] = array( |
| 240 | - 'menuindex' => '10', |
|
| 241 | - 'id' => 'welcome', |
|
| 242 | - 'cols' => 'col-sm-6', |
|
| 243 | - 'icon' => 'fa-home', |
|
| 244 | - 'title' => '[%welcome_title%]', |
|
| 245 | - 'body' => ' |
|
| 240 | + 'menuindex' => '10', |
|
| 241 | + 'id' => 'welcome', |
|
| 242 | + 'cols' => 'col-sm-6', |
|
| 243 | + 'icon' => 'fa-home', |
|
| 244 | + 'title' => '[%welcome_title%]', |
|
| 245 | + 'body' => ' |
|
| 246 | 246 | <div class="wm_buttons card-body"> |
| 247 | 247 | <!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> |
| 248 | 248 | <span class="wm_button"> |
@@ -320,25 +320,25 @@ discard block |
||
| 320 | 320 | </table> |
| 321 | 321 | </div> |
| 322 | 322 | ', |
| 323 | - 'hide'=>'0' |
|
| 323 | + 'hide'=>'0' |
|
| 324 | 324 | ); |
| 325 | 325 | $widgets['onlineinfo'] = array( |
| 326 | - 'menuindex' => '20', |
|
| 327 | - 'id' => 'onlineinfo', |
|
| 328 | - 'cols' => 'col-sm-6', |
|
| 329 | - 'icon' => 'fa-user', |
|
| 330 | - 'title' => '[%onlineusers_title%]', |
|
| 331 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
| 332 | - 'hide'=>'0' |
|
| 326 | + 'menuindex' => '20', |
|
| 327 | + 'id' => 'onlineinfo', |
|
| 328 | + 'cols' => 'col-sm-6', |
|
| 329 | + 'icon' => 'fa-user', |
|
| 330 | + 'title' => '[%onlineusers_title%]', |
|
| 331 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
| 332 | + 'hide'=>'0' |
|
| 333 | 333 | ); |
| 334 | 334 | $widgets['recentinfo'] = array( |
| 335 | - 'menuindex' => '30', |
|
| 336 | - 'id' => 'modxrecent_widget', |
|
| 337 | - 'cols' => 'col-sm-12', |
|
| 338 | - 'icon' => 'fa-pencil-square-o', |
|
| 339 | - 'title' => '[%activity_title%]', |
|
| 340 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
| 341 | - 'hide'=>'0' |
|
| 335 | + 'menuindex' => '30', |
|
| 336 | + 'id' => 'modxrecent_widget', |
|
| 337 | + 'cols' => 'col-sm-12', |
|
| 338 | + 'icon' => 'fa-pencil-square-o', |
|
| 339 | + 'title' => '[%activity_title%]', |
|
| 340 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
| 341 | + 'hide'=>'0' |
|
| 342 | 342 | ); |
| 343 | 343 | if ($modx->config['rss_url_news']) {
|
| 344 | 344 | $widgets['news'] = array( |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | 368 | if(is_array($sitewidgets)) {
|
| 369 | - $newwidgets = array(); |
|
| 369 | + $newwidgets = array(); |
|
| 370 | 370 | foreach($sitewidgets as $widget){
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
@@ -374,21 +374,21 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | usort($widgets, function ($a, $b) {
|
| 377 | - return $a['menuindex'] - $b['menuindex']; |
|
| 377 | + return $a['menuindex'] - $b['menuindex']; |
|
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | 382 | foreach($widgets as $widget) {
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 384 | - $output .= $modx->parseText($tpl, $widget); |
|
| 385 | - } |
|
| 383 | + if ($widget['hide'] != '1'){
|
|
| 384 | + $output .= $modx->parseText($tpl, $widget); |
|
| 385 | + } |
|
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | 390 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
| 391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
@@ -396,27 +396,27 @@ discard block |
||
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | 398 | if(substr($target, 0, 1) === '@') {
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 402 | - $content = file_get_contents(trim(substr($target, 6))); |
|
| 403 | - } else {
|
|
| 404 | - $content = ''; |
|
| 405 | - } |
|
| 399 | + if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
| 401 | + } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 402 | + $content = file_get_contents(trim(substr($target, 6))); |
|
| 403 | + } else {
|
|
| 404 | + $content = ''; |
|
| 405 | + } |
|
| 406 | 406 | } else {
|
| 407 | - $chunk = $modx->getChunk($target); |
|
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 409 | - $content = $chunk; |
|
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | - {
|
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | - } else {
|
|
| 418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 419 | - } |
|
| 407 | + $chunk = $modx->getChunk($target); |
|
| 408 | + if($chunk !== false && !empty($chunk)) {
|
|
| 409 | + $content = $chunk; |
|
| 410 | + } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | + {
|
|
| 416 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | + } else {
|
|
| 418 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 419 | + } |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // merge placeholders |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | $content = $modx->mergeSettingsContent($content); |
| 425 | 425 | $content = $modx->parseText($content, $ph); |
| 426 | 426 | if(strpos($content, '[+') !== false) {
|
| 427 | - $modx->toPlaceholders($ph); |
|
| 428 | - $content = $modx->mergePlaceholderContent($content); |
|
| 427 | + $modx->toPlaceholders($ph); |
|
| 428 | + $content = $modx->mergePlaceholderContent($content); |
|
| 429 | 429 | } |
| 430 | 430 | $content = $modx->parseDocumentSource($content); |
| 431 | 431 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 434 | |
| 435 | 435 | if($js = $modx->getRegisteredClientScripts()) {
|
| 436 | - $content .= $js; |
|
| 436 | + $content .= $js; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | echo $content; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 444 | //</span> |
| 445 | 445 | function getTplWidget() { // recent document info
|
| 446 | - return ' |
|
| 446 | + return ' |
|
| 447 | 447 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 448 | <div class="card"[+cardAttr+]> |
| 449 | 449 | <div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div> |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | function getRecentInfo() { // recent document info
|
| 457 | - $modx = DocumentParser::getInstance(); |
|
| 457 | + $modx = DocumentParser::getInstance(); |
|
| 458 | 458 | |
| 459 | - $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
|
| 459 | + $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
|
| 460 | 460 | |
| 461 | - $html = ' |
|
| 461 | + $html = ' |
|
| 462 | 462 | <div class="table-responsive"> |
| 463 | 463 | <table class="table data"> |
| 464 | 464 | <thead> |
@@ -476,96 +476,96 @@ discard block |
||
| 476 | 476 | </table> |
| 477 | 477 | </div> |
| 478 | 478 | '; |
| 479 | - return $html; |
|
| 479 | + return $html; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | function getRecentInfoList() {
|
| 483 | - $modx = DocumentParser::getInstance(); |
|
| 484 | - |
|
| 485 | - $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
|
| 486 | - |
|
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | - return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
| 489 | - } |
|
| 490 | - |
|
| 491 | - $tpl = getRecentInfoRowTpl(); |
|
| 492 | - |
|
| 493 | - $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
| 494 | - $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
| 495 | - |
|
| 496 | - $output = array(); |
|
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 498 | - $docid = $ph['id']; |
|
| 499 | - $_ = $modx->getUserInfo($ph['editedby']); |
|
| 500 | - $ph['username'] = $_['username']; |
|
| 501 | - |
|
| 502 | - if($ph['deleted'] == 1) {
|
|
| 503 | - $ph['status'] = 'deleted text-danger'; |
|
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 505 | - $ph['status'] = 'unpublished font-italic text-muted'; |
|
| 506 | - } else {
|
|
| 507 | - $ph['status'] = 'published'; |
|
| 508 | - } |
|
| 509 | - |
|
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 511 | - $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
|
| 512 | - } else {
|
|
| 513 | - $ph['edit_btn'] = ''; |
|
| 514 | - } |
|
| 515 | - |
|
| 516 | - $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
| 517 | - $ph['preview_btn'] = str_replace(array( |
|
| 518 | - '[+id+]', |
|
| 519 | - '[+preview_disabled+]' |
|
| 520 | - ), array( |
|
| 521 | - $docid, |
|
| 522 | - $preview_disabled |
|
| 523 | - ), $btntpl['preview_btn']); |
|
| 524 | - |
|
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 527 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
| 528 | - } else {
|
|
| 529 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
| 530 | - } |
|
| 531 | - $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
|
| 532 | - } else {
|
|
| 533 | - $ph['delete_btn'] = ''; |
|
| 534 | - } |
|
| 535 | - |
|
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | - $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 542 | - } else {
|
|
| 543 | - $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 544 | - } |
|
| 545 | - $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
|
| 546 | - |
|
| 547 | - $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
|
| 548 | - |
|
| 549 | - if($ph['longtitle'] == '') {
|
|
| 550 | - $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
| 551 | - } |
|
| 552 | - if($ph['description'] == '') {
|
|
| 553 | - $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
| 554 | - } |
|
| 555 | - if($ph['introtext'] == '') {
|
|
| 556 | - $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
| 557 | - } |
|
| 558 | - if($ph['alias'] == '') {
|
|
| 559 | - $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
| 560 | - } |
|
| 561 | - |
|
| 562 | - $output[] = $modx->parseText($tpl, $ph); |
|
| 563 | - } |
|
| 564 | - return implode("\n", $output);
|
|
| 483 | + $modx = DocumentParser::getInstance(); |
|
| 484 | + |
|
| 485 | + $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
|
| 486 | + |
|
| 487 | + if($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | + return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
| 489 | + } |
|
| 490 | + |
|
| 491 | + $tpl = getRecentInfoRowTpl(); |
|
| 492 | + |
|
| 493 | + $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
| 494 | + $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
| 495 | + |
|
| 496 | + $output = array(); |
|
| 497 | + while($ph = $modx->db->getRow($rs)) {
|
|
| 498 | + $docid = $ph['id']; |
|
| 499 | + $_ = $modx->getUserInfo($ph['editedby']); |
|
| 500 | + $ph['username'] = $_['username']; |
|
| 501 | + |
|
| 502 | + if($ph['deleted'] == 1) {
|
|
| 503 | + $ph['status'] = 'deleted text-danger'; |
|
| 504 | + } elseif($ph['published'] == 0) {
|
|
| 505 | + $ph['status'] = 'unpublished font-italic text-muted'; |
|
| 506 | + } else {
|
|
| 507 | + $ph['status'] = 'published'; |
|
| 508 | + } |
|
| 509 | + |
|
| 510 | + if($modx->hasPermission('edit_document')) {
|
|
| 511 | + $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
|
| 512 | + } else {
|
|
| 513 | + $ph['edit_btn'] = ''; |
|
| 514 | + } |
|
| 515 | + |
|
| 516 | + $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
| 517 | + $ph['preview_btn'] = str_replace(array( |
|
| 518 | + '[+id+]', |
|
| 519 | + '[+preview_disabled+]' |
|
| 520 | + ), array( |
|
| 521 | + $docid, |
|
| 522 | + $preview_disabled |
|
| 523 | + ), $btntpl['preview_btn']); |
|
| 524 | + |
|
| 525 | + if($modx->hasPermission('delete_document')) {
|
|
| 526 | + if($ph['deleted'] == 0) {
|
|
| 527 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
| 528 | + } else {
|
|
| 529 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
| 530 | + } |
|
| 531 | + $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
|
| 532 | + } else {
|
|
| 533 | + $ph['delete_btn'] = ''; |
|
| 534 | + } |
|
| 535 | + |
|
| 536 | + if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 538 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 540 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | + $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 542 | + } else {
|
|
| 543 | + $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 544 | + } |
|
| 545 | + $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
|
| 546 | + |
|
| 547 | + $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
|
| 548 | + |
|
| 549 | + if($ph['longtitle'] == '') {
|
|
| 550 | + $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
| 551 | + } |
|
| 552 | + if($ph['description'] == '') {
|
|
| 553 | + $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
| 554 | + } |
|
| 555 | + if($ph['introtext'] == '') {
|
|
| 556 | + $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
| 557 | + } |
|
| 558 | + if($ph['alias'] == '') {
|
|
| 559 | + $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
| 560 | + } |
|
| 561 | + |
|
| 562 | + $output[] = $modx->parseText($tpl, $ph); |
|
| 563 | + } |
|
| 564 | + return implode("\n", $output);
|
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | function getRecentInfoRowTpl() {
|
| 568 | - $tpl = ' |
|
| 568 | + $tpl = ' |
|
| 569 | 569 | <tr> |
| 570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
| 571 | 571 | <td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&id=[+id+]" target="main">[+pagetitle+]</a></td> |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | </div> |
| 590 | 590 | </td> |
| 591 | 591 | </tr>'; |
| 592 | - return $tpl; |
|
| 592 | + return $tpl; |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | // setup icons |
| 596 | 596 | function wrapIcon($i, $action) {
|
| 597 | - return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
|
| 597 | + return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | function getStartUpScript() {
|
| 601 | - $script = ' |
|
| 601 | + $script = ' |
|
| 602 | 602 | <script type="text/javascript"> |
| 603 | 603 | function hideConfigCheckWarning(key) {
|
| 604 | 604 | var xhr = new XMLHttpRequest(); |
@@ -622,5 +622,5 @@ discard block |
||
| 622 | 622 | })(jQuery); |
| 623 | 623 | </script> |
| 624 | 624 | '; |
| 625 | - return $script; |
|
| 625 | + return $script; |
|
| 626 | 626 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,50 +16,50 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 19 | +if ($modx->hasPermission('messages')) {
|
|
| 20 | + include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php'); |
|
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
| 23 | 23 | |
| 24 | 24 | $msg = array(); |
| 25 | 25 | $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : ''; |
|
| 27 | 27 | $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0'; |
|
| 29 | 29 | $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
| 30 | 30 | $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
| 31 | 31 | $ph['MessageInfo'] = implode("\n", $msg);
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 47 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if ($modx->hasPermission('bk_manager')) {
|
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if ($modx->hasPermission('help')) {
|
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 60 | +if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 61 | + include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php'); |
|
| 62 | + if ($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | 65 | } else {
|
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if (isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | + switch ($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | </tr> |
| 126 | 126 | </table>'; |
| 127 | 127 | |
| 128 | -$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
|
| 128 | +$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>'; |
|
| 129 | 129 | |
| 130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 131 | 131 | 'username' => $modx->getLoginUserName(), |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | 145 | } else {
|
| 146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 146 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
| 149 | 149 | $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while ($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach ($userList as $params) {
|
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 191 | + $html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $html .= ' |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $ph['OnlineInfo'] = $html; |
| 201 | 201 | |
| 202 | 202 | // include rss feeds for important forum topics |
| 203 | -include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php'); |
|
| 203 | +include_once(MODX_MANAGER_PATH.'includes/rss.inc.php'); |
|
| 204 | 204 | $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content']; |
| 205 | 205 | $ph['modx_news_content'] = $feedData['modx_news_content']; |
| 206 | 206 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if (is_array($evtOut)) {
|
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -365,57 +365,57 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if (is_array($sitewidgets)) {
|
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach ($sitewidgets as $widget) {
|
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function($a, $b){
|
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach ($widgets as $widget) {
|
|
| 383 | + if ($widget['hide'] != '1') {
|
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 390 | +if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl'; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if (substr($target, 0, 1) === '@') {
|
|
| 399 | + if (substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif (substr($target, 0, 5) === '@FILE') {
|
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | 403 | } else {
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | 406 | } else {
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if ($chunk !== false && !empty($chunk)) {
|
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 410 | + } elseif (is_file(MODX_BASE_PATH.$target)) {
|
|
| 411 | + $content = file_get_contents(MODX_BASE_PATH.$target); |
|
| 412 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
|
|
| 413 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl'); |
|
| 414 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | 415 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 416 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html'); |
|
| 417 | 417 | } else {
|
| 418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 418 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl'); |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 424 | $content = $modx->mergeSettingsContent($content); |
| 425 | 425 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 426 | +if (strpos($content, '[+') !== false) {
|
|
| 427 | 427 | $modx->toPlaceholders($ph); |
| 428 | 428 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 434 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 435 | +if ($js = $modx->getRegisteredClientScripts()) {
|
|
| 436 | 436 | $content .= $js; |
| 437 | 437 | } |
| 438 | 438 | |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 444 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 445 | +function getTplWidget(){ // recent document info
|
|
| 446 | 446 | return ' |
| 447 | 447 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 448 | <div class="card"[+cardAttr+]> |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | '; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 456 | +function getRecentInfo(){ // recent document info
|
|
| 457 | 457 | $modx = DocumentParser::getInstance(); |
| 458 | 458 | |
| 459 | 459 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | return $html; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | -function getRecentInfoList() {
|
|
| 482 | +function getRecentInfoList(){
|
|
| 483 | 483 | $modx = DocumentParser::getInstance(); |
| 484 | 484 | |
| 485 | 485 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 486 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 487 | + if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | 488 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 489 | } |
| 490 | 490 | |
@@ -494,20 +494,20 @@ discard block |
||
| 494 | 494 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 495 | |
| 496 | 496 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 497 | + while ($ph = $modx->db->getRow($rs)) {
|
|
| 498 | 498 | $docid = $ph['id']; |
| 499 | 499 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 500 | $ph['username'] = $_['username']; |
| 501 | 501 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 502 | + if ($ph['deleted'] == 1) {
|
|
| 503 | 503 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 504 | + } elseif ($ph['published'] == 0) {
|
|
| 505 | 505 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | 506 | } else {
|
| 507 | 507 | $ph['status'] = 'published'; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 510 | + if ($modx->hasPermission('edit_document')) {
|
|
| 511 | 511 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | 512 | } else {
|
| 513 | 513 | $ph['edit_btn'] = ''; |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | $preview_disabled |
| 523 | 523 | ), $btntpl['preview_btn']); |
| 524 | 524 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 525 | + if ($modx->hasPermission('delete_document')) {
|
|
| 526 | + if ($ph['deleted'] == 0) {
|
|
| 527 | 527 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | 528 | } else {
|
| 529 | 529 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
@@ -533,11 +533,11 @@ discard block |
||
| 533 | 533 | $ph['delete_btn'] = ''; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 536 | + if ($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | 537 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 538 | + } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | 539 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 540 | + } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | 541 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | 542 | } else {
|
| 543 | 543 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
@@ -546,16 +546,16 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 548 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 549 | + if ($ph['longtitle'] == '') {
|
|
| 550 | 550 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 551 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 552 | + if ($ph['description'] == '') {
|
|
| 553 | 553 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 554 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 555 | + if ($ph['introtext'] == '') {
|
|
| 556 | 556 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 557 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 558 | + if ($ph['alias'] == '') {
|
|
| 559 | 559 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | return implode("\n", $output);
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 567 | +function getRecentInfoRowTpl(){
|
|
| 568 | 568 | $tpl = ' |
| 569 | 569 | <tr> |
| 570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +593,11 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 596 | +function wrapIcon($i, $action){
|
|
| 597 | 597 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | -function getStartUpScript() {
|
|
| 600 | +function getStartUpScript(){
|
|
| 601 | 601 | $script = ' |
| 602 | 602 | <script type="text/javascript"> |
| 603 | 603 | function hideConfigCheckWarning(key) {
|
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 19 | +if($modx->hasPermission('messages')) { |
|
| 20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -32,46 +32,46 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 47 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if($modx->hasPermission('bk_manager')) { |
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if($modx->hasPermission('help')) { |
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 60 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
| 61 | 61 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | - } else {
|
|
| 65 | + } else { |
|
| 66 | 66 | $ph['config_display'] = 'none'; |
| 67 | 67 | } |
| 68 | -} else {
|
|
| 68 | +} else { |
|
| 69 | 69 | $ph['config_display'] = 'none'; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
| 74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | $ph['show_logout_reminder'] = 'block'; |
| 81 | 81 | unset($_SESSION['show_logout_reminder']); |
| 82 | -} else {
|
|
| 82 | +} else { |
|
| 83 | 83 | $ph['show_logout_reminder'] = 'none'; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if($modx->db->getRecordCount($rs) < 1) { |
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | -} else {
|
|
| 145 | +} else { |
|
| 146 | 146 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach($userList as $params) { |
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | 191 | $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
| 192 | 192 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if(is_array($evtOut)) { |
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
| 341 | 341 | 'hide'=>'0' |
| 342 | 342 | ); |
| 343 | -if ($modx->config['rss_url_news']) {
|
|
| 343 | +if ($modx->config['rss_url_news']) { |
|
| 344 | 344 | $widgets['news'] = array( |
| 345 | 345 | 'menuindex' => '40', |
| 346 | 346 | 'id' => 'news', |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | 'hide'=>'0' |
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | -if ($modx->config['rss_url_security']) {
|
|
| 354 | +if ($modx->config['rss_url_security']) { |
|
| 355 | 355 | $widgets['security'] = array( |
| 356 | 356 | 'menuindex' => '50', |
| 357 | 357 | 'id' => 'security', |
@@ -365,29 +365,29 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if(is_array($sitewidgets)) { |
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach($sitewidgets as $widget) { |
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function ($a, $b){ |
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach($widgets as $widget) { |
|
| 383 | + if ($widget['hide'] != '1') { |
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 390 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
| 391 | 391 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -395,26 +395,28 @@ discard block |
||
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if(substr($target, 0, 1) === '@') { |
|
| 399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | - } else {
|
|
| 403 | + } else { |
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | -} else {
|
|
| 406 | +} else { |
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if($chunk !== false && !empty($chunk)) { |
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 411 | 411 | $content = file_get_contents(MODX_BASE_PATH . $target); |
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
| 413 | 413 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
| 415 | + // ClipperCMS compatible |
|
| 415 | 416 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | - } else {
|
|
| 417 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 418 | + } |
|
| 419 | + } else { |
|
| 418 | 420 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
| 419 | 421 | } |
| 420 | 422 | } |
@@ -423,7 +425,7 @@ discard block |
||
| 423 | 425 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 426 | $content = $modx->mergeSettingsContent($content); |
| 425 | 427 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 428 | +if(strpos($content, '[+') !== false) { |
|
| 427 | 429 | $modx->toPlaceholders($ph); |
| 428 | 430 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 431 | } |
@@ -432,7 +434,7 @@ discard block |
||
| 432 | 434 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 435 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 436 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 437 | +if($js = $modx->getRegisteredClientScripts()) { |
|
| 436 | 438 | $content .= $js; |
| 437 | 439 | } |
| 438 | 440 | |
@@ -442,7 +444,9 @@ discard block |
||
| 442 | 444 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 445 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 446 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 447 | +function getTplWidget() |
|
| 448 | +{ |
|
| 449 | +// recent document info |
|
| 446 | 450 | return ' |
| 447 | 451 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 452 | <div class="card"[+cardAttr+]> |
@@ -453,7 +457,9 @@ discard block |
||
| 453 | 457 | '; |
| 454 | 458 | } |
| 455 | 459 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 460 | +function getRecentInfo() |
|
| 461 | +{ |
|
| 462 | +// recent document info |
|
| 457 | 463 | $modx = DocumentParser::getInstance(); |
| 458 | 464 | |
| 459 | 465 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +485,13 @@ discard block |
||
| 479 | 485 | return $html; |
| 480 | 486 | } |
| 481 | 487 | |
| 482 | -function getRecentInfoList() {
|
|
| 488 | +function getRecentInfoList() |
|
| 489 | +{ |
|
| 483 | 490 | $modx = DocumentParser::getInstance(); |
| 484 | 491 | |
| 485 | 492 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 493 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 494 | + if($modx->db->getRecordCount($rs) < 1) { |
|
| 488 | 495 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 496 | } |
| 490 | 497 | |
@@ -494,22 +501,22 @@ discard block |
||
| 494 | 501 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 502 | |
| 496 | 503 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 504 | + while($ph = $modx->db->getRow($rs)) { |
|
| 498 | 505 | $docid = $ph['id']; |
| 499 | 506 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 507 | $ph['username'] = $_['username']; |
| 501 | 508 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 509 | + if($ph['deleted'] == 1) { |
|
| 503 | 510 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 511 | + } elseif($ph['published'] == 0) { |
|
| 505 | 512 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | - } else {
|
|
| 513 | + } else { |
|
| 507 | 514 | $ph['status'] = 'published'; |
| 508 | 515 | } |
| 509 | 516 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 517 | + if($modx->hasPermission('edit_document')) { |
|
| 511 | 518 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | - } else {
|
|
| 519 | + } else { |
|
| 513 | 520 | $ph['edit_btn'] = ''; |
| 514 | 521 | } |
| 515 | 522 | |
@@ -522,40 +529,40 @@ discard block |
||
| 522 | 529 | $preview_disabled |
| 523 | 530 | ), $btntpl['preview_btn']); |
| 524 | 531 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 532 | + if($modx->hasPermission('delete_document')) { |
|
| 533 | + if($ph['deleted'] == 0) { |
|
| 527 | 534 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | - } else {
|
|
| 535 | + } else { |
|
| 529 | 536 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
| 530 | 537 | } |
| 531 | 538 | $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
| 532 | - } else {
|
|
| 539 | + } else { |
|
| 533 | 540 | $ph['delete_btn'] = ''; |
| 534 | 541 | } |
| 535 | 542 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 543 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
| 537 | 544 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 545 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
| 539 | 546 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 547 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
| 541 | 548 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | - } else {
|
|
| 549 | + } else { |
|
| 543 | 550 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 544 | 551 | } |
| 545 | 552 | $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
| 546 | 553 | |
| 547 | 554 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 555 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 556 | + if($ph['longtitle'] == '') { |
|
| 550 | 557 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 558 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 559 | + if($ph['description'] == '') { |
|
| 553 | 560 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 561 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 562 | + if($ph['introtext'] == '') { |
|
| 556 | 563 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 564 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 565 | + if($ph['alias'] == '') { |
|
| 559 | 566 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 567 | } |
| 561 | 568 | |
@@ -564,7 +571,8 @@ discard block |
||
| 564 | 571 | return implode("\n", $output);
|
| 565 | 572 | } |
| 566 | 573 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 574 | +function getRecentInfoRowTpl() |
|
| 575 | +{ |
|
| 568 | 576 | $tpl = ' |
| 569 | 577 | <tr> |
| 570 | 578 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +601,13 @@ discard block |
||
| 593 | 601 | } |
| 594 | 602 | |
| 595 | 603 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 604 | +function wrapIcon($i, $action) |
|
| 605 | +{ |
|
| 597 | 606 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 607 | } |
| 599 | 608 | |
| 600 | -function getStartUpScript() {
|
|
| 609 | +function getStartUpScript() |
|
| 610 | +{ |
|
| 601 | 611 | $script = ' |
| 602 | 612 | <script type="text/javascript"> |
| 603 | 613 | function hideConfigCheckWarning(key) {
|
@@ -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,30 +12,30 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | 14 | switch($modx->manager->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 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 28 | - $udperms = new udperms(); |
|
| 29 | - $udperms->user = $modx->getLoginUserID(); |
|
| 30 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 31 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 32 | - if(!$udperms->checkPermissions()) { |
|
| 33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 34 | - } |
|
| 35 | - } |
|
| 36 | - break; |
|
| 37 | - default: |
|
| 38 | - $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 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 28 | + $udperms = new udperms(); |
|
| 29 | + $udperms->user = $modx->getLoginUserID(); |
|
| 30 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 31 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 32 | + if(!$udperms->checkPermissions()) { |
|
| 33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | + break; |
|
| 37 | + default: |
|
| 38 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -54,22 +54,22 @@ discard block |
||
| 54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 55 | 55 | |
| 56 | 56 | if($modx->manager->action == 27) { |
| 57 | - //editing an existing document |
|
| 58 | - // check permissions on the document |
|
| 59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 60 | - $udperms = new udperms(); |
|
| 61 | - $udperms->user = $modx->getLoginUserID(); |
|
| 62 | - $udperms->document = $id; |
|
| 63 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 64 | - |
|
| 65 | - if(!$udperms->checkPermissions()) { |
|
| 66 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 67 | - } |
|
| 57 | + //editing an existing document |
|
| 58 | + // check permissions on the document |
|
| 59 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 60 | + $udperms = new udperms(); |
|
| 61 | + $udperms->user = $modx->getLoginUserID(); |
|
| 62 | + $udperms->document = $id; |
|
| 63 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 64 | + |
|
| 65 | + if(!$udperms->checkPermissions()) { |
|
| 66 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // check to see if resource isn't locked |
| 71 | 71 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
| 72 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 72 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 73 | 73 | } |
| 74 | 74 | // end check for lock |
| 75 | 75 | |
@@ -78,74 +78,74 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // get document groups for current user |
| 80 | 80 | if($_SESSION['mgrDocgroups']) { |
| 81 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 81 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if(!empty ($id)) { |
| 85 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 86 | - if($docgrp) { |
|
| 87 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 88 | - } |
|
| 89 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 90 | - $content = array(); |
|
| 91 | - $content = $modx->db->getRow($rs); |
|
| 92 | - $modx->documentObject = &$content; |
|
| 93 | - if(!$content) { |
|
| 94 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 95 | - } |
|
| 96 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
| 85 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 86 | + if($docgrp) { |
|
| 87 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 88 | + } |
|
| 89 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 90 | + $content = array(); |
|
| 91 | + $content = $modx->db->getRow($rs); |
|
| 92 | + $modx->documentObject = &$content; |
|
| 93 | + if(!$content) { |
|
| 94 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 95 | + } |
|
| 96 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
| 97 | 97 | } else { |
| 98 | - $content = array(); |
|
| 98 | + $content = array(); |
|
| 99 | 99 | |
| 100 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 101 | - $content['template'] = $_REQUEST['newtemplate']; |
|
| 102 | - } else { |
|
| 103 | - $content['template'] = getDefaultTemplate(); |
|
| 104 | - } |
|
| 100 | + if(isset($_REQUEST['newtemplate'])) { |
|
| 101 | + $content['template'] = $_REQUEST['newtemplate']; |
|
| 102 | + } else { |
|
| 103 | + $content['template'] = getDefaultTemplate(); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 106 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // restore saved form |
| 110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
| 111 | 111 | if(isset($_REQUEST['newtemplate'])) { |
| 112 | - $formRestored = true; |
|
| 112 | + $formRestored = true; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // retain form values if template was changed |
| 116 | 116 | // edited to convert pub_date and unpub_date |
| 117 | 117 | // sottwell 02-09-2006 |
| 118 | 118 | if($formRestored == true) { |
| 119 | - $content = array_merge($content, $_POST); |
|
| 120 | - $content['content'] = $_POST['ta']; |
|
| 121 | - if(empty ($content['pub_date'])) { |
|
| 122 | - unset ($content['pub_date']); |
|
| 123 | - } else { |
|
| 124 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 125 | - } |
|
| 126 | - if(empty ($content['unpub_date'])) { |
|
| 127 | - unset ($content['unpub_date']); |
|
| 128 | - } else { |
|
| 129 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 130 | - } |
|
| 119 | + $content = array_merge($content, $_POST); |
|
| 120 | + $content['content'] = $_POST['ta']; |
|
| 121 | + if(empty ($content['pub_date'])) { |
|
| 122 | + unset ($content['pub_date']); |
|
| 123 | + } else { |
|
| 124 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 125 | + } |
|
| 126 | + if(empty ($content['unpub_date'])) { |
|
| 127 | + unset ($content['unpub_date']); |
|
| 128 | + } else { |
|
| 129 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 130 | + } |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // increase menu index if this is a new document |
| 134 | 134 | if(!isset ($_REQUEST['id'])) { |
| 135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 136 | - $modx->config['auto_menuindex'] = 1; |
|
| 137 | - } |
|
| 138 | - if($modx->config['auto_menuindex']) { |
|
| 139 | - $pid = (int)$_REQUEST['pid']; |
|
| 140 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 141 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
| 142 | - } else { |
|
| 143 | - $content['menuindex'] = 0; |
|
| 144 | - } |
|
| 135 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
| 136 | + $modx->config['auto_menuindex'] = 1; |
|
| 137 | + } |
|
| 138 | + if($modx->config['auto_menuindex']) { |
|
| 139 | + $pid = (int)$_REQUEST['pid']; |
|
| 140 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 141 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
| 142 | + } else { |
|
| 143 | + $content['menuindex'] = 0; |
|
| 144 | + } |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if(isset ($_POST['which_editor'])) { |
| 148 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 148 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Add lock-element JS-Script |
@@ -545,23 +545,23 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
| 547 | 547 | <?php |
| 548 | - // invoke OnDocFormPrerender event |
|
| 549 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 550 | - 'id' => $id, |
|
| 551 | - 'template' => $content['template'] |
|
| 552 | - )); |
|
| 553 | - |
|
| 554 | - if(is_array($evtOut)) { |
|
| 555 | - echo implode('', $evtOut); |
|
| 556 | - } |
|
| 557 | - |
|
| 558 | - /*************************/ |
|
| 559 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 560 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 561 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 562 | - /*************************/ |
|
| 563 | - |
|
| 564 | - ?> |
|
| 548 | + // invoke OnDocFormPrerender event |
|
| 549 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 550 | + 'id' => $id, |
|
| 551 | + 'template' => $content['template'] |
|
| 552 | + )); |
|
| 553 | + |
|
| 554 | + if(is_array($evtOut)) { |
|
| 555 | + echo implode('', $evtOut); |
|
| 556 | + } |
|
| 557 | + |
|
| 558 | + /*************************/ |
|
| 559 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 560 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 561 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 562 | + /*************************/ |
|
| 563 | + |
|
| 564 | + ?> |
|
| 565 | 565 | <input type="hidden" name="a" value="5" /> |
| 566 | 566 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
| 567 | 567 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -576,54 +576,54 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | <h1> |
| 578 | 578 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
| 579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 580 | - } else { |
|
| 581 | - if ($modx->manager->action == '4') { |
|
| 579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 580 | + } else { |
|
| 581 | + if ($modx->manager->action == '4') { |
|
| 582 | 582 | echo $_lang['add_resource']; |
| 583 | 583 | } else if ($modx->manager->action == '72') { |
| 584 | 584 | echo $_lang['add_weblink']; |
| 585 | 585 | } else { |
| 586 | 586 | echo $_lang['create_resource_title']; |
| 587 | 587 | } |
| 588 | - } ?> |
|
| 588 | + } ?> |
|
| 589 | 589 | </h1> |
| 590 | 590 | |
| 591 | 591 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
| 592 | 592 | |
| 593 | 593 | <?php |
| 594 | - // breadcrumbs |
|
| 595 | - if($modx->config['use_breadcrumbs']) { |
|
| 596 | - $temp = array(); |
|
| 597 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 598 | - |
|
| 599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 600 | - $bID = (int) $_REQUEST['id']; |
|
| 601 | - $temp = $modx->getParentIds($bID); |
|
| 602 | - } else if(isset($_REQUEST['pid'])) { |
|
| 603 | - $bID = (int) $_REQUEST['pid']; |
|
| 604 | - $temp = $modx->getParentIds($bID); |
|
| 605 | - array_unshift($temp, $bID); |
|
| 606 | - } |
|
| 607 | - |
|
| 608 | - if($temp) { |
|
| 609 | - $parents = implode(',', $temp); |
|
| 610 | - |
|
| 611 | - if(!empty($parents)) { |
|
| 612 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 613 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 614 | - while($row = $modx->db->getRow($rs)) { |
|
| 615 | - $out .= '<li class="breadcrumbs__li"> |
|
| 594 | + // breadcrumbs |
|
| 595 | + if($modx->config['use_breadcrumbs']) { |
|
| 596 | + $temp = array(); |
|
| 597 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 598 | + |
|
| 599 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 600 | + $bID = (int) $_REQUEST['id']; |
|
| 601 | + $temp = $modx->getParentIds($bID); |
|
| 602 | + } else if(isset($_REQUEST['pid'])) { |
|
| 603 | + $bID = (int) $_REQUEST['pid']; |
|
| 604 | + $temp = $modx->getParentIds($bID); |
|
| 605 | + array_unshift($temp, $bID); |
|
| 606 | + } |
|
| 607 | + |
|
| 608 | + if($temp) { |
|
| 609 | + $parents = implode(',', $temp); |
|
| 610 | + |
|
| 611 | + if(!empty($parents)) { |
|
| 612 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 613 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 614 | + while($row = $modx->db->getRow($rs)) { |
|
| 615 | + $out .= '<li class="breadcrumbs__li"> |
|
| 616 | 616 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
| 617 | 617 | <span class="breadcrumbs__sep">></span> |
| 618 | 618 | </li>'; |
| 619 | - } |
|
| 620 | - } |
|
| 621 | - } |
|
| 619 | + } |
|
| 620 | + } |
|
| 621 | + } |
|
| 622 | 622 | |
| 623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 625 | - } |
|
| 626 | - ?> |
|
| 623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 624 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 625 | + } |
|
| 626 | + ?> |
|
| 627 | 627 | |
| 628 | 628 | <!-- start main wrapper --> |
| 629 | 629 | <div class="sectionBody"> |
@@ -635,13 +635,13 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | <!-- General --> |
| 637 | 637 | <?php |
| 638 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 639 | - 'id' => $id |
|
| 640 | - )); |
|
| 641 | - if(is_array($evtOut)) { |
|
| 642 | - echo implode('', $evtOut); |
|
| 643 | - } else { |
|
| 644 | - ?> |
|
| 638 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 639 | + 'id' => $id |
|
| 640 | + )); |
|
| 641 | + if(is_array($evtOut)) { |
|
| 642 | + echo implode('', $evtOut); |
|
| 643 | + } else { |
|
| 644 | + ?> |
|
| 645 | 645 | <div class="tab-page" id="tabGeneral"> |
| 646 | 646 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
| 647 | 647 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -726,36 +726,36 @@ discard block |
||
| 726 | 726 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
| 727 | 727 | <option value="0">(blank)</option> |
| 728 | 728 | <?php |
| 729 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 730 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 731 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 732 | - $currentCategory = ''; |
|
| 733 | - while($row = $modx->db->getRow($rs)) { |
|
| 734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 735 | - continue; |
|
| 736 | - }; |
|
| 737 | - // Skip if not selectable but show if selected! |
|
| 738 | - $thisCategory = $row['category']; |
|
| 739 | - if($thisCategory == null) { |
|
| 740 | - $thisCategory = $_lang["no_category"]; |
|
| 741 | - } |
|
| 742 | - if($thisCategory != $currentCategory) { |
|
| 743 | - if($closeOptGroup) { |
|
| 744 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 745 | - } |
|
| 746 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 747 | - $closeOptGroup = true; |
|
| 748 | - } |
|
| 729 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 730 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 731 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 732 | + $currentCategory = ''; |
|
| 733 | + while($row = $modx->db->getRow($rs)) { |
|
| 734 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 735 | + continue; |
|
| 736 | + }; |
|
| 737 | + // Skip if not selectable but show if selected! |
|
| 738 | + $thisCategory = $row['category']; |
|
| 739 | + if($thisCategory == null) { |
|
| 740 | + $thisCategory = $_lang["no_category"]; |
|
| 741 | + } |
|
| 742 | + if($thisCategory != $currentCategory) { |
|
| 743 | + if($closeOptGroup) { |
|
| 744 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 745 | + } |
|
| 746 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 747 | + $closeOptGroup = true; |
|
| 748 | + } |
|
| 749 | 749 | |
| 750 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 750 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 751 | 751 | |
| 752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 753 | - $currentCategory = $thisCategory; |
|
| 754 | - } |
|
| 755 | - if($thisCategory != '') { |
|
| 756 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 757 | - } |
|
| 758 | - ?> |
|
| 752 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 753 | + $currentCategory = $thisCategory; |
|
| 754 | + } |
|
| 755 | + if($thisCategory != '') { |
|
| 756 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 757 | + } |
|
| 758 | + ?> |
|
| 759 | 759 | </select> |
| 760 | 760 | </td> |
| 761 | 761 | </tr> |
@@ -795,37 +795,37 @@ discard block |
||
| 795 | 795 | </td> |
| 796 | 796 | <td valign="top"> |
| 797 | 797 | <?php |
| 798 | - $parentlookup = false; |
|
| 799 | - if(isset ($_REQUEST['id'])) { |
|
| 800 | - if($content['parent'] == 0) { |
|
| 801 | - $parentname = $site_name; |
|
| 802 | - } else { |
|
| 803 | - $parentlookup = $content['parent']; |
|
| 804 | - } |
|
| 805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 806 | - if($_REQUEST['pid'] == 0) { |
|
| 807 | - $parentname = $site_name; |
|
| 808 | - } else { |
|
| 809 | - $parentlookup = $_REQUEST['pid']; |
|
| 810 | - } |
|
| 811 | - } elseif(isset($_POST['parent'])) { |
|
| 812 | - if($_POST['parent'] == 0) { |
|
| 813 | - $parentname = $site_name; |
|
| 814 | - } else { |
|
| 815 | - $parentlookup = $_POST['parent']; |
|
| 816 | - } |
|
| 817 | - } else { |
|
| 818 | - $parentname = $site_name; |
|
| 819 | - $content['parent'] = 0; |
|
| 820 | - } |
|
| 821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 822 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 823 | - $parentname = $modx->db->getValue($rs); |
|
| 824 | - if(!$parentname) { |
|
| 825 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 826 | - } |
|
| 827 | - } |
|
| 828 | - ?> |
|
| 798 | + $parentlookup = false; |
|
| 799 | + if(isset ($_REQUEST['id'])) { |
|
| 800 | + if($content['parent'] == 0) { |
|
| 801 | + $parentname = $site_name; |
|
| 802 | + } else { |
|
| 803 | + $parentlookup = $content['parent']; |
|
| 804 | + } |
|
| 805 | + } elseif(isset ($_REQUEST['pid'])) { |
|
| 806 | + if($_REQUEST['pid'] == 0) { |
|
| 807 | + $parentname = $site_name; |
|
| 808 | + } else { |
|
| 809 | + $parentlookup = $_REQUEST['pid']; |
|
| 810 | + } |
|
| 811 | + } elseif(isset($_POST['parent'])) { |
|
| 812 | + if($_POST['parent'] == 0) { |
|
| 813 | + $parentname = $site_name; |
|
| 814 | + } else { |
|
| 815 | + $parentlookup = $_POST['parent']; |
|
| 816 | + } |
|
| 817 | + } else { |
|
| 818 | + $parentname = $site_name; |
|
| 819 | + $content['parent'] = 0; |
|
| 820 | + } |
|
| 821 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 822 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 823 | + $parentname = $modx->db->getValue($rs); |
|
| 824 | + if(!$parentname) { |
|
| 825 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 826 | + } |
|
| 827 | + } |
|
| 828 | + ?> |
|
| 829 | 829 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
| 830 | 830 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
| 831 | 831 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | </tr> |
| 834 | 834 | <tr></tr> |
| 835 | 835 | <?php |
| 836 | - /* |
|
| 836 | + /* |
|
| 837 | 837 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
| 838 | 838 | ?> |
| 839 | 839 | <tr> |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | </tr> |
| 862 | 862 | <?php |
| 863 | 863 | }*/ |
| 864 | - ?> |
|
| 864 | + ?> |
|
| 865 | 865 | |
| 866 | 866 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
| 867 | 867 | <tr> |
@@ -874,36 +874,36 @@ discard block |
||
| 874 | 874 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
| 875 | 875 | <option value="none"><?= $_lang['none'] ?></option> |
| 876 | 876 | <?php |
| 877 | - // invoke OnRichTextEditorRegister event |
|
| 878 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 879 | - if(is_array($evtOut)) { |
|
| 880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 881 | - $editor = $evtOut[$i]; |
|
| 882 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 883 | - } |
|
| 884 | - } |
|
| 885 | - ?> |
|
| 877 | + // invoke OnRichTextEditorRegister event |
|
| 878 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 879 | + if(is_array($evtOut)) { |
|
| 880 | + for($i = 0; $i < count($evtOut); $i++) { |
|
| 881 | + $editor = $evtOut[$i]; |
|
| 882 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 883 | + } |
|
| 884 | + } |
|
| 885 | + ?> |
|
| 886 | 886 | </select> |
| 887 | 887 | </label> |
| 888 | 888 | </div> |
| 889 | 889 | <div id="content_body"> |
| 890 | 890 | <?php |
| 891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 892 | - $htmlContent = $content['content']; |
|
| 893 | - ?> |
|
| 891 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 892 | + $htmlContent = $content['content']; |
|
| 893 | + ?> |
|
| 894 | 894 | <div class="section-editor clearfix"> |
| 895 | 895 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
| 896 | 896 | </div> |
| 897 | 897 | <?php |
| 898 | - // Richtext-[*content*] |
|
| 899 | - $richtexteditorIds = array(); |
|
| 900 | - $richtexteditorOptions = array(); |
|
| 901 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 902 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 903 | - } else { |
|
| 904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 905 | - } |
|
| 906 | - ?> |
|
| 898 | + // Richtext-[*content*] |
|
| 899 | + $richtexteditorIds = array(); |
|
| 900 | + $richtexteditorOptions = array(); |
|
| 901 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 902 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 903 | + } else { |
|
| 904 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 905 | + } |
|
| 906 | + ?> |
|
| 907 | 907 | </div> |
| 908 | 908 | </td> |
| 909 | 909 | </tr> |
@@ -1190,8 +1190,8 @@ discard block |
||
| 1190 | 1190 | |
| 1191 | 1191 | <?php |
| 1192 | 1192 | |
| 1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1194 | - ?> |
|
| 1193 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1194 | + ?> |
|
| 1195 | 1195 | <tr> |
| 1196 | 1196 | <td> |
| 1197 | 1197 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1213,15 +1213,15 @@ discard block |
||
| 1213 | 1213 | <td> |
| 1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1215 | 1215 | <?php |
| 1216 | - if(!$content['contentType']) { |
|
| 1217 | - $content['contentType'] = 'text/html'; |
|
| 1218 | - } |
|
| 1219 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1220 | - $ct = explode(",", $custom_contenttype); |
|
| 1221 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1223 | - } |
|
| 1224 | - ?> |
|
| 1216 | + if(!$content['contentType']) { |
|
| 1217 | + $content['contentType'] = 'text/html'; |
|
| 1218 | + } |
|
| 1219 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1220 | + $ct = explode(",", $custom_contenttype); |
|
| 1221 | + for($i = 0; $i < count($ct); $i++) { |
|
| 1222 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1223 | + } |
|
| 1224 | + ?> |
|
| 1225 | 1225 | </select> |
| 1226 | 1226 | </td> |
| 1227 | 1227 | </tr> |
@@ -1244,23 +1244,23 @@ discard block |
||
| 1244 | 1244 | </td> |
| 1245 | 1245 | </tr> |
| 1246 | 1246 | <?php |
| 1247 | - } else { |
|
| 1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1249 | - // non-admin managers creating or editing a document resource |
|
| 1250 | - ?> |
|
| 1247 | + } else { |
|
| 1248 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1249 | + // non-admin managers creating or editing a document resource |
|
| 1250 | + ?> |
|
| 1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
| 1252 | 1252 | <input type="hidden" name="type" value="document" /> |
| 1253 | 1253 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
| 1254 | 1254 | <?php |
| 1255 | - } else { |
|
| 1256 | - // non-admin managers creating or editing a reference (weblink) resource |
|
| 1257 | - ?> |
|
| 1255 | + } else { |
|
| 1256 | + // non-admin managers creating or editing a reference (weblink) resource |
|
| 1257 | + ?> |
|
| 1258 | 1258 | <input type="hidden" name="type" value="reference" /> |
| 1259 | 1259 | <input type="hidden" name="contentType" value="text/html" /> |
| 1260 | 1260 | <?php |
| 1261 | - } |
|
| 1262 | - }//if mgrRole |
|
| 1263 | - ?> |
|
| 1261 | + } |
|
| 1262 | + }//if mgrRole |
|
| 1263 | + ?> |
|
| 1264 | 1264 | |
| 1265 | 1265 | <tr> |
| 1266 | 1266 | <td> |
@@ -1343,112 +1343,112 @@ discard block |
||
| 1343 | 1343 | ?> |
| 1344 | 1344 | |
| 1345 | 1345 | <?php |
| 1346 | - /******************************* |
|
| 1346 | + /******************************* |
|
| 1347 | 1347 | * Document Access Permissions */ |
| 1348 | - if($use_udperms == 1) { |
|
| 1349 | - $groupsarray = array(); |
|
| 1350 | - $sql = ''; |
|
| 1351 | - |
|
| 1352 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1353 | - if($documentId > 0) { |
|
| 1354 | - // Load up, the permissions from the parent (if new document) or existing document |
|
| 1355 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1357 | - |
|
| 1358 | - // Load up the current permissions and names |
|
| 1359 | - $vs = array( |
|
| 1360 | - $tbl_document_group_names, |
|
| 1361 | - $tbl_document_groups, |
|
| 1362 | - $documentId |
|
| 1363 | - ); |
|
| 1364 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1365 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1366 | - } else { |
|
| 1367 | - // Just load up the names, we're starting clean |
|
| 1368 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1369 | - } |
|
| 1370 | - |
|
| 1371 | - // retain selected doc groups between post |
|
| 1372 | - if(isset($_POST['docgroups'])) { |
|
| 1373 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1374 | - } |
|
| 1348 | + if($use_udperms == 1) { |
|
| 1349 | + $groupsarray = array(); |
|
| 1350 | + $sql = ''; |
|
| 1351 | + |
|
| 1352 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1353 | + if($documentId > 0) { |
|
| 1354 | + // Load up, the permissions from the parent (if new document) or existing document |
|
| 1355 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1356 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1357 | + |
|
| 1358 | + // Load up the current permissions and names |
|
| 1359 | + $vs = array( |
|
| 1360 | + $tbl_document_group_names, |
|
| 1361 | + $tbl_document_groups, |
|
| 1362 | + $documentId |
|
| 1363 | + ); |
|
| 1364 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1365 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1366 | + } else { |
|
| 1367 | + // Just load up the names, we're starting clean |
|
| 1368 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1369 | + } |
|
| 1370 | + |
|
| 1371 | + // retain selected doc groups between post |
|
| 1372 | + if(isset($_POST['docgroups'])) { |
|
| 1373 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1374 | + } |
|
| 1375 | + |
|
| 1376 | + $isManager = $modx->hasPermission('access_permissions'); |
|
| 1377 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1378 | + |
|
| 1379 | + // Setup Basic attributes for each Input box |
|
| 1380 | + $inputAttributes = array( |
|
| 1381 | + 'type' => 'checkbox', |
|
| 1382 | + 'class' => 'checkbox', |
|
| 1383 | + 'name' => 'docgroups[]', |
|
| 1384 | + 'onclick' => 'makePublic(false);', |
|
| 1385 | + ); |
|
| 1386 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1387 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1388 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1389 | + |
|
| 1390 | + // Loop through the permissions list |
|
| 1391 | + while($row = $modx->db->getRow($rs)) { |
|
| 1392 | + |
|
| 1393 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1394 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1395 | + $inputId = 'group-' . $row['id']; |
|
| 1396 | + |
|
| 1397 | + $checked = in_array($inputValue, $groupsarray); |
|
| 1398 | + if($checked) { |
|
| 1399 | + $notPublic = true; |
|
| 1400 | + } // Mark as private access (either web or manager) |
|
| 1401 | + |
|
| 1402 | + // Skip the access permission if the user doesn't have access... |
|
| 1403 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1404 | + continue; |
|
| 1405 | + } |
|
| 1375 | 1406 | |
| 1376 | - $isManager = $modx->hasPermission('access_permissions'); |
|
| 1377 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1378 | - |
|
| 1379 | - // Setup Basic attributes for each Input box |
|
| 1380 | - $inputAttributes = array( |
|
| 1381 | - 'type' => 'checkbox', |
|
| 1382 | - 'class' => 'checkbox', |
|
| 1383 | - 'name' => 'docgroups[]', |
|
| 1384 | - 'onclick' => 'makePublic(false);', |
|
| 1385 | - ); |
|
| 1386 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1387 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1388 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1389 | - |
|
| 1390 | - // Loop through the permissions list |
|
| 1391 | - while($row = $modx->db->getRow($rs)) { |
|
| 1392 | - |
|
| 1393 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1395 | - $inputId = 'group-' . $row['id']; |
|
| 1396 | - |
|
| 1397 | - $checked = in_array($inputValue, $groupsarray); |
|
| 1398 | - if($checked) { |
|
| 1399 | - $notPublic = true; |
|
| 1400 | - } // Mark as private access (either web or manager) |
|
| 1401 | - |
|
| 1402 | - // Skip the access permission if the user doesn't have access... |
|
| 1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1404 | - continue; |
|
| 1405 | - } |
|
| 1406 | - |
|
| 1407 | - // Setup attributes for this Input box |
|
| 1408 | - $inputAttributes['id'] = $inputId; |
|
| 1409 | - $inputAttributes['value'] = $inputValue; |
|
| 1410 | - if($checked) { |
|
| 1411 | - $inputAttributes['checked'] = 'checked'; |
|
| 1412 | - } else { |
|
| 1413 | - unset($inputAttributes['checked']); |
|
| 1414 | - } |
|
| 1415 | - |
|
| 1416 | - // Create attribute string list |
|
| 1417 | - $inputString = array(); |
|
| 1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1419 | - |
|
| 1420 | - // Make the <input> HTML |
|
| 1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1422 | - |
|
| 1423 | - // does user have this permission? |
|
| 1424 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1425 | - $vs = array( |
|
| 1426 | - $row['id'], |
|
| 1427 | - $_SESSION['mgrInternalKey'] |
|
| 1428 | - ); |
|
| 1429 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1430 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
| 1431 | - $count = $modx->db->getValue($rsp); |
|
| 1432 | - if($count > 0) { |
|
| 1433 | - ++$permissions_yes; |
|
| 1434 | - } else { |
|
| 1435 | - ++$permissions_no; |
|
| 1436 | - } |
|
| 1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1438 | - } |
|
| 1439 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1441 | - $permissions = array(); |
|
| 1442 | - } |
|
| 1407 | + // Setup attributes for this Input box |
|
| 1408 | + $inputAttributes['id'] = $inputId; |
|
| 1409 | + $inputAttributes['value'] = $inputValue; |
|
| 1410 | + if($checked) { |
|
| 1411 | + $inputAttributes['checked'] = 'checked'; |
|
| 1412 | + } else { |
|
| 1413 | + unset($inputAttributes['checked']); |
|
| 1414 | + } |
|
| 1443 | 1415 | |
| 1444 | - // See if the Access Permissions section is worth displaying... |
|
| 1445 | - if(!empty($permissions)) { |
|
| 1446 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1447 | - if($isManager && $isWeb) { |
|
| 1448 | - 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>'); |
|
| 1449 | - } |
|
| 1450 | - // Output the permissions list... |
|
| 1451 | - ?> |
|
| 1416 | + // Create attribute string list |
|
| 1417 | + $inputString = array(); |
|
| 1418 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1419 | + |
|
| 1420 | + // Make the <input> HTML |
|
| 1421 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1422 | + |
|
| 1423 | + // does user have this permission? |
|
| 1424 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1425 | + $vs = array( |
|
| 1426 | + $row['id'], |
|
| 1427 | + $_SESSION['mgrInternalKey'] |
|
| 1428 | + ); |
|
| 1429 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1430 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
| 1431 | + $count = $modx->db->getValue($rsp); |
|
| 1432 | + if($count > 0) { |
|
| 1433 | + ++$permissions_yes; |
|
| 1434 | + } else { |
|
| 1435 | + ++$permissions_no; |
|
| 1436 | + } |
|
| 1437 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1438 | + } |
|
| 1439 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1440 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1441 | + $permissions = array(); |
|
| 1442 | + } |
|
| 1443 | + |
|
| 1444 | + // See if the Access Permissions section is worth displaying... |
|
| 1445 | + if(!empty($permissions)) { |
|
| 1446 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1447 | + if($isManager && $isWeb) { |
|
| 1448 | + 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>'); |
|
| 1449 | + } |
|
| 1450 | + // Output the permissions list... |
|
| 1451 | + ?> |
|
| 1452 | 1452 | <!-- Access Permissions --> |
| 1453 | 1453 | <div class="tab-page" id="tabAccess"> |
| 1454 | 1454 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1482,31 +1482,31 @@ discard block |
||
| 1482 | 1482 | </ul> |
| 1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1484 | 1484 | <?php |
| 1485 | - } // !empty($permissions) |
|
| 1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1487 | - ?> |
|
| 1485 | + } // !empty($permissions) |
|
| 1486 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1487 | + ?> |
|
| 1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1489 | 1489 | <?php |
| 1490 | 1490 | |
| 1491 | - } |
|
| 1492 | - } |
|
| 1493 | - /* End Document Access Permissions * |
|
| 1491 | + } |
|
| 1492 | + } |
|
| 1493 | + /* End Document Access Permissions * |
|
| 1494 | 1494 | ***********************************/ |
| 1495 | - ?> |
|
| 1495 | + ?> |
|
| 1496 | 1496 | |
| 1497 | 1497 | <input type="submit" name="save" style="display:none" /> |
| 1498 | 1498 | <?php |
| 1499 | 1499 | |
| 1500 | - // invoke OnDocFormRender event |
|
| 1501 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1502 | - 'id' => $id, |
|
| 1503 | - 'template' => $content['template'] |
|
| 1504 | - )); |
|
| 1500 | + // invoke OnDocFormRender event |
|
| 1501 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1502 | + 'id' => $id, |
|
| 1503 | + 'template' => $content['template'] |
|
| 1504 | + )); |
|
| 1505 | 1505 | |
| 1506 | - if(is_array($evtOut)) { |
|
| 1507 | - echo implode('', $evtOut); |
|
| 1508 | - } |
|
| 1509 | - ?> |
|
| 1506 | + if(is_array($evtOut)) { |
|
| 1507 | + echo implode('', $evtOut); |
|
| 1508 | + } |
|
| 1509 | + ?> |
|
| 1510 | 1510 | </div><!--div class="tab-pane" id="documentPane"--> |
| 1511 | 1511 | </div><!--div class="sectionBody"--> |
| 1512 | 1512 | </fieldset> |
@@ -1517,63 +1517,63 @@ discard block |
||
| 1517 | 1517 | </script> |
| 1518 | 1518 | <?php |
| 1519 | 1519 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
| 1520 | - if(is_array($richtexteditorIds)) { |
|
| 1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1522 | - // invoke OnRichTextEditorInit event |
|
| 1523 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1524 | - 'editor' => $editor, |
|
| 1525 | - 'elements' => $elements, |
|
| 1526 | - 'options' => $richtexteditorOptions[$editor] |
|
| 1527 | - )); |
|
| 1528 | - if(is_array($evtOut)) { |
|
| 1529 | - echo implode('', $evtOut); |
|
| 1530 | - } |
|
| 1531 | - } |
|
| 1532 | - } |
|
| 1520 | + if(is_array($richtexteditorIds)) { |
|
| 1521 | + foreach($richtexteditorIds as $editor => $elements) { |
|
| 1522 | + // invoke OnRichTextEditorInit event |
|
| 1523 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1524 | + 'editor' => $editor, |
|
| 1525 | + 'elements' => $elements, |
|
| 1526 | + 'options' => $richtexteditorOptions[$editor] |
|
| 1527 | + )); |
|
| 1528 | + if(is_array($evtOut)) { |
|
| 1529 | + echo implode('', $evtOut); |
|
| 1530 | + } |
|
| 1531 | + } |
|
| 1532 | + } |
|
| 1533 | 1533 | } |
| 1534 | 1534 | |
| 1535 | 1535 | /** |
| 1536 | 1536 | * @return string |
| 1537 | 1537 | */ |
| 1538 | 1538 | function getDefaultTemplate() { |
| 1539 | - $modx = DocumentParser::getInstance(); |
|
| 1539 | + $modx = DocumentParser::getInstance(); |
|
| 1540 | 1540 | |
| 1541 | 1541 | $default_template = ''; |
| 1542 | - switch($modx->config['auto_template_logic']) { |
|
| 1543 | - case 'sibling': |
|
| 1544 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1545 | - $site_start = $modx->config['site_start']; |
|
| 1546 | - $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
| 1547 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
| 1548 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1549 | - $default_template = $sibl[0]['template']; |
|
| 1550 | - } |
|
| 1551 | - } else { |
|
| 1552 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1554 | - $default_template = $sibl[0]['template']; |
|
| 1555 | - } else { |
|
| 1556 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1558 | - $default_template = $sibl[0]['template']; |
|
| 1559 | - } |
|
| 1560 | - } |
|
| 1561 | - } |
|
| 1562 | - if(isset($default_template)) { |
|
| 1563 | - break; |
|
| 1564 | - } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
| 1565 | - case 'parent': |
|
| 1566 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1567 | - $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
| 1568 | - if(isset($parent['template'])) { |
|
| 1569 | - $default_template = $parent['template']; |
|
| 1570 | - } |
|
| 1571 | - } |
|
| 1572 | - break; |
|
| 1573 | - case 'system': |
|
| 1574 | - default: // default_template is already set |
|
| 1575 | - $default_template = $modx->config['default_template']; |
|
| 1576 | - } |
|
| 1577 | - |
|
| 1578 | - return empty($default_template) ? $modx->config['default_template'] : $default_template; |
|
| 1542 | + switch($modx->config['auto_template_logic']) { |
|
| 1543 | + case 'sibling': |
|
| 1544 | + if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1545 | + $site_start = $modx->config['site_start']; |
|
| 1546 | + $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
| 1547 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
| 1548 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1549 | + $default_template = $sibl[0]['template']; |
|
| 1550 | + } |
|
| 1551 | + } else { |
|
| 1552 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1553 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1554 | + $default_template = $sibl[0]['template']; |
|
| 1555 | + } else { |
|
| 1556 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1557 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1558 | + $default_template = $sibl[0]['template']; |
|
| 1559 | + } |
|
| 1560 | + } |
|
| 1561 | + } |
|
| 1562 | + if(isset($default_template)) { |
|
| 1563 | + break; |
|
| 1564 | + } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
| 1565 | + case 'parent': |
|
| 1566 | + if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1567 | + $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
| 1568 | + if(isset($parent['template'])) { |
|
| 1569 | + $default_template = $parent['template']; |
|
| 1570 | + } |
|
| 1571 | + } |
|
| 1572 | + break; |
|
| 1573 | + case 'system': |
|
| 1574 | + default: // default_template is already set |
|
| 1575 | + $default_template = $modx->config['default_template']; |
|
| 1576 | + } |
|
| 1577 | + |
|
| 1578 | + return empty($default_template) ? $modx->config['default_template'] : $default_template; |
|
| 1579 | 1579 | } |
@@ -1,35 +1,35 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /********************/ |
| 7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
| 8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
| 9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
| 10 | -$add_path = $sd . $sb . $pg; |
|
| 7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 10 | +$add_path = $sd.$sb.$pg; |
|
| 11 | 11 | /*******************/ |
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | -switch($modx->manager->action) { |
|
| 14 | +switch ($modx->manager->action) { |
|
| 15 | 15 | case 27: |
| 16 | - if(!$modx->hasPermission('edit_document')) { |
|
| 16 | + if (!$modx->hasPermission('edit_document')) { |
|
| 17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 18 | 18 | } |
| 19 | 19 | break; |
| 20 | 20 | case 85: |
| 21 | 21 | case 72: |
| 22 | 22 | case 4: |
| 23 | - if(!$modx->hasPermission('new_document')) { |
|
| 23 | + if (!$modx->hasPermission('new_document')) { |
|
| 24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | 26 | // check user has permissions for parent |
| 27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 27 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
| 28 | 28 | $udperms = new udperms(); |
| 29 | 29 | $udperms->user = $modx->getLoginUserID(); |
| 30 | 30 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
| 31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
| 32 | - if(!$udperms->checkPermissions()) { |
|
| 32 | + if (!$udperms->checkPermissions()) { |
|
| 33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 41 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 42 | 42 | |
| 43 | 43 | // Get table names (alphabetical) |
| 44 | 44 | $tbl_categories = $modx->getFullTableName('categories'); |
@@ -53,22 +53,22 @@ discard block |
||
| 53 | 53 | $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates'); |
| 54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 55 | 55 | |
| 56 | -if($modx->manager->action == 27) { |
|
| 56 | +if ($modx->manager->action == 27) { |
|
| 57 | 57 | //editing an existing document |
| 58 | 58 | // check permissions on the document |
| 59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 59 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
| 60 | 60 | $udperms = new udperms(); |
| 61 | 61 | $udperms->user = $modx->getLoginUserID(); |
| 62 | 62 | $udperms->document = $id; |
| 63 | 63 | $udperms->role = $_SESSION['mgrRole']; |
| 64 | 64 | |
| 65 | - if(!$udperms->checkPermissions()) { |
|
| 65 | + if (!$udperms->checkPermissions()) { |
|
| 66 | 66 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // check to see if resource isn't locked |
| 71 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
| 71 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
| 72 | 72 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
| 73 | 73 | } |
| 74 | 74 | // end check for lock |
@@ -77,27 +77,27 @@ discard block |
||
| 77 | 77 | $modx->lockElement(7, $id); |
| 78 | 78 | |
| 79 | 79 | // get document groups for current user |
| 80 | -if($_SESSION['mgrDocgroups']) { |
|
| 80 | +if ($_SESSION['mgrDocgroups']) { |
|
| 81 | 81 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | -if(!empty ($id)) { |
|
| 84 | +if (!empty ($id)) { |
|
| 85 | 85 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
| 86 | - if($docgrp) { |
|
| 86 | + if ($docgrp) { |
|
| 87 | 87 | $access .= " OR dg.document_group IN ({$docgrp})"; |
| 88 | 88 | } |
| 89 | 89 | $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
| 90 | 90 | $content = array(); |
| 91 | 91 | $content = $modx->db->getRow($rs); |
| 92 | 92 | $modx->documentObject = &$content; |
| 93 | - if(!$content) { |
|
| 93 | + if (!$content) { |
|
| 94 | 94 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 95 | 95 | } |
| 96 | 96 | $_SESSION['itemname'] = $content['pagetitle']; |
| 97 | 97 | } else { |
| 98 | 98 | $content = array(); |
| 99 | 99 | |
| 100 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 100 | + if (isset($_REQUEST['newtemplate'])) { |
|
| 101 | 101 | $content['template'] = $_REQUEST['newtemplate']; |
| 102 | 102 | } else { |
| 103 | 103 | $content['template'] = getDefaultTemplate(); |
@@ -108,22 +108,22 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // restore saved form |
| 110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
| 111 | -if(isset($_REQUEST['newtemplate'])) { |
|
| 111 | +if (isset($_REQUEST['newtemplate'])) { |
|
| 112 | 112 | $formRestored = true; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // retain form values if template was changed |
| 116 | 116 | // edited to convert pub_date and unpub_date |
| 117 | 117 | // sottwell 02-09-2006 |
| 118 | -if($formRestored == true) { |
|
| 118 | +if ($formRestored == true) { |
|
| 119 | 119 | $content = array_merge($content, $_POST); |
| 120 | 120 | $content['content'] = $_POST['ta']; |
| 121 | - if(empty ($content['pub_date'])) { |
|
| 121 | + if (empty ($content['pub_date'])) { |
|
| 122 | 122 | unset ($content['pub_date']); |
| 123 | 123 | } else { |
| 124 | 124 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
| 125 | 125 | } |
| 126 | - if(empty ($content['unpub_date'])) { |
|
| 126 | + if (empty ($content['unpub_date'])) { |
|
| 127 | 127 | unset ($content['unpub_date']); |
| 128 | 128 | } else { |
| 129 | 129 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // increase menu index if this is a new document |
| 134 | -if(!isset ($_REQUEST['id'])) { |
|
| 135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | +if (!isset ($_REQUEST['id'])) { |
|
| 135 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
| 136 | 136 | $modx->config['auto_menuindex'] = 1; |
| 137 | 137 | } |
| 138 | - if($modx->config['auto_menuindex']) { |
|
| 139 | - $pid = (int)$_REQUEST['pid']; |
|
| 138 | + if ($modx->config['auto_menuindex']) { |
|
| 139 | + $pid = (int) $_REQUEST['pid']; |
|
| 140 | 140 | $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
| 141 | 141 | $content['menuindex'] = $modx->db->getValue($rs); |
| 142 | 142 | } else { |
@@ -144,14 +144,14 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | -if(isset ($_POST['which_editor'])) { |
|
| 147 | +if (isset ($_POST['which_editor'])) { |
|
| 148 | 148 | $modx->config['which_editor'] = $_POST['which_editor']; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Add lock-element JS-Script |
| 152 | 152 | $lockElementId = $id; |
| 153 | 153 | $lockElementType = 7; |
| 154 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
| 154 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
| 155 | 155 | ?> |
| 156 | 156 | <script type="text/javascript"> |
| 157 | 157 | /* <![CDATA[ */ |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | }, |
| 182 | 182 | cancel: function() { |
| 183 | 183 | documentDirty = false; |
| 184 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
| 184 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
| 185 | 185 | }, |
| 186 | 186 | duplicate: function() { |
| 187 | 187 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | }, |
| 191 | 191 | view: function() { |
| 192 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
| 192 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
| 193 | 193 | } |
| 194 | 194 | }; |
| 195 | 195 | |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | 'template' => $content['template'] |
| 552 | 552 | )); |
| 553 | 553 | |
| 554 | - if(is_array($evtOut)) { |
|
| 554 | + if (is_array($evtOut)) { |
|
| 555 | 555 | echo implode('', $evtOut); |
| 556 | 556 | } |
| 557 | 557 | |
@@ -575,8 +575,8 @@ discard block |
||
| 575 | 575 | <fieldset id="create_edit"> |
| 576 | 576 | |
| 577 | 577 | <h1> |
| 578 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
| 579 | - 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 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
| 579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
| 580 | 580 | } else { |
| 581 | 581 | if ($modx->manager->action == '4') { |
| 582 | 582 | echo $_lang['add_resource']; |
@@ -592,36 +592,36 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | <?php |
| 594 | 594 | // breadcrumbs |
| 595 | - if($modx->config['use_breadcrumbs']) { |
|
| 595 | + if ($modx->config['use_breadcrumbs']) { |
|
| 596 | 596 | $temp = array(); |
| 597 | 597 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
| 598 | 598 | |
| 599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 599 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 600 | 600 | $bID = (int) $_REQUEST['id']; |
| 601 | 601 | $temp = $modx->getParentIds($bID); |
| 602 | - } else if(isset($_REQUEST['pid'])) { |
|
| 602 | + } else if (isset($_REQUEST['pid'])) { |
|
| 603 | 603 | $bID = (int) $_REQUEST['pid']; |
| 604 | 604 | $temp = $modx->getParentIds($bID); |
| 605 | 605 | array_unshift($temp, $bID); |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | - if($temp) { |
|
| 608 | + if ($temp) { |
|
| 609 | 609 | $parents = implode(',', $temp); |
| 610 | 610 | |
| 611 | - if(!empty($parents)) { |
|
| 611 | + if (!empty($parents)) { |
|
| 612 | 612 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
| 613 | 613 | $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
| 614 | - while($row = $modx->db->getRow($rs)) { |
|
| 614 | + while ($row = $modx->db->getRow($rs)) { |
|
| 615 | 615 | $out .= '<li class="breadcrumbs__li"> |
| 616 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
| 616 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
| 617 | 617 | <span class="breadcrumbs__sep">></span> |
| 618 | 618 | </li>'; |
| 619 | 619 | } |
| 620 | 620 | } |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
| 624 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
| 625 | 625 | } |
| 626 | 626 | ?> |
| 627 | 627 | |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
| 639 | 639 | 'id' => $id |
| 640 | 640 | )); |
| 641 | - if(is_array($evtOut)) { |
|
| 641 | + if (is_array($evtOut)) { |
|
| 642 | 642 | echo implode('', $evtOut); |
| 643 | 643 | } else { |
| 644 | 644 | ?> |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | </td> |
| 695 | 695 | </tr> |
| 696 | 696 | |
| 697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 697 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 698 | 698 | |
| 699 | 699 | <tr> |
| 700 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -730,17 +730,17 @@ discard block |
||
| 730 | 730 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
| 731 | 731 | $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
| 732 | 732 | $currentCategory = ''; |
| 733 | - while($row = $modx->db->getRow($rs)) { |
|
| 734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | + while ($row = $modx->db->getRow($rs)) { |
|
| 734 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 735 | 735 | continue; |
| 736 | 736 | }; |
| 737 | 737 | // Skip if not selectable but show if selected! |
| 738 | 738 | $thisCategory = $row['category']; |
| 739 | - if($thisCategory == null) { |
|
| 739 | + if ($thisCategory == null) { |
|
| 740 | 740 | $thisCategory = $_lang["no_category"]; |
| 741 | 741 | } |
| 742 | - if($thisCategory != $currentCategory) { |
|
| 743 | - if($closeOptGroup) { |
|
| 742 | + if ($thisCategory != $currentCategory) { |
|
| 743 | + if ($closeOptGroup) { |
|
| 744 | 744 | echo "\t\t\t\t\t</optgroup>\n"; |
| 745 | 745 | } |
| 746 | 746 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -749,10 +749,10 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
| 751 | 751 | |
| 752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 752 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
| 753 | 753 | $currentCategory = $thisCategory; |
| 754 | 754 | } |
| 755 | - if($thisCategory != '') { |
|
| 755 | + if ($thisCategory != '') { |
|
| 756 | 756 | echo "\t\t\t\t\t</optgroup>\n"; |
| 757 | 757 | } |
| 758 | 758 | ?> |
@@ -796,20 +796,20 @@ discard block |
||
| 796 | 796 | <td valign="top"> |
| 797 | 797 | <?php |
| 798 | 798 | $parentlookup = false; |
| 799 | - if(isset ($_REQUEST['id'])) { |
|
| 800 | - if($content['parent'] == 0) { |
|
| 799 | + if (isset ($_REQUEST['id'])) { |
|
| 800 | + if ($content['parent'] == 0) { |
|
| 801 | 801 | $parentname = $site_name; |
| 802 | 802 | } else { |
| 803 | 803 | $parentlookup = $content['parent']; |
| 804 | 804 | } |
| 805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 806 | - if($_REQUEST['pid'] == 0) { |
|
| 805 | + } elseif (isset ($_REQUEST['pid'])) { |
|
| 806 | + if ($_REQUEST['pid'] == 0) { |
|
| 807 | 807 | $parentname = $site_name; |
| 808 | 808 | } else { |
| 809 | 809 | $parentlookup = $_REQUEST['pid']; |
| 810 | 810 | } |
| 811 | - } elseif(isset($_POST['parent'])) { |
|
| 812 | - if($_POST['parent'] == 0) { |
|
| 811 | + } elseif (isset($_POST['parent'])) { |
|
| 812 | + if ($_POST['parent'] == 0) { |
|
| 813 | 813 | $parentname = $site_name; |
| 814 | 814 | } else { |
| 815 | 815 | $parentlookup = $_POST['parent']; |
@@ -818,10 +818,10 @@ discard block |
||
| 818 | 818 | $parentname = $site_name; |
| 819 | 819 | $content['parent'] = 0; |
| 820 | 820 | } |
| 821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 821 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 822 | 822 | $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
| 823 | 823 | $parentname = $modx->db->getValue($rs); |
| 824 | - if(!$parentname) { |
|
| 824 | + if (!$parentname) { |
|
| 825 | 825 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
| 826 | 826 | } |
| 827 | 827 | } |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | }*/ |
| 864 | 864 | ?> |
| 865 | 865 | |
| 866 | - <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
| 866 | + <?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
| 867 | 867 | <tr> |
| 868 | 868 | <td colspan="2"> |
| 869 | 869 | <hr> |
@@ -876,8 +876,8 @@ discard block |
||
| 876 | 876 | <?php |
| 877 | 877 | // invoke OnRichTextEditorRegister event |
| 878 | 878 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
| 879 | - if(is_array($evtOut)) { |
|
| 880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | + if (is_array($evtOut)) { |
|
| 880 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
| 881 | 881 | $editor = $evtOut[$i]; |
| 882 | 882 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
| 883 | 883 | } |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | </div> |
| 889 | 889 | <div id="content_body"> |
| 890 | 890 | <?php |
| 891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 891 | + if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 892 | 892 | $htmlContent = $content['content']; |
| 893 | 893 | ?> |
| 894 | 894 | <div class="section-editor clearfix"> |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
| 902 | 902 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
| 903 | 903 | } else { |
| 904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 904 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
| 905 | 905 | } |
| 906 | 906 | ?> |
| 907 | 907 | </div> |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | |
| 918 | 918 | if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) { |
| 919 | 919 | $template = $default_template; |
| 920 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
| 920 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
| 921 | 921 | if (isset ($_REQUEST['newtemplate'])) { |
| 922 | 922 | $template = $_REQUEST['newtemplate']; |
| 923 | 923 | } else { |
@@ -945,10 +945,10 @@ discard block |
||
| 945 | 945 | ); |
| 946 | 946 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
| 947 | 947 | if ($group_tvs) { |
| 948 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
| 948 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
| 949 | 949 | $from .= ' |
| 950 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
| 951 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
| 950 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
| 951 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
| 952 | 952 | } |
| 953 | 953 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
| 954 | 954 | $rs = $modx->db->select($field, $from, $where, $sort); |
@@ -957,37 +957,37 @@ discard block |
||
| 957 | 957 | <!-- Template Variables -->' . "\n"; |
| 958 | 958 | if (!$group_tvs) { |
| 959 | 959 | $templateVariables .= ' |
| 960 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
| 960 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
| 961 | 961 | <div class="sectionBody tmplvars"> |
| 962 | 962 | <table>'; |
| 963 | 963 | } else if ($group_tvs == 2) { |
| 964 | 964 | $templateVariables .= ' |
| 965 | 965 | <div class="tab-section"> |
| 966 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
| 966 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
| 967 | 967 | <div class="tab-pane" id="paneTemplateVariables"> |
| 968 | 968 | <script type="text/javascript"> |
| 969 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
| 969 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
| 970 | 970 | </script>'; |
| 971 | 971 | } else if ($group_tvs == 3) { |
| 972 | 972 | $templateVariables .= ' |
| 973 | 973 | <div id="templateVariables" class="tab-page tmplvars"> |
| 974 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
| 974 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
| 975 | 975 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
| 976 | 976 | } else if ($group_tvs == 4) { |
| 977 | 977 | $templateVariables .= ' |
| 978 | 978 | <div id="templateVariables" class="tab-page tmplvars"> |
| 979 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
| 979 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
| 980 | 980 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
| 981 | 981 | |
| 982 | 982 | <div class="tab-pane" id="paneTemplateVariables"> |
| 983 | 983 | <script type="text/javascript"> |
| 984 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
| 984 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
| 985 | 985 | </script>'; |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | $tvsArray = $modx->db->makeArray($rs, 'name'); |
| 989 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php'); |
|
| 990 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
| 989 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php'); |
|
| 990 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
| 991 | 991 | $i = 0; |
| 992 | 992 | $tab = ''; |
| 993 | 993 | foreach ($tvsArray as $row) { |
@@ -995,8 +995,8 @@ discard block |
||
| 995 | 995 | if ($group_tvs == 1 || $group_tvs == 3) { |
| 996 | 996 | if ($i === 0) { |
| 997 | 997 | $templateVariables .= ' |
| 998 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
| 999 | - <div class="tab-header">' . $row['category'] . '</div> |
|
| 998 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
| 999 | + <div class="tab-header">' . $row['category'].'</div> |
|
| 1000 | 1000 | <div class="tab-body tmplvars"> |
| 1001 | 1001 | <table>' . "\n"; |
| 1002 | 1002 | } else { |
@@ -1005,17 +1005,17 @@ discard block |
||
| 1005 | 1005 | </div> |
| 1006 | 1006 | </div> |
| 1007 | 1007 | |
| 1008 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
| 1009 | - <div class="tab-header">' . $row['category'] . '</div> |
|
| 1008 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
| 1009 | + <div class="tab-header">' . $row['category'].'</div> |
|
| 1010 | 1010 | <div class="tab-body tmplvars"> |
| 1011 | 1011 | <table>'; |
| 1012 | 1012 | } |
| 1013 | 1013 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
| 1014 | 1014 | if ($i === 0) { |
| 1015 | 1015 | $templateVariables .= ' |
| 1016 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1017 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1018 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1016 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1017 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1018 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1019 | 1019 | |
| 1020 | 1020 | <div class="tab-body tmplvars"> |
| 1021 | 1021 | <table>'; |
@@ -1025,9 +1025,9 @@ discard block |
||
| 1025 | 1025 | </div> |
| 1026 | 1026 | </div> |
| 1027 | 1027 | |
| 1028 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1029 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1030 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1028 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1029 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1030 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1031 | 1031 | |
| 1032 | 1032 | <div class="tab-body tmplvars"> |
| 1033 | 1033 | <table>'; |
@@ -1035,18 +1035,18 @@ discard block |
||
| 1035 | 1035 | } else if ($group_tvs == 5) { |
| 1036 | 1036 | if ($i === 0) { |
| 1037 | 1037 | $templateVariables .= ' |
| 1038 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1039 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1040 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1038 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1039 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1040 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1041 | 1041 | <table>'; |
| 1042 | 1042 | } else { |
| 1043 | 1043 | $templateVariables .= ' |
| 1044 | 1044 | </table> |
| 1045 | 1045 | </div> |
| 1046 | 1046 | |
| 1047 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1048 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1049 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1047 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1048 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1049 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1050 | 1050 | |
| 1051 | 1051 | <table>'; |
| 1052 | 1052 | } |
@@ -1064,8 +1064,8 @@ discard block |
||
| 1064 | 1064 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
| 1065 | 1065 | }; |
| 1066 | 1066 | // Add richtext editor to the list |
| 1067 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
| 1068 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
| 1067 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
| 1068 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
| 1069 | 1069 | } |
| 1070 | 1070 | // splitter |
| 1071 | 1071 | if ($group_tvs) { |
@@ -1079,24 +1079,24 @@ discard block |
||
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | // post back value |
| 1082 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
| 1083 | - if (is_array($_POST['tv' . $row['id']])) { |
|
| 1084 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
| 1082 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
| 1083 | + if (is_array($_POST['tv'.$row['id']])) { |
|
| 1084 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
| 1085 | 1085 | } else { |
| 1086 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
| 1086 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
| 1087 | 1087 | } |
| 1088 | 1088 | } else { |
| 1089 | 1089 | $tvPBV = $row['value']; |
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
| 1093 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
| 1094 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
| 1092 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
| 1093 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
| 1094 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
| 1095 | 1095 | |
| 1096 | 1096 | $templateVariables .= ' |
| 1097 | 1097 | <tr> |
| 1098 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
| 1099 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
| 1098 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
| 1099 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
| 1100 | 1100 | </tr>'; |
| 1101 | 1101 | |
| 1102 | 1102 | $tab = $row['category_id']; |
@@ -1190,7 +1190,7 @@ discard block |
||
| 1190 | 1190 | |
| 1191 | 1191 | <?php |
| 1192 | 1192 | |
| 1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1193 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1194 | 1194 | ?> |
| 1195 | 1195 | <tr> |
| 1196 | 1196 | <td> |
@@ -1213,13 +1213,13 @@ discard block |
||
| 1213 | 1213 | <td> |
| 1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1215 | 1215 | <?php |
| 1216 | - if(!$content['contentType']) { |
|
| 1216 | + if (!$content['contentType']) { |
|
| 1217 | 1217 | $content['contentType'] = 'text/html'; |
| 1218 | 1218 | } |
| 1219 | 1219 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
| 1220 | 1220 | $ct = explode(",", $custom_contenttype); |
| 1221 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1221 | + for ($i = 0; $i < count($ct); $i++) { |
|
| 1222 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
| 1223 | 1223 | } |
| 1224 | 1224 | ?> |
| 1225 | 1225 | </select> |
@@ -1245,7 +1245,7 @@ discard block |
||
| 1245 | 1245 | </tr> |
| 1246 | 1246 | <?php |
| 1247 | 1247 | } else { |
| 1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1248 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1249 | 1249 | // non-admin managers creating or editing a document resource |
| 1250 | 1250 | ?> |
| 1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1345,15 +1345,15 @@ discard block |
||
| 1345 | 1345 | <?php |
| 1346 | 1346 | /******************************* |
| 1347 | 1347 | * Document Access Permissions */ |
| 1348 | - if($use_udperms == 1) { |
|
| 1348 | + if ($use_udperms == 1) { |
|
| 1349 | 1349 | $groupsarray = array(); |
| 1350 | 1350 | $sql = ''; |
| 1351 | 1351 | |
| 1352 | 1352 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
| 1353 | - if($documentId > 0) { |
|
| 1353 | + if ($documentId > 0) { |
|
| 1354 | 1354 | // Load up, the permissions from the parent (if new document) or existing document |
| 1355 | 1355 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
| 1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1356 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
| 1357 | 1357 | |
| 1358 | 1358 | // Load up the current permissions and names |
| 1359 | 1359 | $vs = array( |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | } |
| 1370 | 1370 | |
| 1371 | 1371 | // retain selected doc groups between post |
| 1372 | - if(isset($_POST['docgroups'])) { |
|
| 1372 | + if (isset($_POST['docgroups'])) { |
|
| 1373 | 1373 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
| 1374 | 1374 | } |
| 1375 | 1375 | |
@@ -1388,26 +1388,26 @@ discard block |
||
| 1388 | 1388 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
| 1389 | 1389 | |
| 1390 | 1390 | // Loop through the permissions list |
| 1391 | - while($row = $modx->db->getRow($rs)) { |
|
| 1391 | + while ($row = $modx->db->getRow($rs)) { |
|
| 1392 | 1392 | |
| 1393 | 1393 | // Create an inputValue pair (group ID and group link (if it exists)) |
| 1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1395 | - $inputId = 'group-' . $row['id']; |
|
| 1394 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1395 | + $inputId = 'group-'.$row['id']; |
|
| 1396 | 1396 | |
| 1397 | 1397 | $checked = in_array($inputValue, $groupsarray); |
| 1398 | - if($checked) { |
|
| 1398 | + if ($checked) { |
|
| 1399 | 1399 | $notPublic = true; |
| 1400 | 1400 | } // Mark as private access (either web or manager) |
| 1401 | 1401 | |
| 1402 | 1402 | // Skip the access permission if the user doesn't have access... |
| 1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1403 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1404 | 1404 | continue; |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | 1407 | // Setup attributes for this Input box |
| 1408 | 1408 | $inputAttributes['id'] = $inputId; |
| 1409 | 1409 | $inputAttributes['value'] = $inputValue; |
| 1410 | - if($checked) { |
|
| 1410 | + if ($checked) { |
|
| 1411 | 1411 | $inputAttributes['checked'] = 'checked'; |
| 1412 | 1412 | } else { |
| 1413 | 1413 | unset($inputAttributes['checked']); |
@@ -1415,10 +1415,10 @@ discard block |
||
| 1415 | 1415 | |
| 1416 | 1416 | // Create attribute string list |
| 1417 | 1417 | $inputString = array(); |
| 1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1418 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
| 1419 | 1419 | |
| 1420 | 1420 | // Make the <input> HTML |
| 1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1421 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
| 1422 | 1422 | |
| 1423 | 1423 | // does user have this permission? |
| 1424 | 1424 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1429,23 +1429,23 @@ discard block |
||
| 1429 | 1429 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
| 1430 | 1430 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
| 1431 | 1431 | $count = $modx->db->getValue($rsp); |
| 1432 | - if($count > 0) { |
|
| 1432 | + if ($count > 0) { |
|
| 1433 | 1433 | ++$permissions_yes; |
| 1434 | 1434 | } else { |
| 1435 | 1435 | ++$permissions_no; |
| 1436 | 1436 | } |
| 1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1437 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
| 1438 | 1438 | } |
| 1439 | 1439 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
| 1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1440 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1441 | 1441 | $permissions = array(); |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | 1444 | // See if the Access Permissions section is worth displaying... |
| 1445 | - if(!empty($permissions)) { |
|
| 1445 | + if (!empty($permissions)) { |
|
| 1446 | 1446 | // Add the "All Document Groups" item if we have rights in both contexts |
| 1447 | - if($isManager && $isWeb) { |
|
| 1448 | - 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>'); |
|
| 1447 | + if ($isManager && $isWeb) { |
|
| 1448 | + 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>'); |
|
| 1449 | 1449 | } |
| 1450 | 1450 | // Output the permissions list... |
| 1451 | 1451 | ?> |
@@ -1478,12 +1478,12 @@ discard block |
||
| 1478 | 1478 | </script> |
| 1479 | 1479 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
| 1480 | 1480 | <ul> |
| 1481 | - <?= implode("\n", $permissions) . "\n" ?> |
|
| 1481 | + <?= implode("\n", $permissions)."\n" ?> |
|
| 1482 | 1482 | </ul> |
| 1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1484 | 1484 | <?php |
| 1485 | 1485 | } // !empty($permissions) |
| 1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1486 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1487 | 1487 | ?> |
| 1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1489 | 1489 | <?php |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | 'template' => $content['template'] |
| 1504 | 1504 | )); |
| 1505 | 1505 | |
| 1506 | - if(is_array($evtOut)) { |
|
| 1506 | + if (is_array($evtOut)) { |
|
| 1507 | 1507 | echo implode('', $evtOut); |
| 1508 | 1508 | } |
| 1509 | 1509 | ?> |
@@ -1516,16 +1516,16 @@ discard block |
||
| 1516 | 1516 | storeCurTemplate(); |
| 1517 | 1517 | </script> |
| 1518 | 1518 | <?php |
| 1519 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
| 1520 | - if(is_array($richtexteditorIds)) { |
|
| 1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1519 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
| 1520 | + if (is_array($richtexteditorIds)) { |
|
| 1521 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
| 1522 | 1522 | // invoke OnRichTextEditorInit event |
| 1523 | 1523 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
| 1524 | 1524 | 'editor' => $editor, |
| 1525 | 1525 | 'elements' => $elements, |
| 1526 | 1526 | 'options' => $richtexteditorOptions[$editor] |
| 1527 | 1527 | )); |
| 1528 | - if(is_array($evtOut)) { |
|
| 1528 | + if (is_array($evtOut)) { |
|
| 1529 | 1529 | echo implode('', $evtOut); |
| 1530 | 1530 | } |
| 1531 | 1531 | } |
@@ -1535,37 +1535,37 @@ discard block |
||
| 1535 | 1535 | /** |
| 1536 | 1536 | * @return string |
| 1537 | 1537 | */ |
| 1538 | -function getDefaultTemplate() { |
|
| 1538 | +function getDefaultTemplate(){ |
|
| 1539 | 1539 | $modx = DocumentParser::getInstance(); |
| 1540 | 1540 | |
| 1541 | 1541 | $default_template = ''; |
| 1542 | - switch($modx->config['auto_template_logic']) { |
|
| 1542 | + switch ($modx->config['auto_template_logic']) { |
|
| 1543 | 1543 | case 'sibling': |
| 1544 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1544 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1545 | 1545 | $site_start = $modx->config['site_start']; |
| 1546 | 1546 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
| 1547 | 1547 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
| 1548 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1548 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1549 | 1549 | $default_template = $sibl[0]['template']; |
| 1550 | 1550 | } |
| 1551 | 1551 | } else { |
| 1552 | 1552 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
| 1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1553 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1554 | 1554 | $default_template = $sibl[0]['template']; |
| 1555 | 1555 | } else { |
| 1556 | 1556 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
| 1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1557 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1558 | 1558 | $default_template = $sibl[0]['template']; |
| 1559 | 1559 | } |
| 1560 | 1560 | } |
| 1561 | 1561 | } |
| 1562 | - if(isset($default_template)) { |
|
| 1562 | + if (isset($default_template)) { |
|
| 1563 | 1563 | break; |
| 1564 | 1564 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
| 1565 | 1565 | case 'parent': |
| 1566 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1566 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1567 | 1567 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
| 1568 | - if(isset($parent['template'])) { |
|
| 1568 | + if (isset($parent['template'])) { |
|
| 1569 | 1569 | $default_template = $parent['template']; |
| 1570 | 1570 | } |
| 1571 | 1571 | } |
@@ -478,7 +478,8 @@ discard block |
||
| 478 | 478 | return s; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 481 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
| 482 | +// Web Link specific ?> |
|
| 482 | 483 | var lastImageCtrl; |
| 483 | 484 | var lastFileCtrl; |
| 484 | 485 | |
@@ -694,7 +695,8 @@ discard block |
||
| 694 | 695 | </td> |
| 695 | 696 | </tr> |
| 696 | 697 | |
| 697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 698 | + <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
| 699 | +// Web Link specific ?> |
|
| 698 | 700 | |
| 699 | 701 | <tr> |
| 700 | 702 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1353,7 +1355,9 @@ discard block |
||
| 1353 | 1355 | if($documentId > 0) { |
| 1354 | 1356 | // Load up, the permissions from the parent (if new document) or existing document |
| 1355 | 1357 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
| 1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1358 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
| 1359 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1360 | + } |
|
| 1357 | 1361 | |
| 1358 | 1362 | // Load up the current permissions and names |
| 1359 | 1363 | $vs = array( |
@@ -1415,7 +1419,9 @@ discard block |
||
| 1415 | 1419 | |
| 1416 | 1420 | // Create attribute string list |
| 1417 | 1421 | $inputString = array(); |
| 1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1422 | + foreach($inputAttributes as $k => $v) { |
|
| 1423 | + $inputString[] = $k . '="' . $v . '"'; |
|
| 1424 | + } |
|
| 1419 | 1425 | |
| 1420 | 1426 | // Make the <input> HTML |
| 1421 | 1427 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
| 1535 | 1541 | /** |
| 1536 | 1542 | * @return string |
| 1537 | 1543 | */ |
| 1538 | -function getDefaultTemplate() { |
|
| 1544 | +function getDefaultTemplate() |
|
| 1545 | +{ |
|
| 1539 | 1546 | $modx = DocumentParser::getInstance(); |
| 1540 | 1547 | |
| 1541 | 1548 | $default_template = ''; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $autoloader = realpath(__DIR__.'/../vendor/autoload.php'); |
| 52 | 52 | if (file_exists($autoloader) && is_readable($autoloader)) { |
| 53 | - include_once($autoloader); |
|
| 53 | + include_once($autoloader); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // get start time |
@@ -65,22 +65,22 @@ discard block |
||
| 65 | 65 | $site_hostnames_path = $base_path . 'assets/cache/siteHostnames.php'; |
| 66 | 66 | if(is_file($site_hostnames_path)) include_once($site_hostnames_path); |
| 67 | 67 | if(!defined('MGR_DIR') || MGR_DIR!==$mgr_dir) { |
| 68 | - $src = "<?php\n"; |
|
| 69 | - $src .= "define('MGR_DIR', '{$mgr_dir}');\n"; |
|
| 70 | - $rs = file_put_contents($site_mgr_path,$src); |
|
| 71 | - if(!$rs) { |
|
| 72 | - echo 'siteManager.php write error'; |
|
| 73 | - exit; |
|
| 74 | - } |
|
| 75 | - sleep(1); |
|
| 76 | - header('Location:' . $_SERVER['REQUEST_URI']); |
|
| 77 | - exit; |
|
| 68 | + $src = "<?php\n"; |
|
| 69 | + $src .= "define('MGR_DIR', '{$mgr_dir}');\n"; |
|
| 70 | + $rs = file_put_contents($site_mgr_path,$src); |
|
| 71 | + if(!$rs) { |
|
| 72 | + echo 'siteManager.php write error'; |
|
| 73 | + exit; |
|
| 74 | + } |
|
| 75 | + sleep(1); |
|
| 76 | + header('Location:' . $_SERVER['REQUEST_URI']); |
|
| 77 | + exit; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // we use this to make sure files are accessed through |
| 81 | 81 | // the manager instead of seperately. |
| 82 | 82 | if ( ! defined('IN_MANAGER_MODE')) { |
| 83 | - define('IN_MANAGER_MODE', true); |
|
| 83 | + define('IN_MANAGER_MODE', true); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // harden it |
@@ -101,16 +101,16 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | // check PHP version. EVO is compatible with php 5 (5.0.0+) |
| 103 | 103 | $php_ver_comp = version_compare(phpversion(), "5.0.0"); |
| 104 | - // -1 if left is less, 0 if equal, +1 if left is higher |
|
| 104 | + // -1 if left is less, 0 if equal, +1 if left is higher |
|
| 105 | 105 | if($php_ver_comp < 0) { |
| 106 | - echo sprintf($_lang['php_version_check'], phpversion()); |
|
| 107 | - exit; |
|
| 106 | + echo sprintf($_lang['php_version_check'], phpversion()); |
|
| 107 | + exit; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // check if iconv is installed |
| 111 | 111 | if(!function_exists('iconv')) { |
| 112 | - echo $_lang['iconv_not_available']; |
|
| 113 | - exit; |
|
| 112 | + echo $_lang['iconv_not_available']; |
|
| 113 | + exit; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // set some runtime options |
@@ -123,15 +123,15 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | // set the document_root :| |
| 125 | 125 | if(!isset($_SERVER['DOCUMENT_ROOT']) || empty($_SERVER['DOCUMENT_ROOT'])) { |
| 126 | - $_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/"; |
|
| 126 | + $_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/"; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // include_once config file |
| 130 | 130 | $config_filename = "./includes/config.inc.php"; |
| 131 | 131 | if (!file_exists($config_filename)) { |
| 132 | - echo "<h3>Unable to load configuration settings</h3>"; |
|
| 133 | - echo "Please run the EVO <a href='../install'>install utility</a>"; |
|
| 134 | - exit; |
|
| 132 | + echo "<h3>Unable to load configuration settings</h3>"; |
|
| 133 | + echo "Please run the EVO <a href='../install'>install utility</a>"; |
|
| 134 | + exit; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // include the database configuration file |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | // initiate the content manager class |
| 141 | 141 | if (isset($coreClass) && class_exists($coreClass)) { |
| 142 | - $modx = new $coreClass; |
|
| 142 | + $modx = new $coreClass; |
|
| 143 | 143 | } |
| 144 | 144 | if (!isset($modx) || !($modx instanceof DocumentParser)) { |
| 145 | - include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
| 146 | - $modx = DocumentParser::getInstance(); |
|
| 145 | + include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
| 146 | + $modx = DocumentParser::getInstance(); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $modx->loadExtension("ManagerAPI"); |
@@ -166,25 +166,25 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | // now include_once different language file as english |
| 168 | 168 | if(!isset($manager_language) || !file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) { |
| 169 | - $manager_language = "english"; // if not set, get the english language file. |
|
| 169 | + $manager_language = "english"; // if not set, get the english language file. |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // $length_eng_lang = count($_lang); // Not used for now, required for difference-check with other languages than english (i.e. inside installer) |
| 173 | 173 | |
| 174 | 174 | if($manager_language!="english" && file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) { |
| 175 | - include_once "lang/".$manager_language.".inc.php"; |
|
| 175 | + include_once "lang/".$manager_language.".inc.php"; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // allow custom language overrides not altered by future EVO-updates |
| 179 | 179 | if(file_exists(MODX_MANAGER_PATH."includes/lang/override/".$manager_language.".inc.php")) { |
| 180 | - include_once "lang/override/".$manager_language.".inc.php"; |
|
| 180 | + include_once "lang/override/".$manager_language.".inc.php"; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $s = array('[+MGR_DIR+]'); |
| 184 | 184 | $r = array(MGR_DIR); |
| 185 | 185 | foreach($_lang as $k=>$v) |
| 186 | 186 | { |
| 187 | - if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v); |
|
| 187 | + if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // send the charset header |
@@ -199,19 +199,19 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | // double check the session |
| 201 | 201 | if(!isset($_SESSION['mgrValidated'])){ |
| 202 | - echo "Not Logged In!"; |
|
| 203 | - exit; |
|
| 202 | + echo "Not Logged In!"; |
|
| 203 | + exit; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // include_once the style variables file |
| 207 | 207 | if(isset($manager_theme) && !isset($_style)) { |
| 208 | - $_style = array(); |
|
| 209 | - include_once "media/style/".$manager_theme."/style.php"; |
|
| 208 | + $_style = array(); |
|
| 209 | + include_once "media/style/".$manager_theme."/style.php"; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // check if user is allowed to access manager interface |
| 213 | 213 | if(isset($allow_manager_access) && $allow_manager_access==0) { |
| 214 | - include_once "manager.lockout.inc.php"; |
|
| 214 | + include_once "manager.lockout.inc.php"; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // Initialize System Alert Message Queque |
@@ -220,13 +220,13 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // first we check to see if this is a frameset request |
| 222 | 222 | if(!isset($_POST['a']) && !isset($_GET['a']) && !isset($_POST['updateMsgCount'])) { |
| 223 | - // this looks to be a top-level frameset request, so let's serve up a frameset |
|
| 224 | - if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) { |
|
| 225 | - include_once "media/style/".$manager_theme."/frames/1.php"; |
|
| 226 | - }else{ |
|
| 227 | - include_once "frames/1.php"; |
|
| 228 | - } |
|
| 229 | - exit; |
|
| 223 | + // this looks to be a top-level frameset request, so let's serve up a frameset |
|
| 224 | + if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) { |
|
| 225 | + include_once "media/style/".$manager_theme."/frames/1.php"; |
|
| 226 | + }else{ |
|
| 227 | + include_once "frames/1.php"; |
|
| 228 | + } |
|
| 229 | + exit; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // OK, let's retrieve the action directive from the request |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | else $action = null; |
| 238 | 238 | |
| 239 | 239 | if (isset($_POST['updateMsgCount']) && $modx->hasPermission('messages')) { |
| 240 | - include_once 'messageCount.inc.php'; |
|
| 240 | + include_once 'messageCount.inc.php'; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // save page to manager object |
@@ -245,19 +245,19 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | // attempt to foil some simple types of CSRF attacks |
| 247 | 247 | if (isset($modx->config['validate_referer']) && (int)$modx->config['validate_referer']) { |
| 248 | - if (isset($_SERVER['HTTP_REFERER'])) { |
|
| 249 | - $referer = $_SERVER['HTTP_REFERER']; |
|
| 250 | - |
|
| 251 | - if (!empty($referer)) { |
|
| 252 | - if (!preg_match('/^'.preg_quote(MODX_SITE_URL, '/').'/i', $referer)) { |
|
| 253 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected from referer: {$referer}.", "index.php"); |
|
| 254 | - } |
|
| 255 | - } else { |
|
| 256 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the client.", "index.php"); |
|
| 257 | - } |
|
| 258 | - } else { |
|
| 259 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the server.", "index.php"); |
|
| 260 | - } |
|
| 248 | + if (isset($_SERVER['HTTP_REFERER'])) { |
|
| 249 | + $referer = $_SERVER['HTTP_REFERER']; |
|
| 250 | + |
|
| 251 | + if (!empty($referer)) { |
|
| 252 | + if (!preg_match('/^'.preg_quote(MODX_SITE_URL, '/').'/i', $referer)) { |
|
| 253 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected from referer: {$referer}.", "index.php"); |
|
| 254 | + } |
|
| 255 | + } else { |
|
| 256 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the client.", "index.php"); |
|
| 257 | + } |
|
| 258 | + } else { |
|
| 259 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the server.", "index.php"); |
|
| 260 | + } |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // invoke OnManagerPageInit event |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | // return element filepath |
| 267 | 267 | function includeFileProcessor ($filepath,$manager_theme) { |
| 268 | - $element = ""; |
|
| 269 | - if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) { |
|
| 270 | - $element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath; |
|
| 271 | - }else{ |
|
| 272 | - $element = $filepath; |
|
| 273 | - } |
|
| 274 | - return $element; |
|
| 268 | + $element = ""; |
|
| 269 | + if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) { |
|
| 270 | + $element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath; |
|
| 271 | + }else{ |
|
| 272 | + $element = $filepath; |
|
| 273 | + } |
|
| 274 | + return $element; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | // Now we decide what to do according to the action request. This is a BIG list :) |
@@ -279,714 +279,714 @@ discard block |
||
| 279 | 279 | /********************************************************************/ |
| 280 | 280 | /* frame management - show the requested frame */ |
| 281 | 281 | /********************************************************************/ |
| 282 | - case 1 : |
|
| 283 | - // get the requested frame |
|
| 284 | - $frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']); |
|
| 285 | - if($frame>9) { |
|
| 286 | - $enable_debug=false; // this is to stop the debug thingy being attached to the framesets |
|
| 287 | - } |
|
| 288 | - include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme)); |
|
| 289 | - break; |
|
| 282 | + case 1 : |
|
| 283 | + // get the requested frame |
|
| 284 | + $frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']); |
|
| 285 | + if($frame>9) { |
|
| 286 | + $enable_debug=false; // this is to stop the debug thingy being attached to the framesets |
|
| 287 | + } |
|
| 288 | + include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme)); |
|
| 289 | + break; |
|
| 290 | 290 | /********************************************************************/ |
| 291 | 291 | /* show the homepage */ |
| 292 | 292 | /********************************************************************/ |
| 293 | - case 2: |
|
| 294 | - // get the home page |
|
| 295 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 296 | - include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme)); |
|
| 297 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 298 | - break; |
|
| 293 | + case 2: |
|
| 294 | + // get the home page |
|
| 295 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 296 | + include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme)); |
|
| 297 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 298 | + break; |
|
| 299 | 299 | /********************************************************************/ |
| 300 | 300 | /* document data */ |
| 301 | 301 | /********************************************************************/ |
| 302 | - case 3: |
|
| 303 | - // get the page to show document's data |
|
| 304 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 305 | - include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme)); |
|
| 306 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 307 | - break; |
|
| 302 | + case 3: |
|
| 303 | + // get the page to show document's data |
|
| 304 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 305 | + include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme)); |
|
| 306 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 307 | + break; |
|
| 308 | 308 | /********************************************************************/ |
| 309 | 309 | /* content management */ |
| 310 | 310 | /********************************************************************/ |
| 311 | - case 85: |
|
| 312 | - // get the mutate page for adding a folder |
|
| 313 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 314 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 315 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 316 | - break; |
|
| 317 | - case 27: |
|
| 318 | - // get the mutate page for changing content |
|
| 319 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 320 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 321 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 322 | - break; |
|
| 323 | - case 4: |
|
| 324 | - // get the mutate page for adding content |
|
| 325 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 326 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 327 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 328 | - break; |
|
| 329 | - case 5: |
|
| 330 | - // get the save processor |
|
| 331 | - include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme)); |
|
| 332 | - break; |
|
| 333 | - case 6: |
|
| 334 | - // get the delete processor |
|
| 335 | - include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme)); |
|
| 336 | - break; |
|
| 337 | - case 63: |
|
| 338 | - // get the undelete processor |
|
| 339 | - include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme)); |
|
| 340 | - break; |
|
| 341 | - case 51: |
|
| 342 | - // get the move action |
|
| 343 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 344 | - include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme)); |
|
| 345 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 346 | - break; |
|
| 347 | - case 52: |
|
| 348 | - // get the move document processor |
|
| 349 | - include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme)); |
|
| 350 | - break; |
|
| 351 | - case 61: |
|
| 352 | - // get the processor for publishing content |
|
| 353 | - include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme)); |
|
| 354 | - break; |
|
| 355 | - case 62: |
|
| 356 | - // get the processor for publishing content |
|
| 357 | - include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme)); |
|
| 358 | - break; |
|
| 359 | - case 56: |
|
| 360 | - // get the sort menuindex action |
|
| 361 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 362 | - include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme)); |
|
| 363 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 364 | - break; |
|
| 311 | + case 85: |
|
| 312 | + // get the mutate page for adding a folder |
|
| 313 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 314 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 315 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 316 | + break; |
|
| 317 | + case 27: |
|
| 318 | + // get the mutate page for changing content |
|
| 319 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 320 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 321 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 322 | + break; |
|
| 323 | + case 4: |
|
| 324 | + // get the mutate page for adding content |
|
| 325 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 326 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 327 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 328 | + break; |
|
| 329 | + case 5: |
|
| 330 | + // get the save processor |
|
| 331 | + include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme)); |
|
| 332 | + break; |
|
| 333 | + case 6: |
|
| 334 | + // get the delete processor |
|
| 335 | + include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme)); |
|
| 336 | + break; |
|
| 337 | + case 63: |
|
| 338 | + // get the undelete processor |
|
| 339 | + include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme)); |
|
| 340 | + break; |
|
| 341 | + case 51: |
|
| 342 | + // get the move action |
|
| 343 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 344 | + include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme)); |
|
| 345 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 346 | + break; |
|
| 347 | + case 52: |
|
| 348 | + // get the move document processor |
|
| 349 | + include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme)); |
|
| 350 | + break; |
|
| 351 | + case 61: |
|
| 352 | + // get the processor for publishing content |
|
| 353 | + include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme)); |
|
| 354 | + break; |
|
| 355 | + case 62: |
|
| 356 | + // get the processor for publishing content |
|
| 357 | + include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme)); |
|
| 358 | + break; |
|
| 359 | + case 56: |
|
| 360 | + // get the sort menuindex action |
|
| 361 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 362 | + include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme)); |
|
| 363 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 364 | + break; |
|
| 365 | 365 | /********************************************************************/ |
| 366 | 366 | /* show the wait page - gives the tree time to refresh (hopefully) */ |
| 367 | 367 | /********************************************************************/ |
| 368 | - case 7: |
|
| 369 | - // get the wait page (so the tree can reload) |
|
| 370 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 371 | - include_once(includeFileProcessor("actions/wait.static.php",$manager_theme)); |
|
| 372 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 373 | - break; |
|
| 368 | + case 7: |
|
| 369 | + // get the wait page (so the tree can reload) |
|
| 370 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 371 | + include_once(includeFileProcessor("actions/wait.static.php",$manager_theme)); |
|
| 372 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 373 | + break; |
|
| 374 | 374 | /********************************************************************/ |
| 375 | 375 | /* let the user log out */ |
| 376 | 376 | /********************************************************************/ |
| 377 | - case 8: |
|
| 378 | - // get the logout processor |
|
| 379 | - include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme)); |
|
| 380 | - break; |
|
| 377 | + case 8: |
|
| 378 | + // get the logout processor |
|
| 379 | + include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme)); |
|
| 380 | + break; |
|
| 381 | 381 | /********************************************************************/ |
| 382 | 382 | /* user management */ |
| 383 | 383 | /********************************************************************/ |
| 384 | - case 87: |
|
| 385 | - // get the new web user page |
|
| 386 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 387 | - include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
| 388 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 389 | - break; |
|
| 390 | - case 88: |
|
| 391 | - // get the edit web user page |
|
| 392 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 393 | - include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
| 394 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 395 | - break; |
|
| 396 | - case 89: |
|
| 397 | - // get the save web user processor |
|
| 398 | - include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme)); |
|
| 399 | - break; |
|
| 400 | - case 90: |
|
| 401 | - // get the delete web user page |
|
| 402 | - include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme)); |
|
| 403 | - break; |
|
| 404 | - case 11: |
|
| 405 | - // get the new user page |
|
| 406 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 407 | - include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
| 408 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 409 | - break; |
|
| 410 | - case 12: |
|
| 411 | - // get the edit user page |
|
| 412 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 413 | - include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
| 414 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 415 | - break; |
|
| 416 | - case 32: |
|
| 417 | - // get the save user processor |
|
| 418 | - include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme)); |
|
| 419 | - break; |
|
| 420 | - case 28: |
|
| 421 | - // get the change password page |
|
| 422 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 423 | - include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme)); |
|
| 424 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 425 | - break; |
|
| 426 | - case 34: |
|
| 427 | - // get the save new password page |
|
| 428 | - include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme)); |
|
| 429 | - break; |
|
| 430 | - case 33: |
|
| 431 | - // get the delete user page |
|
| 432 | - include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme)); |
|
| 433 | - break; |
|
| 384 | + case 87: |
|
| 385 | + // get the new web user page |
|
| 386 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 387 | + include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
| 388 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 389 | + break; |
|
| 390 | + case 88: |
|
| 391 | + // get the edit web user page |
|
| 392 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 393 | + include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
| 394 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 395 | + break; |
|
| 396 | + case 89: |
|
| 397 | + // get the save web user processor |
|
| 398 | + include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme)); |
|
| 399 | + break; |
|
| 400 | + case 90: |
|
| 401 | + // get the delete web user page |
|
| 402 | + include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme)); |
|
| 403 | + break; |
|
| 404 | + case 11: |
|
| 405 | + // get the new user page |
|
| 406 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 407 | + include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
| 408 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 409 | + break; |
|
| 410 | + case 12: |
|
| 411 | + // get the edit user page |
|
| 412 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 413 | + include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
| 414 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 415 | + break; |
|
| 416 | + case 32: |
|
| 417 | + // get the save user processor |
|
| 418 | + include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme)); |
|
| 419 | + break; |
|
| 420 | + case 28: |
|
| 421 | + // get the change password page |
|
| 422 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 423 | + include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme)); |
|
| 424 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 425 | + break; |
|
| 426 | + case 34: |
|
| 427 | + // get the save new password page |
|
| 428 | + include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme)); |
|
| 429 | + break; |
|
| 430 | + case 33: |
|
| 431 | + // get the delete user page |
|
| 432 | + include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme)); |
|
| 433 | + break; |
|
| 434 | 434 | /********************************************************************/ |
| 435 | 435 | /* role management */ |
| 436 | 436 | /********************************************************************/ |
| 437 | - case 38: |
|
| 438 | - // get the new role page |
|
| 439 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 440 | - include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
| 441 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 442 | - break; |
|
| 443 | - case 35: |
|
| 444 | - // get the edit role page |
|
| 445 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 446 | - include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
| 447 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 448 | - break; |
|
| 449 | - case 36: |
|
| 450 | - // get the save role page |
|
| 451 | - include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme)); |
|
| 452 | - break; |
|
| 453 | - case 37: |
|
| 454 | - // get the delete role page |
|
| 455 | - include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme)); |
|
| 456 | - break; |
|
| 437 | + case 38: |
|
| 438 | + // get the new role page |
|
| 439 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 440 | + include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
| 441 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 442 | + break; |
|
| 443 | + case 35: |
|
| 444 | + // get the edit role page |
|
| 445 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 446 | + include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
| 447 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 448 | + break; |
|
| 449 | + case 36: |
|
| 450 | + // get the save role page |
|
| 451 | + include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme)); |
|
| 452 | + break; |
|
| 453 | + case 37: |
|
| 454 | + // get the delete role page |
|
| 455 | + include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme)); |
|
| 456 | + break; |
|
| 457 | 457 | /********************************************************************/ |
| 458 | 458 | /* category management */ |
| 459 | 459 | /********************************************************************/ |
| 460 | - case 120: |
|
| 461 | - // get the edit category page |
|
| 462 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 463 | - include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
| 464 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 465 | - break; |
|
| 466 | - case 121: |
|
| 467 | - // for ajax-requests |
|
| 468 | - include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
| 469 | - break; |
|
| 460 | + case 120: |
|
| 461 | + // get the edit category page |
|
| 462 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 463 | + include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
| 464 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 465 | + break; |
|
| 466 | + case 121: |
|
| 467 | + // for ajax-requests |
|
| 468 | + include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
| 469 | + break; |
|
| 470 | 470 | /********************************************************************/ |
| 471 | 471 | /* template management */ |
| 472 | 472 | /********************************************************************/ |
| 473 | - case 16: |
|
| 474 | - // get the edit template action |
|
| 475 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 476 | - include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
| 477 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 478 | - break; |
|
| 479 | - case 19: |
|
| 480 | - // get the new template action |
|
| 481 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 482 | - include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
| 483 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 484 | - break; |
|
| 485 | - case 20: |
|
| 486 | - // get the save processor |
|
| 487 | - include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme)); |
|
| 488 | - break; |
|
| 489 | - case 21: |
|
| 490 | - // get the delete processor |
|
| 491 | - include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme)); |
|
| 492 | - break; |
|
| 493 | - case 96: |
|
| 494 | - // get the duplicate template processor |
|
| 495 | - include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme)); |
|
| 496 | - break; |
|
| 497 | - case 117: |
|
| 498 | - // change the tv rank for selected template |
|
| 499 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 500 | - include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme)); |
|
| 501 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 502 | - break; |
|
| 473 | + case 16: |
|
| 474 | + // get the edit template action |
|
| 475 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 476 | + include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
| 477 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 478 | + break; |
|
| 479 | + case 19: |
|
| 480 | + // get the new template action |
|
| 481 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 482 | + include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
| 483 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 484 | + break; |
|
| 485 | + case 20: |
|
| 486 | + // get the save processor |
|
| 487 | + include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme)); |
|
| 488 | + break; |
|
| 489 | + case 21: |
|
| 490 | + // get the delete processor |
|
| 491 | + include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme)); |
|
| 492 | + break; |
|
| 493 | + case 96: |
|
| 494 | + // get the duplicate template processor |
|
| 495 | + include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme)); |
|
| 496 | + break; |
|
| 497 | + case 117: |
|
| 498 | + // change the tv rank for selected template |
|
| 499 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 500 | + include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme)); |
|
| 501 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 502 | + break; |
|
| 503 | 503 | /********************************************************************/ |
| 504 | 504 | /* snippet management */ |
| 505 | 505 | /********************************************************************/ |
| 506 | - case 22: |
|
| 507 | - // get the edit snippet action |
|
| 508 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 509 | - include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
| 510 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 511 | - break; |
|
| 512 | - case 23: |
|
| 513 | - // get the new snippet action |
|
| 514 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 515 | - include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
| 516 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 517 | - break; |
|
| 518 | - case 24: |
|
| 519 | - // get the save processor |
|
| 520 | - include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme)); |
|
| 521 | - break; |
|
| 522 | - case 25: |
|
| 523 | - // get the delete processor |
|
| 524 | - include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme)); |
|
| 525 | - break; |
|
| 526 | - case 98: |
|
| 527 | - // get the duplicate processor |
|
| 528 | - include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme)); |
|
| 529 | - break; |
|
| 506 | + case 22: |
|
| 507 | + // get the edit snippet action |
|
| 508 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 509 | + include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
| 510 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 511 | + break; |
|
| 512 | + case 23: |
|
| 513 | + // get the new snippet action |
|
| 514 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 515 | + include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
| 516 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 517 | + break; |
|
| 518 | + case 24: |
|
| 519 | + // get the save processor |
|
| 520 | + include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme)); |
|
| 521 | + break; |
|
| 522 | + case 25: |
|
| 523 | + // get the delete processor |
|
| 524 | + include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme)); |
|
| 525 | + break; |
|
| 526 | + case 98: |
|
| 527 | + // get the duplicate processor |
|
| 528 | + include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme)); |
|
| 529 | + break; |
|
| 530 | 530 | /********************************************************************/ |
| 531 | 531 | /* htmlsnippet management */ |
| 532 | 532 | /********************************************************************/ |
| 533 | - case 78: |
|
| 534 | - // get the edit snippet action |
|
| 535 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 536 | - include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
| 537 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 538 | - break; |
|
| 539 | - case 77: |
|
| 540 | - // get the new snippet action |
|
| 541 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 542 | - include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
| 543 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 544 | - break; |
|
| 545 | - case 79: |
|
| 546 | - // get the save processor |
|
| 547 | - include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme)); |
|
| 548 | - break; |
|
| 549 | - case 80: |
|
| 550 | - // get the delete processor |
|
| 551 | - include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme)); |
|
| 552 | - break; |
|
| 553 | - case 97: |
|
| 554 | - // get the duplicate processor |
|
| 555 | - include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme)); |
|
| 556 | - break; |
|
| 533 | + case 78: |
|
| 534 | + // get the edit snippet action |
|
| 535 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 536 | + include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
| 537 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 538 | + break; |
|
| 539 | + case 77: |
|
| 540 | + // get the new snippet action |
|
| 541 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 542 | + include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
| 543 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 544 | + break; |
|
| 545 | + case 79: |
|
| 546 | + // get the save processor |
|
| 547 | + include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme)); |
|
| 548 | + break; |
|
| 549 | + case 80: |
|
| 550 | + // get the delete processor |
|
| 551 | + include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme)); |
|
| 552 | + break; |
|
| 553 | + case 97: |
|
| 554 | + // get the duplicate processor |
|
| 555 | + include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme)); |
|
| 556 | + break; |
|
| 557 | 557 | /********************************************************************/ |
| 558 | 558 | /* show the credits page */ |
| 559 | 559 | /********************************************************************/ |
| 560 | - case 18: |
|
| 561 | - // get the credits page |
|
| 562 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 563 | - include_once(includeFileProcessor("actions/credits.static.php",$manager_theme)); |
|
| 564 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 565 | - break; |
|
| 560 | + case 18: |
|
| 561 | + // get the credits page |
|
| 562 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 563 | + include_once(includeFileProcessor("actions/credits.static.php",$manager_theme)); |
|
| 564 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 565 | + break; |
|
| 566 | 566 | /********************************************************************/ |
| 567 | 567 | /* empty cache & synchronisation */ |
| 568 | 568 | /********************************************************************/ |
| 569 | - case 26: |
|
| 570 | - // get the cache emptying processor |
|
| 571 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 572 | - include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme)); |
|
| 573 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 574 | - break; |
|
| 569 | + case 26: |
|
| 570 | + // get the cache emptying processor |
|
| 571 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 572 | + include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme)); |
|
| 573 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 574 | + break; |
|
| 575 | 575 | /********************************************************************/ |
| 576 | 576 | /* Module management */ |
| 577 | 577 | /********************************************************************/ |
| 578 | - case 106: |
|
| 579 | - // get module management |
|
| 580 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 581 | - include_once(includeFileProcessor("actions/modules.static.php",$manager_theme)); |
|
| 582 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 583 | - break; |
|
| 584 | - case 107: |
|
| 585 | - // get the new module action |
|
| 586 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 587 | - include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
| 588 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 589 | - break; |
|
| 590 | - case 108: |
|
| 591 | - // get the edit module action |
|
| 592 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 593 | - include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
| 594 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 595 | - break; |
|
| 596 | - case 109: |
|
| 597 | - // get the save processor |
|
| 598 | - include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme)); |
|
| 599 | - break; |
|
| 600 | - case 110: |
|
| 601 | - // get the delete processor |
|
| 602 | - include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme)); |
|
| 603 | - break; |
|
| 604 | - case 111: |
|
| 605 | - // get the duplicate processor |
|
| 606 | - include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme)); |
|
| 607 | - break; |
|
| 608 | - case 112: |
|
| 609 | - // execute/run the module |
|
| 610 | - //include_once "header.inc.php"; |
|
| 611 | - include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme)); |
|
| 612 | - //include_once "footer.inc.php"; |
|
| 613 | - break; |
|
| 614 | - case 113: |
|
| 615 | - // get the module resources (dependencies) action |
|
| 616 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 617 | - include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme)); |
|
| 618 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 619 | - break; |
|
| 578 | + case 106: |
|
| 579 | + // get module management |
|
| 580 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 581 | + include_once(includeFileProcessor("actions/modules.static.php",$manager_theme)); |
|
| 582 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 583 | + break; |
|
| 584 | + case 107: |
|
| 585 | + // get the new module action |
|
| 586 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 587 | + include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
| 588 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 589 | + break; |
|
| 590 | + case 108: |
|
| 591 | + // get the edit module action |
|
| 592 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 593 | + include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
| 594 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 595 | + break; |
|
| 596 | + case 109: |
|
| 597 | + // get the save processor |
|
| 598 | + include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme)); |
|
| 599 | + break; |
|
| 600 | + case 110: |
|
| 601 | + // get the delete processor |
|
| 602 | + include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme)); |
|
| 603 | + break; |
|
| 604 | + case 111: |
|
| 605 | + // get the duplicate processor |
|
| 606 | + include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme)); |
|
| 607 | + break; |
|
| 608 | + case 112: |
|
| 609 | + // execute/run the module |
|
| 610 | + //include_once "header.inc.php"; |
|
| 611 | + include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme)); |
|
| 612 | + //include_once "footer.inc.php"; |
|
| 613 | + break; |
|
| 614 | + case 113: |
|
| 615 | + // get the module resources (dependencies) action |
|
| 616 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 617 | + include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme)); |
|
| 618 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 619 | + break; |
|
| 620 | 620 | /********************************************************************/ |
| 621 | 621 | /* plugin management */ |
| 622 | 622 | /********************************************************************/ |
| 623 | - case 100: |
|
| 624 | - // change the plugin priority |
|
| 625 | - //include_once "header.inc.php"; - in action file |
|
| 626 | - include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme)); |
|
| 627 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 628 | - break; |
|
| 629 | - case 101: |
|
| 630 | - // get the new plugin action |
|
| 631 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 632 | - include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
| 633 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 634 | - break; |
|
| 635 | - case 102: |
|
| 636 | - // get the edit plugin action |
|
| 637 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 638 | - include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
| 639 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 640 | - break; |
|
| 641 | - case 103: |
|
| 642 | - // get the save processor |
|
| 643 | - include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme)); |
|
| 644 | - break; |
|
| 645 | - case 104: |
|
| 646 | - // get the delete processor |
|
| 647 | - include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme)); |
|
| 648 | - break; |
|
| 649 | - case 105: |
|
| 650 | - // get the duplicate processor |
|
| 651 | - include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme)); |
|
| 652 | - break; |
|
| 653 | - case 119: |
|
| 654 | - // get the purge processor |
|
| 655 | - include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme)); |
|
| 656 | - break; |
|
| 623 | + case 100: |
|
| 624 | + // change the plugin priority |
|
| 625 | + //include_once "header.inc.php"; - in action file |
|
| 626 | + include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme)); |
|
| 627 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 628 | + break; |
|
| 629 | + case 101: |
|
| 630 | + // get the new plugin action |
|
| 631 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 632 | + include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
| 633 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 634 | + break; |
|
| 635 | + case 102: |
|
| 636 | + // get the edit plugin action |
|
| 637 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 638 | + include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
| 639 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 640 | + break; |
|
| 641 | + case 103: |
|
| 642 | + // get the save processor |
|
| 643 | + include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme)); |
|
| 644 | + break; |
|
| 645 | + case 104: |
|
| 646 | + // get the delete processor |
|
| 647 | + include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme)); |
|
| 648 | + break; |
|
| 649 | + case 105: |
|
| 650 | + // get the duplicate processor |
|
| 651 | + include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme)); |
|
| 652 | + break; |
|
| 653 | + case 119: |
|
| 654 | + // get the purge processor |
|
| 655 | + include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme)); |
|
| 656 | + break; |
|
| 657 | 657 | /********************************************************************/ |
| 658 | 658 | /* view phpinfo */ |
| 659 | 659 | /********************************************************************/ |
| 660 | - case 200: |
|
| 661 | - // show phpInfo |
|
| 662 | - if($modx->hasPermission('logs')) { |
|
| 663 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 664 | - include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme)); |
|
| 665 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 666 | - } |
|
| 667 | - break; |
|
| 660 | + case 200: |
|
| 661 | + // show phpInfo |
|
| 662 | + if($modx->hasPermission('logs')) { |
|
| 663 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 664 | + include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme)); |
|
| 665 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 666 | + } |
|
| 667 | + break; |
|
| 668 | 668 | /********************************************************************/ |
| 669 | 669 | /* errorpage */ |
| 670 | 670 | /********************************************************************/ |
| 671 | - case 29: |
|
| 672 | - // get the error page |
|
| 673 | - include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme)); |
|
| 674 | - break; |
|
| 671 | + case 29: |
|
| 672 | + // get the error page |
|
| 673 | + include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme)); |
|
| 674 | + break; |
|
| 675 | 675 | /********************************************************************/ |
| 676 | 676 | /* file manager */ |
| 677 | 677 | /********************************************************************/ |
| 678 | - case 31: |
|
| 679 | - // get the page to manage files |
|
| 680 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 681 | - include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme)); |
|
| 682 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 683 | - break; |
|
| 678 | + case 31: |
|
| 679 | + // get the page to manage files |
|
| 680 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 681 | + include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme)); |
|
| 682 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 683 | + break; |
|
| 684 | 684 | /********************************************************************/ |
| 685 | 685 | /* access permissions */ |
| 686 | 686 | /********************************************************************/ |
| 687 | - case 40: |
|
| 688 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 689 | - include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme)); |
|
| 690 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 691 | - break; |
|
| 692 | - case 91: |
|
| 693 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 694 | - include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme)); |
|
| 695 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 696 | - break; |
|
| 687 | + case 40: |
|
| 688 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 689 | + include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme)); |
|
| 690 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 691 | + break; |
|
| 692 | + case 91: |
|
| 693 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 694 | + include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme)); |
|
| 695 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 696 | + break; |
|
| 697 | 697 | /********************************************************************/ |
| 698 | 698 | /* access groups processor */ |
| 699 | 699 | /********************************************************************/ |
| 700 | - case 41: |
|
| 701 | - include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme)); |
|
| 702 | - break; |
|
| 703 | - case 92: |
|
| 704 | - include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme)); |
|
| 705 | - break; |
|
| 700 | + case 41: |
|
| 701 | + include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme)); |
|
| 702 | + break; |
|
| 703 | + case 92: |
|
| 704 | + include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme)); |
|
| 705 | + break; |
|
| 706 | 706 | /********************************************************************/ |
| 707 | 707 | /* settings editor */ |
| 708 | 708 | /********************************************************************/ |
| 709 | - case 17: |
|
| 710 | - // get the settings editor |
|
| 711 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 712 | - include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme)); |
|
| 713 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 714 | - break; |
|
| 715 | - case 118: |
|
| 716 | - // call settings ajax include |
|
| 717 | - ob_clean(); |
|
| 718 | - include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme)); |
|
| 719 | - break; |
|
| 709 | + case 17: |
|
| 710 | + // get the settings editor |
|
| 711 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 712 | + include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme)); |
|
| 713 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 714 | + break; |
|
| 715 | + case 118: |
|
| 716 | + // call settings ajax include |
|
| 717 | + ob_clean(); |
|
| 718 | + include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme)); |
|
| 719 | + break; |
|
| 720 | 720 | /********************************************************************/ |
| 721 | 721 | /* save settings */ |
| 722 | 722 | /********************************************************************/ |
| 723 | - case 30: |
|
| 724 | - // get the save settings processor |
|
| 725 | - include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme)); |
|
| 726 | - break; |
|
| 723 | + case 30: |
|
| 724 | + // get the save settings processor |
|
| 725 | + include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme)); |
|
| 726 | + break; |
|
| 727 | 727 | /********************************************************************/ |
| 728 | 728 | /* system information */ |
| 729 | 729 | /********************************************************************/ |
| 730 | - case 53: |
|
| 731 | - // get the settings editor |
|
| 732 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 733 | - include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme)); |
|
| 734 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 735 | - break; |
|
| 730 | + case 53: |
|
| 731 | + // get the settings editor |
|
| 732 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 733 | + include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme)); |
|
| 734 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 735 | + break; |
|
| 736 | 736 | /********************************************************************/ |
| 737 | 737 | /* optimise table */ |
| 738 | 738 | /********************************************************************/ |
| 739 | - case 54: |
|
| 740 | - // get the table optimizer/truncate processor |
|
| 741 | - include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme)); |
|
| 742 | - break; |
|
| 739 | + case 54: |
|
| 740 | + // get the table optimizer/truncate processor |
|
| 741 | + include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme)); |
|
| 742 | + break; |
|
| 743 | 743 | /********************************************************************/ |
| 744 | 744 | /* view logging */ |
| 745 | 745 | /********************************************************************/ |
| 746 | - case 13: |
|
| 747 | - // view logging |
|
| 748 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 749 | - include_once(includeFileProcessor("actions/logging.static.php",$manager_theme)); |
|
| 750 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 751 | - break; |
|
| 746 | + case 13: |
|
| 747 | + // view logging |
|
| 748 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 749 | + include_once(includeFileProcessor("actions/logging.static.php",$manager_theme)); |
|
| 750 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 751 | + break; |
|
| 752 | 752 | /********************************************************************/ |
| 753 | 753 | /* empty logs */ |
| 754 | 754 | /********************************************************************/ |
| 755 | - case 55: |
|
| 756 | - // get the settings editor |
|
| 757 | - include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme)); |
|
| 758 | - break; |
|
| 755 | + case 55: |
|
| 756 | + // get the settings editor |
|
| 757 | + include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme)); |
|
| 758 | + break; |
|
| 759 | 759 | /********************************************************************/ |
| 760 | 760 | /* calls test page */ |
| 761 | 761 | /********************************************************************/ |
| 762 | - case 999: |
|
| 763 | - // get the test page |
|
| 764 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 765 | - include_once(includeFileProcessor("test_page.php",$manager_theme)); |
|
| 766 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 767 | - break; |
|
| 762 | + case 999: |
|
| 763 | + // get the test page |
|
| 764 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 765 | + include_once(includeFileProcessor("test_page.php",$manager_theme)); |
|
| 766 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 767 | + break; |
|
| 768 | 768 | /********************************************************************/ |
| 769 | 769 | /* Empty recycle bin */ |
| 770 | 770 | /********************************************************************/ |
| 771 | - case 64: |
|
| 772 | - // get the Recycle bin emptier |
|
| 773 | - include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme)); |
|
| 774 | - break; |
|
| 771 | + case 64: |
|
| 772 | + // get the Recycle bin emptier |
|
| 773 | + include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme)); |
|
| 774 | + break; |
|
| 775 | 775 | /********************************************************************/ |
| 776 | 776 | /* Messages */ |
| 777 | 777 | /********************************************************************/ |
| 778 | - case 10: |
|
| 779 | - // get the messages page |
|
| 780 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 781 | - include_once(includeFileProcessor("actions/messages.static.php",$manager_theme)); |
|
| 782 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 783 | - break; |
|
| 778 | + case 10: |
|
| 779 | + // get the messages page |
|
| 780 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 781 | + include_once(includeFileProcessor("actions/messages.static.php",$manager_theme)); |
|
| 782 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 783 | + break; |
|
| 784 | 784 | /********************************************************************/ |
| 785 | 785 | /* Delete a message */ |
| 786 | 786 | /********************************************************************/ |
| 787 | - case 65: |
|
| 788 | - // get the message deleter |
|
| 789 | - include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme)); |
|
| 790 | - break; |
|
| 787 | + case 65: |
|
| 788 | + // get the message deleter |
|
| 789 | + include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme)); |
|
| 790 | + break; |
|
| 791 | 791 | /********************************************************************/ |
| 792 | 792 | /* Send a message */ |
| 793 | 793 | /********************************************************************/ |
| 794 | - case 66: |
|
| 795 | - // get the message deleter |
|
| 796 | - include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme)); |
|
| 797 | - break; |
|
| 794 | + case 66: |
|
| 795 | + // get the message deleter |
|
| 796 | + include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme)); |
|
| 797 | + break; |
|
| 798 | 798 | /********************************************************************/ |
| 799 | 799 | /* Remove locks */ |
| 800 | 800 | /********************************************************************/ |
| 801 | - case 67: |
|
| 802 | - // get the lock remover |
|
| 803 | - include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme)); |
|
| 804 | - break; |
|
| 801 | + case 67: |
|
| 802 | + // get the lock remover |
|
| 803 | + include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme)); |
|
| 804 | + break; |
|
| 805 | 805 | /********************************************************************/ |
| 806 | 806 | /* Site schedule */ |
| 807 | 807 | /********************************************************************/ |
| 808 | - case 70: |
|
| 809 | - // get the schedule page |
|
| 810 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 811 | - include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme)); |
|
| 812 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 813 | - break; |
|
| 808 | + case 70: |
|
| 809 | + // get the schedule page |
|
| 810 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 811 | + include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme)); |
|
| 812 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 813 | + break; |
|
| 814 | 814 | /********************************************************************/ |
| 815 | 815 | /* Search */ |
| 816 | 816 | /********************************************************************/ |
| 817 | - case 71: |
|
| 818 | - // get the search page |
|
| 819 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 820 | - include_once(includeFileProcessor("actions/search.static.php",$manager_theme)); |
|
| 821 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 822 | - break; |
|
| 817 | + case 71: |
|
| 818 | + // get the search page |
|
| 819 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 820 | + include_once(includeFileProcessor("actions/search.static.php",$manager_theme)); |
|
| 821 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 822 | + break; |
|
| 823 | 823 | /********************************************************************/ |
| 824 | 824 | /* About */ |
| 825 | 825 | /********************************************************************/ |
| 826 | - case 59: |
|
| 827 | - // get the about page |
|
| 828 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 829 | - include_once(includeFileProcessor("actions/about.static.php",$manager_theme)); |
|
| 830 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 831 | - break; |
|
| 826 | + case 59: |
|
| 827 | + // get the about page |
|
| 828 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 829 | + include_once(includeFileProcessor("actions/about.static.php",$manager_theme)); |
|
| 830 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 831 | + break; |
|
| 832 | 832 | /********************************************************************/ |
| 833 | 833 | /* Add weblink */ |
| 834 | 834 | /********************************************************************/ |
| 835 | - case 72: |
|
| 836 | - // get the weblink page |
|
| 837 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 838 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 839 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 840 | - break; |
|
| 835 | + case 72: |
|
| 836 | + // get the weblink page |
|
| 837 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 838 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 839 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 840 | + break; |
|
| 841 | 841 | /********************************************************************/ |
| 842 | 842 | /* User management */ |
| 843 | 843 | /********************************************************************/ |
| 844 | - case 75: |
|
| 845 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 846 | - include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme)); |
|
| 847 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 848 | - break; |
|
| 849 | - case 99: |
|
| 850 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 851 | - include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme)); |
|
| 852 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 853 | - break; |
|
| 854 | - case 86: |
|
| 855 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 856 | - include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme)); |
|
| 857 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 858 | - break; |
|
| 844 | + case 75: |
|
| 845 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 846 | + include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme)); |
|
| 847 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 848 | + break; |
|
| 849 | + case 99: |
|
| 850 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 851 | + include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme)); |
|
| 852 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 853 | + break; |
|
| 854 | + case 86: |
|
| 855 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 856 | + include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme)); |
|
| 857 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 858 | + break; |
|
| 859 | 859 | /********************************************************************/ |
| 860 | 860 | /* template/ snippet management */ |
| 861 | 861 | /********************************************************************/ |
| 862 | - case 76: |
|
| 863 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 864 | - include_once(includeFileProcessor("actions/resources.static.php",$manager_theme)); |
|
| 865 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 866 | - break; |
|
| 862 | + case 76: |
|
| 863 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 864 | + include_once(includeFileProcessor("actions/resources.static.php",$manager_theme)); |
|
| 865 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 866 | + break; |
|
| 867 | 867 | /********************************************************************/ |
| 868 | 868 | /* Export to file */ |
| 869 | 869 | /********************************************************************/ |
| 870 | - case 83: |
|
| 871 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 872 | - include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme)); |
|
| 873 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 874 | - break; |
|
| 870 | + case 83: |
|
| 871 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 872 | + include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme)); |
|
| 873 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 874 | + break; |
|
| 875 | 875 | /********************************************************************/ |
| 876 | 876 | /* Resource Selector */ |
| 877 | 877 | /********************************************************************/ |
| 878 | - case 84: |
|
| 879 | - include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme)); |
|
| 880 | - break; |
|
| 878 | + case 84: |
|
| 879 | + include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme)); |
|
| 880 | + break; |
|
| 881 | 881 | /********************************************************************/ |
| 882 | 882 | /* Backup Manager */ |
| 883 | 883 | /********************************************************************/ |
| 884 | - case 93: |
|
| 885 | - # header and footer will be handled interally |
|
| 886 | - include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme)); |
|
| 887 | - break; |
|
| 884 | + case 93: |
|
| 885 | + # header and footer will be handled interally |
|
| 886 | + include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme)); |
|
| 887 | + break; |
|
| 888 | 888 | /********************************************************************/ |
| 889 | 889 | /* Duplicate Document */ |
| 890 | 890 | /********************************************************************/ |
| 891 | - case 94: |
|
| 892 | - // get the duplicate processor |
|
| 893 | - include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme)); |
|
| 894 | - break; |
|
| 891 | + case 94: |
|
| 892 | + // get the duplicate processor |
|
| 893 | + include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme)); |
|
| 894 | + break; |
|
| 895 | 895 | /********************************************************************/ |
| 896 | 896 | /* Import Document from file */ |
| 897 | 897 | /********************************************************************/ |
| 898 | - case 95: |
|
| 899 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 900 | - include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme)); |
|
| 901 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 902 | - break; |
|
| 898 | + case 95: |
|
| 899 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 900 | + include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme)); |
|
| 901 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 902 | + break; |
|
| 903 | 903 | /********************************************************************/ |
| 904 | 904 | /* Help */ |
| 905 | 905 | /********************************************************************/ |
| 906 | - case 9: |
|
| 907 | - // get the help page |
|
| 908 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 909 | - include_once(includeFileProcessor("actions/help.static.php",$manager_theme)); |
|
| 910 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 911 | - break; |
|
| 906 | + case 9: |
|
| 907 | + // get the help page |
|
| 908 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 909 | + include_once(includeFileProcessor("actions/help.static.php",$manager_theme)); |
|
| 910 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 911 | + break; |
|
| 912 | 912 | /********************************************************************/ |
| 913 | 913 | /* Template Variables - Based on Apodigm's Docvars */ |
| 914 | 914 | /********************************************************************/ |
| 915 | - case 300: |
|
| 916 | - // get the new document variable action |
|
| 917 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 918 | - include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
| 919 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 920 | - break; |
|
| 921 | - case 301: |
|
| 922 | - // get the edit document variable action |
|
| 923 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 924 | - include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
| 925 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 926 | - break; |
|
| 927 | - case 302: |
|
| 928 | - // get the save processor |
|
| 929 | - include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme)); |
|
| 930 | - break; |
|
| 931 | - case 303: |
|
| 932 | - // get the delete processor |
|
| 933 | - include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme)); |
|
| 934 | - break; |
|
| 935 | - case 304: |
|
| 936 | - // get the duplicate processor |
|
| 937 | - include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme)); |
|
| 938 | - break; |
|
| 939 | - case 305: |
|
| 940 | - // get the tv-rank action |
|
| 941 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 942 | - include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme)); |
|
| 943 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 944 | - break; |
|
| 915 | + case 300: |
|
| 916 | + // get the new document variable action |
|
| 917 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 918 | + include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
| 919 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 920 | + break; |
|
| 921 | + case 301: |
|
| 922 | + // get the edit document variable action |
|
| 923 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 924 | + include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
| 925 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 926 | + break; |
|
| 927 | + case 302: |
|
| 928 | + // get the save processor |
|
| 929 | + include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme)); |
|
| 930 | + break; |
|
| 931 | + case 303: |
|
| 932 | + // get the delete processor |
|
| 933 | + include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme)); |
|
| 934 | + break; |
|
| 935 | + case 304: |
|
| 936 | + // get the duplicate processor |
|
| 937 | + include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme)); |
|
| 938 | + break; |
|
| 939 | + case 305: |
|
| 940 | + // get the tv-rank action |
|
| 941 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 942 | + include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme)); |
|
| 943 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 944 | + break; |
|
| 945 | 945 | /********************************************************************/ |
| 946 | 946 | /* Event viewer: show event message log */ |
| 947 | 947 | /********************************************************************/ |
| 948 | - case 114: |
|
| 949 | - // get event logs |
|
| 950 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 951 | - include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme)); |
|
| 952 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 953 | - break; |
|
| 954 | - case 115: |
|
| 955 | - // get event log details viewer |
|
| 956 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 957 | - include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme)); |
|
| 958 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 959 | - break; |
|
| 960 | - case 116: |
|
| 961 | - // get the event log delete processor |
|
| 962 | - include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme)); |
|
| 963 | - break; |
|
| 964 | - |
|
| 965 | - case 501: |
|
| 966 | - //delete category |
|
| 967 | - include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme)); |
|
| 968 | - break; |
|
| 948 | + case 114: |
|
| 949 | + // get event logs |
|
| 950 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 951 | + include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme)); |
|
| 952 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 953 | + break; |
|
| 954 | + case 115: |
|
| 955 | + // get event log details viewer |
|
| 956 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 957 | + include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme)); |
|
| 958 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 959 | + break; |
|
| 960 | + case 116: |
|
| 961 | + // get the event log delete processor |
|
| 962 | + include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme)); |
|
| 963 | + break; |
|
| 964 | + |
|
| 965 | + case 501: |
|
| 966 | + //delete category |
|
| 967 | + include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme)); |
|
| 968 | + break; |
|
| 969 | 969 | /********************************************************************/ |
| 970 | 970 | /* default action: show not implemented message */ |
| 971 | 971 | /********************************************************************/ |
| 972 | - default : |
|
| 973 | - // say that what was requested doesn't do anything yet |
|
| 974 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 975 | - echo " |
|
| 972 | + default : |
|
| 973 | + // say that what was requested doesn't do anything yet |
|
| 974 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 975 | + echo " |
|
| 976 | 976 | <div class='sectionHeader'>".$_lang['functionnotimpl']."</div> |
| 977 | 977 | <div class='sectionBody'> |
| 978 | 978 | <p>".$_lang['functionnotimpl_message']."</p> |
| 979 | 979 | </div> |
| 980 | 980 | "; |
| 981 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 981 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | /********************************************************************/ |
| 985 | 985 | // log action, unless it's a frame request |
| 986 | 986 | if($action!=1 && $action!=7 && $action!=2) { |
| 987 | - include_once "log.class.inc.php"; |
|
| 988 | - $log = new logHandler; |
|
| 989 | - $log->initAndWriteLog(); |
|
| 987 | + include_once "log.class.inc.php"; |
|
| 988 | + $log = new logHandler; |
|
| 989 | + $log->initAndWriteLog(); |
|
| 990 | 990 | } |
| 991 | 991 | /********************************************************************/ |
| 992 | 992 | // show debug |