// Fix Database title to use $db_type if available if (!empty($db_type) && isset($txt['db_' . $db_type])) { $txt['database_settings'] = $txt['db_' . $db_type] . ' ' . $txt['database_settings']; } //Remove this file, maybe? if (isset($_POST['remove_file'])) { @unlink(__FILE__); // Redirect to index.php. header('Location: http://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) . dirname($_SERVER['PHP_SELF']) . '/index.php'); exit; } if (isset($_POST['submit'])) { set_settings(); } if (isset($_POST['remove_hooks'])) { remove_hooks(); } // try to find the smflogo: could be a .gif or a .png $smflogo = "Themes/default/images/smflogo.png"; if (!file_exists(dirname(__FILE__) . "/" . $smflogo)) { $smflogo = "Themes/default/images/smflogo.gif"; } // Note that we're using the default URLs because we aren't even going to try to use Settings.php's settings. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="noindex" /> <title>', $context['is_legacy'] ? $txt['smf11_repair_settings'] : $txt['smf_repair_settings'], '</title> <script type="text/javascript" src="Themes/default/scripts/script.js"></script> <style type="text/css"> body
function fixp_main() { global $txt, $sourcedir, $boarddir, $boardurl, $context, $user_info, $smcFunc; loadLanguage('Admin'); loadLanguage('Packages'); loadTemplate('Admin'); fixp_loadLanguage(); // Sorry, only logged in admins...unless you want so. if (empty($context['override_security'])) { isAllowedTo('admin_forum'); } $context['install'] = isset($_GET['uninstall']) ? 0 : 1; if (!empty($_POST['remove']) && is_array($_POST['remove'])) { checkSession(); foreach ($_POST['remove'] as $id) { if (isset($id) && is_numeric($id)) { if (!empty($context['install'])) { $smcFunc['db_query']('', ' UPDATE {db_prefix}log_packages SET id_member_removed = {int:id_member}, member_removed = {string:member_name}, time_removed = {int:time_removed}, install_state = 0 WHERE id_install = {int:inst_package_id}', array('id_member' => $user_info['id'], 'member_name' => $user_info['name'], 'time_removed' => time(), 'inst_package_id' => $id)); } else { $smcFunc['db_query']('', ' UPDATE {db_prefix}log_packages SET id_member_removed = 0, member_removed = 0, time_removed = 0, install_state = 1 WHERE id_install = {int:inst_package_id}', array('inst_package_id' => $id)); } } } require_once $sourcedir . '/Subs-Package.php'; package_put_contents($boarddir . '/Packages/installed.list', time()); } if (isset($_POST['remove_hooks'])) { remove_hooks(); } $context['sub_template'] = 'admin'; $context['page_title'] = $txt['log_packages_title_' . (!empty($context['install']) ? 'installed' : 'removed')]; // Making a list is not hard with this beauty. require_once $sourcedir . '/Subs-List.php'; // Use the standard templates for showing this. $listOptions = array('id' => 'log_packages', 'title' => $context['page_title'], 'get_items' => array('function' => 'list_getPacks'), 'get_count' => array('function' => 'list_getNumPacks'), 'columns' => array('name' => array('header' => array('value' => $txt['mod_name']), 'data' => array('db' => 'name')), 'version' => array('header' => array('value' => $txt['mod_version']), 'data' => array('db' => 'version')), 'install_date' => array('header' => array('value' => $txt['mod_' . (!empty($context['install']) ? 'installed' : 'removed')]), 'data' => array('function' => create_function('&$data', ' return timeformat($data[\'time_' . (!empty($context['install']) ? 'installed' : 'removed') . '\']); '))), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$data', ' return \'<input type="checkbox" name="remove[]" value="\' . $data[\'id_install\'] . \'" class="input_check" />\'; '), 'class' => 'centertext'))), 'form' => array('href' => $boardurl . '/fix_packages.php?' . $context['session_var'] . '=' . $context['session_id'] . (!empty($context['install']) ? '' : ';uninstall')), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => ' <a href="' . $boardurl . '/fix_packages.php' . (!empty($context['install']) ? '?uninstall' : '') . '">[ ' . (!empty($context['install']) ? $txt['uninstall'] : $txt['install']) . ' ]</a> <input type="submit" name="remove_packages" value="' . $txt['pack_button_' . (!empty($context['install']) ? 'remove' : 'install')] . '" class="button_submit" /> <input type="submit" name="remove_hooks" value="' . $txt['remove_hooks'] . '" class="button_submit" />', 'class' => 'righttext'))); $context['sub_template'] = 'show_list'; $context['default_list'] = 'log_packages'; // Create the request list. createList($listOptions); }