@@ -8,8 +8,8 @@ |
||
| 8 | 8 | ******************************************************* |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -use PHPMailer\PHPMailer\PHPMailer; |
|
| 12 | 11 | use PHPMailer\PHPMailer\Exception as PHPMailerException; |
| 12 | +use PHPMailer\PHPMailer\PHPMailer; |
|
| 13 | 13 | |
| 14 | 14 | require MODX_MANAGER_PATH . 'includes/controls/phpmailer/Exception.php'; |
| 15 | 15 | require MODX_MANAGER_PATH . 'includes/controls/phpmailer/PHPMailer.php'; |
@@ -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,375 +85,375 @@ 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 | |
| 103 | 103 | <?php |
| 104 | 104 | function run() { |
| 105 | - global $modx, $_lang; |
|
| 105 | + global $modx, $_lang; |
|
| 106 | 106 | |
| 107 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 108 | - $output = ''; |
|
| 109 | - $maxtime = $_POST['maxtime']; |
|
| 107 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 108 | + $output = ''; |
|
| 109 | + $maxtime = $_POST['maxtime']; |
|
| 110 | 110 | |
| 111 | - if(!is_numeric($maxtime)) { |
|
| 112 | - $maxtime = 30; |
|
| 113 | - } |
|
| 111 | + if(!is_numeric($maxtime)) { |
|
| 112 | + $maxtime = 30; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - @set_time_limit($maxtime); |
|
| 115 | + @set_time_limit($maxtime); |
|
| 116 | 116 | |
| 117 | - $mtime = microtime(); |
|
| 118 | - $mtime = explode(' ', $mtime); |
|
| 119 | - $mtime = $mtime[1] + $mtime[0]; |
|
| 120 | - $importstart = $mtime; |
|
| 117 | + $mtime = microtime(); |
|
| 118 | + $mtime = explode(' ', $mtime); |
|
| 119 | + $mtime = $mtime[1] + $mtime[0]; |
|
| 120 | + $importstart = $mtime; |
|
| 121 | 121 | |
| 122 | - if($_POST['reset'] == 'on') { |
|
| 123 | - $modx->db->truncate($tbl_site_content); |
|
| 124 | - $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
| 125 | - } |
|
| 122 | + if($_POST['reset'] == 'on') { |
|
| 123 | + $modx->db->truncate($tbl_site_content); |
|
| 124 | + $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - $parent = (int)$_POST['parent']; |
|
| 127 | + $parent = (int)$_POST['parent']; |
|
| 128 | 128 | |
| 129 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 130 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 131 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 132 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 133 | - } else { |
|
| 129 | + if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 130 | + $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 131 | + } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 132 | + $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 133 | + } else { |
|
| 134 | 134 | $filedir = ''; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $filesfound = 0; |
|
| 137 | + $filesfound = 0; |
|
| 138 | 138 | |
| 139 | - $files = getFiles($filedir); |
|
| 140 | - $files = pop_index($files); |
|
| 139 | + $files = getFiles($filedir); |
|
| 140 | + $files = pop_index($files); |
|
| 141 | 141 | |
| 142 | - // no. of files to import |
|
| 143 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 142 | + // no. of files to import |
|
| 143 | + $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 144 | 144 | |
| 145 | - // import files |
|
| 146 | - if(0 < count($files)) { |
|
| 147 | - $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
| 148 | - importFiles($parent, $filedir, $files, 'root'); |
|
| 149 | - } |
|
| 145 | + // import files |
|
| 146 | + if(0 < count($files)) { |
|
| 147 | + $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
| 148 | + importFiles($parent, $filedir, $files, 'root'); |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - $mtime = microtime(); |
|
| 152 | - $mtime = explode(' ', $mtime); |
|
| 153 | - $mtime = $mtime[1] + $mtime[0]; |
|
| 154 | - $importend = $mtime; |
|
| 155 | - $totaltime = ($importend - $importstart); |
|
| 156 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 151 | + $mtime = microtime(); |
|
| 152 | + $mtime = explode(' ', $mtime); |
|
| 153 | + $mtime = $mtime[1] + $mtime[0]; |
|
| 154 | + $importend = $mtime; |
|
| 155 | + $totaltime = ($importend - $importstart); |
|
| 156 | + $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 157 | 157 | |
| 158 | - if($_POST['convert_link'] == 'on') { |
|
| 159 | - convertLink(); |
|
| 160 | - } |
|
| 158 | + if($_POST['convert_link'] == 'on') { |
|
| 159 | + convertLink(); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - return $output; |
|
| 162 | + return $output; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | function importFiles($parent, $filedir, $files, $mode) { |
| 166 | - global $modx; |
|
| 167 | - global $_lang, $allowedfiles; |
|
| 168 | - global $search_default, $cache_default, $publish_default; |
|
| 169 | - |
|
| 170 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 171 | - $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
| 172 | - |
|
| 173 | - $createdby = $modx->getLoginUserID(); |
|
| 174 | - if(!is_array($files)) { |
|
| 175 | - return; |
|
| 176 | - } |
|
| 177 | - if($_POST['object'] == 'all') { |
|
| 178 | - $modx->config['default_template'] = '0'; |
|
| 179 | - $richtext = '0'; |
|
| 180 | - } else { |
|
| 181 | - $richtext = '1'; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - foreach($files as $id => $value) { |
|
| 185 | - if(is_array($value)) { |
|
| 186 | - // create folder |
|
| 187 | - $alias = $id; |
|
| 188 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 189 | - $field = array(); |
|
| 190 | - $field['type'] = 'document'; |
|
| 191 | - $field['contentType'] = 'text/html'; |
|
| 192 | - $field['published'] = $publish_default; |
|
| 193 | - $field['parent'] = $parent; |
|
| 194 | - $field['alias'] = $modx->stripAlias($alias); |
|
| 195 | - $field['richtext'] = $richtext; |
|
| 196 | - $field['template'] = $modx->config['default_template']; |
|
| 197 | - $field['searchable'] = $search_default; |
|
| 198 | - $field['cacheable'] = $cache_default; |
|
| 199 | - $field['createdby'] = $createdby; |
|
| 200 | - $field['isfolder'] = 1; |
|
| 201 | - $field['menuindex'] = 1; |
|
| 202 | - $find = false; |
|
| 203 | - foreach(array( |
|
| 204 | - 'index.html', |
|
| 205 | - 'index.htm' |
|
| 206 | - ) as $filename) { |
|
| 207 | - $filepath = $filedir . $alias . '/' . $filename; |
|
| 208 | - if($find === false && file_exists($filepath)) { |
|
| 209 | - $file = getFileContent($filepath); |
|
| 210 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 211 | - |
|
| 212 | - $date = filemtime($filepath); |
|
| 213 | - $field['pagetitle'] = $pagetitle; |
|
| 214 | - $field['longtitle'] = $pagetitle; |
|
| 215 | - $field['description'] = $description; |
|
| 216 | - $field['content'] = $modx->db->escape($content); |
|
| 217 | - $field['createdon'] = $date; |
|
| 218 | - $field['editedon'] = $date; |
|
| 219 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 220 | - if($newid) { |
|
| 221 | - $find = true; |
|
| 222 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 223 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 224 | - } else { |
|
| 225 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 226 | - exit; |
|
| 227 | - } |
|
| 228 | - } |
|
| 229 | - } |
|
| 230 | - if($find === false) { |
|
| 231 | - $date = time(); |
|
| 232 | - $field['pagetitle'] = '---'; |
|
| 233 | - $field['content'] = ''; |
|
| 234 | - $field['createdon'] = $date; |
|
| 235 | - $field['editedon'] = $date; |
|
| 236 | - $field['hidemenu'] = '1'; |
|
| 237 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 238 | - if($newid) { |
|
| 239 | - $find = true; |
|
| 240 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 241 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 242 | - } else { |
|
| 243 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 244 | - exit; |
|
| 245 | - } |
|
| 246 | - } |
|
| 247 | - } else { |
|
| 248 | - // create document |
|
| 249 | - if($mode == 'sub' && $value == 'index.html') { |
|
| 250 | - continue; |
|
| 251 | - } |
|
| 252 | - $filename = $value; |
|
| 253 | - $fparts = explode('.', $value); |
|
| 254 | - $alias = $fparts[0]; |
|
| 255 | - $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
| 256 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 257 | - |
|
| 258 | - if(!in_array($ext, $allowedfiles)) { |
|
| 259 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 260 | - } else { |
|
| 261 | - $filepath = $filedir . $filename; |
|
| 262 | - $file = getFileContent($filepath); |
|
| 263 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 264 | - |
|
| 265 | - $date = filemtime($filepath); |
|
| 266 | - $field = array(); |
|
| 267 | - $field['type'] = 'document'; |
|
| 268 | - $field['contentType'] = 'text/html'; |
|
| 269 | - $field['pagetitle'] = $pagetitle; |
|
| 270 | - $field['longtitle'] = $pagetitle; |
|
| 271 | - $field['description'] = $description; |
|
| 272 | - $field['alias'] = $modx->stripAlias($alias); |
|
| 273 | - $field['published'] = $publish_default; |
|
| 274 | - $field['parent'] = $parent; |
|
| 275 | - $field['content'] = $modx->db->escape($content); |
|
| 276 | - $field['richtext'] = $richtext; |
|
| 277 | - $field['template'] = $modx->config['default_template']; |
|
| 278 | - $field['searchable'] = $search_default; |
|
| 279 | - $field['cacheable'] = $cache_default; |
|
| 280 | - $field['createdby'] = $createdby; |
|
| 281 | - $field['createdon'] = $date; |
|
| 282 | - $field['editedon'] = $date; |
|
| 283 | - $field['isfolder'] = 0; |
|
| 284 | - $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
| 285 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 286 | - if($newid) { |
|
| 287 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 288 | - } else { |
|
| 289 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 290 | - exit; |
|
| 291 | - } |
|
| 292 | - |
|
| 293 | - $is_site_start = false; |
|
| 294 | - if($filename == 'index.html') { |
|
| 295 | - $is_site_start = true; |
|
| 296 | - } |
|
| 297 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 298 | - $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
| 299 | - $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
| 300 | - } |
|
| 301 | - } |
|
| 302 | - } |
|
| 303 | - } |
|
| 166 | + global $modx; |
|
| 167 | + global $_lang, $allowedfiles; |
|
| 168 | + global $search_default, $cache_default, $publish_default; |
|
| 169 | + |
|
| 170 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 171 | + $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
| 172 | + |
|
| 173 | + $createdby = $modx->getLoginUserID(); |
|
| 174 | + if(!is_array($files)) { |
|
| 175 | + return; |
|
| 176 | + } |
|
| 177 | + if($_POST['object'] == 'all') { |
|
| 178 | + $modx->config['default_template'] = '0'; |
|
| 179 | + $richtext = '0'; |
|
| 180 | + } else { |
|
| 181 | + $richtext = '1'; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + foreach($files as $id => $value) { |
|
| 185 | + if(is_array($value)) { |
|
| 186 | + // create folder |
|
| 187 | + $alias = $id; |
|
| 188 | + printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 189 | + $field = array(); |
|
| 190 | + $field['type'] = 'document'; |
|
| 191 | + $field['contentType'] = 'text/html'; |
|
| 192 | + $field['published'] = $publish_default; |
|
| 193 | + $field['parent'] = $parent; |
|
| 194 | + $field['alias'] = $modx->stripAlias($alias); |
|
| 195 | + $field['richtext'] = $richtext; |
|
| 196 | + $field['template'] = $modx->config['default_template']; |
|
| 197 | + $field['searchable'] = $search_default; |
|
| 198 | + $field['cacheable'] = $cache_default; |
|
| 199 | + $field['createdby'] = $createdby; |
|
| 200 | + $field['isfolder'] = 1; |
|
| 201 | + $field['menuindex'] = 1; |
|
| 202 | + $find = false; |
|
| 203 | + foreach(array( |
|
| 204 | + 'index.html', |
|
| 205 | + 'index.htm' |
|
| 206 | + ) as $filename) { |
|
| 207 | + $filepath = $filedir . $alias . '/' . $filename; |
|
| 208 | + if($find === false && file_exists($filepath)) { |
|
| 209 | + $file = getFileContent($filepath); |
|
| 210 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 211 | + |
|
| 212 | + $date = filemtime($filepath); |
|
| 213 | + $field['pagetitle'] = $pagetitle; |
|
| 214 | + $field['longtitle'] = $pagetitle; |
|
| 215 | + $field['description'] = $description; |
|
| 216 | + $field['content'] = $modx->db->escape($content); |
|
| 217 | + $field['createdon'] = $date; |
|
| 218 | + $field['editedon'] = $date; |
|
| 219 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 220 | + if($newid) { |
|
| 221 | + $find = true; |
|
| 222 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 223 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 224 | + } else { |
|
| 225 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 226 | + exit; |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | + } |
|
| 230 | + if($find === false) { |
|
| 231 | + $date = time(); |
|
| 232 | + $field['pagetitle'] = '---'; |
|
| 233 | + $field['content'] = ''; |
|
| 234 | + $field['createdon'] = $date; |
|
| 235 | + $field['editedon'] = $date; |
|
| 236 | + $field['hidemenu'] = '1'; |
|
| 237 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 238 | + if($newid) { |
|
| 239 | + $find = true; |
|
| 240 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 241 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 242 | + } else { |
|
| 243 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 244 | + exit; |
|
| 245 | + } |
|
| 246 | + } |
|
| 247 | + } else { |
|
| 248 | + // create document |
|
| 249 | + if($mode == 'sub' && $value == 'index.html') { |
|
| 250 | + continue; |
|
| 251 | + } |
|
| 252 | + $filename = $value; |
|
| 253 | + $fparts = explode('.', $value); |
|
| 254 | + $alias = $fparts[0]; |
|
| 255 | + $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
| 256 | + printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 257 | + |
|
| 258 | + if(!in_array($ext, $allowedfiles)) { |
|
| 259 | + echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 260 | + } else { |
|
| 261 | + $filepath = $filedir . $filename; |
|
| 262 | + $file = getFileContent($filepath); |
|
| 263 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 264 | + |
|
| 265 | + $date = filemtime($filepath); |
|
| 266 | + $field = array(); |
|
| 267 | + $field['type'] = 'document'; |
|
| 268 | + $field['contentType'] = 'text/html'; |
|
| 269 | + $field['pagetitle'] = $pagetitle; |
|
| 270 | + $field['longtitle'] = $pagetitle; |
|
| 271 | + $field['description'] = $description; |
|
| 272 | + $field['alias'] = $modx->stripAlias($alias); |
|
| 273 | + $field['published'] = $publish_default; |
|
| 274 | + $field['parent'] = $parent; |
|
| 275 | + $field['content'] = $modx->db->escape($content); |
|
| 276 | + $field['richtext'] = $richtext; |
|
| 277 | + $field['template'] = $modx->config['default_template']; |
|
| 278 | + $field['searchable'] = $search_default; |
|
| 279 | + $field['cacheable'] = $cache_default; |
|
| 280 | + $field['createdby'] = $createdby; |
|
| 281 | + $field['createdon'] = $date; |
|
| 282 | + $field['editedon'] = $date; |
|
| 283 | + $field['isfolder'] = 0; |
|
| 284 | + $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
| 285 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 286 | + if($newid) { |
|
| 287 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 288 | + } else { |
|
| 289 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 290 | + exit; |
|
| 291 | + } |
|
| 292 | + |
|
| 293 | + $is_site_start = false; |
|
| 294 | + if($filename == 'index.html') { |
|
| 295 | + $is_site_start = true; |
|
| 296 | + } |
|
| 297 | + if($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 298 | + $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
| 299 | + $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
| 300 | + } |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | + } |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | function getFiles($directory, $listing = array(), $count = 0) { |
| 307 | - global $_lang; |
|
| 308 | - global $filesfound; |
|
| 309 | - $dummy = $count; |
|
| 310 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
| 311 | - foreach($files as $file) { |
|
| 312 | - if($file == '.' || $file == '..') { |
|
| 313 | - continue; |
|
| 314 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
| 315 | - closedir($h); |
|
| 316 | - $count = -1; |
|
| 317 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 318 | - } elseif(strpos($file, '.htm') !== false) { |
|
| 319 | - $listing[$dummy] = $file; |
|
| 320 | - $dummy = $dummy + 1; |
|
| 321 | - $filesfound++; |
|
| 322 | - } |
|
| 323 | - } |
|
| 324 | - } else { |
|
| 325 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 326 | - } |
|
| 327 | - return ($listing); |
|
| 307 | + global $_lang; |
|
| 308 | + global $filesfound; |
|
| 309 | + $dummy = $count; |
|
| 310 | + if( ! empty($directory) && $files = scandir($directory)) { |
|
| 311 | + foreach($files as $file) { |
|
| 312 | + if($file == '.' || $file == '..') { |
|
| 313 | + continue; |
|
| 314 | + } elseif($h = @opendir($directory . $file . "/")) { |
|
| 315 | + closedir($h); |
|
| 316 | + $count = -1; |
|
| 317 | + $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 318 | + } elseif(strpos($file, '.htm') !== false) { |
|
| 319 | + $listing[$dummy] = $file; |
|
| 320 | + $dummy = $dummy + 1; |
|
| 321 | + $filesfound++; |
|
| 322 | + } |
|
| 323 | + } |
|
| 324 | + } else { |
|
| 325 | + echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 326 | + } |
|
| 327 | + return ($listing); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | function getFileContent($filepath) { |
| 331 | - global $_lang; |
|
| 332 | - // get the file |
|
| 333 | - if(!$buffer = file_get_contents($filepath)) { |
|
| 334 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 335 | - } else { |
|
| 336 | - return $buffer; |
|
| 337 | - } |
|
| 331 | + global $_lang; |
|
| 332 | + // get the file |
|
| 333 | + if(!$buffer = file_get_contents($filepath)) { |
|
| 334 | + echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 335 | + } else { |
|
| 336 | + return $buffer; |
|
| 337 | + } |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | function pop_index($array) { |
| 341 | - $new_array = array(); |
|
| 342 | - foreach($array as $k => $v) { |
|
| 343 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
| 344 | - $new_array[$k] = $v; |
|
| 345 | - } else { |
|
| 346 | - array_unshift($new_array, $v); |
|
| 347 | - } |
|
| 348 | - } |
|
| 349 | - foreach($array as $k => $v) { |
|
| 350 | - if(is_array($v)) { |
|
| 351 | - $new_array[$k] = $v; |
|
| 352 | - } |
|
| 353 | - } |
|
| 354 | - return $new_array; |
|
| 341 | + $new_array = array(); |
|
| 342 | + foreach($array as $k => $v) { |
|
| 343 | + if($v !== 'index.html' && $v !== 'index.htm') { |
|
| 344 | + $new_array[$k] = $v; |
|
| 345 | + } else { |
|
| 346 | + array_unshift($new_array, $v); |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | + foreach($array as $k => $v) { |
|
| 350 | + if(is_array($v)) { |
|
| 351 | + $new_array[$k] = $v; |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | + return $new_array; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | function treatContent($src, $filename, $alias) { |
| 358 | - global $modx; |
|
| 359 | - |
|
| 360 | - $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
| 361 | - |
|
| 362 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 363 | - $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 364 | - $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
| 365 | - } else { |
|
| 366 | - $pagetitle = $alias; |
|
| 367 | - } |
|
| 368 | - if(!$pagetitle) { |
|
| 369 | - $pagetitle = $alias; |
|
| 370 | - } |
|
| 371 | - |
|
| 372 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 373 | - $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 374 | - $description = str_replace('[*description*]', '', $description); |
|
| 375 | - } else { |
|
| 376 | - $description = ''; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 380 | - $content = $matches[1]; |
|
| 381 | - } else { |
|
| 382 | - $content = $src; |
|
| 383 | - $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
| 384 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 385 | - $content = preg_replace($s, $r, $content); |
|
| 386 | - $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
| 387 | - } |
|
| 388 | - $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
| 389 | - $content = trim($content); |
|
| 390 | - $pagetitle = $modx->db->escape($pagetitle); |
|
| 391 | - return array( |
|
| 392 | - $pagetitle, |
|
| 393 | - $content, |
|
| 394 | - $description |
|
| 395 | - ); |
|
| 358 | + global $modx; |
|
| 359 | + |
|
| 360 | + $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
| 361 | + |
|
| 362 | + if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 363 | + $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 364 | + $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
| 365 | + } else { |
|
| 366 | + $pagetitle = $alias; |
|
| 367 | + } |
|
| 368 | + if(!$pagetitle) { |
|
| 369 | + $pagetitle = $alias; |
|
| 370 | + } |
|
| 371 | + |
|
| 372 | + if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 373 | + $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 374 | + $description = str_replace('[*description*]', '', $description); |
|
| 375 | + } else { |
|
| 376 | + $description = ''; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 380 | + $content = $matches[1]; |
|
| 381 | + } else { |
|
| 382 | + $content = $src; |
|
| 383 | + $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
| 384 | + $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 385 | + $content = preg_replace($s, $r, $content); |
|
| 386 | + $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
| 387 | + } |
|
| 388 | + $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
| 389 | + $content = trim($content); |
|
| 390 | + $pagetitle = $modx->db->escape($pagetitle); |
|
| 391 | + return array( |
|
| 392 | + $pagetitle, |
|
| 393 | + $content, |
|
| 394 | + $description |
|
| 395 | + ); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | function convertLink() { |
| 399 | - global $modx; |
|
| 400 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 399 | + global $modx; |
|
| 400 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 401 | 401 | |
| 402 | - $rs = $modx->db->select('id,content', $tbl_site_content); |
|
| 403 | - $p = array(); |
|
| 402 | + $rs = $modx->db->select('id,content', $tbl_site_content); |
|
| 403 | + $p = array(); |
|
| 404 | 404 | $target = array(); |
| 405 | - $dir = ''; |
|
| 406 | - while($row = $modx->db->getRow($rs)) { |
|
| 407 | - $id = $row['id']; |
|
| 408 | - $array = explode('<a href=', $row['content']); |
|
| 409 | - $c = 0; |
|
| 410 | - foreach($array as $v) { |
|
| 411 | - if($v[0] === '"') { |
|
| 412 | - $v = substr($v, 1); |
|
| 413 | - list($href, $v) = explode('"', $v, 2); |
|
| 414 | - $_ = $href; |
|
| 415 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
| 416 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 417 | - } |
|
| 418 | - if($_[0] === '/') { |
|
| 419 | - $_ = substr($_, 1); |
|
| 420 | - } |
|
| 421 | - $_ = str_replace('/index.html', '.html', $_); |
|
| 422 | - $level = substr_count($_, '../'); |
|
| 423 | - if(1 < $level) { |
|
| 424 | - if(!isset($p[$id])) { |
|
| 425 | - $p[$id] = $modx->getParentIds($id); |
|
| 426 | - } |
|
| 427 | - $k = array_keys($p[$id]); |
|
| 428 | - while(0 < $level) { |
|
| 429 | - $dir = array_shift($k); |
|
| 430 | - $level--; |
|
| 431 | - } |
|
| 432 | - if($dir != '') { |
|
| 433 | - $dir .= '/'; |
|
| 434 | - } |
|
| 435 | - } else { |
|
| 436 | - $dir = ''; |
|
| 437 | - } |
|
| 438 | - |
|
| 439 | - $_ = trim($_, './'); |
|
| 440 | - if(strpos($_, '/') !== false) { |
|
| 441 | - $_ = substr($_, strrpos($_, '/')); |
|
| 442 | - } |
|
| 443 | - $_ = $dir . str_replace('.html', '', $_); |
|
| 444 | - if(!isset($target[$_])) { |
|
| 445 | - $target[$_] = $modx->getIdFromAlias($_); |
|
| 446 | - } |
|
| 447 | - $target[$_] = trim($target[$_]); |
|
| 448 | - if(!empty($target[$_])) { |
|
| 449 | - $href = '[~' . $target[$_] . '~]'; |
|
| 450 | - } |
|
| 451 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 452 | - } |
|
| 453 | - $c++; |
|
| 454 | - } |
|
| 455 | - $content = implode('', $array); |
|
| 456 | - $f['content'] = $modx->db->escape($content); |
|
| 457 | - $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
| 458 | - } |
|
| 405 | + $dir = ''; |
|
| 406 | + while($row = $modx->db->getRow($rs)) { |
|
| 407 | + $id = $row['id']; |
|
| 408 | + $array = explode('<a href=', $row['content']); |
|
| 409 | + $c = 0; |
|
| 410 | + foreach($array as $v) { |
|
| 411 | + if($v[0] === '"') { |
|
| 412 | + $v = substr($v, 1); |
|
| 413 | + list($href, $v) = explode('"', $v, 2); |
|
| 414 | + $_ = $href; |
|
| 415 | + if(strpos($_, $modx->config['site_url']) !== false) { |
|
| 416 | + $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 417 | + } |
|
| 418 | + if($_[0] === '/') { |
|
| 419 | + $_ = substr($_, 1); |
|
| 420 | + } |
|
| 421 | + $_ = str_replace('/index.html', '.html', $_); |
|
| 422 | + $level = substr_count($_, '../'); |
|
| 423 | + if(1 < $level) { |
|
| 424 | + if(!isset($p[$id])) { |
|
| 425 | + $p[$id] = $modx->getParentIds($id); |
|
| 426 | + } |
|
| 427 | + $k = array_keys($p[$id]); |
|
| 428 | + while(0 < $level) { |
|
| 429 | + $dir = array_shift($k); |
|
| 430 | + $level--; |
|
| 431 | + } |
|
| 432 | + if($dir != '') { |
|
| 433 | + $dir .= '/'; |
|
| 434 | + } |
|
| 435 | + } else { |
|
| 436 | + $dir = ''; |
|
| 437 | + } |
|
| 438 | + |
|
| 439 | + $_ = trim($_, './'); |
|
| 440 | + if(strpos($_, '/') !== false) { |
|
| 441 | + $_ = substr($_, strrpos($_, '/')); |
|
| 442 | + } |
|
| 443 | + $_ = $dir . str_replace('.html', '', $_); |
|
| 444 | + if(!isset($target[$_])) { |
|
| 445 | + $target[$_] = $modx->getIdFromAlias($_); |
|
| 446 | + } |
|
| 447 | + $target[$_] = trim($target[$_]); |
|
| 448 | + if(!empty($target[$_])) { |
|
| 449 | + $href = '[~' . $target[$_] . '~]'; |
|
| 450 | + } |
|
| 451 | + $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 452 | + } |
|
| 453 | + $c++; |
|
| 454 | + } |
|
| 455 | + $content = implode('', $array); |
|
| 456 | + $f['content'] = $modx->db->escape($content); |
|
| 457 | + $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
| 458 | + } |
|
| 459 | 459 | } |
@@ -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,62 +1517,62 @@ 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 | function getDefaultTemplate() { |
| 1536 | - global $modx; |
|
| 1537 | - |
|
| 1538 | - switch($modx->config['auto_template_logic']) { |
|
| 1539 | - case 'sibling': |
|
| 1540 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1541 | - $site_start = $modx->config['site_start']; |
|
| 1542 | - $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
| 1543 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
| 1544 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1545 | - $default_template = $sibl[0]['template']; |
|
| 1546 | - } |
|
| 1547 | - } else { |
|
| 1548 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1549 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1550 | - $default_template = $sibl[0]['template']; |
|
| 1551 | - } else { |
|
| 1552 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1554 | - $default_template = $sibl[0]['template']; |
|
| 1555 | - } |
|
| 1556 | - } |
|
| 1557 | - } |
|
| 1558 | - if(isset($default_template)) { |
|
| 1559 | - break; |
|
| 1560 | - } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
| 1561 | - case 'parent': |
|
| 1562 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1563 | - $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
| 1564 | - if(isset($parent['template'])) { |
|
| 1565 | - $default_template = $parent['template']; |
|
| 1566 | - } |
|
| 1567 | - } |
|
| 1568 | - break; |
|
| 1569 | - case 'system': |
|
| 1570 | - default: // default_template is already set |
|
| 1571 | - $default_template = $modx->config['default_template']; |
|
| 1572 | - } |
|
| 1573 | - if(!isset($default_template)) { |
|
| 1574 | - $default_template = $modx->config['default_template']; |
|
| 1575 | - } // default_template is already set |
|
| 1576 | - |
|
| 1577 | - return $default_template; |
|
| 1536 | + global $modx; |
|
| 1537 | + |
|
| 1538 | + switch($modx->config['auto_template_logic']) { |
|
| 1539 | + case 'sibling': |
|
| 1540 | + if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1541 | + $site_start = $modx->config['site_start']; |
|
| 1542 | + $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
| 1543 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
| 1544 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1545 | + $default_template = $sibl[0]['template']; |
|
| 1546 | + } |
|
| 1547 | + } else { |
|
| 1548 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1549 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1550 | + $default_template = $sibl[0]['template']; |
|
| 1551 | + } else { |
|
| 1552 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1553 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1554 | + $default_template = $sibl[0]['template']; |
|
| 1555 | + } |
|
| 1556 | + } |
|
| 1557 | + } |
|
| 1558 | + if(isset($default_template)) { |
|
| 1559 | + break; |
|
| 1560 | + } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
| 1561 | + case 'parent': |
|
| 1562 | + if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1563 | + $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
| 1564 | + if(isset($parent['template'])) { |
|
| 1565 | + $default_template = $parent['template']; |
|
| 1566 | + } |
|
| 1567 | + } |
|
| 1568 | + break; |
|
| 1569 | + case 'system': |
|
| 1570 | + default: // default_template is already set |
|
| 1571 | + $default_template = $modx->config['default_template']; |
|
| 1572 | + } |
|
| 1573 | + if(!isset($default_template)) { |
|
| 1574 | + $default_template = $modx->config['default_template']; |
|
| 1575 | + } // default_template is already set |
|
| 1576 | + |
|
| 1577 | + return $default_template; |
|
| 1578 | 1578 | } |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->manager->action) {
|
| 7 | - case 12: |
|
| 8 | - if(!$modx->hasPermission('edit_user')) {
|
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 11: |
|
| 13 | - if(!$modx->hasPermission('new_user')) {
|
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 12: |
|
| 8 | + if(!$modx->hasPermission('edit_user')) {
|
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 11: |
|
| 13 | + if(!$modx->hasPermission('new_user')) {
|
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -23,75 +23,75 @@ discard block |
||
| 23 | 23 | // check to see the snippet editor isn't locked |
| 24 | 24 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
| 25 | 25 | if($username = $modx->db->getValue($rs)) {
|
| 26 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
| 26 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
| 27 | 27 | } |
| 28 | 28 | // end check for lock |
| 29 | 29 | |
| 30 | 30 | if($modx->manager->action == '12') {
|
| 31 | - // get user attribute |
|
| 32 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
|
|
| 33 | - $userdata = $modx->db->getRow($rs); |
|
| 34 | - if(!$userdata) {
|
|
| 35 | - $modx->webAlertAndQuit("No user returned!");
|
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - |
|
| 39 | - // get user settings |
|
| 40 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
|
|
| 41 | - $usersettings = array(); |
|
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | - // manually extract so that user display settings are not overwritten |
|
| 44 | - foreach($usersettings as $k => $v) {
|
|
| 45 | - if($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 46 | - ${$k} = $v;
|
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - // get user name |
|
| 51 | - $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
|
|
| 52 | - $usernamedata = $modx->db->getRow($rs); |
|
| 53 | - if(!$usernamedata) {
|
|
| 54 | - $modx->webAlertAndQuit("No user returned while getting username!");
|
|
| 55 | - } |
|
| 56 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
| 31 | + // get user attribute |
|
| 32 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
|
|
| 33 | + $userdata = $modx->db->getRow($rs); |
|
| 34 | + if(!$userdata) {
|
|
| 35 | + $modx->webAlertAndQuit("No user returned!");
|
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + |
|
| 39 | + // get user settings |
|
| 40 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
|
|
| 41 | + $usersettings = array(); |
|
| 42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | + // manually extract so that user display settings are not overwritten |
|
| 44 | + foreach($usersettings as $k => $v) {
|
|
| 45 | + if($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 46 | + ${$k} = $v;
|
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + // get user name |
|
| 51 | + $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
|
|
| 52 | + $usernamedata = $modx->db->getRow($rs); |
|
| 53 | + if(!$usernamedata) {
|
|
| 54 | + $modx->webAlertAndQuit("No user returned while getting username!");
|
|
| 55 | + } |
|
| 56 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
| 57 | 57 | } else {
|
| 58 | - $userdata = array(); |
|
| 59 | - $usersettings = array(); |
|
| 60 | - $usernamedata = array(); |
|
| 61 | - $_SESSION['itemname'] = $_lang["new_user"]; |
|
| 58 | + $userdata = array(); |
|
| 59 | + $usersettings = array(); |
|
| 60 | + $usernamedata = array(); |
|
| 61 | + $_SESSION['itemname'] = $_lang["new_user"]; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 65 | 65 | foreach($userdata as $key => $val) {
|
| 66 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 66 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 67 | 67 | }; |
| 68 | 68 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 69 | 69 | |
| 70 | 70 | // restore saved form |
| 71 | 71 | $formRestored = false; |
| 72 | 72 | if($modx->manager->hasFormValues()) {
|
| 73 | - $modx->manager->loadFormValues(); |
|
| 74 | - // restore post values |
|
| 75 | - $userdata = array_merge($userdata, $_POST); |
|
| 76 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 77 | - $usernamedata['username'] = $userdata['newusername']; |
|
| 78 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 79 | - $usersettings = array_merge($usersettings, $userdata); |
|
| 80 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
|
|
| 81 | - extract($usersettings, EXTR_OVERWRITE); |
|
| 73 | + $modx->manager->loadFormValues(); |
|
| 74 | + // restore post values |
|
| 75 | + $userdata = array_merge($userdata, $_POST); |
|
| 76 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 77 | + $usernamedata['username'] = $userdata['newusername']; |
|
| 78 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 79 | + $usersettings = array_merge($usersettings, $userdata); |
|
| 80 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
|
|
| 81 | + extract($usersettings, EXTR_OVERWRITE); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // include the country list language file |
| 85 | 85 | $_country_lang = array(); |
| 86 | 86 | include_once "lang/country/english_country.inc.php"; |
| 87 | 87 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
| 88 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 88 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 89 | 89 | } |
| 90 | 90 | asort($_country_lang); |
| 91 | 91 | |
| 92 | 92 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
| 93 | 93 | if($which_browser == 'default') {
|
| 94 | - $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
| 94 | + $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
| 95 | 95 | } |
| 96 | 96 | ?> |
| 97 | 97 | <script type="text/javascript"> |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | <form action="index.php?a=32" method="post" name="userform"> |
| 202 | 202 | <?php |
| 203 | 203 | |
| 204 | - // invoke OnUserFormPrerender event |
|
| 205 | - $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
|
|
| 206 | - "id" => $user |
|
| 207 | - )); |
|
| 208 | - if(is_array($evtOut)) {
|
|
| 209 | - echo implode("", $evtOut);
|
|
| 210 | - } |
|
| 211 | - ?> |
|
| 204 | + // invoke OnUserFormPrerender event |
|
| 205 | + $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
|
|
| 206 | + "id" => $user |
|
| 207 | + )); |
|
| 208 | + if(is_array($evtOut)) {
|
|
| 209 | + echo implode("", $evtOut);
|
|
| 210 | + } |
|
| 211 | + ?> |
|
| 212 | 212 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>"> |
| 213 | 213 | <input type="hidden" name="id" value="<?php echo $user ?>"> |
| 214 | 214 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -301,21 +301,21 @@ discard block |
||
| 301 | 301 | <td> </td> |
| 302 | 302 | <td><?php |
| 303 | 303 | |
| 304 | - $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
|
|
| 305 | - ?> |
|
| 304 | + $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
|
|
| 305 | + ?> |
|
| 306 | 306 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
| 307 | 307 | <?php |
| 308 | - while($row = $modx->db->getRow($rs)) {
|
|
| 309 | - if($modx->manager->action == '11') {
|
|
| 310 | - $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
| 311 | - } else {
|
|
| 312 | - $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
| 313 | - } |
|
| 314 | - ?> |
|
| 308 | + while($row = $modx->db->getRow($rs)) {
|
|
| 309 | + if($modx->manager->action == '11') {
|
|
| 310 | + $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
| 311 | + } else {
|
|
| 312 | + $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
| 313 | + } |
|
| 314 | + ?> |
|
| 315 | 315 | <option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option> |
| 316 | 316 | <?php |
| 317 | - } |
|
| 318 | - ?> |
|
| 317 | + } |
|
| 318 | + ?> |
|
| 319 | 319 | </select></td> |
| 320 | 320 | </tr> |
| 321 | 321 | <tr> |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 361 | 361 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 362 | 362 | <?php |
| 363 | - foreach($_country_lang as $key => $country) {
|
|
| 364 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 365 | - } |
|
| 366 | - ?> |
|
| 363 | + foreach($_country_lang as $key => $country) {
|
|
| 364 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 365 | + } |
|
| 366 | + ?> |
|
| 367 | 367 | </select></td> |
| 368 | 368 | </tr> |
| 369 | 369 | <tr> |
@@ -439,21 +439,21 @@ discard block |
||
| 439 | 439 | <td><select name="manager_language" class="inputBox" onChange="documentDirty=true"> |
| 440 | 440 | <option value=""></option> |
| 441 | 441 | <?php |
| 442 | - $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
| 443 | - $dir = dir("includes/lang");
|
|
| 444 | - while($file = $dir->read()) {
|
|
| 445 | - if(strpos($file, ".inc.php") > 0) {
|
|
| 446 | - $endpos = strpos($file, "."); |
|
| 447 | - $languagename = substr($file, 0, $endpos); |
|
| 448 | - $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
| 449 | - ?> |
|
| 442 | + $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
| 443 | + $dir = dir("includes/lang");
|
|
| 444 | + while($file = $dir->read()) {
|
|
| 445 | + if(strpos($file, ".inc.php") > 0) {
|
|
| 446 | + $endpos = strpos($file, "."); |
|
| 447 | + $languagename = substr($file, 0, $endpos); |
|
| 448 | + $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
| 449 | + ?> |
|
| 450 | 450 | <option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option>
|
| 451 | 451 | <?php |
| 452 | 452 | |
| 453 | - } |
|
| 454 | - } |
|
| 455 | - $dir->close(); |
|
| 456 | - ?> |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + $dir->close(); |
|
| 456 | + ?> |
|
| 457 | 457 | </select></td> |
| 458 | 458 | </tr> |
| 459 | 459 | <tr> |
@@ -528,22 +528,22 @@ discard block |
||
| 528 | 528 | <td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());"> |
| 529 | 529 | <option value=""></option> |
| 530 | 530 | <?php |
| 531 | - $dir = dir("media/style/");
|
|
| 532 | - while($file = $dir->read()) {
|
|
| 533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 534 | - $themename = $file; |
|
| 535 | - if($themename === 'common') {
|
|
| 536 | - continue; |
|
| 537 | - } |
|
| 538 | - $attr = 'value="' . $themename . '" '; |
|
| 539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 540 | - $attr .= 'selected="selected" '; |
|
| 541 | - } |
|
| 542 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
|
|
| 543 | - } |
|
| 544 | - } |
|
| 545 | - $dir->close(); |
|
| 546 | - ?> |
|
| 531 | + $dir = dir("media/style/");
|
|
| 532 | + while($file = $dir->read()) {
|
|
| 533 | + if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 534 | + $themename = $file; |
|
| 535 | + if($themename === 'common') {
|
|
| 536 | + continue; |
|
| 537 | + } |
|
| 538 | + $attr = 'value="' . $themename . '" '; |
|
| 539 | + if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 540 | + $attr .= 'selected="selected" '; |
|
| 541 | + } |
|
| 542 | + echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
|
|
| 543 | + } |
|
| 544 | + } |
|
| 545 | + $dir->close(); |
|
| 546 | + ?> |
|
| 547 | 547 | </select> |
| 548 | 548 | <input type="hidden" name="theme_refresher" value=""></td> |
| 549 | 549 | </tr> |
@@ -555,15 +555,15 @@ discard block |
||
| 555 | 555 | <th><?php echo $_lang["which_browser_title"] ?></th> |
| 556 | 556 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
| 557 | 557 | <?php |
| 558 | - $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 559 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
| 560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 561 | - $dir = str_replace('\\', '/', $dir);
|
|
| 562 | - $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
| 563 | - $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 564 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
|
|
| 565 | - } |
|
| 566 | - ?> |
|
| 558 | + $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 559 | + echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
| 560 | + foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 561 | + $dir = str_replace('\\', '/', $dir);
|
|
| 562 | + $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
| 563 | + $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 564 | + echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
|
|
| 565 | + } |
|
| 566 | + ?> |
|
| 567 | 567 | </select></td> |
| 568 | 568 | </tr> |
| 569 | 569 | <tr> |
@@ -640,17 +640,17 @@ discard block |
||
| 640 | 640 | <option value=""></option> |
| 641 | 641 | <?php |
| 642 | 642 | |
| 643 | - $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
| 644 | - // invoke OnRichTextEditorRegister event |
|
| 645 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
|
|
| 646 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
| 647 | - if(is_array($evtOut)) {
|
|
| 648 | - for($i = 0; $i < count($evtOut); $i++) {
|
|
| 649 | - $editor = $evtOut[$i]; |
|
| 650 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
| 651 | - } |
|
| 652 | - } |
|
| 653 | - ?> |
|
| 643 | + $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
| 644 | + // invoke OnRichTextEditorRegister event |
|
| 645 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
|
|
| 646 | + echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
| 647 | + if(is_array($evtOut)) {
|
|
| 648 | + for($i = 0; $i < count($evtOut); $i++) {
|
|
| 649 | + $editor = $evtOut[$i]; |
|
| 650 | + echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
| 651 | + } |
|
| 652 | + } |
|
| 653 | + ?> |
|
| 654 | 654 | </select></td> |
| 655 | 655 | </tr> |
| 656 | 656 | <tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>"> |
@@ -683,12 +683,12 @@ discard block |
||
| 683 | 683 | </tr> |
| 684 | 684 | </table> |
| 685 | 685 | <?php |
| 686 | - // invoke OnInterfaceSettingsRender event |
|
| 687 | - $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
|
|
| 688 | - if(is_array($evtOut)) {
|
|
| 689 | - echo implode("", $evtOut);
|
|
| 690 | - } |
|
| 691 | - ?> |
|
| 686 | + // invoke OnInterfaceSettingsRender event |
|
| 687 | + $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
|
|
| 688 | + if(is_array($evtOut)) {
|
|
| 689 | + echo implode("", $evtOut);
|
|
| 690 | + } |
|
| 691 | + ?> |
|
| 692 | 692 | </div> |
| 693 | 693 | |
| 694 | 694 | <!-- Photo --> |
@@ -737,39 +737,39 @@ discard block |
||
| 737 | 737 | </div> |
| 738 | 738 | <?php if($use_udperms == 1) {
|
| 739 | 739 | |
| 740 | - $groupsarray = array(); |
|
| 741 | - |
|
| 742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 743 | - $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
|
|
| 744 | - $groupsarray = $modx->db->getColumn('user_group', $rs);
|
|
| 745 | - } |
|
| 746 | - // retain selected doc groups between post |
|
| 747 | - if(is_array($_POST['user_groups'])) {
|
|
| 748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 749 | - } |
|
| 750 | - ?> |
|
| 740 | + $groupsarray = array(); |
|
| 741 | + |
|
| 742 | + if($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 743 | + $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
|
|
| 744 | + $groupsarray = $modx->db->getColumn('user_group', $rs);
|
|
| 745 | + } |
|
| 746 | + // retain selected doc groups between post |
|
| 747 | + if(is_array($_POST['user_groups'])) {
|
|
| 748 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 749 | + } |
|
| 750 | + ?> |
|
| 751 | 751 | <div class="tab-page" id="tabAccess"> |
| 752 | 752 | <h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2> |
| 753 | 753 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script>
|
| 754 | 754 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 755 | 755 | <?php |
| 756 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
|
|
| 757 | - while($row = $modx->db->getRow($rs)) {
|
|
| 758 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
| 759 | - } |
|
| 760 | - } |
|
| 761 | - ?> |
|
| 756 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
|
|
| 757 | + while($row = $modx->db->getRow($rs)) {
|
|
| 758 | + echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
| 759 | + } |
|
| 760 | + } |
|
| 761 | + ?> |
|
| 762 | 762 | </div> |
| 763 | 763 | </div> |
| 764 | 764 | </div> |
| 765 | 765 | <input type="submit" name="save" style="display:none"> |
| 766 | 766 | <?php |
| 767 | - // invoke OnUserFormRender event |
|
| 768 | - $evtOut = $modx->invokeEvent("OnUserFormRender", array(
|
|
| 769 | - "id" => $user |
|
| 770 | - )); |
|
| 771 | - if(is_array($evtOut)) {
|
|
| 772 | - echo implode("", $evtOut);
|
|
| 773 | - } |
|
| 774 | - ?> |
|
| 767 | + // invoke OnUserFormRender event |
|
| 768 | + $evtOut = $modx->invokeEvent("OnUserFormRender", array(
|
|
| 769 | + "id" => $user |
|
| 770 | + )); |
|
| 771 | + if(is_array($evtOut)) {
|
|
| 772 | + echo implode("", $evtOut);
|
|
| 773 | + } |
|
| 774 | + ?> |
|
| 775 | 775 | </form> |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->manager->action) {
|
| 7 | - case 88: |
|
| 8 | - if(!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 87: |
|
| 13 | - if(!$modx->hasPermission('new_web_user')) {
|
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 88: |
|
| 8 | + if(!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 87: |
|
| 13 | + if(!$modx->hasPermission('new_web_user')) {
|
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,64 +24,64 @@ discard block |
||
| 24 | 24 | // check to see the snippet editor isn't locked |
| 25 | 25 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
| 26 | 26 | if($username = $modx->db->getValue($rs)) {
|
| 27 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
| 27 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
| 31 | 31 | if($modx->manager->action == '88') {
|
| 32 | - // get user attributes |
|
| 33 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
|
|
| 34 | - $userdata = $modx->db->getRow($rs); |
|
| 35 | - if(!$userdata) {
|
|
| 36 | - $modx->webAlertAndQuit("No user returned!");
|
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - // get user settings |
|
| 40 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
|
|
| 41 | - $usersettings = array(); |
|
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | - extract($usersettings, EXTR_OVERWRITE); |
|
| 44 | - |
|
| 45 | - // get user name |
|
| 46 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
|
|
| 47 | - $usernamedata = $modx->db->getRow($rs); |
|
| 48 | - if(!$usernamedata) {
|
|
| 49 | - $modx->webAlertAndQuit("No user returned while getting username!");
|
|
| 50 | - } |
|
| 51 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
| 32 | + // get user attributes |
|
| 33 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
|
|
| 34 | + $userdata = $modx->db->getRow($rs); |
|
| 35 | + if(!$userdata) {
|
|
| 36 | + $modx->webAlertAndQuit("No user returned!");
|
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + // get user settings |
|
| 40 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
|
|
| 41 | + $usersettings = array(); |
|
| 42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | + extract($usersettings, EXTR_OVERWRITE); |
|
| 44 | + |
|
| 45 | + // get user name |
|
| 46 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
|
|
| 47 | + $usernamedata = $modx->db->getRow($rs); |
|
| 48 | + if(!$usernamedata) {
|
|
| 49 | + $modx->webAlertAndQuit("No user returned while getting username!");
|
|
| 50 | + } |
|
| 51 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
| 52 | 52 | } else {
|
| 53 | - $userdata = array(); |
|
| 54 | - $usersettings = array(); |
|
| 55 | - $usernamedata = array(); |
|
| 56 | - $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
| 53 | + $userdata = array(); |
|
| 54 | + $usersettings = array(); |
|
| 55 | + $usernamedata = array(); |
|
| 56 | + $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 60 | 60 | foreach($userdata as $key => $val) {
|
| 61 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 61 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 62 | 62 | }; |
| 63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 64 | 64 | |
| 65 | 65 | // restore saved form |
| 66 | 66 | $formRestored = false; |
| 67 | 67 | if($modx->manager->hasFormValues()) {
|
| 68 | - $modx->manager->loadFormValues(); |
|
| 69 | - // restore post values |
|
| 70 | - $userdata = array_merge($userdata, $_POST); |
|
| 71 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 72 | - $usernamedata['username'] = $userdata['newusername']; |
|
| 73 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 74 | - $usersettings = array_merge($usersettings, $userdata); |
|
| 75 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
|
|
| 76 | - extract($usersettings, EXTR_OVERWRITE); |
|
| 68 | + $modx->manager->loadFormValues(); |
|
| 69 | + // restore post values |
|
| 70 | + $userdata = array_merge($userdata, $_POST); |
|
| 71 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 72 | + $usernamedata['username'] = $userdata['newusername']; |
|
| 73 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 74 | + $usersettings = array_merge($usersettings, $userdata); |
|
| 75 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
|
|
| 76 | + extract($usersettings, EXTR_OVERWRITE); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // include the country list language file |
| 80 | 80 | $_country_lang = array(); |
| 81 | 81 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
| 82 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 82 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 83 | 83 | } else {
|
| 84 | - include_once "lang/country/english_country.inc.php"; |
|
| 84 | + include_once "lang/country/english_country.inc.php"; |
|
| 85 | 85 | } |
| 86 | 86 | asort($_country_lang); |
| 87 | 87 | |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | <form action="index.php?a=89" method="post" name="userform"> |
| 191 | 191 | <?php |
| 192 | - // invoke OnWUsrFormPrerender event |
|
| 193 | - $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
|
|
| 194 | - if(is_array($evtOut)) {
|
|
| 195 | - echo implode("", $evtOut);
|
|
| 196 | - } |
|
| 197 | - ?> |
|
| 192 | + // invoke OnWUsrFormPrerender event |
|
| 193 | + $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
|
|
| 194 | + if(is_array($evtOut)) {
|
|
| 195 | + echo implode("", $evtOut);
|
|
| 196 | + } |
|
| 197 | + ?> |
|
| 198 | 198 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>" /> |
| 199 | 199 | <input type="hidden" name="id" value="<?php echo $user ?>" /> |
| 200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 325 | 325 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 326 | 326 | <?php |
| 327 | - foreach($_country_lang as $key => $country) {
|
|
| 328 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 329 | - } |
|
| 330 | - ?> |
|
| 327 | + foreach($_country_lang as $key => $country) {
|
|
| 328 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 329 | + } |
|
| 330 | + ?> |
|
| 331 | 331 | </select></td> |
| 332 | 332 | </tr> |
| 333 | 333 | <tr> |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | <i onClick="document.userform.blockedafter.value=''; return true;" class="clearDate <?php echo $_style["actions_calendar_delete"] ?>" data-tooltip="<?php echo $_lang['remove_date']; ?>"></i></td> |
| 388 | 388 | </tr> |
| 389 | 389 | <?php |
| 390 | - } |
|
| 391 | - ?> |
|
| 390 | + } |
|
| 391 | + ?> |
|
| 392 | 392 | </table> |
| 393 | 393 | </div> |
| 394 | 394 | |
@@ -496,40 +496,40 @@ discard block |
||
| 496 | 496 | </table> |
| 497 | 497 | </div> |
| 498 | 498 | <?php |
| 499 | - if($use_udperms == 1) {
|
|
| 500 | - |
|
| 501 | - $groupsarray = array(); |
|
| 502 | - |
|
| 503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited
|
|
| 504 | - $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
|
|
| 505 | - $groupsarray = $modx->db->getColumn('webgroup', $rs);
|
|
| 506 | - } |
|
| 507 | - // retain selected user groups between post |
|
| 508 | - if(is_array($_POST['user_groups'])) {
|
|
| 509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 510 | - } |
|
| 511 | - ?> |
|
| 499 | + if($use_udperms == 1) {
|
|
| 500 | + |
|
| 501 | + $groupsarray = array(); |
|
| 502 | + |
|
| 503 | + if($modx->manager->action == '88') { // only do this bit if the user is being edited
|
|
| 504 | + $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
|
|
| 505 | + $groupsarray = $modx->db->getColumn('webgroup', $rs);
|
|
| 506 | + } |
|
| 507 | + // retain selected user groups between post |
|
| 508 | + if(is_array($_POST['user_groups'])) {
|
|
| 509 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 510 | + } |
|
| 511 | + ?> |
|
| 512 | 512 | <div class="tab-page" id="tabPermissions"> |
| 513 | 513 | <h2 class="tab"><?php echo $_lang['web_access_permissions'] ?></h2> |
| 514 | 514 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabPermissions"));</script>
|
| 515 | 515 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 516 | 516 | <?php |
| 517 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
|
|
| 518 | - while($row = $modx->db->getRow($rs)) {
|
|
| 519 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
| 520 | - } |
|
| 521 | - } |
|
| 522 | - ?> |
|
| 517 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
|
|
| 518 | + while($row = $modx->db->getRow($rs)) {
|
|
| 519 | + echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
| 520 | + } |
|
| 521 | + } |
|
| 522 | + ?> |
|
| 523 | 523 | </div> |
| 524 | 524 | <?php |
| 525 | - // invoke OnWUsrFormRender event |
|
| 526 | - $evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
|
|
| 527 | - "id" => $user |
|
| 528 | - )); |
|
| 529 | - if(is_array($evtOut)) {
|
|
| 530 | - echo implode("", $evtOut);
|
|
| 531 | - } |
|
| 532 | - ?> |
|
| 525 | + // invoke OnWUsrFormRender event |
|
| 526 | + $evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
|
|
| 527 | + "id" => $user |
|
| 528 | + )); |
|
| 529 | + if(is_array($evtOut)) {
|
|
| 530 | + echo implode("", $evtOut);
|
|
| 531 | + } |
|
| 532 | + ?> |
|
| 533 | 533 | </div> |
| 534 | 534 | </div> |
| 535 | 535 | <input type="submit" name="save" style="display:none"> |
@@ -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> |
@@ -294,32 +294,32 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | <?php |
| 296 | 296 | function render_form($name, $label, $status = '') { |
| 297 | - global $modx, $roledata; |
|
| 297 | + global $modx, $roledata; |
|
| 298 | 298 | |
| 299 | - $tpl = '<label class="d-block" for="[+name+]check"> |
|
| 299 | + $tpl = '<label class="d-block" for="[+name+]check"> |
|
| 300 | 300 | <input name="[+name+]check" id="[+name+]check" class="click" type="checkbox" onchange="changestate(document.userform.[+name+])" [+checked+] [+status+]> |
| 301 | 301 | <input type="hidden" class="[+set+]" name="[+name+]" value="[+value+]"> |
| 302 | 302 | [+label+] |
| 303 | 303 | </label>'; |
| 304 | 304 | |
| 305 | - $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
| 306 | - $value = ($roledata[$name] == 1) ? 1 : 0; |
|
| 307 | - if($status == 'disabled') { |
|
| 308 | - $checked = 'checked'; |
|
| 309 | - $value = 1; |
|
| 310 | - $set = 'fix'; |
|
| 311 | - } else { |
|
| 312 | - $set = 'set'; |
|
| 313 | - } |
|
| 305 | + $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
| 306 | + $value = ($roledata[$name] == 1) ? 1 : 0; |
|
| 307 | + if($status == 'disabled') { |
|
| 308 | + $checked = 'checked'; |
|
| 309 | + $value = 1; |
|
| 310 | + $set = 'fix'; |
|
| 311 | + } else { |
|
| 312 | + $set = 'set'; |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - $ph = array( |
|
| 316 | - 'name' => $name, |
|
| 317 | - 'checked' => $checked, |
|
| 318 | - 'status' => $status, |
|
| 319 | - 'value' => $value, |
|
| 320 | - 'label' => $label, |
|
| 321 | - 'set' => $set |
|
| 322 | - ); |
|
| 315 | + $ph = array( |
|
| 316 | + 'name' => $name, |
|
| 317 | + 'checked' => $checked, |
|
| 318 | + 'status' => $status, |
|
| 319 | + 'value' => $value, |
|
| 320 | + 'label' => $label, |
|
| 321 | + 'set' => $set |
|
| 322 | + ); |
|
| 323 | 323 | |
| 324 | - return $modx->parseText($tpl, $ph); |
|
| 324 | + return $modx->parseText($tpl, $ph); |
|
| 325 | 325 | } |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->manager->action) { |
| 7 | - case 16: |
|
| 8 | - if(!$modx->hasPermission('edit_template')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 19: |
|
| 13 | - if(!$modx->hasPermission('new_template')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 16: |
|
| 8 | + if(!$modx->hasPermission('edit_template')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 19: |
|
| 13 | + if(!$modx->hasPermission('new_template')) { |
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // check to see the snippet editor isn't locked |
| 26 | 26 | if($lockedEl = $modx->elementIsLocked(1, $id)) { |
| 27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
| 27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
@@ -33,23 +33,23 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $content = array(); |
| 35 | 35 | if(!empty($id)) { |
| 36 | - $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
| 37 | - $content = $modx->db->getRow($rs); |
|
| 38 | - if(!$content) { |
|
| 39 | - $modx->webAlertAndQuit("No database record has been found for this template."); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - $_SESSION['itemname'] = $content['templatename']; |
|
| 43 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 44 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 45 | - } |
|
| 36 | + $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
| 37 | + $content = $modx->db->getRow($rs); |
|
| 38 | + if(!$content) { |
|
| 39 | + $modx->webAlertAndQuit("No database record has been found for this template."); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + $_SESSION['itemname'] = $content['templatename']; |
|
| 43 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 44 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 45 | + } |
|
| 46 | 46 | } else { |
| 47 | - $_SESSION['itemname'] = $_lang["new_template"]; |
|
| 48 | - $content['category'] = (int)$_REQUEST['catid']; |
|
| 47 | + $_SESSION['itemname'] = $_lang["new_template"]; |
|
| 48 | + $content['category'] = (int)$_REQUEST['catid']; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if($modx->manager->hasFormValues()) { |
| 52 | - $modx->manager->loadFormValues(); |
|
| 52 | + $modx->manager->loadFormValues(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $content = array_merge($content, $_POST); |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | <form name="mutate" method="post" action="index.php"> |
| 100 | 100 | <?php |
| 101 | - // invoke OnTempFormPrerender event |
|
| 102 | - $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
| 103 | - if(is_array($evtOut)) { |
|
| 104 | - echo implode("", $evtOut); |
|
| 105 | - } |
|
| 106 | - ?> |
|
| 101 | + // invoke OnTempFormPrerender event |
|
| 102 | + $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
| 103 | + if(is_array($evtOut)) { |
|
| 104 | + echo implode("", $evtOut); |
|
| 105 | + } |
|
| 106 | + ?> |
|
| 107 | 107 | <input type="hidden" name="a" value="20"> |
| 108 | 108 | <input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>"> |
| 109 | 109 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | <label class="col-md-3 col-lg-2"> |
| 134 | 134 | <?= $_lang['template_name'] ?> |
| 135 | 135 | <?php if($id == $modx->config['default_template']) { |
| 136 | - echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
| 137 | - } ?> |
|
| 136 | + echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
| 137 | + } ?> |
|
| 138 | 138 | </label> |
| 139 | 139 | <div class="col-md-9 col-lg-10"> |
| 140 | 140 | <div class="form-control-name clearfix"> |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
| 163 | 163 | <option> </option> |
| 164 | 164 | <?php |
| 165 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 166 | - foreach(getCategories() as $n => $v) { |
|
| 167 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
| 168 | - } |
|
| 169 | - ?> |
|
| 165 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 166 | + foreach(getCategories() as $n => $v) { |
|
| 167 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
| 168 | + } |
|
| 169 | + ?> |
|
| 170 | 170 | </select> |
| 171 | 171 | </div> |
| 172 | 172 | </div> |
@@ -197,38 +197,38 @@ discard block |
||
| 197 | 197 | <input type="submit" name="save" style="display:none"> |
| 198 | 198 | |
| 199 | 199 | <?php |
| 200 | - $selectedTvs = array(); |
|
| 201 | - if(!isset($_POST['assignedTv'])) { |
|
| 202 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
| 200 | + $selectedTvs = array(); |
|
| 201 | + if(!isset($_POST['assignedTv'])) { |
|
| 202 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
| 203 | 203 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
| 204 | 204 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC" // workaround for correct sort of none-existing ranks |
| 205 | - ); |
|
| 206 | - while($row = $modx->db->getRow($rs)) { |
|
| 207 | - $selectedTvs[$row['tvid']] = $row; |
|
| 208 | - } |
|
| 209 | - $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - $unselectedTvs = array(); |
|
| 213 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
| 205 | + ); |
|
| 206 | + while($row = $modx->db->getRow($rs)) { |
|
| 207 | + $selectedTvs[$row['tvid']] = $row; |
|
| 208 | + } |
|
| 209 | + $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + $unselectedTvs = array(); |
|
| 213 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
| 214 | 214 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
| 215 | 215 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "", "category, tvcaption"); |
| 216 | - while($row = $modx->db->getRow($rs)) { |
|
| 217 | - $unselectedTvs[$row['tvid']] = $row; |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - // Catch checkboxes if form not validated |
|
| 221 | - if(isset($_POST['assignedTv'])) { |
|
| 222 | - $selectedTvs = array(); |
|
| 223 | - foreach($_POST['assignedTv'] as $tvid) { |
|
| 224 | - if(isset($unselectedTvs[$tvid])) { |
|
| 225 | - $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
| 226 | - } |
|
| 227 | - }; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - $total = count($selectedTvs); |
|
| 231 | - ?> |
|
| 216 | + while($row = $modx->db->getRow($rs)) { |
|
| 217 | + $unselectedTvs[$row['tvid']] = $row; |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + // Catch checkboxes if form not validated |
|
| 221 | + if(isset($_POST['assignedTv'])) { |
|
| 222 | + $selectedTvs = array(); |
|
| 223 | + foreach($_POST['assignedTv'] as $tvid) { |
|
| 224 | + if(isset($unselectedTvs[$tvid])) { |
|
| 225 | + $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
| 226 | + } |
|
| 227 | + }; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + $total = count($selectedTvs); |
|
| 231 | + ?> |
|
| 232 | 232 | </div> |
| 233 | 233 | |
| 234 | 234 | <div class="tab-page" id="tabAssignedTVs"> |
@@ -238,65 +238,65 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | <div class="container container-body"> |
| 240 | 240 | <?php |
| 241 | - if($total > 0) { |
|
| 242 | - echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
| 243 | - } |
|
| 244 | - if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
| 245 | - echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - // Selected TVs |
|
| 249 | - $tvList = ''; |
|
| 250 | - if($total > 0) { |
|
| 251 | - $tvList .= '<ul>'; |
|
| 252 | - foreach($selectedTvs as $row) { |
|
| 253 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 254 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 255 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
| 256 | - } |
|
| 257 | - $tvList .= '</ul>'; |
|
| 258 | - |
|
| 259 | - } else { |
|
| 260 | - echo $_lang['template_no_tv']; |
|
| 261 | - } |
|
| 262 | - echo $tvList; |
|
| 263 | - |
|
| 264 | - // Unselected TVs |
|
| 265 | - $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
| 266 | - $preCat = ''; |
|
| 267 | - $insideUl = 0; |
|
| 268 | - while($row = array_shift($unselectedTvs)) { |
|
| 269 | - if(isset($selectedTvs[$row['tvid']])) { |
|
| 270 | - continue; |
|
| 271 | - } // Skip selected |
|
| 272 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
| 273 | - if($preCat !== $row['category']) { |
|
| 274 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
| 275 | - $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 276 | - $insideUl = 1; |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 280 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 281 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
| 282 | - $tvList .= '</li>'; |
|
| 283 | - |
|
| 284 | - $preCat = $row['category']; |
|
| 285 | - } |
|
| 286 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
| 287 | - $tvList .= '</ul>'; |
|
| 288 | - echo $tvList; |
|
| 289 | - |
|
| 290 | - ?> |
|
| 241 | + if($total > 0) { |
|
| 242 | + echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
| 243 | + } |
|
| 244 | + if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
| 245 | + echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + // Selected TVs |
|
| 249 | + $tvList = ''; |
|
| 250 | + if($total > 0) { |
|
| 251 | + $tvList .= '<ul>'; |
|
| 252 | + foreach($selectedTvs as $row) { |
|
| 253 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 254 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 255 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
| 256 | + } |
|
| 257 | + $tvList .= '</ul>'; |
|
| 258 | + |
|
| 259 | + } else { |
|
| 260 | + echo $_lang['template_no_tv']; |
|
| 261 | + } |
|
| 262 | + echo $tvList; |
|
| 263 | + |
|
| 264 | + // Unselected TVs |
|
| 265 | + $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
| 266 | + $preCat = ''; |
|
| 267 | + $insideUl = 0; |
|
| 268 | + while($row = array_shift($unselectedTvs)) { |
|
| 269 | + if(isset($selectedTvs[$row['tvid']])) { |
|
| 270 | + continue; |
|
| 271 | + } // Skip selected |
|
| 272 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
| 273 | + if($preCat !== $row['category']) { |
|
| 274 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
| 275 | + $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 276 | + $insideUl = 1; |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 280 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 281 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
| 282 | + $tvList .= '</li>'; |
|
| 283 | + |
|
| 284 | + $preCat = $row['category']; |
|
| 285 | + } |
|
| 286 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
| 287 | + $tvList .= '</ul>'; |
|
| 288 | + echo $tvList; |
|
| 289 | + |
|
| 290 | + ?> |
|
| 291 | 291 | </div> |
| 292 | 292 | </div> |
| 293 | 293 | |
| 294 | 294 | <?php |
| 295 | - // invoke OnTempFormRender event |
|
| 296 | - $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
| 297 | - if(is_array($evtOut)) { |
|
| 298 | - echo implode("", $evtOut); |
|
| 299 | - } |
|
| 300 | - ?> |
|
| 295 | + // invoke OnTempFormRender event |
|
| 296 | + $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
| 297 | + if(is_array($evtOut)) { |
|
| 298 | + echo implode("", $evtOut); |
|
| 299 | + } |
|
| 300 | + ?> |
|
| 301 | 301 | </div> |
| 302 | 302 | </form> |
@@ -1,20 +1,20 @@ 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 | switch($modx->manager->action) {
|
| 6 | - case 107: |
|
| 7 | - if(!$modx->hasPermission('new_module')) {
|
|
| 8 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 9 | - } |
|
| 10 | - break; |
|
| 11 | - case 108: |
|
| 12 | - if(!$modx->hasPermission('edit_module')) {
|
|
| 13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 14 | - } |
|
| 15 | - break; |
|
| 16 | - default: |
|
| 17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + case 107: |
|
| 7 | + if(!$modx->hasPermission('new_module')) {
|
|
| 8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 9 | + } |
|
| 10 | + break; |
|
| 11 | + case 108: |
|
| 12 | + if(!$modx->hasPermission('edit_module')) {
|
|
| 13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 14 | + } |
|
| 15 | + break; |
|
| 16 | + default: |
|
| 17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | 18 | } |
| 19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
| 20 | 20 | // Get table names (alphabetical) |
@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
|
| 31 | 31 | // create globally unique identifiers (guid) |
| 32 | 32 | function createGUID() {
|
| 33 | - srand((double) microtime() * 1000000); |
|
| 34 | - $r = rand(); |
|
| 35 | - $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
| 36 | - $m = md5($u); |
|
| 37 | - return $m; |
|
| 33 | + srand((double) microtime() * 1000000); |
|
| 34 | + $r = rand(); |
|
| 35 | + $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
| 36 | + $m = md5($u); |
|
| 37 | + return $m; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // check to see the module editor isn't locked |
| 41 | 41 | if($lockedEl = $modx->elementIsLocked(6, $id)) {
|
| 42 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
| 42 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
| 43 | 43 | } |
| 44 | 44 | // end check for lock |
| 45 | 45 | |
@@ -47,22 +47,22 @@ discard block |
||
| 47 | 47 | $modx->lockElement(6, $id); |
| 48 | 48 | |
| 49 | 49 | if(isset($_GET['id'])) {
|
| 50 | - $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
|
|
| 51 | - $content = $modx->db->getRow($rs); |
|
| 52 | - if(!$content) {
|
|
| 53 | - $modx->webAlertAndQuit("Module not found for id '{$id}'.");
|
|
| 54 | - } |
|
| 55 | - $content['properties'] = str_replace("&", "&", $content['properties']);
|
|
| 56 | - $_SESSION['itemname'] = $content['name']; |
|
| 57 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
|
|
| 58 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 59 | - } |
|
| 50 | + $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
|
|
| 51 | + $content = $modx->db->getRow($rs); |
|
| 52 | + if(!$content) {
|
|
| 53 | + $modx->webAlertAndQuit("Module not found for id '{$id}'.");
|
|
| 54 | + } |
|
| 55 | + $content['properties'] = str_replace("&", "&", $content['properties']);
|
|
| 56 | + $_SESSION['itemname'] = $content['name']; |
|
| 57 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
|
|
| 58 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 59 | + } |
|
| 60 | 60 | } else {
|
| 61 | - $_SESSION['itemname'] = $_lang["new_module"]; |
|
| 62 | - $content['wrap'] = '1'; |
|
| 61 | + $_SESSION['itemname'] = $_lang["new_module"]; |
|
| 62 | + $content['wrap'] = '1'; |
|
| 63 | 63 | } |
| 64 | 64 | if($modx->manager->hasFormValues()) {
|
| 65 | - $modx->manager->loadFormValues(); |
|
| 65 | + $modx->manager->loadFormValues(); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Add lock-element JS-Script |
@@ -433,18 +433,18 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | <form name="mutate" id="mutate" class="module" method="post" action="index.php?a=109"> |
| 435 | 435 | <?php |
| 436 | - // invoke OnModFormPrerender event |
|
| 437 | - $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
|
|
| 438 | - if(is_array($evtOut)) {
|
|
| 439 | - echo implode('', $evtOut);
|
|
| 440 | - } |
|
| 441 | - |
|
| 442 | - // Prepare internal params & info-tab via parseDocBlock |
|
| 443 | - $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
| 444 | - $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
| 445 | - $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
| 446 | - $internal = array(); |
|
| 447 | - ?> |
|
| 436 | + // invoke OnModFormPrerender event |
|
| 437 | + $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
|
|
| 438 | + if(is_array($evtOut)) {
|
|
| 439 | + echo implode('', $evtOut);
|
|
| 440 | + } |
|
| 441 | + |
|
| 442 | + // Prepare internal params & info-tab via parseDocBlock |
|
| 443 | + $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
| 444 | + $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
| 445 | + $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
| 446 | + $internal = array(); |
|
| 447 | + ?> |
|
| 448 | 448 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
| 449 | 449 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
| 450 | 450 | |
@@ -497,11 +497,11 @@ discard block |
||
| 497 | 497 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
| 498 | 498 | <option> </option> |
| 499 | 499 | <?php |
| 500 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 501 | - foreach(getCategories() as $n => $v) {
|
|
| 502 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
| 503 | - } |
|
| 504 | - ?> |
|
| 500 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 501 | + foreach(getCategories() as $n => $v) {
|
|
| 502 | + echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
| 503 | + } |
|
| 504 | + ?> |
|
| 505 | 505 | </select> |
| 506 | 506 | </div> |
| 507 | 507 | </div> |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | <i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang['manage_depends'] ?></a> |
| 609 | 609 | </div> |
| 610 | 610 | <?php |
| 611 | - $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name,
|
|
| 611 | + $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name,
|
|
| 612 | 612 | CASE smd.type |
| 613 | 613 | WHEN 10 THEN 'Chunk' |
| 614 | 614 | WHEN 20 THEN 'Document' |
@@ -624,17 +624,17 @@ discard block |
||
| 624 | 624 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50
|
| 625 | 625 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name');
|
| 626 | 626 | |
| 627 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 628 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
|
|
| 629 | - $grd->noRecordMsg = $_lang['no_records_found']; |
|
| 630 | - $grd->cssClass = 'grid'; |
|
| 631 | - $grd->columnHeaderClass = 'gridHeader'; |
|
| 632 | - $grd->itemClass = 'gridItem'; |
|
| 633 | - $grd->altItemClass = 'gridAltItem'; |
|
| 634 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
| 635 | - $grd->fields = "name,type"; |
|
| 636 | - echo $grd->render(); |
|
| 637 | - ?> |
|
| 627 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 628 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
|
|
| 629 | + $grd->noRecordMsg = $_lang['no_records_found']; |
|
| 630 | + $grd->cssClass = 'grid'; |
|
| 631 | + $grd->columnHeaderClass = 'gridHeader'; |
|
| 632 | + $grd->itemClass = 'gridItem'; |
|
| 633 | + $grd->altItemClass = 'gridAltItem'; |
|
| 634 | + $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
| 635 | + $grd->fields = "name,type"; |
|
| 636 | + echo $grd->render(); |
|
| 637 | + ?> |
|
| 638 | 638 | </div> |
| 639 | 639 | </div> |
| 640 | 640 | <?php endif; ?> |
@@ -646,12 +646,12 @@ discard block |
||
| 646 | 646 | <div class="container container-body"> |
| 647 | 647 | <?php if($use_udperms == 1) : ?> |
| 648 | 648 | <?php |
| 649 | - // fetch user access permissions for the module |
|
| 650 | - $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
|
|
| 651 | - $groupsarray = $modx->db->getColumn('usergroup', $rs);
|
|
| 649 | + // fetch user access permissions for the module |
|
| 650 | + $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
|
|
| 651 | + $groupsarray = $modx->db->getColumn('usergroup', $rs);
|
|
| 652 | 652 | |
| 653 | - if($modx->hasPermission('access_permissions')) {
|
|
| 654 | - ?> |
|
| 653 | + if($modx->hasPermission('access_permissions')) {
|
|
| 654 | + ?> |
|
| 655 | 655 | <!-- User Group Access Permissions --> |
| 656 | 656 | <script type="text/javascript"> |
| 657 | 657 | function makePublic(b) {
|
@@ -675,28 +675,28 @@ discard block |
||
| 675 | 675 | </script> |
| 676 | 676 | <p><?= $_lang['module_group_access_msg'] ?></p> |
| 677 | 677 | <?php |
| 678 | - } |
|
| 679 | - $chk = ''; |
|
| 680 | - $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
|
|
| 681 | - while($row = $modx->db->getRow($rs)) {
|
|
| 682 | - $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
| 683 | - $checked = in_array($row['id'], $groupsarray); |
|
| 684 | - if($modx->hasPermission('access_permissions')) {
|
|
| 685 | - if($checked) {
|
|
| 686 | - $notPublic = true; |
|
| 687 | - } |
|
| 688 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
| 689 | - } else {
|
|
| 690 | - if($checked) {
|
|
| 691 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
| 692 | - } |
|
| 693 | - } |
|
| 694 | - } |
|
| 695 | - if($modx->hasPermission('access_permissions')) {
|
|
| 696 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
| 697 | - } |
|
| 698 | - echo $chks; |
|
| 699 | - ?> |
|
| 678 | + } |
|
| 679 | + $chk = ''; |
|
| 680 | + $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
|
|
| 681 | + while($row = $modx->db->getRow($rs)) {
|
|
| 682 | + $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
| 683 | + $checked = in_array($row['id'], $groupsarray); |
|
| 684 | + if($modx->hasPermission('access_permissions')) {
|
|
| 685 | + if($checked) {
|
|
| 686 | + $notPublic = true; |
|
| 687 | + } |
|
| 688 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
| 689 | + } else {
|
|
| 690 | + if($checked) {
|
|
| 691 | + $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
| 692 | + } |
|
| 693 | + } |
|
| 694 | + } |
|
| 695 | + if($modx->hasPermission('access_permissions')) {
|
|
| 696 | + $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
| 697 | + } |
|
| 698 | + echo $chks; |
|
| 699 | + ?> |
|
| 700 | 700 | <?php endif; ?> |
| 701 | 701 | </div> |
| 702 | 702 | </div> |
@@ -712,11 +712,11 @@ discard block |
||
| 712 | 712 | |
| 713 | 713 | <input type="submit" name="save" style="display:none;"> |
| 714 | 714 | <?php |
| 715 | - // invoke OnModFormRender event |
|
| 716 | - $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
|
|
| 717 | - if(is_array($evtOut)) {
|
|
| 718 | - echo implode('', $evtOut);
|
|
| 719 | - } |
|
| 720 | - ?> |
|
| 715 | + // invoke OnModFormRender event |
|
| 716 | + $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
|
|
| 717 | + if(is_array($evtOut)) {
|
|
| 718 | + echo implode('', $evtOut);
|
|
| 719 | + } |
|
| 720 | + ?> |
|
| 721 | 721 | </form> |
| 722 | 722 | <script type="text/javascript">setTimeout('showParameters();', 10);</script>
|
@@ -1,10 +1,10 @@ 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 | if(!$modx->hasPermission('edit_module')) { |
| 7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -26,91 +26,91 @@ discard block |
||
| 26 | 26 | // check to see the editor isn't locked |
| 27 | 27 | $rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
| 28 | 28 | if($username = $modx->db->getValue($rs)) { |
| 29 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
| 29 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
| 30 | 30 | } |
| 31 | 31 | // end check for lock |
| 32 | 32 | |
| 33 | 33 | // take action |
| 34 | 34 | switch($_REQUEST['op']) { |
| 35 | - case 'add': |
|
| 36 | - // convert ids to numbers |
|
| 37 | - $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
| 38 | - |
|
| 39 | - if(count($opids) > 0) { |
|
| 40 | - // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
| 41 | - $rt = strtolower($_REQUEST["rt"]); |
|
| 42 | - if($rt == 'chunk') { |
|
| 43 | - $type = 10; |
|
| 44 | - } |
|
| 45 | - if($rt == 'doc') { |
|
| 46 | - $type = 20; |
|
| 47 | - } |
|
| 48 | - if($rt == 'plug') { |
|
| 49 | - $type = 30; |
|
| 50 | - } |
|
| 51 | - if($rt == 'snip') { |
|
| 52 | - $type = 40; |
|
| 53 | - } |
|
| 54 | - if($rt == 'tpl') { |
|
| 55 | - $type = 50; |
|
| 56 | - } |
|
| 57 | - if($rt == 'tv') { |
|
| 58 | - $type = 60; |
|
| 59 | - } |
|
| 60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | - foreach($opids as $opid) { |
|
| 62 | - $modx->db->insert(array( |
|
| 63 | - 'module' => $id, |
|
| 64 | - 'resource' => $opid, |
|
| 65 | - 'type' => $type, |
|
| 66 | - ), $tbl_site_module_depobj); |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - break; |
|
| 70 | - case 'del': |
|
| 71 | - // convert ids to numbers |
|
| 72 | - $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
| 73 | - |
|
| 74 | - // get resources that needs to be removed |
|
| 75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 76 | - // loop through resources and look for plugins and snippets |
|
| 77 | - $plids = array(); |
|
| 78 | - $snid = array(); |
|
| 79 | - while($row = $modx->db->getRow($ds)) { |
|
| 80 | - if($row['type'] == '30') { |
|
| 81 | - $plids[$i] = $row['resource']; |
|
| 82 | - } |
|
| 83 | - if($row['type'] == '40') { |
|
| 84 | - $snids[$i] = $row['resource']; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - // get guid |
|
| 88 | - $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
| 89 | - $guid = $modx->db->getValue($ds); |
|
| 90 | - // reset moduleguid for deleted resources |
|
| 91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | - if($cp) { |
|
| 93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 94 | - } |
|
| 95 | - if($cs) { |
|
| 96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 97 | - } |
|
| 98 | - // reset cache |
|
| 99 | - $modx->clearCache('full'); |
|
| 100 | - } |
|
| 101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 102 | - break; |
|
| 35 | + case 'add': |
|
| 36 | + // convert ids to numbers |
|
| 37 | + $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
| 38 | + |
|
| 39 | + if(count($opids) > 0) { |
|
| 40 | + // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
| 41 | + $rt = strtolower($_REQUEST["rt"]); |
|
| 42 | + if($rt == 'chunk') { |
|
| 43 | + $type = 10; |
|
| 44 | + } |
|
| 45 | + if($rt == 'doc') { |
|
| 46 | + $type = 20; |
|
| 47 | + } |
|
| 48 | + if($rt == 'plug') { |
|
| 49 | + $type = 30; |
|
| 50 | + } |
|
| 51 | + if($rt == 'snip') { |
|
| 52 | + $type = 40; |
|
| 53 | + } |
|
| 54 | + if($rt == 'tpl') { |
|
| 55 | + $type = 50; |
|
| 56 | + } |
|
| 57 | + if($rt == 'tv') { |
|
| 58 | + $type = 60; |
|
| 59 | + } |
|
| 60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | + foreach($opids as $opid) { |
|
| 62 | + $modx->db->insert(array( |
|
| 63 | + 'module' => $id, |
|
| 64 | + 'resource' => $opid, |
|
| 65 | + 'type' => $type, |
|
| 66 | + ), $tbl_site_module_depobj); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + break; |
|
| 70 | + case 'del': |
|
| 71 | + // convert ids to numbers |
|
| 72 | + $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
| 73 | + |
|
| 74 | + // get resources that needs to be removed |
|
| 75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 76 | + // loop through resources and look for plugins and snippets |
|
| 77 | + $plids = array(); |
|
| 78 | + $snid = array(); |
|
| 79 | + while($row = $modx->db->getRow($ds)) { |
|
| 80 | + if($row['type'] == '30') { |
|
| 81 | + $plids[$i] = $row['resource']; |
|
| 82 | + } |
|
| 83 | + if($row['type'] == '40') { |
|
| 84 | + $snids[$i] = $row['resource']; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + // get guid |
|
| 88 | + $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
| 89 | + $guid = $modx->db->getValue($ds); |
|
| 90 | + // reset moduleguid for deleted resources |
|
| 91 | + if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | + if($cp) { |
|
| 93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 94 | + } |
|
| 95 | + if($cs) { |
|
| 96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 97 | + } |
|
| 98 | + // reset cache |
|
| 99 | + $modx->clearCache('full'); |
|
| 100 | + } |
|
| 101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 102 | + break; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // load record |
| 106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
| 107 | 107 | $content = $modx->db->getRow($rs); |
| 108 | 108 | if(!$content) { |
| 109 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
| 109 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
| 110 | 110 | } |
| 111 | 111 | $_SESSION['itemname'] = $content['name']; |
| 112 | 112 | if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
| 113 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 113 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | ?> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | <tr> |
| 204 | 204 | <td valign="top" align="left"> |
| 205 | 205 | <?php |
| 206 | - $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
| 206 | + $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
| 207 | 207 | CASE smd.type |
| 208 | 208 | WHEN 10 THEN 'Chunk' |
| 209 | 209 | WHEN 20 THEN 'Document' |
@@ -218,18 +218,18 @@ discard block |
||
| 218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
| 219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
| 220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
| 221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 222 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
| 223 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 224 | - $grd->cssClass = "grid"; |
|
| 225 | - $grd->columnHeaderClass = "gridHeader"; |
|
| 226 | - $grd->itemClass = "gridItem"; |
|
| 227 | - $grd->altItemClass = "gridAltItem"; |
|
| 228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 229 | - $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
| 230 | - $grd->fields = "name,type"; |
|
| 231 | - echo $grd->render(); |
|
| 232 | - ?> |
|
| 221 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 222 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
| 223 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 224 | + $grd->cssClass = "grid"; |
|
| 225 | + $grd->columnHeaderClass = "gridHeader"; |
|
| 226 | + $grd->itemClass = "gridItem"; |
|
| 227 | + $grd->altItemClass = "gridAltItem"; |
|
| 228 | + $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 229 | + $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
| 230 | + $grd->fields = "name,type"; |
|
| 231 | + echo $grd->render(); |
|
| 232 | + ?> |
|
| 233 | 233 | </td> |
| 234 | 234 | <td valign="top" style="width: 150px;"> |
| 235 | 235 | <a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a> |