function initialize_inputs() { global $databases, $incontext; // Just so people using older versions of PHP aren't left in the cold. if (!isset($_SERVER['PHP_SELF'])) { $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; } // Turn off magic quotes runtime and enable error reporting. if (function_exists('set_magic_quotes_runtime')) { @set_magic_quotes_runtime(0); } error_reporting(E_ALL); // Fun. Low PHP version... if (!isset($_GET)) { $GLOBALS['_GET']['step'] = 0; return; } if (!isset($_GET['obgz'])) { ob_start(); if (@ini_get('session.save_handler') == 'user') { @ini_set('session.save_handler', 'files'); } if (function_exists('session_start')) { @session_start(); } } else { ob_start('ob_gzhandler'); if (@ini_get('session.save_handler') == 'user') { @ini_set('session.save_handler', 'files'); } session_start(); if (!headers_sent()) { 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> <title>', htmlspecialchars($_GET['pass_string']), '</title> </head> <body style="background-color: #d4d4d4; margin-top: 16%; text-align: center; font-size: 16pt;"> <strong>', htmlspecialchars($_GET['pass_string']), '</strong> </body> </html>'; } exit; } // Are we calling the backup css file? if (isset($_GET['infile_css'])) { header('Content-Type: text/css'); template_css(); exit; } // Anybody home? if (!isset($_GET['xml'])) { $incontext['remote_files_available'] = false; $test = @fsockopen('www.simplemachines.org', 80, $errno, $errstr, 1); if ($test) { $incontext['remote_files_available'] = true; } @fclose($test); } // Add slashes, as long as they aren't already being added. if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) { foreach ($_POST as $k => $v) { $_POST[$k] = addslashes($v); } } // This is really quite simple; if ?delete is on the URL, delete the installer... if (isset($_GET['delete'])) { if (isset($_SESSION['installer_temp_ftp'])) { $ftp = new ftp_connection($_SESSION['installer_temp_ftp']['server'], $_SESSION['installer_temp_ftp']['port'], $_SESSION['installer_temp_ftp']['username'], $_SESSION['installer_temp_ftp']['password']); $ftp->chdir($_SESSION['installer_temp_ftp']['path']); $ftp->unlink('install.php'); $ftp->unlink('webinstall.php'); foreach ($databases as $key => $dummy) { $ftp->unlink('install_' . $GLOBALS['db_script_version'] . '_' . $key . '.sql'); } $ftp->close(); unset($_SESSION['installer_temp_ftp']); } else { @unlink(__FILE__); @unlink(dirname(__FILE__) . '/webinstall.php'); foreach ($databases as $key => $dummy) { @unlink(dirname(__FILE__) . '/install_' . $GLOBALS['db_script_version'] . '_' . $key . '.sql'); } } // Now just redirect to a blank.gif... header('Location: http://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) . dirname($_SERVER['PHP_SELF']) . '/Themes/default/images/blank.gif'); exit; } // PHP 5 might cry if we don't do this now. if (function_exists('date_default_timezone_set')) { $server_offset = @mktime(0, 0, 0, 1, 1, 1970); date_default_timezone_set('Etc/GMT' . ($server_offset > 0 ? '+' : '') . $server_offset / 3600); } // Force an integer step, defaulting to 0. $_GET['step'] = (int) @$_GET['step']; }
/** * The main sub template above the content. */ function template_html_above() { global $context, $settings, $scripturl, $txt, $modSettings; // Show right to left and the character set for ease of translating. echo '<!DOCTYPE html> <html ', $context['right_to_left'] ? ' dir="rtl"' : '', '> <head> <title>', $context['page_title_html_safe'], '</title>'; // Tell IE to render the page in standards not compatibility mode. really for ie >= 8 // Note if this is not in the first 4k, its ignored, thats why its here if (isBrowser('ie')) { echo ' <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />'; } // load in any css from mods or themes so they can overwrite if wanted template_css(); // Save some database hits, if a width for multiple wrappers is set in admin. if (!empty($settings['forum_width'])) { echo ' <style> #wrapper, .frame { width: ', $settings['forum_width'], '; } </style>'; } // Quick and dirty testing of RTL horrors. Remove before production build. //echo ' //<link rel="stylesheet" href="', $settings['theme_url'], '/css/rtl.css?alp21" />'; // RTL languages require an additional stylesheet. if ($context['right_to_left']) { echo ' <link rel="stylesheet" href="', $settings['theme_url'], '/css/rtl.css?alp21" />'; if (!empty($context['theme_variant'])) { echo ' <link rel="stylesheet" href="', $settings['theme_url'], '/css/rtl', $context['theme_variant'], '.css?alp21" />'; } } echo ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width" /> <meta name="description" content="', $context['page_title_html_safe'], '" />', !empty($context['meta_keywords']) ? ' <meta name="keywords" content="' . $context['meta_keywords'] . '" />' : ''; // Please don't index these Mr Robot. if (!empty($context['robot_no_index'])) { echo ' <meta name="robots" content="noindex" />'; } // Present a canonical url for search engines to prevent duplicate content in their indices. if (!empty($context['canonical_url'])) { echo ' <link rel="canonical" href="', $context['canonical_url'], '" />'; } // Show all the relative links, such as help, search, contents, and the like. echo ' <link rel="help" href="', $scripturl, '?action=help" /> <link rel="contents" href="', $scripturl, '" />', $context['allow_search'] ? ' <link rel="search" href="' . $scripturl . '?action=search" />' : ''; // If RSS feeds are enabled, advertise the presence of one. if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) { echo ' <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss2;action=.xml" /> <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?type=atom;action=.xml" />'; } // If we're viewing a topic, these should be the previous and next topics, respectively. if (!empty($context['links']['next'])) { echo '<link rel="next" href="', $context['links']['next'], '" />'; } else { if (!empty($context['current_topic'])) { echo '<link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />'; } } if (!empty($context['links']['prev'])) { echo '<link rel="prev" href="', $context['links']['prev'], '" />'; } else { if (!empty($context['current_topic'])) { echo '<link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />'; } } // If we're in a board, or a topic for that matter, the index will be the board's index. if (!empty($context['current_board'])) { echo ' <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0" />'; } // load in any javascript files from mods and themes template_javascript(); // Output any remaining HTML headers. (from mods, maybe?) echo $context['html_headers']; // A little help for our friends echo ' <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->'; echo ' </head> <body id="', $context['browser_body_id'], '" class="action_', !empty($context['current_action']) ? htmlspecialchars($context['current_action']) : (!empty($context['current_board']) ? 'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')), !empty($context['current_board']) ? ' board_' . htmlspecialchars($context['current_board']) : '', '">'; }
/** * template_header * * Echo out the header for each HTML page * * @param String $title The title to be used for this page. * * @return void * @author Eli White <*****@*****.**> **/ function template_header($title) { $css = template_css(); echo <<<EOHTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Phergie LogViewer - {$title}</title> <style type="text/css" media="all">{$css}</style> </head> <body> <h2>Phergie LogViewer - {$title}</h2> EOHTML; }
/** * The main sub template above the content. */ function template_html_above() { global $context, $settings, $scripturl, $txt, $modSettings, $mbname; // Show right to left and the character set for ease of translating. echo '<!DOCTYPE html> <html', $context['right_to_left'] ? ' dir="rtl"' : '', '> <head> <meta charset="', $context['character_set'], '">'; // You don't need to manually load index.css, this will be set up for you. You can, of course, add // any other files you want, after template_css() has been run. Note that RTL will also be loaded for you. // The most efficient way of writing multi themes is to use a master index.css plus variant.css files. // If you've set them up properly (through $settings['theme_variants'], loadCSSFile will load the variant files for you. // load in any css from mods or themes so they can overwrite if wanted template_css(); // Save some database hits, if a width for multiple wrappers is set in admin. if (!empty($settings['forum_width'])) { echo ' <style type="text/css">#wrapper, .frame {max-width:1024px;}</style>'; } // load in any javascript files from mods and themes template_javascript(); echo ' <script src="', $settings['theme_url'], '/scripts/jquery.scrollbar.js"></script> <meta name="description" content="', !empty($context['meta_description']) ? $context['meta_description'] : $context['page_title_html_safe'], '">', !empty($context['meta_keywords']) ? ' <meta name="keywords" content="' . $context['meta_keywords'] . '">' : '', ' <title>', $context['page_title_html_safe'], '</title> <meta name="viewport" content="width=device-width, initial-scale=1">'; // Some Open Graph? echo ' <meta property="og:site_name" content="', $mbname, '"> <meta property="og:title" content="', $context['page_title_html_safe'], '"> ', !empty($context['canonical_url']) ? '<meta property="og:url" content="' . $context['canonical_url'] . '">' : '', !empty($settings['og_image']) ? '<meta property="og:image" content="' . $settings['og_image'] . '">' : '', ' <meta property="og:description" content="', !empty($context['meta_description']) ? $context['meta_description'] : $context['page_title_html_safe'], '">'; /* What is your Lollipop's color? Theme Authors you can change here to make sure your theme's main color got visible on tab */ echo ' <meta name="theme-color" content="#557EA0">'; // Please don't index these Mr Robot. if (!empty($context['robot_no_index'])) { echo ' <meta name="robots" content="noindex">'; } // Present a canonical url for search engines to prevent duplicate content in their indices. if (!empty($context['canonical_url'])) { echo ' <link rel="canonical" href="', $context['canonical_url'], '">'; } // Show all the relative links, such as help, search, contents, and the like. echo ' <link rel="help" href="', $scripturl, '?action=help"> <link rel="contents" href="', $scripturl, '">', $context['allow_search'] ? ' <link rel="search" href="' . $scripturl . '?action=search">' : ''; // If RSS feeds are enabled, advertise the presence of one. if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) { echo ' <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss2;action=.xml"> <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?type=atom;action=.xml">'; } // If we're viewing a topic, these should be the previous and next topics, respectively. if (!empty($context['links']['next'])) { echo ' <link rel="next" href="', $context['links']['next'], '">'; } if (!empty($context['links']['prev'])) { echo ' <link rel="prev" href="', $context['links']['prev'], '">'; } // If we're in a board, or a topic for that matter, the index will be the board's index. if (!empty($context['current_board'])) { echo ' <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">'; } // Output any remaining HTML headers. (from mods, maybe?) echo $context['html_headers']; echo ' </head> <body id="', $context['browser_body_id'], '" class="action_', !empty($context['current_action']) ? $context['current_action'] : (!empty($context['current_board']) ? 'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')), !empty($context['current_board']) ? ' board_' . $context['current_board'] : '', '">'; }
/** * template_header * * Echo out the header for each HTML page * * @param String $title The title to be used for this page. * * @return void * @author Eli White <*****@*****.**> **/ function template_header($title) { $css = template_css(); echo <<<EOHTML <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Phergie LogViewer - {$title}</title> <style type="text/css" media="all">{$css}</style> </head> <body> <h2>Phergie LogViewer - {$title}</h2> EOHTML; }
function initialize_inputs() { global $sourcedir, $start_time, $upcontext, $db_type; $start_time = time(); umask(0); // Fun. Low PHP version... if (!isset($_GET)) { $GLOBALS['_GET']['step'] = 0; return; } ob_start(); // Better to upgrade cleanly and fall apart than to screw everything up if things take too long. ignore_user_abort(true); // This is really quite simple; if ?delete is on the URL, delete the upgrader... if (isset($_GET['delete'])) { @unlink(__FILE__); // And the extra little files ;). @unlink(dirname(__FILE__) . '/upgrade_1-0.sql'); @unlink(dirname(__FILE__) . '/upgrade_1-1.sql'); @unlink(dirname(__FILE__) . '/webinstall.php'); $dh = opendir(dirname(__FILE__)); while ($file = readdir($dh)) { if (preg_match('~upgrade_\\d-\\d_([A-Za-z])+\\.sql~i', $file, $matches) && isset($matches[1])) { @unlink(dirname(__FILE__) . '/' . $file); } } closedir($dh); header('Location: http://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) . dirname($_SERVER['PHP_SELF']) . '/Themes/default/images/blank.gif'); exit; } // Are we calling the backup css file? if (isset($_GET['infile_css'])) { header('Content-Type: text/css'); template_css(); exit; } // Anybody home? if (!isset($_GET['xml'])) { $upcontext['remote_files_available'] = false; $test = @fsockopen('www.simplemachines.org', 80, $errno, $errstr, 1); if ($test) { $upcontext['remote_files_available'] = true; } @fclose($test); } // Something is causing this to happen, and it's annoying. Stop it. $temp = 'upgrade_php?step'; while (strlen($temp) > 4) { if (isset($_GET[$temp])) { unset($_GET[$temp]); } $temp = substr($temp, 1); } // Force a step, defaulting to 0. $_GET['step'] = (int) @$_GET['step']; $_GET['substep'] = (int) @$_GET['substep']; }
/** * The main sub template above the content. */ function template_html_above() { global $context, $settings, $scripturl, $txt, $modSettings; // Show right to left and the character set for ease of translating. echo '<!DOCTYPE html> <html', $context['right_to_left'] ? ' dir="rtl"' : '', '> <head> <title>', $context['page_title_html_safe'], '</title>'; // Tell IE to render the page in standards not compatibility mode. really for ie >= 8 // Note if this is not in the first 4k, its ignored, that's why its here if (isBrowser('ie')) { echo ' <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />'; } // load in any css from addons or themes so they can overwrite if wanted template_css(); // Save some database hits, if a width for multiple wrappers is set in admin. if (!empty($settings['forum_width'])) { echo ' <style> .wrapper {width: ', $settings['forum_width'], ';} </style>'; } echo ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width" /> <meta name="mobile-web-app-capable" content="yes" /> <meta name="description" content="', $context['page_title_html_safe'], '" />', !empty($context['meta_keywords']) ? ' <meta name="keywords" content="' . $context['meta_keywords'] . '" />' : ''; // OpenID enabled? Advertise the location of our endpoint using YADIS protocol. if (!empty($modSettings['enableOpenID'])) { echo ' <meta http-equiv="x-xrds-location" content="' . $scripturl . '?action=xrds" />'; } // Please don't index these Mr Robot. if (!empty($context['robot_no_index'])) { echo ' <meta name="robots" content="noindex" />'; } // Present a canonical url for search engines to prevent duplicate content in their indices. if (!empty($context['canonical_url'])) { echo ' <link rel="canonical" href="', $context['canonical_url'], '" />'; } // Show all the relative links, such as help, search, contents, and the like. echo ' <link rel="shortcut icon" sizes="196x196" href="' . $settings['images_url'] . '/mobile.png" /> <link rel="help" href="', $scripturl, '?action=help" /> <link rel="contents" href="', $scripturl, '" />', $context['allow_search'] ? ' <link rel="search" href="' . $scripturl . '?action=search" />' : ''; // If RSS feeds are enabled, advertise the presence of one. if (!empty($context['newsfeed_urls'])) { echo ' <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $context['newsfeed_urls']['rss'], '" /> <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $context['newsfeed_urls']['atom'], '" />'; } // If we're viewing a topic, these should be the previous and next topics, respectively. if (!empty($context['links']['next'])) { echo '<link rel="next" href="', $context['links']['next'], '" />'; } elseif (!empty($context['current_topic'])) { echo '<link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />'; } if (!empty($context['links']['prev'])) { echo '<link rel="prev" href="', $context['links']['prev'], '" />'; } elseif (!empty($context['current_topic'])) { echo '<link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />'; } // If we're in a board, or a topic for that matter, the index will be the board's index. if (!empty($context['current_board'])) { echo ' <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0" />'; } // load in any javascript files from addons and themes template_javascript(); // Output any remaining HTML headers. (from addons, maybe?) echo $context['html_headers']; // A little help for our friends echo ' <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->'; echo ' </head> <body id="', $context['browser_body_id'], '" class="action_', !empty($context['current_action']) ? htmlspecialchars($context['current_action'], ENT_COMPAT, 'UTF-8') : (!empty($context['current_board']) ? 'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')), !empty($context['current_board']) ? ' board_' . htmlspecialchars($context['current_board'], ENT_COMPAT, 'UTF-8') : '', '">'; }
/** * The main sub template above the content. */ function template_html_above() { global $context, $settings, $options, $scripturl, $txt, $modSettings; // Show right to left and the character set for ease of translating. 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"', $context['right_to_left'] ? ' dir="rtl"' : '', '> <head>'; // The ?alp21 part of this link is just here to make sure browsers don't cache it wrongly. echo ' <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index.css?alp21" />'; // The most efficient way of writing multi themes is to use a master index.css plus variant.css files. if (!empty($context['theme_variant'])) { echo ' <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?alp21" />'; } // RTL languages require an additional stylesheet. if ($context['right_to_left']) { echo ' <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/rtl.css?alp21" />'; if (!empty($context['theme_variant'])) { echo ' <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/rtl', $context['theme_variant'], '.css?alp21" />'; } } // Save some database hits, if a width for multiple wrappers is set in admin. if (!empty($settings['forum_width'])) { echo ' <style type="text/css">#wrapper, .frame {width: ', $settings['forum_width'], ';}</style>'; } // Quick and dirty testing of RTL horrors. Remove before production build. //echo ' //<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/rtl.css?alp21" />'; // load in any css from mods or themes so they can overwrite if wanted template_css(); // load in any javascript files from mods and themes template_javascript(); echo ' <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" /> <meta name="description" content="', $context['page_title_html_safe'], '" />', !empty($context['meta_keywords']) ? ' <meta name="keywords" content="' . $context['meta_keywords'] . '" />' : '', ' <title>', $context['page_title_html_safe'], '</title>'; // Please don't index these Mr Robot. if (!empty($context['robot_no_index'])) { echo ' <meta name="robots" content="noindex" />'; } // Present a canonical url for search engines to prevent duplicate content in their indices. if (!empty($context['canonical_url'])) { echo ' <link rel="canonical" href="', $context['canonical_url'], '" />'; } // Show all the relative links, such as help, search, contents, and the like. echo ' <link rel="help" href="', $scripturl, '?action=help" /> <link rel="contents" href="', $scripturl, '" />', $context['allow_search'] ? ' <link rel="search" href="' . $scripturl . '?action=search" />' : ''; // If RSS feeds are enabled, advertise the presence of one. if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) { echo ' <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss2;action=.xml" /> <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?type=atom;action=.xml" />'; } // If we're viewing a topic, these should be the previous and next topics, respectively. if (!empty($context['links']['next'])) { echo '<link rel="next" href="', $context['links']['next'], '" />'; } else { if (!empty($context['current_topic'])) { echo '<link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />'; } } if (!empty($context['links']['prev'])) { echo '<link rel="prev" href="', $context['links']['prev'], '" />'; } else { if (!empty($context['current_topic'])) { echo '<link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />'; } } // If we're in a board, or a topic for that matter, the index will be the board's index. if (!empty($context['current_board'])) { echo ' <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0" />'; } // Output any remaining HTML headers. (from mods, maybe?) echo $context['html_headers']; echo ' </head> <body id="', $context['browser_body_id'], '" class="action_', !empty($context['current_action']) ? htmlspecialchars($context['current_action']) : (!empty($context['current_board']) ? 'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')), !empty($context['current_board']) ? ' board_' . htmlspecialchars($context['current_board']) : '', '">'; }