| Conditions | 15 |
| Paths | 1024 |
| Total Lines | 475 |
| Code Lines | 365 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 25 | function AdminMain() |
||
| 26 | { |
||
| 27 | global $txt, $context, $scripturl, $modSettings, $settings; |
||
| 28 | global $smcFunc, $sourcedir, $options, $boarddir; |
||
| 29 | |||
| 30 | // Load the language and templates.... |
||
| 31 | loadLanguage('Admin'); |
||
| 32 | loadTemplate('Admin'); |
||
| 33 | loadJavaScriptFile('admin.js', array('minimize' => true), 'smf_admin'); |
||
| 34 | loadCSSFile('admin.css', array(), 'smf_admin'); |
||
| 35 | |||
| 36 | // No indexing evil stuff. |
||
| 37 | $context['robot_no_index'] = true; |
||
| 38 | |||
| 39 | require_once($sourcedir . '/Subs-Menu.php'); |
||
| 40 | |||
| 41 | // Some preferences. |
||
| 42 | $context['admin_preferences'] = !empty($options['admin_preferences']) ? $smcFunc['json_decode']($options['admin_preferences'], true) : array(); |
||
| 43 | |||
| 44 | /** @var array $admin_areas Defines the menu structure for the admin center. See {@link Subs-Menu.php Subs-Menu.php} for details! */ |
||
| 45 | $admin_areas = array( |
||
| 46 | 'forum' => array( |
||
| 47 | 'title' => $txt['admin_main'], |
||
| 48 | 'permission' => array('admin_forum', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_boards', 'manage_smileys', 'manage_attachments'), |
||
| 49 | 'areas' => array( |
||
| 50 | 'index' => array( |
||
| 51 | 'label' => $txt['admin_center'], |
||
| 52 | 'function' => 'AdminHome', |
||
| 53 | 'icon' => 'administration', |
||
| 54 | ), |
||
| 55 | 'credits' => array( |
||
| 56 | 'label' => $txt['support_credits_title'], |
||
| 57 | 'function' => 'AdminHome', |
||
| 58 | 'icon' => 'support', |
||
| 59 | ), |
||
| 60 | 'news' => array( |
||
| 61 | 'label' => $txt['news_title'], |
||
| 62 | 'file' => 'ManageNews.php', |
||
| 63 | 'function' => 'ManageNews', |
||
| 64 | 'icon' => 'news', |
||
| 65 | 'permission' => array('edit_news', 'send_mail', 'admin_forum'), |
||
| 66 | 'subsections' => array( |
||
| 67 | 'editnews' => array($txt['admin_edit_news'], 'edit_news'), |
||
| 68 | 'mailingmembers' => array($txt['admin_newsletters'], 'send_mail'), |
||
| 69 | 'settings' => array($txt['settings'], 'admin_forum'), |
||
| 70 | ), |
||
| 71 | ), |
||
| 72 | 'packages' => array( |
||
| 73 | 'label' => $txt['package'], |
||
| 74 | 'file' => 'Packages.php', |
||
| 75 | 'function' => 'Packages', |
||
| 76 | 'permission' => array('admin_forum'), |
||
| 77 | 'icon' => 'packages', |
||
| 78 | 'subsections' => array( |
||
| 79 | 'browse' => array($txt['browse_packages']), |
||
| 80 | 'packageget' => array($txt['download_packages'], 'url' => $scripturl . '?action=admin;area=packages;sa=packageget;get'), |
||
| 81 | 'perms' => array($txt['package_file_perms']), |
||
| 82 | 'options' => array($txt['package_settings']), |
||
| 83 | ), |
||
| 84 | ), |
||
| 85 | 'search' => array( |
||
| 86 | 'function' => 'AdminSearch', |
||
| 87 | 'permission' => array('admin_forum'), |
||
| 88 | 'select' => 'index' |
||
| 89 | ), |
||
| 90 | 'adminlogoff' => array( |
||
| 91 | 'label' => $txt['admin_logoff'], |
||
| 92 | 'function' => 'AdminEndSession', |
||
| 93 | 'enabled' => empty($modSettings['securityDisable']), |
||
| 94 | 'icon' => 'exit', |
||
| 95 | ), |
||
| 96 | |||
| 97 | ), |
||
| 98 | ), |
||
| 99 | 'config' => array( |
||
| 100 | 'title' => $txt['admin_config'], |
||
| 101 | 'permission' => array('admin_forum'), |
||
| 102 | 'areas' => array( |
||
| 103 | 'featuresettings' => array( |
||
| 104 | 'label' => $txt['modSettings_title'], |
||
| 105 | 'file' => 'ManageSettings.php', |
||
| 106 | 'function' => 'ModifyFeatureSettings', |
||
| 107 | 'icon' => 'features', |
||
| 108 | 'subsections' => array( |
||
| 109 | 'basic' => array($txt['mods_cat_features']), |
||
| 110 | 'bbc' => array($txt['manageposts_bbc_settings']), |
||
| 111 | 'layout' => array($txt['mods_cat_layout']), |
||
| 112 | 'sig' => array($txt['signature_settings_short']), |
||
| 113 | 'profile' => array($txt['custom_profile_shorttitle']), |
||
| 114 | 'likes' => array($txt['likes']), |
||
| 115 | 'mentions' => array($txt['mentions']), |
||
| 116 | 'alerts' => array($txt['notifications']), |
||
| 117 | ), |
||
| 118 | ), |
||
| 119 | 'antispam' => array( |
||
| 120 | 'label' => $txt['antispam_title'], |
||
| 121 | 'file' => 'ManageSettings.php', |
||
| 122 | 'function' => 'ModifyAntispamSettings', |
||
| 123 | 'icon' => 'security', |
||
| 124 | ), |
||
| 125 | 'languages' => array( |
||
| 126 | 'label' => $txt['language_configuration'], |
||
| 127 | 'file' => 'ManageLanguages.php', |
||
| 128 | 'function' => 'ManageLanguages', |
||
| 129 | 'icon' => 'languages', |
||
| 130 | 'subsections' => array( |
||
| 131 | 'edit' => array($txt['language_edit']), |
||
| 132 | 'add' => array($txt['language_add']), |
||
| 133 | 'settings' => array($txt['language_settings']), |
||
| 134 | ), |
||
| 135 | ), |
||
| 136 | 'current_theme' => array( |
||
| 137 | 'label' => $txt['theme_current_settings'], |
||
| 138 | 'file' => 'Themes.php', |
||
| 139 | 'function' => 'ThemesMain', |
||
| 140 | 'custom_url' => $scripturl . '?action=admin;area=theme;sa=list;th=' . $settings['theme_id'], |
||
| 141 | 'icon' => 'current_theme', |
||
| 142 | ), |
||
| 143 | 'theme' => array( |
||
| 144 | 'label' => $txt['theme_admin'], |
||
| 145 | 'file' => 'Themes.php', |
||
| 146 | 'function' => 'ThemesMain', |
||
| 147 | 'custom_url' => $scripturl . '?action=admin;area=theme', |
||
| 148 | 'icon' => 'themes', |
||
| 149 | 'subsections' => array( |
||
| 150 | 'admin' => array($txt['themeadmin_admin_title']), |
||
| 151 | 'list' => array($txt['themeadmin_list_title']), |
||
| 152 | 'reset' => array($txt['themeadmin_reset_title']), |
||
| 153 | 'edit' => array($txt['themeadmin_edit_title']), |
||
| 154 | ), |
||
| 155 | ), |
||
| 156 | 'modsettings' => array( |
||
| 157 | 'label' => $txt['admin_modifications'], |
||
| 158 | 'file' => 'ManageSettings.php', |
||
| 159 | 'function' => 'ModifyModSettings', |
||
| 160 | 'icon' => 'modifications', |
||
| 161 | 'subsections' => array( |
||
| 162 | 'general' => array($txt['mods_cat_modifications_misc']), |
||
| 163 | // Mod Authors for a "ADD AFTER" on this line. Ensure you end your change with a comma. For example: |
||
| 164 | // 'shout' => array($txt['shout']), |
||
| 165 | // Note the comma!! The setting with automatically appear with the first mod to be added. |
||
| 166 | ), |
||
| 167 | ), |
||
| 168 | ), |
||
| 169 | ), |
||
| 170 | 'layout' => array( |
||
| 171 | 'title' => $txt['layout_controls'], |
||
| 172 | 'permission' => array('manage_boards', 'admin_forum', 'manage_smileys', 'manage_attachments', 'moderate_forum'), |
||
| 173 | 'areas' => array( |
||
| 174 | 'manageboards' => array( |
||
| 175 | 'label' => $txt['admin_boards'], |
||
| 176 | 'file' => 'ManageBoards.php', |
||
| 177 | 'function' => 'ManageBoards', |
||
| 178 | 'icon' => 'boards', |
||
| 179 | 'permission' => array('manage_boards'), |
||
| 180 | 'subsections' => array( |
||
| 181 | 'main' => array($txt['boards_edit']), |
||
| 182 | 'newcat' => array($txt['mboards_new_cat']), |
||
| 183 | 'settings' => array($txt['settings'], 'admin_forum'), |
||
| 184 | ), |
||
| 185 | ), |
||
| 186 | 'postsettings' => array( |
||
| 187 | 'label' => $txt['manageposts'], |
||
| 188 | 'file' => 'ManagePosts.php', |
||
| 189 | 'function' => 'ManagePostSettings', |
||
| 190 | 'permission' => array('admin_forum'), |
||
| 191 | 'icon' => 'posts', |
||
| 192 | 'subsections' => array( |
||
| 193 | 'posts' => array($txt['manageposts_settings']), |
||
| 194 | 'censor' => array($txt['admin_censored_words']), |
||
| 195 | 'topics' => array($txt['manageposts_topic_settings']), |
||
| 196 | 'drafts' => array($txt['manage_drafts']), |
||
| 197 | ), |
||
| 198 | ), |
||
| 199 | 'managecalendar' => array( |
||
| 200 | 'label' => $txt['manage_calendar'], |
||
| 201 | 'file' => 'ManageCalendar.php', |
||
| 202 | 'function' => 'ManageCalendar', |
||
| 203 | 'icon' => 'calendar', |
||
| 204 | 'permission' => array('admin_forum'), |
||
| 205 | 'inactive' => empty($modSettings['cal_enabled']), |
||
| 206 | 'subsections' => empty($modSettings['cal_enabled']) ? array() : array( |
||
| 207 | 'holidays' => array($txt['manage_holidays'], 'admin_forum'), |
||
| 208 | 'settings' => array($txt['calendar_settings'], 'admin_forum'), |
||
| 209 | ), |
||
| 210 | ), |
||
| 211 | 'managesearch' => array( |
||
| 212 | 'label' => $txt['manage_search'], |
||
| 213 | 'file' => 'ManageSearch.php', |
||
| 214 | 'function' => 'ManageSearch', |
||
| 215 | 'icon' => 'search', |
||
| 216 | 'permission' => array('admin_forum'), |
||
| 217 | 'subsections' => array( |
||
| 218 | 'weights' => array($txt['search_weights']), |
||
| 219 | 'method' => array($txt['search_method']), |
||
| 220 | 'settings' => array($txt['settings']), |
||
| 221 | ), |
||
| 222 | ), |
||
| 223 | 'smileys' => array( |
||
| 224 | 'label' => $txt['smileys_manage'], |
||
| 225 | 'file' => 'ManageSmileys.php', |
||
| 226 | 'function' => 'ManageSmileys', |
||
| 227 | 'icon' => 'smiley', |
||
| 228 | 'permission' => array('manage_smileys'), |
||
| 229 | 'subsections' => array( |
||
| 230 | 'editsets' => array($txt['smiley_sets']), |
||
| 231 | 'addsmiley' => array($txt['smileys_add'], 'enabled' => !empty($modSettings['smiley_enable'])), |
||
| 232 | 'editsmileys' => array($txt['smileys_edit'], 'enabled' => !empty($modSettings['smiley_enable'])), |
||
| 233 | 'setorder' => array($txt['smileys_set_order'], 'enabled' => !empty($modSettings['smiley_enable'])), |
||
| 234 | 'editicons' => array($txt['icons_edit_message_icons'], 'enabled' => !empty($modSettings['messageIcons_enable'])), |
||
| 235 | 'settings' => array($txt['settings']), |
||
| 236 | ), |
||
| 237 | ), |
||
| 238 | 'manageattachments' => array( |
||
| 239 | 'label' => $txt['attachments_avatars'], |
||
| 240 | 'file' => 'ManageAttachments.php', |
||
| 241 | 'function' => 'ManageAttachments', |
||
| 242 | 'icon' => 'attachment', |
||
| 243 | 'permission' => array('manage_attachments'), |
||
| 244 | 'subsections' => array( |
||
| 245 | 'browse' => array($txt['attachment_manager_browse']), |
||
| 246 | 'attachments' => array($txt['attachment_manager_settings']), |
||
| 247 | 'avatars' => array($txt['attachment_manager_avatar_settings']), |
||
| 248 | 'attachpaths' => array($txt['attach_directories']), |
||
| 249 | 'maintenance' => array($txt['attachment_manager_maintenance']), |
||
| 250 | ), |
||
| 251 | ), |
||
| 252 | 'sengines' => array( |
||
| 253 | 'label' => $txt['search_engines'], |
||
| 254 | 'inactive' => empty($modSettings['spider_mode']), |
||
| 255 | 'file' => 'ManageSearchEngines.php', |
||
| 256 | 'icon' => 'engines', |
||
| 257 | 'function' => 'SearchEngines', |
||
| 258 | 'permission' => 'admin_forum', |
||
| 259 | 'subsections' => empty($modSettings['spider_mode']) ? array() : array( |
||
| 260 | 'stats' => array($txt['spider_stats']), |
||
| 261 | 'logs' => array($txt['spider_logs']), |
||
| 262 | 'spiders' => array($txt['spiders']), |
||
| 263 | 'settings' => array($txt['settings']), |
||
| 264 | ), |
||
| 265 | ), |
||
| 266 | ), |
||
| 267 | ), |
||
| 268 | 'members' => array( |
||
| 269 | 'title' => $txt['admin_manage_members'], |
||
| 270 | 'permission' => array('moderate_forum', 'manage_membergroups', 'manage_bans', 'manage_permissions', 'admin_forum'), |
||
| 271 | 'areas' => array( |
||
| 272 | 'viewmembers' => array( |
||
| 273 | 'label' => $txt['admin_users'], |
||
| 274 | 'file' => 'ManageMembers.php', |
||
| 275 | 'function' => 'ViewMembers', |
||
| 276 | 'icon' => 'members', |
||
| 277 | 'permission' => array('moderate_forum'), |
||
| 278 | 'subsections' => array( |
||
| 279 | 'all' => array($txt['view_all_members']), |
||
| 280 | 'search' => array($txt['mlist_search']), |
||
| 281 | ), |
||
| 282 | ), |
||
| 283 | 'membergroups' => array( |
||
| 284 | 'label' => $txt['admin_groups'], |
||
| 285 | 'file' => 'ManageMembergroups.php', |
||
| 286 | 'function' => 'ModifyMembergroups', |
||
| 287 | 'icon' => 'membergroups', |
||
| 288 | 'permission' => array('manage_membergroups'), |
||
| 289 | 'subsections' => array( |
||
| 290 | 'index' => array($txt['membergroups_edit_groups'], 'manage_membergroups'), |
||
| 291 | 'add' => array($txt['membergroups_new_group'], 'manage_membergroups'), |
||
| 292 | 'settings' => array($txt['settings'], 'admin_forum'), |
||
| 293 | ), |
||
| 294 | ), |
||
| 295 | 'permissions' => array( |
||
| 296 | 'label' => $txt['edit_permissions'], |
||
| 297 | 'file' => 'ManagePermissions.php', |
||
| 298 | 'function' => 'ModifyPermissions', |
||
| 299 | 'icon' => 'permissions', |
||
| 300 | 'permission' => array('manage_permissions'), |
||
| 301 | 'subsections' => array( |
||
| 302 | 'index' => array($txt['permissions_groups'], 'manage_permissions'), |
||
| 303 | 'board' => array($txt['permissions_boards'], 'manage_permissions'), |
||
| 304 | 'profiles' => array($txt['permissions_profiles'], 'manage_permissions'), |
||
| 305 | 'postmod' => array($txt['permissions_post_moderation'], 'manage_permissions'), |
||
| 306 | 'settings' => array($txt['settings'], 'admin_forum'), |
||
| 307 | ), |
||
| 308 | ), |
||
| 309 | 'regcenter' => array( |
||
| 310 | 'label' => $txt['registration_center'], |
||
| 311 | 'file' => 'ManageRegistration.php', |
||
| 312 | 'function' => 'RegCenter', |
||
| 313 | 'icon' => 'regcenter', |
||
| 314 | 'permission' => array('admin_forum', 'moderate_forum'), |
||
| 315 | 'subsections' => array( |
||
| 316 | 'register' => array($txt['admin_browse_register_new'], 'moderate_forum'), |
||
| 317 | 'agreement' => array($txt['registration_agreement'], 'admin_forum'), |
||
| 318 | 'policy' => array($txt['privacy_policy'], 'admin_forum'), |
||
| 319 | 'reservednames' => array($txt['admin_reserved_set'], 'admin_forum'), |
||
| 320 | 'settings' => array($txt['settings'], 'admin_forum'), |
||
| 321 | ), |
||
| 322 | ), |
||
| 323 | 'warnings' => array( |
||
| 324 | 'label' => $txt['warnings'], |
||
| 325 | 'file' => 'ManageSettings.php', |
||
| 326 | 'function' => 'ModifyWarningSettings', |
||
| 327 | 'icon' => 'warning', |
||
| 328 | 'inactive' => $modSettings['warning_settings'][0] == 0, |
||
| 329 | 'permission' => array('admin_forum'), |
||
| 330 | ), |
||
| 331 | 'ban' => array( |
||
| 332 | 'label' => $txt['ban_title'], |
||
| 333 | 'file' => 'ManageBans.php', |
||
| 334 | 'function' => 'Ban', |
||
| 335 | 'icon' => 'ban', |
||
| 336 | 'permission' => 'manage_bans', |
||
| 337 | 'subsections' => array( |
||
| 338 | 'list' => array($txt['ban_edit_list']), |
||
| 339 | 'add' => array($txt['ban_add_new']), |
||
| 340 | 'browse' => array($txt['ban_trigger_browse']), |
||
| 341 | 'log' => array($txt['ban_log']), |
||
| 342 | ), |
||
| 343 | ), |
||
| 344 | 'paidsubscribe' => array( |
||
| 345 | 'label' => $txt['paid_subscriptions'], |
||
| 346 | 'inactive' => empty($modSettings['paid_enabled']), |
||
| 347 | 'file' => 'ManagePaid.php', |
||
| 348 | 'icon' => 'paid', |
||
| 349 | 'function' => 'ManagePaidSubscriptions', |
||
| 350 | 'permission' => 'admin_forum', |
||
| 351 | 'subsections' => empty($modSettings['paid_enabled']) ? array() : array( |
||
| 352 | 'view' => array($txt['paid_subs_view']), |
||
| 353 | 'settings' => array($txt['settings']), |
||
| 354 | ), |
||
| 355 | ), |
||
| 356 | ), |
||
| 357 | ), |
||
| 358 | 'maintenance' => array( |
||
| 359 | 'title' => $txt['admin_maintenance'], |
||
| 360 | 'permission' => array('admin_forum'), |
||
| 361 | 'areas' => array( |
||
| 362 | 'serversettings' => array( |
||
| 363 | 'label' => $txt['admin_server_settings'], |
||
| 364 | 'file' => 'ManageServer.php', |
||
| 365 | 'function' => 'ModifySettings', |
||
| 366 | 'icon' => 'server', |
||
| 367 | 'subsections' => array( |
||
| 368 | 'general' => array($txt['general_settings']), |
||
| 369 | 'database' => array($txt['database_settings']), |
||
| 370 | 'cookie' => array($txt['cookies_sessions_settings']), |
||
| 371 | 'security' => array($txt['security_settings']), |
||
| 372 | 'cache' => array($txt['caching_settings']), |
||
| 373 | 'export' => array($txt['export_settings']), |
||
| 374 | 'loads' => array($txt['load_balancing_settings']), |
||
| 375 | 'phpinfo' => array($txt['phpinfo_settings']), |
||
| 376 | ), |
||
| 377 | ), |
||
| 378 | 'maintain' => array( |
||
| 379 | 'label' => $txt['maintain_title'], |
||
| 380 | 'file' => 'ManageMaintenance.php', |
||
| 381 | 'icon' => 'maintain', |
||
| 382 | 'function' => 'ManageMaintenance', |
||
| 383 | 'subsections' => array( |
||
| 384 | 'routine' => array($txt['maintain_sub_routine'], 'admin_forum'), |
||
| 385 | 'database' => array($txt['maintain_sub_database'], 'admin_forum'), |
||
| 386 | 'members' => array($txt['maintain_sub_members'], 'admin_forum'), |
||
| 387 | 'topics' => array($txt['maintain_sub_topics'], 'admin_forum'), |
||
| 388 | 'hooks' => array($txt['hooks_title_list'], 'admin_forum'), |
||
| 389 | ), |
||
| 390 | ), |
||
| 391 | 'scheduledtasks' => array( |
||
| 392 | 'label' => $txt['maintain_tasks'], |
||
| 393 | 'file' => 'ManageScheduledTasks.php', |
||
| 394 | 'icon' => 'scheduled', |
||
| 395 | 'function' => 'ManageScheduledTasks', |
||
| 396 | 'subsections' => array( |
||
| 397 | 'tasks' => array($txt['maintain_tasks'], 'admin_forum'), |
||
| 398 | 'tasklog' => array($txt['scheduled_log'], 'admin_forum'), |
||
| 399 | 'settings' => array($txt['scheduled_tasks_settings'], 'admin_forum'), |
||
| 400 | ), |
||
| 401 | ), |
||
| 402 | 'mailqueue' => array( |
||
| 403 | 'label' => $txt['mailqueue_title'], |
||
| 404 | 'file' => 'ManageMail.php', |
||
| 405 | 'function' => 'ManageMail', |
||
| 406 | 'icon' => 'mail', |
||
| 407 | 'subsections' => array( |
||
| 408 | 'browse' => array($txt['mailqueue_browse'], 'admin_forum'), |
||
| 409 | 'settings' => array($txt['mailqueue_settings'], 'admin_forum'), |
||
| 410 | 'test' => array($txt['mailqueue_test'], 'admin_forum'), |
||
| 411 | ), |
||
| 412 | ), |
||
| 413 | 'reports' => array( |
||
| 414 | 'label' => $txt['generate_reports'], |
||
| 415 | 'file' => 'Reports.php', |
||
| 416 | 'function' => 'ReportsMain', |
||
| 417 | 'icon' => 'reports', |
||
| 418 | ), |
||
| 419 | 'logs' => array( |
||
| 420 | 'label' => $txt['logs'], |
||
| 421 | 'function' => 'AdminLogs', |
||
| 422 | 'icon' => 'logs', |
||
| 423 | 'subsections' => array( |
||
| 424 | 'errorlog' => array($txt['errorlog'], 'admin_forum', 'enabled' => !empty($modSettings['enableErrorLogging']), 'url' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc'), |
||
| 425 | 'adminlog' => array($txt['admin_log'], 'admin_forum', 'enabled' => !empty($modSettings['adminlog_enabled'])), |
||
| 426 | 'modlog' => array($txt['moderation_log'], 'admin_forum', 'enabled' => !empty($modSettings['modlog_enabled'])), |
||
| 427 | 'banlog' => array($txt['ban_log'], 'manage_bans'), |
||
| 428 | 'spiderlog' => array($txt['spider_logs'], 'admin_forum', 'enabled' => !empty($modSettings['spider_mode'])), |
||
| 429 | 'tasklog' => array($txt['scheduled_log'], 'admin_forum'), |
||
| 430 | 'settings' => array($txt['log_settings'], 'admin_forum'), |
||
| 431 | ), |
||
| 432 | ), |
||
| 433 | 'repairboards' => array( |
||
| 434 | 'label' => $txt['admin_repair'], |
||
| 435 | 'file' => 'RepairBoards.php', |
||
| 436 | 'function' => 'RepairBoards', |
||
| 437 | 'select' => 'maintain', |
||
| 438 | 'hidden' => true, |
||
| 439 | ), |
||
| 440 | ), |
||
| 441 | ), |
||
| 442 | ); |
||
| 443 | |||
| 444 | // Any files to include for administration? |
||
| 445 | if (!empty($modSettings['integrate_admin_include'])) |
||
| 446 | { |
||
| 447 | $admin_includes = explode(',', $modSettings['integrate_admin_include']); |
||
| 448 | foreach ($admin_includes as $include) |
||
| 449 | { |
||
| 450 | $include = strtr(trim($include), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir'])); |
||
| 451 | if (file_exists($include)) |
||
| 452 | require_once($include); |
||
| 453 | } |
||
| 454 | } |
||
| 455 | |||
| 456 | // Make sure the administrator has a valid session... |
||
| 457 | validateSession(); |
||
| 458 | |||
| 459 | // Actually create the menu! |
||
| 460 | $admin_include_data = createMenu($admin_areas, array('do_big_icons' => true)); |
||
| 461 | unset($admin_areas); |
||
| 462 | |||
| 463 | // Nothing valid? |
||
| 464 | if ($admin_include_data == false) |
||
| 465 | fatal_lang_error('no_access', false); |
||
| 466 | |||
| 467 | // Build the link tree. |
||
| 468 | $context['linktree'][] = array( |
||
| 469 | 'url' => $scripturl . '?action=admin', |
||
| 470 | 'name' => $txt['admin_center'], |
||
| 471 | ); |
||
| 472 | if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index') |
||
| 473 | $context['linktree'][] = array( |
||
| 474 | 'url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';' . $context['session_var'] . '=' . $context['session_id'], |
||
| 475 | 'name' => $admin_include_data['label'], |
||
| 476 | ); |
||
| 477 | if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label']) |
||
| 478 | $context['linktree'][] = array( |
||
| 479 | 'url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';sa=' . $admin_include_data['current_subsection'] . ';' . $context['session_var'] . '=' . $context['session_id'], |
||
| 480 | 'name' => $admin_include_data['subsections'][$admin_include_data['current_subsection']][0], |
||
| 481 | ); |
||
| 482 | |||
| 483 | // Make a note of the Unique ID for this menu. |
||
| 484 | $context['admin_menu_id'] = $context['max_menu_id']; |
||
| 485 | $context['admin_menu_name'] = 'menu_data_' . $context['admin_menu_id']; |
||
| 486 | |||
| 487 | // Where in the admin are we? |
||
| 488 | $context['admin_area'] = $admin_include_data['current_area']; |
||
| 489 | |||
| 490 | // Now - finally - call the right place! |
||
| 491 | if (isset($admin_include_data['file'])) |
||
| 492 | require_once($sourcedir . '/' . $admin_include_data['file']); |
||
| 493 | |||
| 494 | // Get the right callable. |
||
| 495 | $call = call_helper($admin_include_data['function'], true); |
||
| 496 | |||
| 497 | // Is it valid? |
||
| 498 | if (!empty($call)) |
||
| 499 | call_user_func($call); |
||
| 500 | } |
||
| 971 | ?> |