/** * file_source() * * - initialises all the basic context required for the database cleanup. * - passes execution onto the relevant section. * - if the passed action is not found it shows the main page. * * @return */ function file_source() { global $smcFunc, $context, $table_prefix, $version; // You have to be allowed to do this isAllowedTo('admin_forum'); // SMF 1 or 2 ? if (isset($smcFunc)) { db_extend('packages'); $version = 2; $table_prefix = '{db_prefix}'; } else { db_compat(); $version = 1; $table_prefix = ''; } $actions = array('examine' => 'examine', 'execute' => 'execute'); $titles = array('examine' => 'Examine Database', 'execute' => 'Execute Changes'); // Set a default action if none or an unsupported one is given if (!isset($_GET['action']) || !isset($actions[$_GET['action']])) { $current_action = 'examine'; } else { $current_action = $actions[$_GET['action']]; } // Set up the template information and language loadtext(); $context['sub_template'] = $current_action; $context['page_title'] = $titles[$current_action]; $context['page_title_html_safe'] = $titles[$current_action]; $context['robot_no_index'] = true; $context['html_headers'] .= ' <style type="text/css"> .normallist li { list-style: circle; line-height: 1.5em; } .submit_button { text-align: center; } .error { background-color: #FFECEC; } .success { color: #00CC00; } .fail { color: #EE0000; } </style>'; $current_action(); }
function loadsubtag($subtag, $tagkey, $taglevel) { global $settings; loadsettings($subtag, $taglevel); switch ($tagkey) { case "global": return; //do nothing ("ignore" global tag, because it's loaded manually) //do nothing ("ignore" global tag, because it's loaded manually) case "char": loadcharacter($subtag, $taglevel + 1); $stoploading = true; break; //do_charbuild //do_charbuild case "text": loadtext($subtag, $taglevel + 1); $stoploading = true; break; // do_textbuild // do_textbuild case "object": insertobject($subtag, $taglevel + 1); $stoploading = true; break; //do_object } if (!$stoploading) { foreach ($subtag as $newsubkey => $newsubvalue) { loadsubtag($newsubvalue, "{$newsubkey}", $taglevel + 1); } } }