function getServerVersions($checkFor) { global $txt, $db_connection, $_PHPA, $memcached, $modSettings; loadLanguage('Admin'); $versions = array(); // Is GD available? If it is, we should show version information for it too. if (in_array('gd', $checkFor) && function_exists('gd_info')) { $temp = gd_info(); $versions['gd'] = array('title' => $txt['support_versions_gd'], 'version' => $temp['GD Version']); } // Now lets check for the Database. if (in_array('db_server', $checkFor)) { db_extend(); if (!isset($db_connection) || $db_connection === false) { trigger_error('getServerVersions(): you need to be connected to the database in order to get its server version', E_USER_NOTICE); } else { $versions['db_server'] = array('title' => sprintf($txt['support_versions_db'], 'MySQL'), 'version' => ''); $versions['db_server']['version'] = smf_db_get_version(); } } // If we're using memcache we need the server info. if (empty($memcached) && function_exists('memcache_get') && isset($modSettings['cache_memcached']) && trim($modSettings['cache_memcached']) != '') { get_memcached_server(); } // Check to see if we have any accelerators installed... if (in_array('phpa', $checkFor) && isset($_PHPA)) { $versions['phpa'] = array('title' => 'ionCube PHP-Accelerator', 'version' => $_PHPA['VERSION']); } if (in_array('apc', $checkFor) && extension_loaded('apc')) { $versions['apc'] = array('title' => 'Alternative PHP Cache', 'version' => phpversion('apc')); } if (in_array('memcache', $checkFor) && function_exists('memcache_set')) { $versions['memcache'] = array('title' => 'Memcached', 'version' => empty($memcached) ? '???' : memcache_get_version($memcached)); } if (in_array('xcache', $checkFor) && function_exists('xcache_set')) { $versions['xcache'] = array('title' => 'XCache', 'version' => XCACHE_VERSION); } if (in_array('php', $checkFor)) { $versions['php'] = array('title' => 'PHP', 'version' => PHP_VERSION); } if (in_array('server', $checkFor)) { $versions['server'] = array('title' => $txt['support_versions_server'], 'version' => $_SERVER['SERVER_SOFTWARE']); } return $versions; }
function DeleteInstall() { global $txt, $HTTP_SESSION_VARS, $incontext; global $current_smf_version, $sourcedir, $forum_version, $modSettings, $user_info, $db_type; $incontext['page_title'] = $txt['congratulations']; $incontext['sub_template'] = 'delete_install'; $incontext['continue'] = 0; require dirname(__FILE__) . '/Settings.php'; load_database(); chdir(dirname(__FILE__)); require_once $sourcedir . '/Errors.php'; require_once $sourcedir . '/lib/Subs.php'; require_once $sourcedir . '/CommonAPI.php'; require_once $sourcedir . '/Load.php'; require_once $sourcedir . '/Security.php'; require_once $sourcedir . '/lib/Subs-Auth.php'; // Bring a warning over. if (!empty($incontext['account_existed'])) { $incontext['warning'] = $incontext['account_existed']; } smf_db_query(' SET NAMES utf8', array()); // As track stats is by default enabled let's add some activity. smf_db_insert('ignore', '{db_prefix}log_activity', array('date' => 'date', 'topics' => 'int', 'posts' => 'int', 'registers' => 'int'), array(strftime('%Y-%m-%d', time()), 1, 1, !empty($incontext['member_id']) ? 1 : 0), array('date')); // Automatically log them in ;) if (isset($incontext['member_id']) && isset($incontext['member_salt'])) { setLoginCookie(3153600 * 60, $incontext['member_id'], sha1(sha1(strtolower($_POST['username']) . $_POST['password1']) . $incontext['member_salt'])); } $result = smf_db_query(' SELECT value FROM {db_prefix}settings WHERE variable = {string:db_sessions}', array('db_sessions' => 'databaseSession_enable', 'db_error_skip' => true)); if (mysql_num_rows($result) != 0) { list($db_sessions) = mysql_fetch_row($result); } mysql_free_result($result); if (empty($db_sessions)) { if (@version_compare(PHP_VERSION, '4.2.0') == -1) { $HTTP_SESSION_VARS['php_412_bugfix'] = true; } $_SESSION['admin_time'] = time(); } else { $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); smf_db_insert('replace', '{db_prefix}sessions', array('session_id' => 'string', 'last_update' => 'int', 'data' => 'string'), array(session_id(), time(), 'USER_AGENT|s:' . strlen($_SERVER['HTTP_USER_AGENT']) . ':"' . $_SERVER['HTTP_USER_AGENT'] . '";admin_time|i:' . time() . ';'), array('session_id')); } // We're going to want our lovely $modSettings now. $request = smf_db_query(' SELECT variable, value FROM {db_prefix}settings', array('db_error_skip' => true)); // Only proceed if we can load the data. if ($request) { while ($row = mysql_fetch_row($request)) { $modSettings[$row[0]] = $row[1]; } mysql_free_result($request); } updateStats('member'); updateStats('message'); updateStats('topic'); $request = smf_db_query(' SELECT id_msg FROM {db_prefix}messages WHERE id_msg = 1 AND modified_time = 0 LIMIT 1', array('db_error_skip' => true)); if (mysql_num_rows($request) > 0) { updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); } mysql_free_result($request); // Now is the perfect time to fetch the SM files. require_once $sourcedir . '/ScheduledTasks.php'; // Sanity check that they loaded earlier! if (isset($modSettings['recycle_board'])) { $forum_version = $current_smf_version; // The variable is usually defined in index.php so lets just use our variable to do it for us. scheduled_fetchSMfiles(); // Now go get those files! // We've just installed! $user_info['ip'] = $_SERVER['REMOTE_ADDR']; $user_info['id'] = isset($incontext['member_id']) ? $incontext['member_id'] : 0; logAction('install', array('version' => $forum_version), 'admin'); } // Check if we need some stupid MySQL fix. $server_version = smf_db_get_version(); if ($db_type == 'mysql' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { updateSettings(array('db_mysql_group_by_fix' => '1')); } // Some final context for the template. $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\'; $incontext['probably_delete_install'] = isset($_SESSION['installer_temp_ftp']) || is_writable(dirname(__FILE__)) || is_writable(__FILE__); return false; }