", " "); $replace = array(""", "'", "\", """, "'", "<", ">", " "); $text = str_replace($search, $replace, $text); return $text; } function is_function_available($function) { $available = true; if ( ! function_exists( $function ) ) { if ( ! ini_get( $function ) ) { $available = false; } else { $d = ini_get('disable_functions'); $s = ini_get('suhosin.executor.func.blacklist'); if ("$d$s") { $array = preg_split('/,\s*/', "$d,$s"); if ( in_array( $function, $array ) ) { $available = false; } } } } else { $d = ini_get('disable_functions'); $s = ini_get('suhosin.executor.func.blacklist'); if ("$d$s") { $array = preg_split('/,\s*/', "$d,$s"); if (in_array($function, $array)) { $available = false; } } } return $available; } session_start(); if ( !isset($_SESSION['users_lang']) ) $_SESSION['users_lang'] = "English"; if ( isset($_GET['localeset']) ) $_SESSION['users_lang'] = $_GET['localeset']; define("REQUIRED_PHP_VERSION", "5.3"); require_once("includes/helpers.php"); require_once("includes/view.php"); require_once("includes/lang.php"); require_once("includes/html_functions.php"); require_once("includes/functions.php"); ogpLang(); $view = new OGPView(); $view->setCharset(get_lang('lang_charset')); ?>
| ";
if ($locale_files[$i] == $_SESSION['users_lang']) {
echo " | \n";
$counter++;
}
echo "
| ".$value." | ". get_lang('create_an_empty_file')." |
| ".$value." | ". get_lang('write_permission_required')." |
| ".$value." | ".get_lang('OK')." |
| ".$value." | ". get_lang('write_permission_required')." |
| ".$value." | ".get_lang('OK')." |
| PHP Version >= ".REQUIRED_PHP_VERSION." | "; if ( version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, ">=") ) { echo "".PHP_VERSION.""; } else { echo "".PHP_VERSION.""; $failed = true; } echo " |
| ".$propertie['name']." | ".get_lang('found')." |
| ".$propertie['name']." | ".get_lang('not_found')." |
| Pear XXTEA | ";
$xxtea_found = false;
$pear_found = false;
// Lets search for XXTEA pear module from include path.
$include_paths = explode(PATH_SEPARATOR, get_include_path());
foreach ( $include_paths as $include_path )
{
if ( file_exists( $include_path."/"."Crypt/XXTEA.php") )
$xxtea_found = true;
// Pear always includes System.php file that should be found from the include path.
if ( file_exists( $include_path."/"."System.php") )
$pear_found = true;
}
if ( $xxtea_found )
{
print_success(get_lang('found'));
}
else
{
print_failure(get_lang('not_found'));
echo " ".get_lang('pear_xxtea_info')." "; $failed = true; } echo " |
| Pear | "; if ( $pear_found ) { print_success(get_lang('found')); } else { print_failure(get_lang('not_found')); $failed = true; } echo " |
| file_get_contents() | "; if ( is_function_available('file_get_contents') ) { print_success(get_lang('found')); } else { print_failure(get_lang('not_found')); $failed = true; } echo " |
| allow_url_fopen=on | "; if ( is_function_available('allow_url_fopen') ) { print_success(get_lang('found')); } else { print_failure(get_lang('not_found')); $failed = true; } echo " |
| ".$propertie['name']." | ".get_lang('found')." |
| ".$propertie['name']." | ".get_lang('not_found')." |
| \n"; if ( is_readable('includes/config.inc.php') ) require_once "includes/config.inc.php"; echo ""; echo ""; echo " |
| \n";
if ( isset($_POST['db_host']) )
{
$db_host = stripinput($_POST['db_host']);
$db_user = stripinput($_POST['db_user']);
$db_pass = stripinput($_POST['db_pass']);
$db_name = stripinput($_POST['db_name']);
$table_prefix = stripinput($_POST['table_prefix']);
$db_type = "mysql";
$config = "";
$temp = @fopen("includes/config.inc.php","w");
if (!@fwrite($temp, $config))
{
print_failure(get_lang('unable_to_write_config'));
echo "";
fclose($temp);
return;
}
fclose($temp);
}
require_once "includes/config.inc.php";
$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
$error_text = "";
if ( get_db_error_text($db,$error_text) )
{
print_failure($error_text);
echo "";
return;
}
$fail = false;
// These belong to module manager, but they need to be created before other modules can be "installed".
$result = $db->query("DROP TABLE IF EXISTS ".$table_prefix."modules");
$result = $db->query("CREATE TABLE IF NOT EXISTS `".$table_prefix."modules` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`title` varchar(100) NOT NULL default '',
`folder` varchar(100) NOT NULL default '',
`version` varchar(10) NOT NULL default '0',
`db_version` int(10) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `folder` (`folder`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
$result = $db->query("DROP TABLE IF EXISTS ".$table_prefix."module_menus");
$result = $db->query("CREATE TABLE IF NOT EXISTS `".$table_prefix."module_menus` (
`module_id` int(11) NOT NULL COMMENT 'This references to modules.id',
`subpage` varchar(64) NOT NULL default '',
`group` varchar(32) NOT NULL,
`menu_name` varchar(128) NOT NULL,
`pos` INT UNSIGNED NOT NULL,
PRIMARY KEY (`module_id`,`subpage`,`group`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
if (!$result) $fail = true;
// Install modules.
require_once("modules/modulemanager/module_handling.php");
@add_lang_module('modulemanager');
$modules = list_available_modules();
if(in_array('modulemanager', $modules))
{
// Install module manager first
$fail = $fail || install_module($db, 'modulemanager', FALSE) < 0;
}
foreach ( $modules as $module )
{
if($module == 'modulemanager')//Has already been installed
continue;
$fail = $fail || install_module($db,$module,FALSE) < 0;
}
if ( $fail ) {
print_failure(get_lang('database_setup_failure'));
echo "";
echo " ".get_lang('unable_to_resolve'). " http://www.opengamepanel.org "; return; } print_success(get_lang('config_written')); print_success(get_lang('database_created')); echo "\n"; echo ""; echo " |
| \n";
require_once "includes/config.inc.php";
$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
$error = "";
$username = stripinput($_POST['username']);
$password1 = stripinput($_POST['password1']);
$password2 = stripinput($_POST['password2']);
$email = stripinput($_POST['email']);
if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username))
{
print_failure(get_lang('invalid_username'));
echo "";
return;
}
// TODO: replace with a constant
if (strlen($password1) < 6) {
print_failure(get_lang_f('password_too_short', 6));
echo "";
return;
}
if ( $password1 != $password2 )
{
print_failure(get_lang('password_mismatch'));
echo "";
return;
}
if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email))
{
print_failure(get_lang('invalid_email_address'));
echo "";
return;
}
//detect nighly builds, if not its SVN
if (file_exists("version.txt")) {
$file = "version.txt";
$contents = file($file);
$nversion = implode($contents);
$nversion2 = substr($nversion ,60);
$nversion2 = trim($nversion2);
$site_settings = array("title"=>"Open Game Panel",
"slogan" => "".get_lang('slogan')."",
"ogp_version" => "$nversion2",
"version_type" => "SVN",
"theme" => "Revolution",
"welcome_title" => "1",
"welcome_title_message" => " ".get_lang('remove_install_and_secure_config')." "; echo ""; echo " |