@@ -102,19 +102,19 @@ |
||
| 102 | 102 | $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']); |
| 103 | 103 | |
| 104 | 104 | switch ($modx->config['manager_theme_mode']) { |
| 105 | - case '1': |
|
| 105 | + case '1': |
|
| 106 | 106 | $modx->setPlaceholder('manager_theme_style', 'lightness'); |
| 107 | 107 | break; |
| 108 | - case '2': |
|
| 108 | + case '2': |
|
| 109 | 109 | $modx->setPlaceholder('manager_theme_style', 'light'); |
| 110 | 110 | break; |
| 111 | - case '3': |
|
| 111 | + case '3': |
|
| 112 | 112 | $modx->setPlaceholder('manager_theme_style', 'dark'); |
| 113 | 113 | break; |
| 114 | - case '4': |
|
| 114 | + case '4': |
|
| 115 | 115 | $modx->setPlaceholder('manager_theme_style', 'darkness'); |
| 116 | 116 | break; |
| 117 | - } |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | 119 | // andrazk 20070416 - notify user of install/update |
| 120 | 120 | if (isset($_GET['installGoingOn'])) { |
@@ -4,237 +4,237 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | $sitemenu['bars'] = array( |
| 7 | - 'bars', |
|
| 8 | - 'main', |
|
| 9 | - '<i class="fa fa-bars"></i>', |
|
| 10 | - 'javascript:;', |
|
| 11 | - $_lang['home'], |
|
| 12 | - 'modx.resizer.toggle(); return false;', |
|
| 13 | - ' return false;', |
|
| 14 | - '', |
|
| 15 | - 0, |
|
| 16 | - 10, |
|
| 17 | - '' |
|
| 7 | + 'bars', |
|
| 8 | + 'main', |
|
| 9 | + '<i class="fa fa-bars"></i>', |
|
| 10 | + 'javascript:;', |
|
| 11 | + $_lang['home'], |
|
| 12 | + 'modx.resizer.toggle(); return false;', |
|
| 13 | + ' return false;', |
|
| 14 | + '', |
|
| 15 | + 0, |
|
| 16 | + 10, |
|
| 17 | + '' |
|
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | 20 | //mainMenu |
| 21 | 21 | $sitemenu['site'] = array( |
| 22 | - 'site', |
|
| 23 | - 'main', |
|
| 24 | - '<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>', |
|
| 25 | - 'index.php?a=2', |
|
| 26 | - $_lang['home'], |
|
| 27 | - '', |
|
| 28 | - '', |
|
| 29 | - 'main', |
|
| 30 | - 0, |
|
| 31 | - 10, |
|
| 32 | - 'active' |
|
| 22 | + 'site', |
|
| 23 | + 'main', |
|
| 24 | + '<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>', |
|
| 25 | + 'index.php?a=2', |
|
| 26 | + $_lang['home'], |
|
| 27 | + '', |
|
| 28 | + '', |
|
| 29 | + 'main', |
|
| 30 | + 0, |
|
| 31 | + 10, |
|
| 32 | + 'active' |
|
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
|
| 36 | - $sitemenu['elements'] = array( |
|
| 37 | - 'elements', |
|
| 38 | - 'main', |
|
| 39 | - '<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>', |
|
| 40 | - 'javascript:;', |
|
| 41 | - $_lang['elements'], |
|
| 42 | - ' return false;', |
|
| 43 | - '', |
|
| 44 | - '', |
|
| 45 | - 0, |
|
| 46 | - 20, |
|
| 47 | - '' |
|
| 48 | - ); |
|
| 36 | + $sitemenu['elements'] = array( |
|
| 37 | + 'elements', |
|
| 38 | + 'main', |
|
| 39 | + '<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>', |
|
| 40 | + 'javascript:;', |
|
| 41 | + $_lang['elements'], |
|
| 42 | + ' return false;', |
|
| 43 | + '', |
|
| 44 | + '', |
|
| 45 | + 0, |
|
| 46 | + 20, |
|
| 47 | + '' |
|
| 48 | + ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if($modx->hasPermission('exec_module')) {
|
| 52 | - $sitemenu['modules'] = array( |
|
| 53 | - 'modules', |
|
| 54 | - 'main', |
|
| 55 | - '<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>', |
|
| 56 | - 'javascript:;', |
|
| 57 | - $_lang['modules'], |
|
| 58 | - ' return false;', |
|
| 59 | - '', |
|
| 60 | - '', |
|
| 61 | - 0, |
|
| 62 | - 30, |
|
| 63 | - '' |
|
| 64 | - ); |
|
| 52 | + $sitemenu['modules'] = array( |
|
| 53 | + 'modules', |
|
| 54 | + 'main', |
|
| 55 | + '<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>', |
|
| 56 | + 'javascript:;', |
|
| 57 | + $_lang['modules'], |
|
| 58 | + ' return false;', |
|
| 59 | + '', |
|
| 60 | + '', |
|
| 61 | + 0, |
|
| 62 | + 30, |
|
| 63 | + '' |
|
| 64 | + ); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
|
| 68 | - $sitemenu['users'] = array( |
|
| 69 | - 'users', |
|
| 70 | - 'main', |
|
| 71 | - '<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>', |
|
| 72 | - 'javascript:;', |
|
| 73 | - $_lang['users'], |
|
| 74 | - ' return false;', |
|
| 75 | - 'edit_user', |
|
| 76 | - '', |
|
| 77 | - 0, |
|
| 78 | - 40, |
|
| 79 | - '' |
|
| 80 | - ); |
|
| 68 | + $sitemenu['users'] = array( |
|
| 69 | + 'users', |
|
| 70 | + 'main', |
|
| 71 | + '<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>', |
|
| 72 | + 'javascript:;', |
|
| 73 | + $_lang['users'], |
|
| 74 | + ' return false;', |
|
| 75 | + 'edit_user', |
|
| 76 | + '', |
|
| 77 | + 0, |
|
| 78 | + 40, |
|
| 79 | + '' |
|
| 80 | + ); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
|
| 84 | - $sitemenu['tools'] = array( |
|
| 85 | - 'tools', |
|
| 86 | - 'main', |
|
| 87 | - '<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>', |
|
| 88 | - 'javascript:;', |
|
| 89 | - $_lang['tools'], |
|
| 90 | - ' return false;', |
|
| 91 | - '', |
|
| 92 | - '', |
|
| 93 | - 0, |
|
| 94 | - 50, |
|
| 95 | - '' |
|
| 96 | - ); |
|
| 84 | + $sitemenu['tools'] = array( |
|
| 85 | + 'tools', |
|
| 86 | + 'main', |
|
| 87 | + '<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>', |
|
| 88 | + 'javascript:;', |
|
| 89 | + $_lang['tools'], |
|
| 90 | + ' return false;', |
|
| 91 | + '', |
|
| 92 | + '', |
|
| 93 | + 0, |
|
| 94 | + 50, |
|
| 95 | + '' |
|
| 96 | + ); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $tab = 0; |
| 100 | 100 | if($modx->hasPermission('edit_template')) {
|
| 101 | - $sitemenu['element_templates'] = array( |
|
| 102 | - 'element_templates', |
|
| 103 | - 'elements', |
|
| 104 | - '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 105 | - 'index.php?a=76&tab=' . $tab++, |
|
| 106 | - $_lang['manage_templates'], |
|
| 107 | - '', |
|
| 108 | - 'new_template,edit_template', |
|
| 109 | - 'main', |
|
| 110 | - 0, |
|
| 111 | - 10, |
|
| 112 | - 'dropdown-toggle' |
|
| 113 | - ); |
|
| 101 | + $sitemenu['element_templates'] = array( |
|
| 102 | + 'element_templates', |
|
| 103 | + 'elements', |
|
| 104 | + '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 105 | + 'index.php?a=76&tab=' . $tab++, |
|
| 106 | + $_lang['manage_templates'], |
|
| 107 | + '', |
|
| 108 | + 'new_template,edit_template', |
|
| 109 | + 'main', |
|
| 110 | + 0, |
|
| 111 | + 10, |
|
| 112 | + 'dropdown-toggle' |
|
| 113 | + ); |
|
| 114 | 114 | } |
| 115 | 115 | if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
|
| 116 | - $sitemenu['element_tplvars'] = array( |
|
| 117 | - 'element_tplvars', |
|
| 118 | - 'elements', |
|
| 119 | - '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 120 | - 'index.php?a=76&tab=' . $tab++, |
|
| 121 | - $_lang['tmplvars'], |
|
| 122 | - '', |
|
| 123 | - 'new_template,edit_template', |
|
| 124 | - 'main', |
|
| 125 | - 0, |
|
| 126 | - 20, |
|
| 127 | - 'dropdown-toggle' |
|
| 128 | - ); |
|
| 116 | + $sitemenu['element_tplvars'] = array( |
|
| 117 | + 'element_tplvars', |
|
| 118 | + 'elements', |
|
| 119 | + '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 120 | + 'index.php?a=76&tab=' . $tab++, |
|
| 121 | + $_lang['tmplvars'], |
|
| 122 | + '', |
|
| 123 | + 'new_template,edit_template', |
|
| 124 | + 'main', |
|
| 125 | + 0, |
|
| 126 | + 20, |
|
| 127 | + 'dropdown-toggle' |
|
| 128 | + ); |
|
| 129 | 129 | } |
| 130 | 130 | if($modx->hasPermission('edit_chunk')) {
|
| 131 | - $sitemenu['element_htmlsnippets'] = array( |
|
| 132 | - 'element_htmlsnippets', |
|
| 133 | - 'elements', |
|
| 134 | - '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 135 | - 'index.php?a=76&tab=' . $tab++, |
|
| 136 | - $_lang['manage_htmlsnippets'], |
|
| 137 | - '', |
|
| 138 | - 'new_chunk,edit_chunk', |
|
| 139 | - 'main', |
|
| 140 | - 0, |
|
| 141 | - 30, |
|
| 142 | - 'dropdown-toggle' |
|
| 143 | - ); |
|
| 131 | + $sitemenu['element_htmlsnippets'] = array( |
|
| 132 | + 'element_htmlsnippets', |
|
| 133 | + 'elements', |
|
| 134 | + '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 135 | + 'index.php?a=76&tab=' . $tab++, |
|
| 136 | + $_lang['manage_htmlsnippets'], |
|
| 137 | + '', |
|
| 138 | + 'new_chunk,edit_chunk', |
|
| 139 | + 'main', |
|
| 140 | + 0, |
|
| 141 | + 30, |
|
| 142 | + 'dropdown-toggle' |
|
| 143 | + ); |
|
| 144 | 144 | } |
| 145 | 145 | if($modx->hasPermission('edit_snippet')) {
|
| 146 | - $sitemenu['element_snippets'] = array( |
|
| 147 | - 'element_snippets', |
|
| 148 | - 'elements', |
|
| 149 | - '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 150 | - 'index.php?a=76&tab=' . $tab++, |
|
| 151 | - $_lang['manage_snippets'], |
|
| 152 | - '', |
|
| 153 | - 'new_snippet,edit_snippet', |
|
| 154 | - 'main', |
|
| 155 | - 0, |
|
| 156 | - 40, |
|
| 157 | - 'dropdown-toggle' |
|
| 158 | - ); |
|
| 146 | + $sitemenu['element_snippets'] = array( |
|
| 147 | + 'element_snippets', |
|
| 148 | + 'elements', |
|
| 149 | + '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 150 | + 'index.php?a=76&tab=' . $tab++, |
|
| 151 | + $_lang['manage_snippets'], |
|
| 152 | + '', |
|
| 153 | + 'new_snippet,edit_snippet', |
|
| 154 | + 'main', |
|
| 155 | + 0, |
|
| 156 | + 40, |
|
| 157 | + 'dropdown-toggle' |
|
| 158 | + ); |
|
| 159 | 159 | } |
| 160 | 160 | if($modx->hasPermission('edit_plugin')) {
|
| 161 | - $sitemenu['element_plugins'] = array( |
|
| 162 | - 'element_plugins', |
|
| 163 | - 'elements', |
|
| 164 | - '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 165 | - 'index.php?a=76&tab=' . $tab++, |
|
| 166 | - $_lang['manage_plugins'], |
|
| 167 | - '', |
|
| 168 | - 'new_plugin,edit_plugin', |
|
| 169 | - 'main', |
|
| 170 | - 0, |
|
| 171 | - 50, |
|
| 172 | - 'dropdown-toggle' |
|
| 173 | - ); |
|
| 161 | + $sitemenu['element_plugins'] = array( |
|
| 162 | + 'element_plugins', |
|
| 163 | + 'elements', |
|
| 164 | + '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 165 | + 'index.php?a=76&tab=' . $tab++, |
|
| 166 | + $_lang['manage_plugins'], |
|
| 167 | + '', |
|
| 168 | + 'new_plugin,edit_plugin', |
|
| 169 | + 'main', |
|
| 170 | + 0, |
|
| 171 | + 50, |
|
| 172 | + 'dropdown-toggle' |
|
| 173 | + ); |
|
| 174 | 174 | } |
| 175 | 175 | //$sitemenu['element_categories'] = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,'');
|
| 176 | 176 | |
| 177 | 177 | if($modx->hasPermission('file_manager')) {
|
| 178 | - $sitemenu['manage_files'] = array( |
|
| 179 | - 'manage_files', |
|
| 180 | - 'elements', |
|
| 181 | - '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
| 182 | - 'index.php?a=31', |
|
| 183 | - $_lang['manage_files'], |
|
| 184 | - '', |
|
| 185 | - 'file_manager', |
|
| 186 | - 'main', |
|
| 187 | - 0, |
|
| 188 | - 80, |
|
| 189 | - '' |
|
| 190 | - ); |
|
| 178 | + $sitemenu['manage_files'] = array( |
|
| 179 | + 'manage_files', |
|
| 180 | + 'elements', |
|
| 181 | + '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
| 182 | + 'index.php?a=31', |
|
| 183 | + $_lang['manage_files'], |
|
| 184 | + '', |
|
| 185 | + 'file_manager', |
|
| 186 | + 'main', |
|
| 187 | + 0, |
|
| 188 | + 80, |
|
| 189 | + '' |
|
| 190 | + ); |
|
| 191 | 191 | } |
| 192 | 192 | if($modx->hasPermission('category_manager')) {
|
| 193 | - $sitemenu['manage_categories'] = array( |
|
| 194 | - 'manage_categories', |
|
| 195 | - 'elements', |
|
| 196 | - '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
| 197 | - 'index.php?a=120', |
|
| 198 | - $_lang['manage_categories'], |
|
| 199 | - '', |
|
| 200 | - 'category_manager', |
|
| 201 | - 'main', |
|
| 202 | - 0, |
|
| 203 | - 70, |
|
| 204 | - '' |
|
| 205 | - ); |
|
| 193 | + $sitemenu['manage_categories'] = array( |
|
| 194 | + 'manage_categories', |
|
| 195 | + 'elements', |
|
| 196 | + '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
| 197 | + 'index.php?a=120', |
|
| 198 | + $_lang['manage_categories'], |
|
| 199 | + '', |
|
| 200 | + 'category_manager', |
|
| 201 | + 'main', |
|
| 202 | + 0, |
|
| 203 | + 70, |
|
| 204 | + '' |
|
| 205 | + ); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // Modules Menu Items |
| 209 | 209 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
|
| 210 | - $sitemenu['new_module'] = array( |
|
| 211 | - 'new_module', |
|
| 212 | - 'modules', |
|
| 213 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
| 214 | - 'index.php?a=106', |
|
| 215 | - $_lang['module_management'], |
|
| 216 | - '', |
|
| 217 | - 'new_module,edit_module', |
|
| 218 | - 'main', |
|
| 219 | - 1, |
|
| 220 | - 0, |
|
| 221 | - '' |
|
| 222 | - ); |
|
| 210 | + $sitemenu['new_module'] = array( |
|
| 211 | + 'new_module', |
|
| 212 | + 'modules', |
|
| 213 | + '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
| 214 | + 'index.php?a=106', |
|
| 215 | + $_lang['module_management'], |
|
| 216 | + '', |
|
| 217 | + 'new_module,edit_module', |
|
| 218 | + 'main', |
|
| 219 | + 1, |
|
| 220 | + 0, |
|
| 221 | + '' |
|
| 222 | + ); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if($modx->hasPermission('exec_module')) {
|
| 226 | - if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
|
|
| 227 | - $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
|
|
| 226 | + if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
|
|
| 227 | + $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
|
|
| 228 | 228 | FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
|
| 229 | 229 | LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
|
| 230 | 230 | LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
|
| 231 | 231 | WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
| 232 | 232 | ORDER BY sm.name'); |
| 233 | - } else {
|
|
| 234 | - $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
|
|
| 235 | - } |
|
| 236 | - if($modx->db->getRecordCount($rs)) {
|
|
| 237 | - while ($row = $modx->db->getRow($rs)) {
|
|
| 233 | + } else {
|
|
| 234 | + $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
|
|
| 235 | + } |
|
| 236 | + if($modx->db->getRecordCount($rs)) {
|
|
| 237 | + while ($row = $modx->db->getRow($rs)) {
|
|
| 238 | 238 | $sitemenu['module' . $row['id']] = array( |
| 239 | 239 | 'module' . $row['id'], |
| 240 | 240 | 'modules', |
@@ -255,83 +255,83 @@ discard block |
||
| 255 | 255 | // security menu items (users) |
| 256 | 256 | |
| 257 | 257 | if($modx->hasPermission('edit_user')) {
|
| 258 | - $sitemenu['user_management_title'] = array( |
|
| 259 | - 'user_management_title', |
|
| 260 | - 'users', |
|
| 261 | - '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 262 | - 'index.php?a=75', |
|
| 263 | - $_lang['user_management_title'], |
|
| 264 | - '', |
|
| 265 | - 'edit_user', |
|
| 266 | - 'main', |
|
| 267 | - 0, |
|
| 268 | - 10, |
|
| 269 | - 'dropdown-toggle' |
|
| 270 | - ); |
|
| 258 | + $sitemenu['user_management_title'] = array( |
|
| 259 | + 'user_management_title', |
|
| 260 | + 'users', |
|
| 261 | + '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 262 | + 'index.php?a=75', |
|
| 263 | + $_lang['user_management_title'], |
|
| 264 | + '', |
|
| 265 | + 'edit_user', |
|
| 266 | + 'main', |
|
| 267 | + 0, |
|
| 268 | + 10, |
|
| 269 | + 'dropdown-toggle' |
|
| 270 | + ); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if($modx->hasPermission('edit_web_user')) {
|
| 274 | - $sitemenu['web_user_management_title'] = array( |
|
| 275 | - 'web_user_management_title', |
|
| 276 | - 'users', |
|
| 277 | - '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 278 | - 'index.php?a=99', |
|
| 279 | - $_lang['web_user_management_title'], |
|
| 280 | - '', |
|
| 281 | - 'edit_web_user', |
|
| 282 | - 'main', |
|
| 283 | - 0, |
|
| 284 | - 20, |
|
| 285 | - 'dropdown-toggle' |
|
| 286 | - ); |
|
| 274 | + $sitemenu['web_user_management_title'] = array( |
|
| 275 | + 'web_user_management_title', |
|
| 276 | + 'users', |
|
| 277 | + '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
| 278 | + 'index.php?a=99', |
|
| 279 | + $_lang['web_user_management_title'], |
|
| 280 | + '', |
|
| 281 | + 'edit_web_user', |
|
| 282 | + 'main', |
|
| 283 | + 0, |
|
| 284 | + 20, |
|
| 285 | + 'dropdown-toggle' |
|
| 286 | + ); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | if($modx->hasPermission('edit_role')) {
|
| 290 | - $sitemenu['role_management_title'] = array( |
|
| 291 | - 'role_management_title', |
|
| 292 | - 'users', |
|
| 293 | - '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
| 294 | - 'index.php?a=86', |
|
| 295 | - $_lang['role_management_title'], |
|
| 296 | - '', |
|
| 297 | - 'new_role,edit_role,delete_role', |
|
| 298 | - 'main', |
|
| 299 | - 0, |
|
| 300 | - 30, |
|
| 301 | - '' |
|
| 302 | - ); |
|
| 290 | + $sitemenu['role_management_title'] = array( |
|
| 291 | + 'role_management_title', |
|
| 292 | + 'users', |
|
| 293 | + '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
| 294 | + 'index.php?a=86', |
|
| 295 | + $_lang['role_management_title'], |
|
| 296 | + '', |
|
| 297 | + 'new_role,edit_role,delete_role', |
|
| 298 | + 'main', |
|
| 299 | + 0, |
|
| 300 | + 30, |
|
| 301 | + '' |
|
| 302 | + ); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | if($modx->hasPermission('access_permissions')) {
|
| 306 | - $sitemenu['manager_permissions'] = array( |
|
| 307 | - 'manager_permissions', |
|
| 308 | - 'users', |
|
| 309 | - '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
| 310 | - 'index.php?a=40', |
|
| 311 | - $_lang['manager_permissions'], |
|
| 312 | - '', |
|
| 313 | - 'access_permissions', |
|
| 314 | - 'main', |
|
| 315 | - 0, |
|
| 316 | - 40, |
|
| 317 | - '' |
|
| 318 | - ); |
|
| 306 | + $sitemenu['manager_permissions'] = array( |
|
| 307 | + 'manager_permissions', |
|
| 308 | + 'users', |
|
| 309 | + '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
| 310 | + 'index.php?a=40', |
|
| 311 | + $_lang['manager_permissions'], |
|
| 312 | + '', |
|
| 313 | + 'access_permissions', |
|
| 314 | + 'main', |
|
| 315 | + 0, |
|
| 316 | + 40, |
|
| 317 | + '' |
|
| 318 | + ); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | if($modx->hasPermission('web_access_permissions')) {
|
| 322 | - $sitemenu['web_permissions'] = array( |
|
| 323 | - 'web_permissions', |
|
| 324 | - 'users', |
|
| 325 | - '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
| 326 | - 'index.php?a=91', |
|
| 327 | - $_lang['web_permissions'], |
|
| 328 | - '', |
|
| 329 | - 'web_access_permissions', |
|
| 330 | - 'main', |
|
| 331 | - 0, |
|
| 332 | - 50, |
|
| 333 | - '' |
|
| 334 | - ); |
|
| 322 | + $sitemenu['web_permissions'] = array( |
|
| 323 | + 'web_permissions', |
|
| 324 | + 'users', |
|
| 325 | + '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
| 326 | + 'index.php?a=91', |
|
| 327 | + $_lang['web_permissions'], |
|
| 328 | + '', |
|
| 329 | + 'web_access_permissions', |
|
| 330 | + 'main', |
|
| 331 | + 0, |
|
| 332 | + 50, |
|
| 333 | + '' |
|
| 334 | + ); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | // Tools Menu |
@@ -361,104 +361,104 @@ discard block |
||
| 361 | 361 | ); |
| 362 | 362 | |
| 363 | 363 | $sitemenu['search'] = array( |
| 364 | - 'search', |
|
| 365 | - 'tools', |
|
| 366 | - '<i class="fa fa-search"></i>' . $_lang['search'], |
|
| 367 | - 'index.php?a=71', |
|
| 368 | - $_lang['search'], |
|
| 369 | - '', |
|
| 370 | - '', |
|
| 371 | - 'main', |
|
| 372 | - 1, |
|
| 373 | - 9, |
|
| 374 | - '' |
|
| 364 | + 'search', |
|
| 365 | + 'tools', |
|
| 366 | + '<i class="fa fa-search"></i>' . $_lang['search'], |
|
| 367 | + 'index.php?a=71', |
|
| 368 | + $_lang['search'], |
|
| 369 | + '', |
|
| 370 | + '', |
|
| 371 | + 'main', |
|
| 372 | + 1, |
|
| 373 | + 9, |
|
| 374 | + '' |
|
| 375 | 375 | ); |
| 376 | 376 | |
| 377 | 377 | if($modx->hasPermission('bk_manager')) {
|
| 378 | - $sitemenu['bk_manager'] = array( |
|
| 379 | - 'bk_manager', |
|
| 380 | - 'tools', |
|
| 381 | - '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
| 382 | - 'index.php?a=93', |
|
| 383 | - $_lang['bk_manager'], |
|
| 384 | - '', |
|
| 385 | - 'bk_manager', |
|
| 386 | - 'main', |
|
| 387 | - 0, |
|
| 388 | - 10, |
|
| 389 | - '' |
|
| 390 | - ); |
|
| 378 | + $sitemenu['bk_manager'] = array( |
|
| 379 | + 'bk_manager', |
|
| 380 | + 'tools', |
|
| 381 | + '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
| 382 | + 'index.php?a=93', |
|
| 383 | + $_lang['bk_manager'], |
|
| 384 | + '', |
|
| 385 | + 'bk_manager', |
|
| 386 | + 'main', |
|
| 387 | + 0, |
|
| 388 | + 10, |
|
| 389 | + '' |
|
| 390 | + ); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | if($modx->hasPermission('remove_locks')) {
|
| 394 | - $sitemenu['remove_locks'] = array( |
|
| 395 | - 'remove_locks', |
|
| 396 | - 'tools', |
|
| 397 | - '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
| 398 | - 'javascript:modx.removeLocks();', |
|
| 399 | - $_lang['remove_locks'], |
|
| 400 | - '', |
|
| 401 | - 'remove_locks', |
|
| 402 | - '', |
|
| 403 | - 0, |
|
| 404 | - 20, |
|
| 405 | - '' |
|
| 406 | - ); |
|
| 394 | + $sitemenu['remove_locks'] = array( |
|
| 395 | + 'remove_locks', |
|
| 396 | + 'tools', |
|
| 397 | + '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
| 398 | + 'javascript:modx.removeLocks();', |
|
| 399 | + $_lang['remove_locks'], |
|
| 400 | + '', |
|
| 401 | + 'remove_locks', |
|
| 402 | + '', |
|
| 403 | + 0, |
|
| 404 | + 20, |
|
| 405 | + '' |
|
| 406 | + ); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | if($modx->hasPermission('import_static')) {
|
| 410 | - $sitemenu['import_site'] = array( |
|
| 411 | - 'import_site', |
|
| 412 | - 'tools', |
|
| 413 | - '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
| 414 | - 'index.php?a=95', |
|
| 415 | - $_lang['import_site'], |
|
| 416 | - '', |
|
| 417 | - 'import_static', |
|
| 418 | - 'main', |
|
| 419 | - 0, |
|
| 420 | - 30, |
|
| 421 | - '' |
|
| 422 | - ); |
|
| 410 | + $sitemenu['import_site'] = array( |
|
| 411 | + 'import_site', |
|
| 412 | + 'tools', |
|
| 413 | + '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
| 414 | + 'index.php?a=95', |
|
| 415 | + $_lang['import_site'], |
|
| 416 | + '', |
|
| 417 | + 'import_static', |
|
| 418 | + 'main', |
|
| 419 | + 0, |
|
| 420 | + 30, |
|
| 421 | + '' |
|
| 422 | + ); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | if($modx->hasPermission('export_static')) {
|
| 426 | - $sitemenu['export_site'] = array( |
|
| 427 | - 'export_site', |
|
| 428 | - 'tools', |
|
| 429 | - '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
| 430 | - 'index.php?a=83', |
|
| 431 | - $_lang['export_site'], |
|
| 432 | - '', |
|
| 433 | - 'export_static', |
|
| 434 | - 'main', |
|
| 435 | - 1, |
|
| 436 | - 40, |
|
| 437 | - '' |
|
| 438 | - ); |
|
| 426 | + $sitemenu['export_site'] = array( |
|
| 427 | + 'export_site', |
|
| 428 | + 'tools', |
|
| 429 | + '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
| 430 | + 'index.php?a=83', |
|
| 431 | + $_lang['export_site'], |
|
| 432 | + '', |
|
| 433 | + 'export_static', |
|
| 434 | + 'main', |
|
| 435 | + 1, |
|
| 436 | + 40, |
|
| 437 | + '' |
|
| 438 | + ); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu));
|
| 442 | 442 | if(is_array($menu)) {
|
| 443 | - $newmenu = array(); |
|
| 444 | - foreach($menu as $item){
|
|
| 445 | - if(is_array(unserialize($item))){
|
|
| 446 | - $newmenu = array_merge($newmenu, unserialize($item)); |
|
| 447 | - } |
|
| 448 | - } |
|
| 449 | - if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
| 443 | + $newmenu = array(); |
|
| 444 | + foreach($menu as $item){
|
|
| 445 | + if(is_array(unserialize($item))){
|
|
| 446 | + $newmenu = array_merge($newmenu, unserialize($item)); |
|
| 447 | + } |
|
| 448 | + } |
|
| 449 | + if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) {
|
| 453 | - include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
| 453 | + include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
| 454 | 454 | } else {
|
| 455 | - include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
| 455 | + include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
| 456 | 456 | } |
| 457 | 457 | $menu = new EVOmenu(); |
| 458 | 458 | $menu->Build($sitemenu, array( |
| 459 | - 'outerClass' => 'nav', |
|
| 460 | - 'innerClass' => 'dropdown-menu', |
|
| 461 | - 'parentClass' => 'dropdown', |
|
| 459 | + 'outerClass' => 'nav', |
|
| 460 | + 'innerClass' => 'dropdown-menu', |
|
| 461 | + 'parentClass' => 'dropdown', |
|
| 462 | 462 | 'parentLinkClass' => 'dropdown-toggle', |
| 463 | 463 | 'parentLinkAttr' => '', |
| 464 | 464 | 'parentLinkIn' => '' |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('save_web_user')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $tbl_web_users = $modx->getFullTableName('web_users'); |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $input = $_POST; |
| 14 | 14 | foreach($input as $k => $v) { |
| 15 | - if($k !== 'comment') { |
|
| 16 | - $v = sanitize($v); |
|
| 17 | - } |
|
| 18 | - $input[$k] = $v; |
|
| 15 | + if($k !== 'comment') { |
|
| 16 | + $v = sanitize($v); |
|
| 17 | + } |
|
| 18 | + $input[$k] = $v; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $id = (int)$input['id']; |
@@ -51,82 +51,82 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // verify password |
| 53 | 53 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
| 54 | - webAlertAndQuit("Password typed is mismatched"); |
|
| 54 | + webAlertAndQuit("Password typed is mismatched"); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // verify email |
| 58 | 58 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
| 59 | - webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
| 59 | + webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | switch($input['mode']) { |
| 63 | - case '87' : // new user |
|
| 64 | - // check if this user name already exist |
|
| 65 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
| 66 | - $limit = $modx->db->getValue($rs); |
|
| 67 | - if($limit > 0) { |
|
| 68 | - webAlertAndQuit("User name is already in use!"); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // check if the email address already exist |
|
| 72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 73 | - $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
| 74 | - $limit = $modx->db->getValue($rs); |
|
| 75 | - if($limit > 0) { |
|
| 76 | - webAlertAndQuit("Email is already in use!"); |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // generate a new password for this user |
|
| 81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | - if(strlen($specifiedpassword) < 6) { |
|
| 83 | - webAlertAndQuit("Password is too short!"); |
|
| 84 | - } else { |
|
| 85 | - $newpassword = $specifiedpassword; |
|
| 86 | - } |
|
| 87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 89 | - } elseif($passwordgenmethod == 'g') { |
|
| 90 | - $newpassword = generate_password(8); |
|
| 91 | - } else { |
|
| 92 | - webAlertAndQuit("No password generation method specified!"); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - // invoke OnBeforeWUsrFormSave event |
|
| 96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 97 | - "mode" => "new", |
|
| 98 | - )); |
|
| 99 | - |
|
| 100 | - // create the user account |
|
| 101 | - $field = array(); |
|
| 102 | - $field['username'] = $esc_newusername; |
|
| 103 | - $field['password'] = md5($newpassword); |
|
| 104 | - $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
| 105 | - |
|
| 106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 107 | - $field = $modx->db->escape($field); |
|
| 108 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
| 109 | - |
|
| 110 | - // Save User Settings |
|
| 111 | - saveUserSettings($internalKey); |
|
| 112 | - |
|
| 113 | - // Set the item name for logger |
|
| 114 | - $_SESSION['itemname'] = $newusername; |
|
| 115 | - |
|
| 116 | - /*******************************************************************************/ |
|
| 117 | - // put the user in the user_groups he/ she should be in |
|
| 118 | - // first, check that up_perms are switched on! |
|
| 119 | - if($use_udperms == 1) { |
|
| 120 | - if(!empty($user_groups)) { |
|
| 121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | - $f = array(); |
|
| 123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
| 124 | - $f['webuser'] = $internalKey; |
|
| 125 | - $modx->db->insert($f, $tbl_web_groups); |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - // end of user_groups stuff! |
|
| 63 | + case '87' : // new user |
|
| 64 | + // check if this user name already exist |
|
| 65 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
| 66 | + $limit = $modx->db->getValue($rs); |
|
| 67 | + if($limit > 0) { |
|
| 68 | + webAlertAndQuit("User name is already in use!"); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + // check if the email address already exist |
|
| 72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 73 | + $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
| 74 | + $limit = $modx->db->getValue($rs); |
|
| 75 | + if($limit > 0) { |
|
| 76 | + webAlertAndQuit("Email is already in use!"); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // generate a new password for this user |
|
| 81 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | + if(strlen($specifiedpassword) < 6) { |
|
| 83 | + webAlertAndQuit("Password is too short!"); |
|
| 84 | + } else { |
|
| 85 | + $newpassword = $specifiedpassword; |
|
| 86 | + } |
|
| 87 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 89 | + } elseif($passwordgenmethod == 'g') { |
|
| 90 | + $newpassword = generate_password(8); |
|
| 91 | + } else { |
|
| 92 | + webAlertAndQuit("No password generation method specified!"); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + // invoke OnBeforeWUsrFormSave event |
|
| 96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 97 | + "mode" => "new", |
|
| 98 | + )); |
|
| 99 | + |
|
| 100 | + // create the user account |
|
| 101 | + $field = array(); |
|
| 102 | + $field['username'] = $esc_newusername; |
|
| 103 | + $field['password'] = md5($newpassword); |
|
| 104 | + $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
| 105 | + |
|
| 106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 107 | + $field = $modx->db->escape($field); |
|
| 108 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
| 109 | + |
|
| 110 | + // Save User Settings |
|
| 111 | + saveUserSettings($internalKey); |
|
| 112 | + |
|
| 113 | + // Set the item name for logger |
|
| 114 | + $_SESSION['itemname'] = $newusername; |
|
| 115 | + |
|
| 116 | + /*******************************************************************************/ |
|
| 117 | + // put the user in the user_groups he/ she should be in |
|
| 118 | + // first, check that up_perms are switched on! |
|
| 119 | + if($use_udperms == 1) { |
|
| 120 | + if(!empty($user_groups)) { |
|
| 121 | + for($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | + $f = array(); |
|
| 123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
| 124 | + $f['webuser'] = $internalKey; |
|
| 125 | + $modx->db->insert($f, $tbl_web_groups); |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + // end of user_groups stuff! |
|
| 130 | 130 | |
| 131 | 131 | // invoke OnWebSaveUser event |
| 132 | 132 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -144,26 +144,26 @@ discard block |
||
| 144 | 144 | "id" => $internalKey |
| 145 | 145 | )); |
| 146 | 146 | |
| 147 | - if($passwordnotifymethod == 'e') { |
|
| 148 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 149 | - if($input['stay'] != '') { |
|
| 150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 152 | - header($header); |
|
| 153 | - } else { |
|
| 154 | - $header = "Location: index.php?a=99&r=2"; |
|
| 155 | - header($header); |
|
| 156 | - } |
|
| 157 | - } else { |
|
| 158 | - if($input['stay'] != '') { |
|
| 159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | - } else { |
|
| 162 | - $stayUrl = "index.php?a=99&r=2"; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - include_once "header.inc.php"; |
|
| 166 | - ?> |
|
| 147 | + if($passwordnotifymethod == 'e') { |
|
| 148 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 149 | + if($input['stay'] != '') { |
|
| 150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 152 | + header($header); |
|
| 153 | + } else { |
|
| 154 | + $header = "Location: index.php?a=99&r=2"; |
|
| 155 | + header($header); |
|
| 156 | + } |
|
| 157 | + } else { |
|
| 158 | + if($input['stay'] != '') { |
|
| 159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | + } else { |
|
| 162 | + $stayUrl = "index.php?a=99&r=2"; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + include_once "header.inc.php"; |
|
| 166 | + ?> |
|
| 167 | 167 | |
| 168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
| 169 | 169 | |
@@ -185,86 +185,86 @@ discard block |
||
| 185 | 185 | </div> |
| 186 | 186 | <?php |
| 187 | 187 | |
| 188 | - include_once "footer.inc.php"; |
|
| 189 | - } |
|
| 190 | - break; |
|
| 191 | - case '88' : // edit user |
|
| 192 | - // generate a new password for this user |
|
| 193 | - if($genpassword == 1) { |
|
| 194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | - if(strlen($specifiedpassword) < 6) { |
|
| 196 | - webAlertAndQuit("Password is too short!"); |
|
| 197 | - } else { |
|
| 198 | - $newpassword = $specifiedpassword; |
|
| 199 | - } |
|
| 200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 201 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 202 | - } elseif($passwordgenmethod == 'g') { |
|
| 203 | - $newpassword = generate_password(8); |
|
| 204 | - } else { |
|
| 205 | - webAlertAndQuit("No password generation method specified!"); |
|
| 206 | - } |
|
| 207 | - } |
|
| 208 | - if($passwordnotifymethod == 'e') { |
|
| 209 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - // check if the username already exist |
|
| 213 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
| 214 | - $limit = $modx->db->getValue($rs); |
|
| 215 | - if($limit > 0) { |
|
| 216 | - webAlertAndQuit("User name is already in use!"); |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - // check if the email address already exists |
|
| 220 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 221 | - $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
| 222 | - $limit = $modx->db->getValue($rs); |
|
| 223 | - if($limit > 0) { |
|
| 224 | - webAlertAndQuit("Email is already in use!"); |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - // invoke OnBeforeWUsrFormSave event |
|
| 229 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 230 | - "mode" => "upd", |
|
| 231 | - "id" => $id |
|
| 232 | - )); |
|
| 233 | - |
|
| 234 | - // update user name and password |
|
| 235 | - $field = array(); |
|
| 236 | - $field['username'] = $esc_newusername; |
|
| 237 | - if($genpassword == 1) { |
|
| 238 | - $field['password'] = md5($newpassword); |
|
| 239 | - } |
|
| 240 | - $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
| 241 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 242 | - $field = $modx->db->escape($field); |
|
| 243 | - $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
| 244 | - |
|
| 245 | - // Save User Settings |
|
| 246 | - saveUserSettings($id); |
|
| 247 | - |
|
| 248 | - // Set the item name for logger |
|
| 249 | - $_SESSION['itemname'] = $newusername; |
|
| 250 | - |
|
| 251 | - /*******************************************************************************/ |
|
| 252 | - // put the user in the user_groups he/ she should be in |
|
| 253 | - // first, check that up_perms are switched on! |
|
| 254 | - if($use_udperms == 1) { |
|
| 255 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 256 | - $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
| 257 | - if(!empty($user_groups)) { |
|
| 258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 259 | - $field = array(); |
|
| 260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
| 261 | - $field['webuser'] = $id; |
|
| 262 | - $modx->db->insert($field, $tbl_web_groups); |
|
| 263 | - } |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - // end of user_groups stuff! |
|
| 267 | - /*******************************************************************************/ |
|
| 188 | + include_once "footer.inc.php"; |
|
| 189 | + } |
|
| 190 | + break; |
|
| 191 | + case '88' : // edit user |
|
| 192 | + // generate a new password for this user |
|
| 193 | + if($genpassword == 1) { |
|
| 194 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | + if(strlen($specifiedpassword) < 6) { |
|
| 196 | + webAlertAndQuit("Password is too short!"); |
|
| 197 | + } else { |
|
| 198 | + $newpassword = $specifiedpassword; |
|
| 199 | + } |
|
| 200 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 201 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 202 | + } elseif($passwordgenmethod == 'g') { |
|
| 203 | + $newpassword = generate_password(8); |
|
| 204 | + } else { |
|
| 205 | + webAlertAndQuit("No password generation method specified!"); |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | + if($passwordnotifymethod == 'e') { |
|
| 209 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + // check if the username already exist |
|
| 213 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
| 214 | + $limit = $modx->db->getValue($rs); |
|
| 215 | + if($limit > 0) { |
|
| 216 | + webAlertAndQuit("User name is already in use!"); |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + // check if the email address already exists |
|
| 220 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 221 | + $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
| 222 | + $limit = $modx->db->getValue($rs); |
|
| 223 | + if($limit > 0) { |
|
| 224 | + webAlertAndQuit("Email is already in use!"); |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + // invoke OnBeforeWUsrFormSave event |
|
| 229 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 230 | + "mode" => "upd", |
|
| 231 | + "id" => $id |
|
| 232 | + )); |
|
| 233 | + |
|
| 234 | + // update user name and password |
|
| 235 | + $field = array(); |
|
| 236 | + $field['username'] = $esc_newusername; |
|
| 237 | + if($genpassword == 1) { |
|
| 238 | + $field['password'] = md5($newpassword); |
|
| 239 | + } |
|
| 240 | + $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
| 241 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 242 | + $field = $modx->db->escape($field); |
|
| 243 | + $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
| 244 | + |
|
| 245 | + // Save User Settings |
|
| 246 | + saveUserSettings($id); |
|
| 247 | + |
|
| 248 | + // Set the item name for logger |
|
| 249 | + $_SESSION['itemname'] = $newusername; |
|
| 250 | + |
|
| 251 | + /*******************************************************************************/ |
|
| 252 | + // put the user in the user_groups he/ she should be in |
|
| 253 | + // first, check that up_perms are switched on! |
|
| 254 | + if($use_udperms == 1) { |
|
| 255 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 256 | + $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
| 257 | + if(!empty($user_groups)) { |
|
| 258 | + for($i = 0; $i < count($user_groups); $i++) { |
|
| 259 | + $field = array(); |
|
| 260 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
| 261 | + $field['webuser'] = $id; |
|
| 262 | + $modx->db->insert($field, $tbl_web_groups); |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + // end of user_groups stuff! |
|
| 267 | + /*******************************************************************************/ |
|
| 268 | 268 | |
| 269 | 269 | // invoke OnWebSaveUser event |
| 270 | 270 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -293,16 +293,16 @@ discard block |
||
| 293 | 293 | "id" => $id |
| 294 | 294 | )); |
| 295 | 295 | |
| 296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | - if($input['stay'] != '') { |
|
| 298 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 300 | - } else { |
|
| 301 | - $stayUrl = "index.php?a=99&r=2"; |
|
| 302 | - } |
|
| 296 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | + if($input['stay'] != '') { |
|
| 298 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 299 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 300 | + } else { |
|
| 301 | + $stayUrl = "index.php?a=99&r=2"; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - include_once "header.inc.php"; |
|
| 305 | - ?> |
|
| 304 | + include_once "header.inc.php"; |
|
| 305 | + ?> |
|
| 306 | 306 | |
| 307 | 307 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
| 308 | 308 | |
@@ -322,20 +322,20 @@ discard block |
||
| 322 | 322 | </div> |
| 323 | 323 | <?php |
| 324 | 324 | |
| 325 | - include_once "footer.inc.php"; |
|
| 326 | - } else { |
|
| 327 | - if($input['stay'] != '') { |
|
| 328 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 330 | - header($header); |
|
| 331 | - } else { |
|
| 332 | - $header = "Location: index.php?a=99&r=2"; |
|
| 333 | - header($header); |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - break; |
|
| 337 | - default : |
|
| 338 | - webAlertAndQuit("No operation set in request."); |
|
| 325 | + include_once "footer.inc.php"; |
|
| 326 | + } else { |
|
| 327 | + if($input['stay'] != '') { |
|
| 328 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 329 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 330 | + header($header); |
|
| 331 | + } else { |
|
| 332 | + $header = "Location: index.php?a=99&r=2"; |
|
| 333 | + header($header); |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + break; |
|
| 337 | + default : |
|
| 338 | + webAlertAndQuit("No operation set in request."); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
@@ -345,14 +345,14 @@ discard block |
||
| 345 | 345 | * @return string |
| 346 | 346 | */ |
| 347 | 347 | function save_user_quoted_printable($string) { |
| 348 | - $crlf = "\n"; |
|
| 349 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
| 350 | - $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
|
| 351 | - $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
|
| 352 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
| 353 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
| 354 | - $string = preg_replace($f, $r, $string); |
|
| 355 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
| 348 | + $crlf = "\n"; |
|
| 349 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
| 350 | + $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
|
| 351 | + $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
|
| 352 | + $f[] = '/([\011\040])' . $crlf . '/e'; |
|
| 353 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
| 354 | + $string = preg_replace($f, $r, $string); |
|
| 355 | + return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -364,94 +364,94 @@ discard block |
||
| 364 | 364 | * @param string $ufn |
| 365 | 365 | */ |
| 366 | 366 | function sendMailMessage($email, $uid, $pwd, $ufn) { |
| 367 | - $modx = evolutionCMS(); global $_lang, $websignupemail_message; |
|
| 368 | - global $emailsubject, $emailsender; |
|
| 369 | - global $site_name, $site_url; |
|
| 370 | - $message = sprintf($websignupemail_message, $uid, $pwd); // use old method |
|
| 371 | - // replace placeholders |
|
| 372 | - $message = str_replace("[+uid+]", $uid, $message); |
|
| 373 | - $message = str_replace("[+pwd+]", $pwd, $message); |
|
| 374 | - $message = str_replace("[+ufn+]", $ufn, $message); |
|
| 375 | - $message = str_replace("[+sname+]", $site_name, $message); |
|
| 376 | - $message = str_replace("[+saddr+]", $emailsender, $message); |
|
| 377 | - $message = str_replace("[+semail+]", $emailsender, $message); |
|
| 378 | - $message = str_replace("[+surl+]", $site_url, $message); |
|
| 379 | - |
|
| 380 | - $param = array(); |
|
| 381 | - $param['from'] = "{$site_name}<{$emailsender}>"; |
|
| 382 | - $param['subject'] = $emailsubject; |
|
| 383 | - $param['body'] = $message; |
|
| 384 | - $param['to'] = $email; |
|
| 385 | - $param['type'] = 'text'; |
|
| 386 | - $rs = $modx->sendmail($param); |
|
| 387 | - if(!$rs) { |
|
| 388 | - $modx->manager->saveFormValues(); |
|
| 389 | - $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
| 390 | - } |
|
| 367 | + $modx = evolutionCMS(); global $_lang, $websignupemail_message; |
|
| 368 | + global $emailsubject, $emailsender; |
|
| 369 | + global $site_name, $site_url; |
|
| 370 | + $message = sprintf($websignupemail_message, $uid, $pwd); // use old method |
|
| 371 | + // replace placeholders |
|
| 372 | + $message = str_replace("[+uid+]", $uid, $message); |
|
| 373 | + $message = str_replace("[+pwd+]", $pwd, $message); |
|
| 374 | + $message = str_replace("[+ufn+]", $ufn, $message); |
|
| 375 | + $message = str_replace("[+sname+]", $site_name, $message); |
|
| 376 | + $message = str_replace("[+saddr+]", $emailsender, $message); |
|
| 377 | + $message = str_replace("[+semail+]", $emailsender, $message); |
|
| 378 | + $message = str_replace("[+surl+]", $site_url, $message); |
|
| 379 | + |
|
| 380 | + $param = array(); |
|
| 381 | + $param['from'] = "{$site_name}<{$emailsender}>"; |
|
| 382 | + $param['subject'] = $emailsubject; |
|
| 383 | + $param['body'] = $message; |
|
| 384 | + $param['to'] = $email; |
|
| 385 | + $param['type'] = 'text'; |
|
| 386 | + $rs = $modx->sendmail($param); |
|
| 387 | + if(!$rs) { |
|
| 388 | + $modx->manager->saveFormValues(); |
|
| 389 | + $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
| 390 | + } |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // Save User Settings |
| 394 | 394 | function saveUserSettings($id) { |
| 395 | - $modx = evolutionCMS(); |
|
| 396 | - $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
|
| 397 | - |
|
| 398 | - $settings = array( |
|
| 399 | - "login_home", |
|
| 400 | - "allowed_ip", |
|
| 401 | - "allowed_days" |
|
| 402 | - ); |
|
| 403 | - |
|
| 404 | - $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
|
| 405 | - |
|
| 406 | - foreach($settings as $n) { |
|
| 407 | - $vl = $_POST[$n]; |
|
| 408 | - if(is_array($vl)) { |
|
| 409 | - $vl = implode(",", $vl); |
|
| 410 | - } |
|
| 411 | - if($vl != '') { |
|
| 412 | - $f = array(); |
|
| 413 | - $f['webuser'] = $id; |
|
| 414 | - $f['setting_name'] = $n; |
|
| 415 | - $f['setting_value'] = $vl; |
|
| 416 | - $f = $modx->db->escape($f); |
|
| 417 | - $modx->db->insert($f, $tbl_web_user_settings); |
|
| 418 | - } |
|
| 419 | - } |
|
| 395 | + $modx = evolutionCMS(); |
|
| 396 | + $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
|
| 397 | + |
|
| 398 | + $settings = array( |
|
| 399 | + "login_home", |
|
| 400 | + "allowed_ip", |
|
| 401 | + "allowed_days" |
|
| 402 | + ); |
|
| 403 | + |
|
| 404 | + $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
|
| 405 | + |
|
| 406 | + foreach($settings as $n) { |
|
| 407 | + $vl = $_POST[$n]; |
|
| 408 | + if(is_array($vl)) { |
|
| 409 | + $vl = implode(",", $vl); |
|
| 410 | + } |
|
| 411 | + if($vl != '') { |
|
| 412 | + $f = array(); |
|
| 413 | + $f['webuser'] = $id; |
|
| 414 | + $f['setting_name'] = $n; |
|
| 415 | + $f['setting_value'] = $vl; |
|
| 416 | + $f = $modx->db->escape($f); |
|
| 417 | + $modx->db->insert($f, $tbl_web_user_settings); |
|
| 418 | + } |
|
| 419 | + } |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // Web alert - sends an alert to web browser |
| 423 | 423 | function webAlertAndQuit($msg) { |
| 424 | - global $id, $modx; |
|
| 425 | - $mode = $_POST['mode']; |
|
| 426 | - $modx->manager->saveFormValues($mode); |
|
| 427 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
| 424 | + global $id, $modx; |
|
| 425 | + $mode = $_POST['mode']; |
|
| 426 | + $modx->manager->saveFormValues($mode); |
|
| 427 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // Generate password |
| 431 | 431 | function generate_password($length = 10) { |
| 432 | - $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
| 433 | - $ps_len = strlen($allowable_characters); |
|
| 434 | - mt_srand((double) microtime() * 1000000); |
|
| 435 | - $pass = ""; |
|
| 436 | - for($i = 0; $i < $length; $i++) { |
|
| 437 | - $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
| 438 | - } |
|
| 439 | - return $pass; |
|
| 432 | + $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
| 433 | + $ps_len = strlen($allowable_characters); |
|
| 434 | + mt_srand((double) microtime() * 1000000); |
|
| 435 | + $pass = ""; |
|
| 436 | + for($i = 0; $i < $length; $i++) { |
|
| 437 | + $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
| 438 | + } |
|
| 439 | + return $pass; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | function sanitize($str = '', $safecount = 0) { |
| 443 | - $modx = evolutionCMS(); |
|
| 444 | - $safecount++; |
|
| 445 | - if(1000 < $safecount) { |
|
| 446 | - exit("error too many loops '{$safecount}'"); |
|
| 447 | - } |
|
| 448 | - if(is_array($str)) { |
|
| 449 | - foreach($str as $i => $v) { |
|
| 450 | - $str[$i] = sanitize($v, $safecount); |
|
| 451 | - } |
|
| 452 | - } else { |
|
| 453 | - // $str = strip_tags($str); // LEAVE < and > intact |
|
| 454 | - $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 455 | - } |
|
| 456 | - return $str; |
|
| 443 | + $modx = evolutionCMS(); |
|
| 444 | + $safecount++; |
|
| 445 | + if(1000 < $safecount) { |
|
| 446 | + exit("error too many loops '{$safecount}'"); |
|
| 447 | + } |
|
| 448 | + if(is_array($str)) { |
|
| 449 | + foreach($str as $i => $v) { |
|
| 450 | + $str[$i] = sanitize($v, $safecount); |
|
| 451 | + } |
|
| 452 | + } else { |
|
| 453 | + // $str = strip_tags($str); // LEAVE < and > intact |
|
| 454 | + $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 455 | + } |
|
| 456 | + return $str; |
|
| 457 | 457 | } |
@@ -3,51 +3,51 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('exec_module')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | 15 | if($_SESSION['mgrRole']!=1){ |
| 16 | - $rs = $modx->db->select( |
|
| 17 | - 'sma.usergroup,mg.member', |
|
| 18 | - $modx->getFullTableName("site_module_access")." sma |
|
| 16 | + $rs = $modx->db->select( |
|
| 17 | + 'sma.usergroup,mg.member', |
|
| 18 | + $modx->getFullTableName("site_module_access")." sma |
|
| 19 | 19 | LEFT JOIN ".$modx->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'", |
| 20 | - "sma.module = '{$id}'" |
|
| 21 | - ); |
|
| 22 | - //initialize permission to -1, if it stays -1 no permissions |
|
| 23 | - //attached so permission granted |
|
| 24 | - $permissionAccessInt = -1; |
|
| 20 | + "sma.module = '{$id}'" |
|
| 21 | + ); |
|
| 22 | + //initialize permission to -1, if it stays -1 no permissions |
|
| 23 | + //attached so permission granted |
|
| 24 | + $permissionAccessInt = -1; |
|
| 25 | 25 | |
| 26 | - while ($row = $modx->db->getRow($rs)) { |
|
| 27 | - if($row["usergroup"] && $row["member"]) { |
|
| 28 | - //if there are permissions and this member has permission, ofcourse |
|
| 29 | - //this is granted |
|
| 30 | - $permissionAccessInt = 1; |
|
| 31 | - } elseif ($permissionAccessInt==-1) { |
|
| 32 | - //if there are permissions but this member has no permission and the |
|
| 33 | - //variable was still in init state we set permission to 0; no permissions |
|
| 34 | - $permissionAccessInt = 0; |
|
| 35 | - } |
|
| 36 | - } |
|
| 26 | + while ($row = $modx->db->getRow($rs)) { |
|
| 27 | + if($row["usergroup"] && $row["member"]) { |
|
| 28 | + //if there are permissions and this member has permission, ofcourse |
|
| 29 | + //this is granted |
|
| 30 | + $permissionAccessInt = 1; |
|
| 31 | + } elseif ($permissionAccessInt==-1) { |
|
| 32 | + //if there are permissions but this member has no permission and the |
|
| 33 | + //variable was still in init state we set permission to 0; no permissions |
|
| 34 | + $permissionAccessInt = 0; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - if($permissionAccessInt==0) { |
|
| 39 | - $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
| 40 | - } |
|
| 38 | + if($permissionAccessInt==0) { |
|
| 39 | + $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
| 40 | + } |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // get module data |
| 44 | 44 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
| 45 | 45 | $content = $modx->db->getRow($rs); |
| 46 | 46 | if(!$content) { |
| 47 | - $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
| 47 | + $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
| 48 | 48 | } |
| 49 | 49 | if($content['disabled']) { |
| 50 | - $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
| 50 | + $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Set the item name for logger |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $output = evalModule($content["modulecode"],$parameter); |
| 64 | 64 | if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
| 65 | - echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
| 65 | + echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
| 66 | 66 | } |
| 67 | 67 | echo $output; |
| 68 | 68 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
@@ -75,38 +75,38 @@ discard block |
||
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | 77 | function evalModule($moduleCode,$params){ |
| 78 | - $modx = evolutionCMS(); |
|
| 79 | - $modx->event->params = &$params; // store params inside event object |
|
| 80 | - if(is_array($params)) { |
|
| 81 | - extract($params, EXTR_SKIP); |
|
| 82 | - } |
|
| 83 | - ob_start(); |
|
| 84 | - $mod = eval($moduleCode); |
|
| 85 | - $msg = ob_get_contents(); |
|
| 86 | - ob_end_clean(); |
|
| 87 | - if (isset($php_errormsg)) |
|
| 88 | - { |
|
| 89 | - $error_info = error_get_last(); |
|
| 78 | + $modx = evolutionCMS(); |
|
| 79 | + $modx->event->params = &$params; // store params inside event object |
|
| 80 | + if(is_array($params)) { |
|
| 81 | + extract($params, EXTR_SKIP); |
|
| 82 | + } |
|
| 83 | + ob_start(); |
|
| 84 | + $mod = eval($moduleCode); |
|
| 85 | + $msg = ob_get_contents(); |
|
| 86 | + ob_end_clean(); |
|
| 87 | + if (isset($php_errormsg)) |
|
| 88 | + { |
|
| 89 | + $error_info = error_get_last(); |
|
| 90 | 90 | switch($error_info['type']) |
| 91 | 91 | { |
| 92 | - case E_NOTICE : |
|
| 93 | - $error_level = 1; |
|
| 94 | - case E_USER_NOTICE : |
|
| 95 | - break; |
|
| 96 | - case E_DEPRECATED : |
|
| 97 | - case E_USER_DEPRECATED : |
|
| 98 | - case E_STRICT : |
|
| 99 | - $error_level = 2; |
|
| 100 | - break; |
|
| 101 | - default: |
|
| 102 | - $error_level = 99; |
|
| 92 | + case E_NOTICE : |
|
| 93 | + $error_level = 1; |
|
| 94 | + case E_USER_NOTICE : |
|
| 95 | + break; |
|
| 96 | + case E_DEPRECATED : |
|
| 97 | + case E_USER_DEPRECATED : |
|
| 98 | + case E_STRICT : |
|
| 99 | + $error_level = 2; |
|
| 100 | + break; |
|
| 101 | + default: |
|
| 102 | + $error_level = 99; |
|
| 103 | + } |
|
| 104 | + if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 105 | + { |
|
| 106 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | + $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
|
| 103 | 108 | } |
| 104 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 105 | - { |
|
| 106 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | - $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - unset($modx->event->params); |
|
| 111 | - return $mod.$msg; |
|
| 109 | + } |
|
| 110 | + unset($modx->event->params); |
|
| 111 | + return $mod.$msg; |
|
| 112 | 112 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
| 3 | - header('HTTP/1.0 404 Not Found'); |
|
| 4 | - exit('error'); |
|
| 3 | + header('HTTP/1.0 404 Not Found'); |
|
| 4 | + exit('error'); |
|
| 5 | 5 | } |
| 6 | 6 | define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
| 7 | 7 | define('MODX_API_MODE', true); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | include_once("{$core_path}lang/english.inc.php"); |
| 19 | 19 | |
| 20 | 20 | if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
| 21 | - include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
| 21 | + include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | // include the logger |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | // Initialize System Alert Message Queque |
| 28 | 28 | if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
| 29 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
| 29 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
| 30 | 30 | } |
| 31 | 31 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
| 32 | 32 | |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // invoke OnBeforeManagerLogin event |
| 43 | 43 | $modx->invokeEvent('OnBeforeManagerLogin', array( |
| 44 | - 'username' => $username, |
|
| 45 | - 'userpassword' => $givenPassword, |
|
| 46 | - 'rememberme' => $rememberme |
|
| 47 | - )); |
|
| 44 | + 'username' => $username, |
|
| 45 | + 'userpassword' => $givenPassword, |
|
| 46 | + 'rememberme' => $rememberme |
|
| 47 | + )); |
|
| 48 | 48 | $fields = 'mu.*, ua.*'; |
| 49 | 49 | $from = '[+prefix+]manager_users AS mu, [+prefix+]user_attributes AS ua'; |
| 50 | 50 | $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id"; |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | $limit = $modx->db->getRecordCount($rs); |
| 53 | 53 | |
| 54 | 54 | if($limit == 0 || $limit > 1) { |
| 55 | - jsAlert($_lang['login_processor_unknown_user']); |
|
| 56 | - return; |
|
| 55 | + jsAlert($_lang['login_processor_unknown_user']); |
|
| 56 | + return; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $row = $modx->db->getRow($rs); |
@@ -74,127 +74,127 @@ discard block |
||
| 74 | 74 | // get the user settings from the database |
| 75 | 75 | $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
| 76 | 76 | while($row = $modx->db->getRow($rs)) { |
| 77 | - extract($row); |
|
| 78 | - ${$setting_name} = $setting_value; |
|
| 77 | + extract($row); |
|
| 78 | + ${$setting_name} = $setting_value; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // blocked due to number of login errors. |
| 82 | 82 | if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
| 83 | - @session_destroy(); |
|
| 84 | - session_unset(); |
|
| 85 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
| 86 | - $ip = $cip; |
|
| 87 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
| 88 | - $ip = $cip; |
|
| 89 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
| 90 | - $ip = $cip; |
|
| 91 | - } else { |
|
| 92 | - $ip = "UNKNOWN"; |
|
| 93 | - } |
|
| 94 | - $log = new logHandler; |
|
| 95 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
| 96 | - jsAlert($_lang['login_processor_many_failed_logins']); |
|
| 97 | - return; |
|
| 83 | + @session_destroy(); |
|
| 84 | + session_unset(); |
|
| 85 | + if($cip = getenv("HTTP_CLIENT_IP")) { |
|
| 86 | + $ip = $cip; |
|
| 87 | + } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
| 88 | + $ip = $cip; |
|
| 89 | + } elseif($cip = getenv("REMOTE_ADDR")) { |
|
| 90 | + $ip = $cip; |
|
| 91 | + } else { |
|
| 92 | + $ip = "UNKNOWN"; |
|
| 93 | + } |
|
| 94 | + $log = new logHandler; |
|
| 95 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
| 96 | + jsAlert($_lang['login_processor_many_failed_logins']); |
|
| 97 | + return; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // blocked due to number of login errors, but get to try again |
| 101 | 101 | if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
| 102 | - $fields = array(); |
|
| 103 | - $fields['failedlogincount'] = '0'; |
|
| 104 | - $fields['blockeduntil'] = time() - 1; |
|
| 105 | - $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
| 102 | + $fields = array(); |
|
| 103 | + $fields['failedlogincount'] = '0'; |
|
| 104 | + $fields['blockeduntil'] = time() - 1; |
|
| 105 | + $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // this user has been blocked by an admin, so no way he's loggin in! |
| 109 | 109 | if($blocked == '1') { |
| 110 | - @session_destroy(); |
|
| 111 | - session_unset(); |
|
| 112 | - jsAlert($_lang['login_processor_blocked1']); |
|
| 113 | - return; |
|
| 110 | + @session_destroy(); |
|
| 111 | + session_unset(); |
|
| 112 | + jsAlert($_lang['login_processor_blocked1']); |
|
| 113 | + return; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // blockuntil: this user has a block until date |
| 117 | 117 | if($blockeduntildate > time()) { |
| 118 | - @session_destroy(); |
|
| 119 | - session_unset(); |
|
| 120 | - jsAlert($_lang['login_processor_blocked2']); |
|
| 121 | - return; |
|
| 118 | + @session_destroy(); |
|
| 119 | + session_unset(); |
|
| 120 | + jsAlert($_lang['login_processor_blocked2']); |
|
| 121 | + return; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // blockafter: this user has a block after date |
| 125 | 125 | if($blockedafterdate > 0 && $blockedafterdate < time()) { |
| 126 | - @session_destroy(); |
|
| 127 | - session_unset(); |
|
| 128 | - jsAlert($_lang['login_processor_blocked3']); |
|
| 129 | - return; |
|
| 126 | + @session_destroy(); |
|
| 127 | + session_unset(); |
|
| 128 | + jsAlert($_lang['login_processor_blocked3']); |
|
| 129 | + return; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // allowed ip |
| 133 | 133 | if($allowed_ip) { |
| 134 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 135 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 136 | - jsAlert($_lang['login_processor_remotehost_ip']); |
|
| 137 | - return; |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 141 | - jsAlert($_lang['login_processor_remote_ip']); |
|
| 142 | - return; |
|
| 143 | - } |
|
| 134 | + if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
| 135 | + if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
| 136 | + jsAlert($_lang['login_processor_remotehost_ip']); |
|
| 137 | + return; |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
| 141 | + jsAlert($_lang['login_processor_remote_ip']); |
|
| 142 | + return; |
|
| 143 | + } |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // allowed days |
| 147 | 147 | if($allowed_days) { |
| 148 | - $date = getdate(); |
|
| 149 | - $day = $date['wday'] + 1; |
|
| 150 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
| 151 | - jsAlert($_lang['login_processor_date']); |
|
| 152 | - return; |
|
| 153 | - } |
|
| 148 | + $date = getdate(); |
|
| 149 | + $day = $date['wday'] + 1; |
|
| 150 | + if(!in_array($day,explode(',',$allowed_days))) { |
|
| 151 | + jsAlert($_lang['login_processor_date']); |
|
| 152 | + return; |
|
| 153 | + } |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // invoke OnManagerAuthentication event |
| 157 | 157 | $rt = $modx->invokeEvent('OnManagerAuthentication', array( |
| 158 | - 'userid' => $internalKey, |
|
| 159 | - 'username' => $username, |
|
| 160 | - 'userpassword' => $givenPassword, |
|
| 161 | - 'savedpassword' => $dbasePassword, |
|
| 162 | - 'rememberme' => $rememberme |
|
| 163 | - )); |
|
| 158 | + 'userid' => $internalKey, |
|
| 159 | + 'username' => $username, |
|
| 160 | + 'userpassword' => $givenPassword, |
|
| 161 | + 'savedpassword' => $dbasePassword, |
|
| 162 | + 'rememberme' => $rememberme |
|
| 163 | + )); |
|
| 164 | 164 | |
| 165 | 165 | // check if plugin authenticated the user |
| 166 | 166 | $matchPassword = false; |
| 167 | 167 | if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
| 168 | - // check user password - local authentication |
|
| 169 | - $hashType = $modx->manager->getHashType($dbasePassword); |
|
| 170 | - if($hashType == 'phpass') { |
|
| 171 | - $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
| 172 | - } elseif($hashType == 'md5') { |
|
| 173 | - $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
| 174 | - } elseif($hashType == 'v1') { |
|
| 175 | - $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
| 176 | - } else { |
|
| 177 | - $matchPassword = false; |
|
| 178 | - } |
|
| 168 | + // check user password - local authentication |
|
| 169 | + $hashType = $modx->manager->getHashType($dbasePassword); |
|
| 170 | + if($hashType == 'phpass') { |
|
| 171 | + $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
| 172 | + } elseif($hashType == 'md5') { |
|
| 173 | + $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
| 174 | + } elseif($hashType == 'v1') { |
|
| 175 | + $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
| 176 | + } else { |
|
| 177 | + $matchPassword = false; |
|
| 178 | + } |
|
| 179 | 179 | } else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
| 180 | - $matchPassword = true; |
|
| 180 | + $matchPassword = true; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | if(!$matchPassword) { |
| 184 | - jsAlert($_lang['login_processor_wrong_password']); |
|
| 185 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
| 186 | - return; |
|
| 184 | + jsAlert($_lang['login_processor_wrong_password']); |
|
| 185 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
| 186 | + return; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | if($modx->config['use_captcha'] == 1) { |
| 190 | - if(!isset ($_SESSION['veriword'])) { |
|
| 191 | - jsAlert($_lang['login_processor_captcha_config']); |
|
| 192 | - return; |
|
| 193 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
| 194 | - jsAlert($_lang['login_processor_bad_code']); |
|
| 195 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
| 196 | - return; |
|
| 197 | - } |
|
| 190 | + if(!isset ($_SESSION['veriword'])) { |
|
| 191 | + jsAlert($_lang['login_processor_captcha_config']); |
|
| 192 | + return; |
|
| 193 | + } elseif($_SESSION['veriword'] != $captcha_code) { |
|
| 194 | + jsAlert($_lang['login_processor_bad_code']); |
|
| 195 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
| 196 | + return; |
|
| 197 | + } |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | $modx->cleanupExpiredLocks(); |
@@ -229,36 +229,36 @@ discard block |
||
| 229 | 229 | $_SESSION['mgrToken'] = md5($currentsessionid); |
| 230 | 230 | |
| 231 | 231 | if($rememberme == '1') { |
| 232 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
| 233 | - |
|
| 234 | - // Set a cookie separate from the session cookie with the username in it. |
|
| 235 | - // Are we using secure connection? If so, make sure the cookie is secure |
|
| 236 | - global $https_port; |
|
| 237 | - |
|
| 238 | - $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
| 239 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 240 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
| 241 | - } else { |
|
| 242 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
| 243 | - } |
|
| 232 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
| 233 | + |
|
| 234 | + // Set a cookie separate from the session cookie with the username in it. |
|
| 235 | + // Are we using secure connection? If so, make sure the cookie is secure |
|
| 236 | + global $https_port; |
|
| 237 | + |
|
| 238 | + $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
| 239 | + if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
| 240 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
| 241 | + } else { |
|
| 242 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
| 243 | + } |
|
| 244 | 244 | } else { |
| 245 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
| 245 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
| 246 | 246 | |
| 247 | - // Remove the Remember Me cookie |
|
| 248 | - setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
| 247 | + // Remove the Remember Me cookie |
|
| 248 | + setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Check if user already has an active session, if not check if user pressed logout end of last session |
| 252 | 252 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
| 253 | 253 | $activeSession = $modx->db->getValue($rs); |
| 254 | 254 | if(!$activeSession) { |
| 255 | - $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
| 256 | - if($lastHit = $modx->db->getValue($rs)) { |
|
| 257 | - $_SESSION['show_logout_reminder'] = array( |
|
| 258 | - 'type' => 'logout_reminder', |
|
| 259 | - 'lastHit' => $lastHit |
|
| 260 | - ); |
|
| 261 | - } |
|
| 255 | + $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
| 256 | + if($lastHit = $modx->db->getValue($rs)) { |
|
| 257 | + $_SESSION['show_logout_reminder'] = array( |
|
| 258 | + 'type' => 'logout_reminder', |
|
| 259 | + 'lastHit' => $lastHit |
|
| 260 | + ); |
|
| 261 | + } |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $log = new logHandler; |
@@ -266,29 +266,29 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | // invoke OnManagerLogin event |
| 268 | 268 | $modx->invokeEvent('OnManagerLogin', array( |
| 269 | - 'userid' => $internalKey, |
|
| 270 | - 'username' => $username, |
|
| 271 | - 'userpassword' => $givenPassword, |
|
| 272 | - 'rememberme' => $rememberme |
|
| 273 | - )); |
|
| 269 | + 'userid' => $internalKey, |
|
| 270 | + 'username' => $username, |
|
| 271 | + 'userpassword' => $givenPassword, |
|
| 272 | + 'rememberme' => $rememberme |
|
| 273 | + )); |
|
| 274 | 274 | |
| 275 | 275 | // check if we should redirect user to a web page |
| 276 | 276 | $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
| 277 | 277 | $id = (int)$modx->db->getValue($rs); |
| 278 | 278 | if($id > 0) { |
| 279 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
| 280 | - if($_POST['ajax'] == 1) { |
|
| 281 | - echo $header; |
|
| 282 | - } else { |
|
| 283 | - header($header); |
|
| 284 | - } |
|
| 279 | + $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
| 280 | + if($_POST['ajax'] == 1) { |
|
| 281 | + echo $header; |
|
| 282 | + } else { |
|
| 283 | + header($header); |
|
| 284 | + } |
|
| 285 | 285 | } else { |
| 286 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
| 287 | - if($_POST['ajax'] == 1) { |
|
| 288 | - echo $header; |
|
| 289 | - } else { |
|
| 290 | - header($header); |
|
| 291 | - } |
|
| 286 | + $header = 'Location: ' . MODX_MANAGER_URL; |
|
| 287 | + if($_POST['ajax'] == 1) { |
|
| 288 | + echo $header; |
|
| 289 | + } else { |
|
| 290 | + header($header); |
|
| 291 | + } |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | * @param string $msg |
| 298 | 298 | */ |
| 299 | 299 | function jsAlert($msg) { |
| 300 | - $modx = evolutionCMS(); |
|
| 301 | - if($_POST['ajax'] != 1) { |
|
| 302 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
| 303 | - } else { |
|
| 304 | - echo $msg . "\n"; |
|
| 305 | - } |
|
| 300 | + $modx = evolutionCMS(); |
|
| 301 | + if($_POST['ajax'] != 1) { |
|
| 302 | + echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
| 303 | + } else { |
|
| 304 | + echo $msg . "\n"; |
|
| 305 | + } |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | * @return bool |
| 313 | 313 | */ |
| 314 | 314 | function login($username, $givenPassword, $dbasePassword) { |
| 315 | - $modx = evolutionCMS(); |
|
| 316 | - return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
|
| 315 | + $modx = evolutionCMS(); |
|
| 316 | + return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -324,26 +324,26 @@ discard block |
||
| 324 | 324 | * @return bool |
| 325 | 325 | */ |
| 326 | 326 | function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
| 327 | - $modx = evolutionCMS(); |
|
| 327 | + $modx = evolutionCMS(); |
|
| 328 | 328 | |
| 329 | - $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
|
| 329 | + $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
|
| 330 | 330 | |
| 331 | - if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
| 332 | - $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
|
| 333 | - } |
|
| 331 | + if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
| 332 | + $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
|
| 333 | + } |
|
| 334 | 334 | |
| 335 | - if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
| 336 | - $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
|
| 337 | - $modx->config['pwd_hash_algo'] = $user_algo; |
|
| 338 | - } |
|
| 335 | + if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
| 336 | + $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
|
| 337 | + $modx->config['pwd_hash_algo'] = $user_algo; |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | - if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
| 341 | - return false; |
|
| 342 | - } |
|
| 340 | + if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
| 341 | + return false; |
|
| 342 | + } |
|
| 343 | 343 | |
| 344 | - updateNewHash($username, $givenPassword); |
|
| 344 | + updateNewHash($username, $givenPassword); |
|
| 345 | 345 | |
| 346 | - return true; |
|
| 346 | + return true; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -354,13 +354,13 @@ discard block |
||
| 354 | 354 | * @return bool |
| 355 | 355 | */ |
| 356 | 356 | function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
| 357 | - $modx = evolutionCMS(); |
|
| 357 | + $modx = evolutionCMS(); |
|
| 358 | 358 | |
| 359 | - if($dbasePassword != md5($givenPassword)) { |
|
| 360 | - return false; |
|
| 361 | - } |
|
| 362 | - updateNewHash($username, $givenPassword); |
|
| 363 | - return true; |
|
| 359 | + if($dbasePassword != md5($givenPassword)) { |
|
| 360 | + return false; |
|
| 361 | + } |
|
| 362 | + updateNewHash($username, $givenPassword); |
|
| 363 | + return true; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | /** |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | * @param string $password |
| 369 | 369 | */ |
| 370 | 370 | function updateNewHash($username, $password) { |
| 371 | - $modx = evolutionCMS(); |
|
| 371 | + $modx = evolutionCMS(); |
|
| 372 | 372 | |
| 373 | - $field = array(); |
|
| 374 | - $field['password'] = $modx->phpass->HashPassword($password); |
|
| 375 | - $modx->db->update($field, '[+prefix+]manager_users', "username='{$username}'"); |
|
| 373 | + $field = array(); |
|
| 374 | + $field['password'] = $modx->phpass->HashPassword($password); |
|
| 375 | + $modx->db->update($field, '[+prefix+]manager_users', "username='{$username}'"); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | /** |
@@ -382,27 +382,27 @@ discard block |
||
| 382 | 382 | * @param int $blocked_minutes |
| 383 | 383 | */ |
| 384 | 384 | function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
| 385 | - $modx = evolutionCMS(); |
|
| 386 | - |
|
| 387 | - $failedlogins += 1; |
|
| 388 | - |
|
| 389 | - $fields = array('failedlogincount' => $failedlogins); |
|
| 390 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
| 391 | - { |
|
| 392 | - $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
|
| 393 | - } |
|
| 394 | - |
|
| 395 | - $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
| 396 | - |
|
| 397 | - if($failedlogins < $failed_allowed) { |
|
| 398 | - //sleep to help prevent brute force attacks |
|
| 399 | - $sleep = (int) $failedlogins / 2; |
|
| 400 | - if($sleep > 5) { |
|
| 401 | - $sleep = 5; |
|
| 402 | - } |
|
| 403 | - sleep($sleep); |
|
| 404 | - } |
|
| 405 | - @session_destroy(); |
|
| 406 | - session_unset(); |
|
| 407 | - return; |
|
| 385 | + $modx = evolutionCMS(); |
|
| 386 | + |
|
| 387 | + $failedlogins += 1; |
|
| 388 | + |
|
| 389 | + $fields = array('failedlogincount' => $failedlogins); |
|
| 390 | + if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
| 391 | + { |
|
| 392 | + $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
|
| 393 | + } |
|
| 394 | + |
|
| 395 | + $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
| 396 | + |
|
| 397 | + if($failedlogins < $failed_allowed) { |
|
| 398 | + //sleep to help prevent brute force attacks |
|
| 399 | + $sleep = (int) $failedlogins / 2; |
|
| 400 | + if($sleep > 5) { |
|
| 401 | + $sleep = 5; |
|
| 402 | + } |
|
| 403 | + sleep($sleep); |
|
| 404 | + } |
|
| 405 | + @session_destroy(); |
|
| 406 | + session_unset(); |
|
| 407 | + return; |
|
| 408 | 408 | } |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
| 3 | - die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
|
| 3 | + die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
| 9 | - // seems to be a new install - send the user to the configuration page |
|
| 10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
|
| 9 | + // seems to be a new install - send the user to the configuration page |
|
| 10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // set placeholders |
@@ -17,92 +17,92 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | 19 | if($modx->hasPermission('messages')) {
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
| 22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
| 23 | - |
|
| 24 | - $msg = array(); |
|
| 25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
| 30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
|
| 31 | - $ph['MessageInfo'] = implode("\n", $msg);
|
|
| 20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
| 22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
| 23 | + |
|
| 24 | + $msg = array(); |
|
| 25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
| 30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
|
| 31 | + $ph['MessageInfo'] = implode("\n", $msg);
|
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | 35 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
| 36 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
| 37 | - $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
| 36 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
| 37 | + $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
| 38 | 38 | } |
| 39 | 39 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
| 40 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
| 41 | - $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
| 40 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
| 41 | + $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
| 42 | 42 | } |
| 43 | 43 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
| 44 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
| 45 | - $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
| 44 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
| 45 | + $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
| 46 | 46 | } |
| 47 | 47 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
| 48 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
| 49 | - $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
| 48 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
| 49 | + $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
| 50 | 50 | } |
| 51 | 51 | if($modx->hasPermission('bk_manager')) {
|
| 52 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
| 53 | - $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
| 52 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
| 53 | + $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
| 54 | 54 | } |
| 55 | 55 | if($modx->hasPermission('help')) {
|
| 56 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
| 57 | - $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
| 56 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
| 57 | + $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if($modx->hasPermission('new_document')) {
|
| 61 | - $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]'; |
|
| 62 | - $ph['ResourceIcon'] = wrapIcon($icon, 4); |
|
| 63 | - $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]'; |
|
| 64 | - $ph['WeblinkIcon'] = wrapIcon($icon, 72); |
|
| 61 | + $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]'; |
|
| 62 | + $ph['ResourceIcon'] = wrapIcon($icon, 4); |
|
| 63 | + $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]'; |
|
| 64 | + $ph['WeblinkIcon'] = wrapIcon($icon, 72); |
|
| 65 | 65 | } |
| 66 | 66 | if($modx->hasPermission('assets_images')) {
|
| 67 | - $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]'; |
|
| 68 | - $ph['ImagesIcon'] = wrapIcon($icon, 72); |
|
| 67 | + $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]'; |
|
| 68 | + $ph['ImagesIcon'] = wrapIcon($icon, 72); |
|
| 69 | 69 | } |
| 70 | 70 | if($modx->hasPermission('assets_files')) {
|
| 71 | - $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]'; |
|
| 72 | - $ph['FilesIcon'] = wrapIcon($icon, 72); |
|
| 71 | + $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]'; |
|
| 72 | + $ph['FilesIcon'] = wrapIcon($icon, 72); |
|
| 73 | 73 | } |
| 74 | 74 | if($modx->hasPermission('change_password')) {
|
| 75 | - $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]'; |
|
| 76 | - $ph['PasswordIcon'] = wrapIcon($icon, 28); |
|
| 75 | + $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]'; |
|
| 76 | + $ph['PasswordIcon'] = wrapIcon($icon, 28); |
|
| 77 | 77 | } |
| 78 | 78 | $icon = '<i class="[&icons_logout_large&]"></i>[%logout%]'; |
| 79 | 79 | $ph['LogoutIcon'] = wrapIcon($icon, 8); |
| 80 | 80 | |
| 81 | 81 | // do some config checks |
| 82 | 82 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
| 83 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 84 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 85 | - $ph['config_check_results'] = $config_check_results; |
|
| 86 | - $ph['config_display'] = 'block'; |
|
| 87 | - } else {
|
|
| 88 | - $ph['config_display'] = 'none'; |
|
| 89 | - } |
|
| 83 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 84 | + if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 85 | + $ph['config_check_results'] = $config_check_results; |
|
| 86 | + $ph['config_display'] = 'block'; |
|
| 87 | + } else {
|
|
| 88 | + $ph['config_display'] = 'none'; |
|
| 89 | + } |
|
| 90 | 90 | } else {
|
| 91 | - $ph['config_display'] = 'none'; |
|
| 91 | + $ph['config_display'] = 'none'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Check logout-reminder |
| 95 | 95 | if(isset($_SESSION['show_logout_reminder'])) {
|
| 96 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 97 | - case 'logout_reminder': |
|
| 98 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
| 99 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
|
| 100 | - break; |
|
| 101 | - } |
|
| 102 | - $ph['show_logout_reminder'] = 'block'; |
|
| 103 | - unset($_SESSION['show_logout_reminder']); |
|
| 96 | + switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 97 | + case 'logout_reminder': |
|
| 98 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
| 99 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
|
| 100 | + break; |
|
| 101 | + } |
|
| 102 | + $ph['show_logout_reminder'] = 'block'; |
|
| 103 | + unset($_SESSION['show_logout_reminder']); |
|
| 104 | 104 | } else {
|
| 105 | - $ph['show_logout_reminder'] = 'none'; |
|
| 105 | + $ph['show_logout_reminder'] = 'none'; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Check multiple sessions |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
| 151 | 151 | |
| 152 | 152 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 153 | - 'username' => $modx->getLoginUserName(), |
|
| 154 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
| 155 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
| 156 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
| 157 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
| 153 | + 'username' => $modx->getLoginUserName(), |
|
| 154 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
| 155 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
| 156 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
| 157 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
| 158 | 158 | )); |
| 159 | 159 | |
| 160 | 160 | $from = array(); |
@@ -163,13 +163,13 @@ discard block |
||
| 163 | 163 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 164 | 164 | |
| 165 | 165 | if($modx->db->getRecordCount($rs) < 1) {
|
| 166 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
| 166 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
| 167 | 167 | } else {
|
| 168 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 169 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
| 170 | - $ph['now'] = strftime('%H:%M:%S', $now);
|
|
| 171 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
| 172 | - $html = ' |
|
| 168 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 169 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
| 170 | + $ph['now'] = strftime('%H:%M:%S', $now);
|
|
| 171 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
| 172 | + $html = ' |
|
| 173 | 173 | <div class="card-body"> |
| 174 | 174 | [%onlineusers_message%] |
| 175 | 175 | <b>[+now+]</b>): |
@@ -187,33 +187,33 @@ discard block |
||
| 187 | 187 | </thead> |
| 188 | 188 | <tbody>'; |
| 189 | 189 | |
| 190 | - $userList = array(); |
|
| 191 | - $userCount = array(); |
|
| 192 | - // Create userlist with session-count first before output |
|
| 193 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 194 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
| 195 | - |
|
| 196 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
| 197 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
| 198 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
| 199 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
| 200 | - $userList[] = array( |
|
| 201 | - $idle, |
|
| 202 | - '', |
|
| 203 | - $activeusers['username'], |
|
| 204 | - $webicon, |
|
| 205 | - abs($activeusers['internalKey']), |
|
| 206 | - $ip, |
|
| 207 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
|
| 208 | - $currentaction |
|
| 209 | - ); |
|
| 210 | - } |
|
| 211 | - foreach($userList as $params) {
|
|
| 212 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
| 213 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - $html .= ' |
|
| 190 | + $userList = array(); |
|
| 191 | + $userCount = array(); |
|
| 192 | + // Create userlist with session-count first before output |
|
| 193 | + while($activeusers = $modx->db->getRow($rs)) {
|
|
| 194 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
| 195 | + |
|
| 196 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
| 197 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
| 198 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
| 199 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
| 200 | + $userList[] = array( |
|
| 201 | + $idle, |
|
| 202 | + '', |
|
| 203 | + $activeusers['username'], |
|
| 204 | + $webicon, |
|
| 205 | + abs($activeusers['internalKey']), |
|
| 206 | + $ip, |
|
| 207 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
|
| 208 | + $currentaction |
|
| 209 | + ); |
|
| 210 | + } |
|
| 211 | + foreach($userList as $params) {
|
|
| 212 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
| 213 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + $html .= ' |
|
| 217 | 217 | </tbody> |
| 218 | 218 | </table> |
| 219 | 219 | </div> |
@@ -254,17 +254,17 @@ discard block |
||
| 254 | 254 | // invoke event OnManagerWelcomePrerender |
| 255 | 255 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 256 | 256 | if(is_array($evtOut)) {
|
| 257 | - $output = implode('', $evtOut);
|
|
| 258 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
| 257 | + $output = implode('', $evtOut);
|
|
| 258 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $widgets['welcome'] = array( |
| 262 | - 'menuindex' => '10', |
|
| 263 | - 'id' => 'welcome', |
|
| 264 | - 'cols' => 'col-lg-6', |
|
| 265 | - 'icon' => 'fa-home', |
|
| 266 | - 'title' => '[%welcome_title%]', |
|
| 267 | - 'body' => ' |
|
| 262 | + 'menuindex' => '10', |
|
| 263 | + 'id' => 'welcome', |
|
| 264 | + 'cols' => 'col-lg-6', |
|
| 265 | + 'icon' => 'fa-home', |
|
| 266 | + 'title' => '[%welcome_title%]', |
|
| 267 | + 'body' => ' |
|
| 268 | 268 | <div class="wm_buttons card-body"> |
| 269 | 269 | <!--@IF:[[#hasPermission?key=new_document]]--> |
| 270 | 270 | <span class="wm_button"> |
@@ -338,25 +338,25 @@ discard block |
||
| 338 | 338 | </table> |
| 339 | 339 | </div> |
| 340 | 340 | ', |
| 341 | - 'hide'=>'0' |
|
| 341 | + 'hide'=>'0' |
|
| 342 | 342 | ); |
| 343 | 343 | $widgets['onlineinfo'] = array( |
| 344 | - 'menuindex' => '20', |
|
| 345 | - 'id' => 'onlineinfo', |
|
| 346 | - 'cols' => 'col-lg-6', |
|
| 347 | - 'icon' => 'fa-user', |
|
| 348 | - 'title' => '[%onlineusers_title%]', |
|
| 349 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
| 350 | - 'hide'=>'0' |
|
| 344 | + 'menuindex' => '20', |
|
| 345 | + 'id' => 'onlineinfo', |
|
| 346 | + 'cols' => 'col-lg-6', |
|
| 347 | + 'icon' => 'fa-user', |
|
| 348 | + 'title' => '[%onlineusers_title%]', |
|
| 349 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
| 350 | + 'hide'=>'0' |
|
| 351 | 351 | ); |
| 352 | 352 | $widgets['recentinfo'] = array( |
| 353 | - 'menuindex' => '30', |
|
| 354 | - 'id' => 'modxrecent_widget', |
|
| 355 | - 'cols' => 'col-sm-12', |
|
| 356 | - 'icon' => 'fa-pencil-square-o', |
|
| 357 | - 'title' => '[%activity_title%]', |
|
| 358 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
| 359 | - 'hide'=>'0' |
|
| 353 | + 'menuindex' => '30', |
|
| 354 | + 'id' => 'modxrecent_widget', |
|
| 355 | + 'cols' => 'col-sm-12', |
|
| 356 | + 'icon' => 'fa-pencil-square-o', |
|
| 357 | + 'title' => '[%activity_title%]', |
|
| 358 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
| 359 | + 'hide'=>'0' |
|
| 360 | 360 | ); |
| 361 | 361 | if ($modx->config['rss_url_news']) {
|
| 362 | 362 | $widgets['news'] = array( |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | // invoke OnManagerWelcomeHome event |
| 385 | 385 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 386 | 386 | if(is_array($sitewidgets)) {
|
| 387 | - $newwidgets = array(); |
|
| 387 | + $newwidgets = array(); |
|
| 388 | 388 | foreach($sitewidgets as $widget){
|
| 389 | 389 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 390 | 390 | } |
@@ -392,21 +392,21 @@ discard block |
||
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | usort($widgets, function ($a, $b) {
|
| 395 | - return $a['menuindex'] - $b['menuindex']; |
|
| 395 | + return $a['menuindex'] - $b['menuindex']; |
|
| 396 | 396 | }); |
| 397 | 397 | |
| 398 | 398 | $tpl = getTplWidget(); |
| 399 | 399 | $output = ''; |
| 400 | 400 | foreach($widgets as $widget) {
|
| 401 | - if ($widget['hide'] != '1'){
|
|
| 402 | - $output .= $modx->parseText($tpl, $widget); |
|
| 403 | - } |
|
| 401 | + if ($widget['hide'] != '1'){
|
|
| 402 | + $output .= $modx->parseText($tpl, $widget); |
|
| 403 | + } |
|
| 404 | 404 | } |
| 405 | 405 | $ph['widgets'] = $output; |
| 406 | 406 | |
| 407 | 407 | // load template |
| 408 | 408 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
| 409 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 409 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | $target = $modx->config['manager_welcome_tpl']; |
@@ -414,27 +414,27 @@ discard block |
||
| 414 | 414 | $target = $modx->mergeSettingsContent($target); |
| 415 | 415 | |
| 416 | 416 | if(substr($target, 0, 1) === '@') {
|
| 417 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 418 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
| 419 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 420 | - $content = file_get_contents(trim(substr($target, 6))); |
|
| 421 | - } else {
|
|
| 422 | - $content = ''; |
|
| 423 | - } |
|
| 417 | + if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 418 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
| 419 | + } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 420 | + $content = file_get_contents(trim(substr($target, 6))); |
|
| 421 | + } else {
|
|
| 422 | + $content = ''; |
|
| 423 | + } |
|
| 424 | 424 | } else {
|
| 425 | - $chunk = $modx->getChunk($target); |
|
| 426 | - if($chunk !== false && !empty($chunk)) {
|
|
| 427 | - $content = $chunk; |
|
| 428 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 429 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 430 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 431 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 432 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 433 | - {
|
|
| 434 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 435 | - } else {
|
|
| 436 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 437 | - } |
|
| 425 | + $chunk = $modx->getChunk($target); |
|
| 426 | + if($chunk !== false && !empty($chunk)) {
|
|
| 427 | + $content = $chunk; |
|
| 428 | + } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 429 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 430 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 431 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 432 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 433 | + {
|
|
| 434 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 435 | + } else {
|
|
| 436 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 437 | + } |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | // merge placeholders |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | $content = $modx->mergeSettingsContent($content); |
| 443 | 443 | $content = $modx->parseText($content, $ph); |
| 444 | 444 | if(strpos($content, '[+') !== false) {
|
| 445 | - $modx->toPlaceholders($ph); |
|
| 446 | - $content = $modx->mergePlaceholderContent($content); |
|
| 445 | + $modx->toPlaceholders($ph); |
|
| 446 | + $content = $modx->mergePlaceholderContent($content); |
|
| 447 | 447 | } |
| 448 | 448 | $content = $modx->parseDocumentSource($content); |
| 449 | 449 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 452 | 452 | |
| 453 | 453 | if($js = $modx->getRegisteredClientScripts()) {
|
| 454 | - $content .= $js; |
|
| 454 | + $content .= $js; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | echo $content; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 462 | 462 | //</span> |
| 463 | 463 | function getTplWidget() { // recent document info
|
| 464 | - return ' |
|
| 464 | + return ' |
|
| 465 | 465 | <div class="[+cols+]" id="[+id+]"> |
| 466 | 466 | <div class="card"[+cardAttr+]> |
| 467 | 467 | <div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div> |
@@ -472,11 +472,11 @@ discard block |
||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | function getRecentInfo() { // recent document info
|
| 475 | - $modx = evolutionCMS(); |
|
| 475 | + $modx = evolutionCMS(); |
|
| 476 | 476 | |
| 477 | - $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
|
| 477 | + $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
|
| 478 | 478 | |
| 479 | - $html = ' |
|
| 479 | + $html = ' |
|
| 480 | 480 | <div class="table-responsive"> |
| 481 | 481 | <table class="table data"> |
| 482 | 482 | <thead> |
@@ -494,96 +494,96 @@ discard block |
||
| 494 | 494 | </table> |
| 495 | 495 | </div> |
| 496 | 496 | '; |
| 497 | - return $html; |
|
| 497 | + return $html; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | function getRecentInfoList() {
|
| 501 | - $modx = evolutionCMS(); |
|
| 502 | - |
|
| 503 | - $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
|
| 504 | - |
|
| 505 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 506 | - return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
| 507 | - } |
|
| 508 | - |
|
| 509 | - $tpl = getRecentInfoRowTpl(); |
|
| 510 | - |
|
| 511 | - $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
| 512 | - $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
| 513 | - |
|
| 514 | - $output = array(); |
|
| 515 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 516 | - $docid = $ph['id']; |
|
| 517 | - $_ = $modx->getUserInfo($ph['editedby']); |
|
| 518 | - $ph['username'] = $_['username']; |
|
| 519 | - |
|
| 520 | - if($ph['deleted'] == 1) {
|
|
| 521 | - $ph['status'] = 'deleted text-danger'; |
|
| 522 | - } elseif($ph['published'] == 0) {
|
|
| 523 | - $ph['status'] = 'unpublished font-italic text-muted'; |
|
| 524 | - } else {
|
|
| 525 | - $ph['status'] = 'published'; |
|
| 526 | - } |
|
| 527 | - |
|
| 528 | - if($modx->hasPermission('edit_document')) {
|
|
| 529 | - $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
|
| 530 | - } else {
|
|
| 531 | - $ph['edit_btn'] = ''; |
|
| 532 | - } |
|
| 533 | - |
|
| 534 | - $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
| 535 | - $ph['preview_btn'] = str_replace(array( |
|
| 536 | - '[+id+]', |
|
| 537 | - '[+preview_disabled+]' |
|
| 538 | - ), array( |
|
| 539 | - $docid, |
|
| 540 | - $preview_disabled |
|
| 541 | - ), $btntpl['preview_btn']); |
|
| 542 | - |
|
| 543 | - if($modx->hasPermission('delete_document')) {
|
|
| 544 | - if($ph['deleted'] == 0) {
|
|
| 545 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
| 546 | - } else {
|
|
| 547 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
| 548 | - } |
|
| 549 | - $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
|
| 550 | - } else {
|
|
| 551 | - $ph['delete_btn'] = ''; |
|
| 552 | - } |
|
| 553 | - |
|
| 554 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 555 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 556 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 557 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 558 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 559 | - $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 560 | - } else {
|
|
| 561 | - $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 562 | - } |
|
| 563 | - $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
|
| 564 | - |
|
| 565 | - $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
|
| 566 | - |
|
| 567 | - if($ph['longtitle'] == '') {
|
|
| 568 | - $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
| 569 | - } |
|
| 570 | - if($ph['description'] == '') {
|
|
| 571 | - $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
| 572 | - } |
|
| 573 | - if($ph['introtext'] == '') {
|
|
| 574 | - $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
| 575 | - } |
|
| 576 | - if($ph['alias'] == '') {
|
|
| 577 | - $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - $output[] = $modx->parseText($tpl, $ph); |
|
| 581 | - } |
|
| 582 | - return implode("\n", $output);
|
|
| 501 | + $modx = evolutionCMS(); |
|
| 502 | + |
|
| 503 | + $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
|
| 504 | + |
|
| 505 | + if($modx->db->getRecordCount($rs) < 1) {
|
|
| 506 | + return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
| 507 | + } |
|
| 508 | + |
|
| 509 | + $tpl = getRecentInfoRowTpl(); |
|
| 510 | + |
|
| 511 | + $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
| 512 | + $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
| 513 | + |
|
| 514 | + $output = array(); |
|
| 515 | + while($ph = $modx->db->getRow($rs)) {
|
|
| 516 | + $docid = $ph['id']; |
|
| 517 | + $_ = $modx->getUserInfo($ph['editedby']); |
|
| 518 | + $ph['username'] = $_['username']; |
|
| 519 | + |
|
| 520 | + if($ph['deleted'] == 1) {
|
|
| 521 | + $ph['status'] = 'deleted text-danger'; |
|
| 522 | + } elseif($ph['published'] == 0) {
|
|
| 523 | + $ph['status'] = 'unpublished font-italic text-muted'; |
|
| 524 | + } else {
|
|
| 525 | + $ph['status'] = 'published'; |
|
| 526 | + } |
|
| 527 | + |
|
| 528 | + if($modx->hasPermission('edit_document')) {
|
|
| 529 | + $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
|
| 530 | + } else {
|
|
| 531 | + $ph['edit_btn'] = ''; |
|
| 532 | + } |
|
| 533 | + |
|
| 534 | + $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
| 535 | + $ph['preview_btn'] = str_replace(array( |
|
| 536 | + '[+id+]', |
|
| 537 | + '[+preview_disabled+]' |
|
| 538 | + ), array( |
|
| 539 | + $docid, |
|
| 540 | + $preview_disabled |
|
| 541 | + ), $btntpl['preview_btn']); |
|
| 542 | + |
|
| 543 | + if($modx->hasPermission('delete_document')) {
|
|
| 544 | + if($ph['deleted'] == 0) {
|
|
| 545 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
| 546 | + } else {
|
|
| 547 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
| 548 | + } |
|
| 549 | + $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
|
| 550 | + } else {
|
|
| 551 | + $ph['delete_btn'] = ''; |
|
| 552 | + } |
|
| 553 | + |
|
| 554 | + if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 555 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 556 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 557 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 558 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 559 | + $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 560 | + } else {
|
|
| 561 | + $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 562 | + } |
|
| 563 | + $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
|
| 564 | + |
|
| 565 | + $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
|
| 566 | + |
|
| 567 | + if($ph['longtitle'] == '') {
|
|
| 568 | + $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
| 569 | + } |
|
| 570 | + if($ph['description'] == '') {
|
|
| 571 | + $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
| 572 | + } |
|
| 573 | + if($ph['introtext'] == '') {
|
|
| 574 | + $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
| 575 | + } |
|
| 576 | + if($ph['alias'] == '') {
|
|
| 577 | + $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + $output[] = $modx->parseText($tpl, $ph); |
|
| 581 | + } |
|
| 582 | + return implode("\n", $output);
|
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | function getRecentInfoRowTpl() {
|
| 586 | - $tpl = ' |
|
| 586 | + $tpl = ' |
|
| 587 | 587 | <tr> |
| 588 | 588 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
| 589 | 589 | <td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&id=[+id+]" target="main">[+pagetitle+]</a></td> |
@@ -607,16 +607,16 @@ discard block |
||
| 607 | 607 | </div> |
| 608 | 608 | </td> |
| 609 | 609 | </tr>'; |
| 610 | - return $tpl; |
|
| 610 | + return $tpl; |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // setup icons |
| 614 | 614 | function wrapIcon($i, $action) {
|
| 615 | - return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
|
| 615 | + return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | function getStartUpScript() {
|
| 619 | - $script = ' |
|
| 619 | + $script = ' |
|
| 620 | 620 | <script type="text/javascript"> |
| 621 | 621 | function hideConfigCheckWarning(key) {
|
| 622 | 622 | var xhr = new XMLHttpRequest(); |
@@ -640,5 +640,5 @@ discard block |
||
| 640 | 640 | })(jQuery); |
| 641 | 641 | </script> |
| 642 | 642 | '; |
| 643 | - return $script; |
|
| 643 | + return $script; |
|
| 644 | 644 | } |
@@ -14,158 +14,158 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
| 16 | 16 | $modx = evolutionCMS(); |
| 17 | - global $_style; |
|
| 18 | - global $_lang; |
|
| 19 | - global $content; |
|
| 20 | - global $which_browser; |
|
| 17 | + global $_style; |
|
| 18 | + global $_lang; |
|
| 19 | + global $content; |
|
| 20 | + global $which_browser; |
|
| 21 | 21 | |
| 22 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
| 23 | - $eval_str = trim(substr($default_text, 7)); |
|
| 24 | - $default_text = eval($eval_str); |
|
| 25 | - $field_value = $default_text; |
|
| 26 | - } |
|
| 22 | + if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
| 23 | + $eval_str = trim(substr($default_text, 7)); |
|
| 24 | + $default_text = eval($eval_str); |
|
| 25 | + $field_value = $default_text; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - $field_html = ''; |
|
| 29 | - $cimode = strpos($field_type, ':'); |
|
| 30 | - if($cimode === false) { |
|
| 31 | - switch($field_type) { |
|
| 28 | + $field_html = ''; |
|
| 29 | + $cimode = strpos($field_type, ':'); |
|
| 30 | + if($cimode === false) { |
|
| 31 | + switch($field_type) { |
|
| 32 | 32 | |
| 33 | - case "text": // handler for regular text boxes |
|
| 34 | - case "rawtext"; // non-htmlentity converted text boxes |
|
| 35 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
| 36 | - break; |
|
| 37 | - case "email": // handles email input fields |
|
| 38 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
| 39 | - break; |
|
| 40 | - case "number": // handles the input of numbers |
|
| 41 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
| 42 | - break; |
|
| 43 | - case "textareamini": // handler for textarea mini boxes |
|
| 44 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 45 | - break; |
|
| 46 | - case "textarea": // handler for textarea boxes |
|
| 47 | - case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
| 48 | - case "htmlarea": // handler for textarea boxes (deprecated) |
|
| 49 | - case "richtext": // handler for textarea boxes |
|
| 50 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 51 | - break; |
|
| 52 | - case "date": |
|
| 53 | - $field_id = str_replace(array( |
|
| 54 | - '-', |
|
| 55 | - '.' |
|
| 56 | - ), '_', urldecode($field_id)); |
|
| 57 | - if($field_value == '') { |
|
| 58 | - $field_value = 0; |
|
| 59 | - } |
|
| 60 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
| 61 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
| 33 | + case "text": // handler for regular text boxes |
|
| 34 | + case "rawtext"; // non-htmlentity converted text boxes |
|
| 35 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
| 36 | + break; |
|
| 37 | + case "email": // handles email input fields |
|
| 38 | + $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
| 39 | + break; |
|
| 40 | + case "number": // handles the input of numbers |
|
| 41 | + $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
| 42 | + break; |
|
| 43 | + case "textareamini": // handler for textarea mini boxes |
|
| 44 | + $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 45 | + break; |
|
| 46 | + case "textarea": // handler for textarea boxes |
|
| 47 | + case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
| 48 | + case "htmlarea": // handler for textarea boxes (deprecated) |
|
| 49 | + case "richtext": // handler for textarea boxes |
|
| 50 | + $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 51 | + break; |
|
| 52 | + case "date": |
|
| 53 | + $field_id = str_replace(array( |
|
| 54 | + '-', |
|
| 55 | + '.' |
|
| 56 | + ), '_', urldecode($field_id)); |
|
| 57 | + if($field_value == '') { |
|
| 58 | + $field_value = 0; |
|
| 59 | + } |
|
| 60 | + $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
| 61 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
| 62 | 62 | |
| 63 | - break; |
|
| 64 | - case "dropdown": // handler for select boxes |
|
| 65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
| 66 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 68 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 69 | - if(strlen($itemvalue) == 0) { |
|
| 70 | - $itemvalue = $item; |
|
| 71 | - } |
|
| 72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 73 | - } |
|
| 74 | - $field_html .= "</select>"; |
|
| 75 | - break; |
|
| 76 | - case "listbox": // handler for select boxes |
|
| 77 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
| 78 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 79 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 80 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 81 | - if(strlen($itemvalue) == 0) { |
|
| 82 | - $itemvalue = $item; |
|
| 83 | - } |
|
| 84 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 85 | - } |
|
| 86 | - $field_html .= "</select>"; |
|
| 87 | - break; |
|
| 88 | - case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
| 89 | - $field_value = explode("||", $field_value); |
|
| 90 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
| 91 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 92 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 93 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 94 | - if(strlen($itemvalue) == 0) { |
|
| 95 | - $itemvalue = $item; |
|
| 96 | - } |
|
| 97 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 98 | - } |
|
| 99 | - $field_html .= "</select>"; |
|
| 100 | - break; |
|
| 101 | - case "url": // handles url input fields |
|
| 102 | - $urls = array( |
|
| 103 | - '' => '--', |
|
| 104 | - 'http://' => 'http://', |
|
| 105 | - 'https://' => 'https://', |
|
| 106 | - 'ftp://' => 'ftp://', |
|
| 107 | - 'mailto:' => 'mailto:' |
|
| 108 | - ); |
|
| 109 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
| 110 | - foreach($urls as $k => $v) { |
|
| 111 | - if(strpos($field_value, $v) === false) { |
|
| 112 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
| 113 | - } else { |
|
| 114 | - $field_value = str_replace($v, '', $field_value); |
|
| 115 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - $field_html .= '</select></td><td>'; |
|
| 119 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
| 120 | - break; |
|
| 121 | - case 'checkbox': // handles check boxes |
|
| 122 | - $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
| 123 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 124 | - $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
| 125 | - static $i = 0; |
|
| 126 | - $_ = array(); |
|
| 127 | - foreach($index_list as $c => $item) { |
|
| 128 | - if(is_array($item)) { |
|
| 129 | - $name = trim($item[0]); |
|
| 130 | - $value = isset($item[1]) ? $item[1] : $name; |
|
| 131 | - } else { |
|
| 132 | - $item = trim($item); |
|
| 133 | - list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
| 134 | - $item, |
|
| 135 | - $item |
|
| 136 | - ); |
|
| 137 | - } |
|
| 138 | - $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
| 139 | - $param = array( |
|
| 140 | - $modx->htmlspecialchars($value), |
|
| 141 | - $i, |
|
| 142 | - $field_id, |
|
| 143 | - $checked, |
|
| 144 | - $name |
|
| 145 | - ); |
|
| 146 | - $_[] = vsprintf($tpl, $param); |
|
| 147 | - $i++; |
|
| 148 | - } |
|
| 149 | - $field_html = implode("\n", $_); |
|
| 150 | - break; |
|
| 151 | - case "option": // handles radio buttons |
|
| 152 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 153 | - static $i = 0; |
|
| 154 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 155 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 156 | - if(strlen($itemvalue) == 0) { |
|
| 157 | - $itemvalue = $item; |
|
| 158 | - } |
|
| 159 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
| 160 | - $i++; |
|
| 161 | - } |
|
| 162 | - break; |
|
| 163 | - case "image": // handles image fields using htmlarea image manager |
|
| 164 | - global $_lang; |
|
| 165 | - global $ResourceManagerLoaded; |
|
| 166 | - global $content, $use_editor, $which_editor; |
|
| 167 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 168 | - $field_html .= " |
|
| 63 | + break; |
|
| 64 | + case "dropdown": // handler for select boxes |
|
| 65 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
| 66 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 67 | + while(list($item, $itemvalue) = each($index_list)) { |
|
| 68 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 69 | + if(strlen($itemvalue) == 0) { |
|
| 70 | + $itemvalue = $item; |
|
| 71 | + } |
|
| 72 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 73 | + } |
|
| 74 | + $field_html .= "</select>"; |
|
| 75 | + break; |
|
| 76 | + case "listbox": // handler for select boxes |
|
| 77 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
| 78 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 79 | + while(list($item, $itemvalue) = each($index_list)) { |
|
| 80 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 81 | + if(strlen($itemvalue) == 0) { |
|
| 82 | + $itemvalue = $item; |
|
| 83 | + } |
|
| 84 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 85 | + } |
|
| 86 | + $field_html .= "</select>"; |
|
| 87 | + break; |
|
| 88 | + case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
| 89 | + $field_value = explode("||", $field_value); |
|
| 90 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
| 91 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 92 | + while(list($item, $itemvalue) = each($index_list)) { |
|
| 93 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 94 | + if(strlen($itemvalue) == 0) { |
|
| 95 | + $itemvalue = $item; |
|
| 96 | + } |
|
| 97 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 98 | + } |
|
| 99 | + $field_html .= "</select>"; |
|
| 100 | + break; |
|
| 101 | + case "url": // handles url input fields |
|
| 102 | + $urls = array( |
|
| 103 | + '' => '--', |
|
| 104 | + 'http://' => 'http://', |
|
| 105 | + 'https://' => 'https://', |
|
| 106 | + 'ftp://' => 'ftp://', |
|
| 107 | + 'mailto:' => 'mailto:' |
|
| 108 | + ); |
|
| 109 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
| 110 | + foreach($urls as $k => $v) { |
|
| 111 | + if(strpos($field_value, $v) === false) { |
|
| 112 | + $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
| 113 | + } else { |
|
| 114 | + $field_value = str_replace($v, '', $field_value); |
|
| 115 | + $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + $field_html .= '</select></td><td>'; |
|
| 119 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
| 120 | + break; |
|
| 121 | + case 'checkbox': // handles check boxes |
|
| 122 | + $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
| 123 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 124 | + $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
| 125 | + static $i = 0; |
|
| 126 | + $_ = array(); |
|
| 127 | + foreach($index_list as $c => $item) { |
|
| 128 | + if(is_array($item)) { |
|
| 129 | + $name = trim($item[0]); |
|
| 130 | + $value = isset($item[1]) ? $item[1] : $name; |
|
| 131 | + } else { |
|
| 132 | + $item = trim($item); |
|
| 133 | + list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
| 134 | + $item, |
|
| 135 | + $item |
|
| 136 | + ); |
|
| 137 | + } |
|
| 138 | + $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
| 139 | + $param = array( |
|
| 140 | + $modx->htmlspecialchars($value), |
|
| 141 | + $i, |
|
| 142 | + $field_id, |
|
| 143 | + $checked, |
|
| 144 | + $name |
|
| 145 | + ); |
|
| 146 | + $_[] = vsprintf($tpl, $param); |
|
| 147 | + $i++; |
|
| 148 | + } |
|
| 149 | + $field_html = implode("\n", $_); |
|
| 150 | + break; |
|
| 151 | + case "option": // handles radio buttons |
|
| 152 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 153 | + static $i = 0; |
|
| 154 | + while(list($item, $itemvalue) = each($index_list)) { |
|
| 155 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 156 | + if(strlen($itemvalue) == 0) { |
|
| 157 | + $itemvalue = $item; |
|
| 158 | + } |
|
| 159 | + $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
| 160 | + $i++; |
|
| 161 | + } |
|
| 162 | + break; |
|
| 163 | + case "image": // handles image fields using htmlarea image manager |
|
| 164 | + global $_lang; |
|
| 165 | + global $ResourceManagerLoaded; |
|
| 166 | + global $content, $use_editor, $which_editor; |
|
| 167 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 168 | + $field_html .= " |
|
| 169 | 169 | <script type=\"text/javascript\"> |
| 170 | 170 | /* <![CDATA[ */ |
| 171 | 171 | var lastImageCtrl; |
@@ -224,18 +224,18 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | /* ]]> */ |
| 226 | 226 | </script>"; |
| 227 | - $ResourceManagerLoaded = true; |
|
| 228 | - } |
|
| 229 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
| 230 | - break; |
|
| 231 | - case "file": // handles the input of file uploads |
|
| 232 | - /* Modified by Timon for use with resource browser */ |
|
| 233 | - global $_lang; |
|
| 234 | - global $ResourceManagerLoaded; |
|
| 235 | - global $content, $use_editor, $which_editor; |
|
| 236 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 237 | - /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
| 238 | - $field_html .= " |
|
| 227 | + $ResourceManagerLoaded = true; |
|
| 228 | + } |
|
| 229 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
| 230 | + break; |
|
| 231 | + case "file": // handles the input of file uploads |
|
| 232 | + /* Modified by Timon for use with resource browser */ |
|
| 233 | + global $_lang; |
|
| 234 | + global $ResourceManagerLoaded; |
|
| 235 | + global $content, $use_editor, $which_editor; |
|
| 236 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 237 | + /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
| 238 | + $field_html .= " |
|
| 239 | 239 | <script type=\"text/javascript\"> |
| 240 | 240 | /* <![CDATA[ */ |
| 241 | 241 | var lastImageCtrl; |
@@ -294,90 +294,90 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | /* ]]> */ |
| 296 | 296 | </script>"; |
| 297 | - $ResourceManagerLoaded = true; |
|
| 298 | - } |
|
| 299 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
| 297 | + $ResourceManagerLoaded = true; |
|
| 298 | + } |
|
| 299 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
| 300 | 300 | |
| 301 | - break; |
|
| 301 | + break; |
|
| 302 | 302 | |
| 303 | - case 'custom_tv': |
|
| 304 | - $custom_output = ''; |
|
| 305 | - /* If we are loading a file */ |
|
| 306 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
| 307 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
| 308 | - if(!file_exists($file_name)) { |
|
| 309 | - $custom_output = $file_name . ' does not exist'; |
|
| 310 | - } else { |
|
| 311 | - $custom_output = file_get_contents($file_name); |
|
| 312 | - } |
|
| 313 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
| 314 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
| 315 | - if(!file_exists($file_name)) { |
|
| 316 | - $custom_output = $file_name . ' does not exist'; |
|
| 317 | - } else { |
|
| 318 | - ob_start(); |
|
| 319 | - include $file_name; |
|
| 320 | - $custom_output = ob_get_contents(); |
|
| 321 | - ob_end_clean(); |
|
| 322 | - } |
|
| 323 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
| 324 | - $chunk_name = trim(substr($field_elements, 7)); |
|
| 325 | - $chunk_body = $modx->getChunk($chunk_name); |
|
| 326 | - if($chunk_body == false) { |
|
| 327 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
| 328 | - } else { |
|
| 329 | - $custom_output = $chunk_body; |
|
| 330 | - } |
|
| 331 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
| 332 | - $eval_str = trim(substr($field_elements, 6)); |
|
| 333 | - $custom_output = eval($eval_str); |
|
| 334 | - } else { |
|
| 335 | - $custom_output = $field_elements; |
|
| 336 | - } |
|
| 337 | - $replacements = array( |
|
| 338 | - '[+field_type+]' => $field_type, |
|
| 339 | - '[+field_id+]' => $field_id, |
|
| 340 | - '[+default_text+]' => $default_text, |
|
| 341 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
| 342 | - '[+field_style+]' => $field_style, |
|
| 343 | - ); |
|
| 344 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
| 345 | - $modx->documentObject = $content; |
|
| 346 | - $modx->documentIdentifier = $content['id']; |
|
| 347 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
| 348 | - $field_html .= $custom_output; |
|
| 349 | - break; |
|
| 303 | + case 'custom_tv': |
|
| 304 | + $custom_output = ''; |
|
| 305 | + /* If we are loading a file */ |
|
| 306 | + if(substr($field_elements, 0, 5) == "@FILE") { |
|
| 307 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
| 308 | + if(!file_exists($file_name)) { |
|
| 309 | + $custom_output = $file_name . ' does not exist'; |
|
| 310 | + } else { |
|
| 311 | + $custom_output = file_get_contents($file_name); |
|
| 312 | + } |
|
| 313 | + } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
| 314 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
| 315 | + if(!file_exists($file_name)) { |
|
| 316 | + $custom_output = $file_name . ' does not exist'; |
|
| 317 | + } else { |
|
| 318 | + ob_start(); |
|
| 319 | + include $file_name; |
|
| 320 | + $custom_output = ob_get_contents(); |
|
| 321 | + ob_end_clean(); |
|
| 322 | + } |
|
| 323 | + } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
| 324 | + $chunk_name = trim(substr($field_elements, 7)); |
|
| 325 | + $chunk_body = $modx->getChunk($chunk_name); |
|
| 326 | + if($chunk_body == false) { |
|
| 327 | + $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
| 328 | + } else { |
|
| 329 | + $custom_output = $chunk_body; |
|
| 330 | + } |
|
| 331 | + } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
| 332 | + $eval_str = trim(substr($field_elements, 6)); |
|
| 333 | + $custom_output = eval($eval_str); |
|
| 334 | + } else { |
|
| 335 | + $custom_output = $field_elements; |
|
| 336 | + } |
|
| 337 | + $replacements = array( |
|
| 338 | + '[+field_type+]' => $field_type, |
|
| 339 | + '[+field_id+]' => $field_id, |
|
| 340 | + '[+default_text+]' => $default_text, |
|
| 341 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
| 342 | + '[+field_style+]' => $field_style, |
|
| 343 | + ); |
|
| 344 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
| 345 | + $modx->documentObject = $content; |
|
| 346 | + $modx->documentIdentifier = $content['id']; |
|
| 347 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
| 348 | + $field_html .= $custom_output; |
|
| 349 | + break; |
|
| 350 | 350 | |
| 351 | - default: // the default handler -- for errors, mostly |
|
| 352 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
| 351 | + default: // the default handler -- for errors, mostly |
|
| 352 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
| 353 | 353 | |
| 354 | - } // end switch statement |
|
| 355 | - } else { |
|
| 356 | - $custom = explode(":", $field_type); |
|
| 357 | - $custom_output = ''; |
|
| 358 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
| 359 | - if(!file_exists($file_name)) { |
|
| 360 | - $custom_output = $file_name . ' does not exist'; |
|
| 361 | - } else { |
|
| 362 | - ob_start(); |
|
| 363 | - include $file_name; |
|
| 364 | - $custom_output = ob_get_contents(); |
|
| 365 | - ob_end_clean(); |
|
| 366 | - } |
|
| 367 | - $replacements = array( |
|
| 368 | - '[+field_type+]' => $field_type, |
|
| 369 | - '[+field_id+]' => $field_id, |
|
| 370 | - '[+default_text+]' => $default_text, |
|
| 371 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
| 372 | - '[+field_style+]' => $field_style, |
|
| 373 | - ); |
|
| 374 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
| 375 | - $modx->documentObject = $content; |
|
| 376 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
| 377 | - $field_html .= $custom_output; |
|
| 378 | - } |
|
| 354 | + } // end switch statement |
|
| 355 | + } else { |
|
| 356 | + $custom = explode(":", $field_type); |
|
| 357 | + $custom_output = ''; |
|
| 358 | + $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
| 359 | + if(!file_exists($file_name)) { |
|
| 360 | + $custom_output = $file_name . ' does not exist'; |
|
| 361 | + } else { |
|
| 362 | + ob_start(); |
|
| 363 | + include $file_name; |
|
| 364 | + $custom_output = ob_get_contents(); |
|
| 365 | + ob_end_clean(); |
|
| 366 | + } |
|
| 367 | + $replacements = array( |
|
| 368 | + '[+field_type+]' => $field_type, |
|
| 369 | + '[+field_id+]' => $field_id, |
|
| 370 | + '[+default_text+]' => $default_text, |
|
| 371 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
| 372 | + '[+field_style+]' => $field_style, |
|
| 373 | + ); |
|
| 374 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
| 375 | + $modx->documentObject = $content; |
|
| 376 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
| 377 | + $field_html .= $custom_output; |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | - return $field_html; |
|
| 380 | + return $field_html; |
|
| 381 | 381 | } // end renderFormElement function |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -386,13 +386,13 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | function ParseIntputOptions($v) { |
| 388 | 388 | $modx = evolutionCMS(); |
| 389 | - $a = array(); |
|
| 390 | - if(is_array($v)) { |
|
| 391 | - return $v; |
|
| 392 | - } else if($modx->db->isResult($v)) { |
|
| 393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
| 394 | - } else { |
|
| 395 | - $a = explode("||", $v); |
|
| 396 | - } |
|
| 397 | - return $a; |
|
| 389 | + $a = array(); |
|
| 390 | + if(is_array($v)) { |
|
| 391 | + return $v; |
|
| 392 | + } else if($modx->db->isResult($v)) { |
|
| 393 | + while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
| 394 | + } else { |
|
| 395 | + $a = explode("||", $v); |
|
| 396 | + } |
|
| 397 | + return $a; |
|
| 398 | 398 | } |