Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class checkphpsafemode
- {
- public function checkphpsafemode( )
- {
- if ( ini_get( "safe_mode" ) )
- {
- critical_error( "Please disable PHP Safe Mode to continue installation!" );
- exit( );
- }
- }
- }
- function connect_server( $__query )
- {
- $___headers = "POST /authenticate/5.4/license.php HTTP/1.0\r\n";
- $___headers .= "Host: www.templateshares.info\r\n";
- $___headers .= "User-Agent: TS SE Installation Script\r\n";
- $___headers .= "Referer: TS SE Installation Script\r\n";
- $___headers .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $___headers .= "Content-Length: ".strlen( $__query )."\r\n\r\n";
- if ( $___fp = @fsockopen( "www.templateshares.info", 80, $errno, $errstr, 15 ) )
- {
- @socket_set_timeout( $___fp, 15 );
- @fwrite( $___fp, $___headers.$__query );
- $___response = "";
- while ( !feof( $___fp ) )
- {
- $___response .= @fgets( $___fp, 1024 );
- }
- @fclose( $___fp );
- return $___response;
- }
- critical_error( "System Error: fsockopen (allow_url_fopen must be turned on for this script to work)." );
- }
- function read_config_file( )
- {
- require( "config.php" );
- if ( USERNAME == "" || PASSWORD == "" || SECURITYKEY == "" )
- {
- critical_error( "Please open following file: <b>install/config.php</b> and enter/check your account details which you have registered on Templateshares." );
- }
- else
- {
- }
- return "&U=".urlencode( base64_encode( USERNAME ) )."&P=".urlencode( base64_encode( PASSWORD ) )."&S=".urlencode( base64_encode( SECURITYKEY ) )."&I=".urlencode( base64_encode( $_SERVER['REMOTE_ADDR'] ) );
- }
- function compare_key( $installkey = "" )
- {
- $regex = "{########-####-####-####-############}";
- $regex = str_replace( "#", "[0-9,A-F]", $regex );
- if ( @preg_match( $regex, $installkey ) )
- {
- return true;
- }
- return false;
- }
- function mksecret( $length = 20 )
- {
- $str = "";
- $set = array( "a", "A", "b", "B", "c", "C", "d", "D", "e", "E", "f", "F", "g", "G", "h", "H", "i", "I", "j", "J", "k", "K", "l", "L", "m", "M", "n", "N", "o", "O", "p", "P", "q", "Q", "r", "R", "s", "S", "t", "T", "u", "U", "v", "V", "w", "W", "x", "X", "y", "Y", "z", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9" );
- $i = 1;
- while ( $i <= $length )
- {
- $ch = rand( 0, count( $set ) - 1 );
- $str .= $set[$ch];
- ++$i;
- }
- return $str;
- }
- function get_date_time( )
- {
- return date( "Y-m-d H:i:s" );
- }
- function sqlesc( $value )
- {
- if ( get_magic_quotes_gpc( ) )
- {
- $value = stripslashes( $value );
- }
- if ( !is_numeric( $value ) )
- {
- $value = "'".mysql_real_escape_string( $value )."'";
- }
- return $value;
- }
- function insert_admin( )
- {
- $db = connect_db( );
- if ( !empty( "db" ) )
- {
- critical_error( implode( "<br />", $db )."<br />There seems to be one or more errors with the database configuration information that you supplied. Click <a href=\"install.php?step=2\">here</a> to to back step 2." );
- }
- $secretkey = mksecret( );
- $secret = "'".mysql_real_escape_string( $secretkey )."'";
- $username = "'".mysql_real_escape_string( $_SESSION['username'] )."'";
- $passhash = "'".mysql_real_escape_string( md5( $secretkey.$_SESSION['password'].$secretkey ) )."'";
- $email = "'".mysql_real_escape_string( $_SESSION['email'] )."'";
- $status = "'".mysql_real_escape_string( "confirmed" )."'";
- $usergroup = "'".mysql_real_escape_string( "8" )."'";
- $added = "'".mysql_real_escape_string( get_date_time( ) )."'";
- if ( !mysql_query( "INSERT INTO users (username, passhash, secret, email, status, usergroup, added) VALUES ({$username}, {$passhash}, {$secret}, {$email}, {$status}, {$usergroup}, {$added})" ) )
- {
- critical_error( mysql_errno( )." : ".mysql_error( ) );
- }
- $id = mysql_insert_id( );
- $sechash = md5( $_SESSION['SITENAME'] );
- $pincode = md5( md5( $sechash ).md5( $_SESSION['pincode'] ) );
- mysql_query( "INSERT INTO pincode SET pincode = ".sqlesc( $pincode ).", sechash = ".sqlesc( $sechash ).", area = 1" );
- $filename = ROOT_PATH."config/STAFFTEAM";
- $somecontent = $_SESSION['username'].":".$id;
- if ( is_writable( $filename ) )
- {
- $handle = @fopen( $filename, "w" );
- @fwrite( $handle, $somecontent );
- @fclose( $handle );
- }
- }
- function generate_and_save_key( )
- {
- clearstatcache( );
- $__TSKeY = ROOT_PATH."cache/systemcache.dat";
- @chmod( $__TSKeY, 438 );
- if ( $__FILE = @fopen( $__TSKeY, "w" ) )
- {
- $__OrjKey = md5( "LEGAL LICENSE: ".INSTALL_URL." INSTALL: FINISHED VERSION: ".SCRIPT_VERSION );
- if ( @fwrite( $__FILE, $__OrjKey ) )
- {
- @fclose( $__FILE );
- return true;
- }
- }
- return false;
- }
- function writeconfig( $configname, $config )
- {
- $configname = basename( $configname );
- $path = ROOT_PATH."config/".$configname;
- if ( !file_exists( $path ) || !is_writable( $path ) )
- {
- critical_error( "{$path} isn't writable! Please check chmod settings." );
- }
- $data = @serialize( $config );
- if ( empty( "data" ) )
- {
- critical_error( "{$path} is corrupted! Please re-upload it in binary mode!" );
- }
- $fp = @fopen( $path, "w" );
- if ( !$fp )
- {
- critical_error( "{$path} is corrupted! Please re-upload it in binary mode!" );
- }
- $Res = @fwrite( $fp, $data );
- if ( empty( "Res" ) )
- {
- critical_error( "{$path} isn't writable! Please check chmod settings." );
- }
- fclose( $fp );
- return true;
- }
- function get_ext( $file )
- {
- $file = strtolower( substr( strrchr( $file, "." ), 1 ) );
- return $file;
- }
- function replace_url( $url )
- {
- return str_replace( array( "http://www.", "http://", "www." ), "", $url );
- }
- function critical_error( $message )
- {
- echo html_header( "A critical error has occured.", "<span style=\"color: darkred; font-weight: bold;\">".$message."</span>" );
- echo html_footer( );
- exit( );
- }
- function next_button( $step, $message = "", $error = false )
- {
- return "<br /><table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" align=\"center\"><tr><td class=\"subheader\"><span style=\"float: right\"><input type=\"button\" value=\"NEXT\" class=button onclick=\"".( !$error ? "window.location='install.php?step=".$step."'" : "alert('The installer has detected some problems, which will not allow ".SCRIPT_VERSION." to operate correctly. Please correct these issues and then refresh the page.')" )."\"></span>".$message."</td></tr></table>";
- }
- function cmessage( $message, $good )
- {
- if ( $good )
- {
- $yesno = "<b><font color=\"darkgreen\">YES</font></b>";
- }
- else
- {
- $yesno = "<b><font color=\"darkred\">NO</font></b>";
- }
- return "<tr><td width=\"85%\" align=\"left\">".$message."</td><td class=\"req\" width=\"15%\" align=\"center\">".$yesno."</td></tr>";
- }
- function finalize_installation( )
- {
- $EXTRA = "";
- $INSTALL_URL = "http".( $_SERVER['HTTPS'] == "on" ? "s" : "" )."://".( !empty( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : !empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : "" ).( $_SERVER['SERVER_PORT'] ? ":".$_SERVER['SERVER_PORT'] : "" ).( $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF'] );
- $INSTALL_IP = !empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : !empty( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : "";
- $FILECONTENTS = @file_get_contents( ROOT_PATH."ff.php" );
- $SIGNATURE_KEY = @preg_match( "#Signature Key: (.*)#", $FILECONTENTS, $SK );
- if ( $_SERVER['SERVER_ADMIN'] )
- {
- $EXTRA .= "&SA=".urlencode( $_SERVER['SERVER_ADMIN'] );
- }
- if ( $_SERVER['SERVER_SOFTWARE'] )
- {
- $EXTRA .= "&SS=".urlencode( $_SERVER['SERVER_SOFTWARE'] );
- }
- if ( $_SERVER['HTTP_USER_AGENT'] )
- {
- $EXTRA .= "&UA=".urlencode( $_SERVER['HTTP_USER_AGENT'] );
- }
- if ( $_SERVER['REMOTE_ADDR'] )
- {
- $EXTRA .= "&UI=".urlencode( $_SERVER['REMOTE_ADDR'] );
- }
- @file_get_contents( "http://templateshares.info/authenticate/5.4/installation.php?IU=".@urlencode( $INSTALL_URL )."&IP=".$INSTALL_IP."&SK=".@urlencode( $SK[1] ).$EXTRA );
- }
- function insert_session( $values )
- {
- foreach ( $values as $name => $value )
- {
- unset( $_SESSION[$name] );
- $_SESSION[$name] = $value;
- }
- }
- function connect_db( )
- {
- $errors = array(
- "1" => "<li>Don't leave any fields blank!</li>",
- "2" => "<li>Could not connect to the database server at '".( isset( $_POST['mysql_host'] ) ? htmlspecialchars( trim( $_POST['mysql_host'] ) ) : isset( $_SESSION['mysql_host'] ) ? $_SESSION['mysql_host'] : "empty" )."' with the supplied username and password.<br>Are you sure the hostname and user details are correct?</li>",
- "3" => "<li>Could not select the database '".( isset( $_POST['mysql_db'] ) ? htmlspecialchars( trim( $_POST['mysql_db'] ) ) : isset( $_SESSION['mysql_db'] ) ? $_SESSION['mysql_db'] : "empty" )."'.<br>Are you sure it exists and the specified username and password have access to it?</li>",
- "4" => "<li>The passwords you entered do not match.</li>"
- );
- $link = @mysql_connect( $_SESSION['mysql_host'], $_SESSION['mysql_user'], $_SESSION['mysql_pass'] );
- $db_selected = @mysql_select_db( $_SESSION['mysql_db'], $link );
- if ( !$link )
- {
- $error[] = $errors['2'];
- }
- if ( !$db_selected )
- {
- $error[] = $errors['3'];
- }
- if ( 0 < count( $error ) )
- {
- return $error;
- }
- }
- function redirect( $message, $url, $wait = 3 )
- {
- exit( "\r\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\t<html lang=\"en\">\r\n\t<head>\r\n\t<title>".$message."</title>\r\n\t<meta http-equiv=\"refresh\" content=\"".$wait.";URL=".$url."\">\r\n\t<link rel=\"stylesheet\" href=\"".ROOT_PATH."include/templates/default/style/style.css\" type=\"text/css\" media=\"screen\" />\r\n\t</head>\r\n\t<body>\r\n\t<br />\r\n\t<br />\r\n\t<br />\r\n\t<br />\r\n\t<div style=\"margin: auto auto; width: 50%\" align=\"center\">\r\n\t<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" class=\"tborder\">\t\r\n\t<tr>\r\n\t<td class=\"trow1\" align=\"center\"><p><font color=\"#000000\">".$message."</font></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"trow2\" align=\"right\"><a href=\"".$url."\">\r\n\t<span class=\"smalltext\">Please click here if your browser does not automatically redirect you.</span></a></td>\r\n\t</tr>\r\n\t</table>\r\n\t</div>\r\n\t</body>\r\n\t</html>\r\n\t" );
- }
- function html_header( $title = "TS SE Installation Wizard", $content = "", $step = "" )
- {
- return "\r\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\t<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\r\n\t\t<head>\r\n\t\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n\t\t\t<title>".$title."</title>\r\n\t\t\t<link rel=\"stylesheet\" href=\"".ROOT_PATH."include/templates/default/style/style.css\" type=\"text/css\" media=\"screen\" />\r\n\t\t</head>\r\n\t\t<body>\r\n\t\t\t<div class=\"content\">\r\n\t\t\t\t<div id=\"top\">\r\n\t\t\t\t\t<div style=\"float: left; padding: 20px 25px 0 40px; position:relative;\">".date( "F j, Y, g:i a" )."</div>\r\n\t\t\t\t\t<div class=\"padding\" align=\"center\">TS SE Installation Wizard v.".INSTALL_VERSION."</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div id=\"header\">\r\n\t\t\t\t\t<div class=\"f_search\"></div>\r\n\t\t\t\t\t<div class=\"title\"><h1> </h1><h6> </h6></div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div id=\"subheader\">\r\n\t\t\t\t\t<div id=\"menu\">\r\n\t\t\t\t\t\t<ul>\r\n\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t".$step."\r\n\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t</ul>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div id=\"main\">\r\n\t\t\t\t\t<div class=\"left_side\">\r\n\t\t\t\t\t\t<table width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\">\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td class=\"thead\" align=\"center\"><font size=\"2\"><b>".$title."</b></font></td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\t".( $content ? $content."\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t</table>" : "" )."\r\n\t";
- }
- function html_footer( )
- {
- return "\r\n\t\t\t\t\t\t<br />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div id=\"footer\">\r\n\t\t\t\t\t<div class=\"padding\">Powered by <font color=\"white\"><strong><a href=\"https://templateshares.net/?".INSTALL_URL."\" target=\"_blank\">".SCRIPT_VERSION."</a></strong></font> © ".date( "Y" )."</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\t\r\n\t\t</body>\r\n\t</html>";
- }
- function step_0( )
- {
- $_step_0_contents = "\r\n\tThis wizard will install and configure a copy of ".SCRIPT_VERSION." on your server.\r\n\t<p>Now that you've uploaded the ".SCRIPT_VERSION." files, the database and settings need to be created and imported. Below is an outline of what is going to be completed during installation.</p>\r\n\t<ul>\r\n\t<li>".SCRIPT_VERSION." requirements checked,</li>\r\n\t<li>Configuration of database engine,</li>\r\n\t<li>Creation of database tables,</li>\r\n\t<li>Popularite tables,</li>\r\n\t<li>Basic script settings configured,</li>\r\n\t<li>Creation of an administrator account to manage your script,</li>\r\n\t<li>Finishing Setup.</li>\r\n\t</ul>\t\t\t\r\n\tBefore we go any further, please ensure that all the files have been uploaded in binary mode, and that the folders \"CONFIG\" and \"CACHE\" has suitable permissions to allow this script to write to it (0777 should be sufficient).<br /><br />\r\n\r\n\t".SCRIPT_VERSION." requires PHP 4.1.2 or better and an MYSQL database.<br /><br />\r\n\r\n\t<b>You will also need the following information that your webhost can provide:</b><br />\r\n\t<ul>\r\n\t<li> Any linux (unix), windows webserver running Apache will work. IIS may work but is not recommended, some users might have trouble with file permissions when running IIS.</li>\r\n\t<li><b>The Apache webserver version 1.3 or greater.</b></li>\t\t\r\n\t<ul><li>Short Open Tag support.</li></ul>\r\n\t<ul><li>The ability to change directory permissions to 777 or to change ownership of directories to be owned by the webserver process.</li></ul>\r\n\t<li><b>MYSQL 4.1 or greater.</b></li>\r\n\t<ul><li> Your MYSQL database name.</li></ul>\r\n\t<ul><li> Your MYSQL username.</li></ul>\r\n\t<ul><li> Your MYSQL password.</li></ul>\r\n\t<ul><li> Your MYSQL host address (usually localhost).</li></ul>\t\t\r\n\t<li><b>PHP version 4.1 or greater.</b></li>\r\n\t<ul><li> Ioncube Loader support for PHP.</li></ul>\r\n\t<ul><li> PHP session support.</li></ul>\r\n\t</ul>\r\n\t<div class=warnbox>Using this installer will delete any current ".SCRIPT_VERSION." database if you are using the same table prefix.</div>\r\n\t<br />\r\n\tAfter each step has successfully been completed, click Next button to move on to the next step.".next_button( 1 );
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, $_step_0_contents, "Welcome Screen" );
- echo html_footer( );
- }
- function step_1( )
- {
- clearstatcache( );
- $_folders = array( "admin/backup", "cache", "config", "error_logs", "include/avatars", "torrents", "torrents/images", "tsf_forums/uploads" );
- $_files = array( "admin/adminnotes.txt", "admin/ads.txt", "admin/quicklinks.txt", "include/config_announce.php" );
- $__chmod_error = false;
- $_step_1_contents = "\r\n\tIn this step, the ".SCRIPT_VERSION." installer will determine if your system meets the requirements for the server environment. To use ".SCRIPT_VERSION.", you must have PHP with MySQL support and write-permissions on certain directories/files.<br /><br />";
- $canContinue = 1;
- $good = "4.1.2" <= phpversion( ) ? 1 : 0;
- $canContinue = $canContinue && $good;
- $return .= cmessage( "PHP version >= 4.1.2: ", $good );
- $_SESSION['testing_string'] = "Just a Test!";
- $good = $_SESSION['testing_string'] === "Just a Test!" ? 1 : 0;
- $canContinue = $canContinue && $good;
- $return .= cmessage( "PHP session support:", $good );
- $good = function_exists( "mysql_connect" ) ? 1 : 0;
- $canContinue = $canContinue && $good;
- $return .= cmessage( "MySQL support exists: ", $good );
- if ( !$canContinue )
- {
- $__chmod_error = true;
- }
- $_step_1_contents .= "\r\n\t<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" align=\"center\">\r\n\t\t<tr>\r\n\t\t\t<td class=\"colhead\" colspan=\"2\" width=\"100%\" align=\"left\">Requirements Check</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td class=\"subheader\" width=\"75%\" align=\"left\">Function / Feature / Requirement</td>\r\n\t\t\t<td class=\"subheader\" width=\"25%\" align=\"center\">Available</td>\r\n\t\t</tr>\r\n\t\t".$return."\r\n\t\t</table><br />";
- $_step_1_contents .= "\r\n\t<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" align=\"center\">\r\n\t\t<tr>\r\n\t\t\t<td class=\"colhead\" colspan=\"2\" width=\"100%\" align=\"left\">Checking Directory Chmod Permissions</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td class=\"subheader\" width=\"75%\" align=\"left\">Directory</td>\r\n\t\t\t<td class=\"subheader\" width=\"25%\" align=\"center\">Writable</td>\r\n\t\t</tr>\r\n\t";
- sort( $_folders );
- foreach ( $_folders as $folder )
- {
- $__dir = ROOT_PATH.$folder;
- $_step_1_contents .= "\r\n\t\t<tr>\r\n\t\t\t<td width=\"85%\" align=\"left\">".str_replace( ROOT_PATH, "", $__dir )."</td>";
- if ( !is_writable( $__dir ) || !is_dir( $__dir ) )
- {
- $_step_1_contents .= "\r\n\t\t\t<td align=\"center\" width=\"15%\"><b><font color=\"darkred\">NO</font></b></td>\r\n\t\t</tr>";
- $__chmod_error = true;
- }
- else
- {
- $_step_1_contents .= "\r\n\t\t\t<td align=\"center\" width=\"15%\"><b><font color=\"darkgreen\">YES</font></b></td>\r\n\t\t</tr>";
- }
- }
- $_step_1_contents .= "\r\n\t</table><br />";
- $_step_1_contents .= "\r\n\t<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" align=\"center\">\r\n\t\t<tr>\r\n\t\t\t<td class=\"colhead\" colspan=\"2\" width=\"100%\" align=\"left\">Checking File Chmod Permissions</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td class=\"subheader\" width=\"75%\" align=\"left\">File</td>\r\n\t\t\t<td class=\"subheader\" width=\"25%\" align=\"center\">Writable</td>\r\n\t\t</tr>\r\n\t";
- if ( $handle = opendir( ROOT_PATH."cache/" ) )
- {
- while ( false !== ( $file = readdir( $handle ) ) )
- {
- if ( $file != "." && $file != ".." && $file != ".htaccess" && $file != "htaccess" && get_ext( $file ) != "html" )
- {
- array_push( $_files, "cache/".$file );
- }
- }
- closedir( $handle );
- }
- if ( $handle = opendir( ROOT_PATH."config/" ) )
- {
- while ( false !== ( $file = readdir( $handle ) ) )
- {
- if ( $file != "." && $file != ".." && $file != ".htaccess" && $file != "htaccess" && get_ext( $file ) != "html" && $file != "paypal_config.php" )
- {
- array_push( $_files, "config/".$file );
- }
- }
- closedir( $handle );
- }
- if ( $handle = opendir( ROOT_PATH."error_logs/" ) )
- {
- while ( false !== ( $file = readdir( $handle ) ) )
- {
- if ( $file != "." && $file != ".." && get_ext( $file ) == "php" )
- {
- array_push( $_files, "error_logs/".$file );
- }
- }
- closedir( $handle );
- }
- sort( $_files );
- foreach ( $_files as $file )
- {
- $__file = ROOT_PATH.$file;
- $_step_1_contents .= "\r\n\t\t<tr>\r\n\t\t\t<td width=\"85%\" align=\"left\">".str_replace( ROOT_PATH, "", $__file )."</td>";
- if ( !is_writable( $__file ) || !is_file( $__file ) )
- {
- $_step_1_contents .= "\r\n\t\t\t<td align=\"center\" width=\"15%\"><b><font color=\"darkred\">NO</font></b></td>\r\n\t\t</tr>";
- $__chmod_error = true;
- }
- else
- {
- $_step_1_contents .= "\r\n\t\t\t<td align=\"center\" width=\"15%\"><b><font color=\"darkgreen\">YES</font></b></td>\r\n\t\t</tr>";
- }
- }
- $_step_1_contents .= "\r\n\t</table>";
- if ( !$__chmod_error )
- {
- $_step_1_contents .= next_button( 2, "Congratulations, no errors found!" );
- }
- else
- {
- $_step_1_contents .= next_button( 2, "The installer has detected some problems with your server environment, which will not allow ".SCRIPT_VERSION." to operate correctly. Please correct these issues and then refresh the page to re-check your environment.", true );
- }
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, "\t\r\n\t".$_step_1_contents."\r\n\t", "Requirements Check" );
- echo html_footer( );
- }
- function step_2( )
- {
- $error = array( );
- $errors = array(
- "1" => "<li>Don't leave any fields blank!</li>",
- "2" => "<li>Could not connect to the database server at '".( isset( $_POST['mysql_host'] ) ? htmlspecialchars( trim( $_POST['mysql_host'] ) ) : isset( $_SESSION['mysql_host'] ) ? $_SESSION['mysql_host'] : "empty" )."' with the supplied username and password.<br>Are you sure the hostname and user details are correct?</li>",
- "3" => "<li>Could not select the database '".( isset( $_POST['mysql_db'] ) ? htmlspecialchars( trim( $_POST['mysql_db'] ) ) : isset( $_SESSION['mysql_db'] ) ? $_SESSION['mysql_db'] : "empty" )."'.<br>Are you sure it exists and the specified username and password have access to it?</li>",
- "4" => "<li>The passwords you entered do not match.</li>"
- );
- if ( strtoupper( $_SERVER['REQUEST_METHOD'] ) == "POST" )
- {
- $mysql_host = htmlspecialchars( trim( $_POST['mysql_host'] ) );
- $mysql_user = htmlspecialchars( trim( $_POST['mysql_user'] ) );
- $mysql_pass = htmlspecialchars( trim( $_POST['mysql_pass'] ) );
- $mysql_db = htmlspecialchars( trim( $_POST['mysql_db'] ) );
- if ( empty( "mysql_host" ) || empty( "mysql_user" ) || empty( "mysql_pass" ) || empty( "mysql_db" ) )
- {
- $error[] = $errors['1'];
- }
- $link = @mysql_connect( $mysql_host, $mysql_user, $mysql_pass );
- if ( !$link )
- {
- $error[] = $errors['2'];
- }
- $db_selected = @mysql_select_db( $mysql_db, $link );
- if ( !$db_selected )
- {
- $error[] = $errors['3'];
- }
- if ( empty( "error" ) )
- {
- $values = array(
- "mysql_host" => $mysql_host,
- "mysql_user" => $mysql_user,
- "mysql_pass" => $mysql_pass,
- "mysql_db" => $mysql_db
- );
- insert_session( $values );
- redirect( "Database configuration has been saved successfully.", "install.php?step=3" );
- }
- }
- if ( 0 < count( $error ) )
- {
- foreach ( $error as $_e )
- {
- $_step_2_contents = "<font color=\"red\"><b>".$_e."</b></font><br />";
- }
- }
- $_step_2_contents .= "\r\n\tThe ".SCRIPT_VERSION." installer needs some information about your database to finish the installation. If you do not know this information, then please contact your website host or administrator. Please note that this is probably <strong>NOT</strong> the same as your <strong>FTP</strong> login information!<br /><br />\r\n\t<form method=\"POST\" action=\"".$_SERVER['SCRIPT_NAME']."\"?step=2\">\r\n\t<input type=\"hidden\" name=\"step\" value=\"2\">\r\n\t<table border=\"0\" width=\"100%\" align=\"center\" cellpadding=\"4\"> \t\t \r\n\t\t<tr>\r\n\t\t\t<td align=\"right\" class=\"subheader\"><div align=\"right\">Database Host: </div></td>\r\n\t\t\t<td><input name=\"mysql_host\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['mysql_host'] ) ? htmlspecialchars( $_POST['mysql_host'] ) : "localhost" )."\" onblur=\"if (this.value == '') this.value = 'localhost';\" onfocus=\"if (this.value == 'localhost') this.value = '';\"></td>\r\n\t\t</tr>\t\t \r\n\t\t<tr>\r\n\t\t\t<td align=\"right\" class=\"subheader\"><div align=\"right\">Database Username: </div></td>\r\n\t\t\t<td><input name=\"mysql_user\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['mysql_user'] ) ? htmlspecialchars( $_POST['mysql_user'] ) : "root" )."\" onblur=\"if (this.value == '') this.value = 'root';\" onfocus=\"if (this.value == 'root') this.value = '';\"></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td align=\"right\" class=\"subheader\"><div align=\"right\">Database Password: </div></td>\r\n\t\t\t<td><input name=\"mysql_pass\" id=\"input\" type=\"password\" value=\"\"></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td align=\"right\" class=\"subheader\"><div align=\"right\">Database Name: </div></td>\r\n\t\t\t<td><input name=\"mysql_db\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['mysql_db'] ) ? htmlspecialchars( $_POST['mysql_db'] ) : "" )."\"></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td align=\"right\" colspan=\"2\"><br /><table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" align=\"center\"><tr><td class=\"subheader\"><span style=\"float: right\"><input type=\"submit\" value=\"NEXT\" class=button></td></tr></table></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>";
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, "\t\r\n\t".$_step_2_contents."\r\n\t", "Database Configuration" );
- echo html_footer( );
- }
- function step_3( )
- {
- $db = connect_db( );
- if ( !empty( "db" ) )
- {
- critical_error( implode( "<br />", $db )."<br />There seems to be one or more errors with the database configuration information that you supplied. Click <a href=\"install.php?step=2\">here</a> to to back step 2." );
- }
- $_post_query2 = "0=2&1=".urlencode( base64_encode( gzdeflate( gzcompress( INSTALL_URL, 9 ), 9 ) ) )."&2=".urlencode( base64_encode( gzdeflate( gzcompress( INSTALL_IP, 9 ), 9 ) ) )."&3=".urlencode( base64_encode( gzdeflate( gzcompress( SHORT_SCRIPT_VERSION, 9 ), 9 ) ) ).read_config_file( );
- $_server_response2 = connect_server( $_post_query2 );
- if ( preg_match( "#INVALID USER ACCOUNT#", $_server_response2 ) )
- {
- critical_error( "Please open following file: <b>install/config.php</b> and enter/check your account details which you have registered on Templateshares." );
- }
- $_server_response2 = @preg_match( "#--BEGIN--(.*)--END--#is", $_server_response2, $TSSE_Tables1 );
- $_server_response2 = @str_replace( array( "\n", "\r" ), "", $TSSE_Tables1[1] );
- $ts_tables = @explode( "[TABLE]", $_server_response2 );
- if ( count( $ts_tables ) < 1 )
- {
- critical_error( "Connection Error: ts_tables" );
- }
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, FALSE, "Table Creation" );
- echo "<table border=\"0\" align=\"center\" cellpadding=\"4\" class=\"okbox\" width=100%>";
- ob_flush( );
- flush( );
- $count = 0;
- $dberror = false;
- foreach ( $ts_tables as $val )
- {
- @preg_match( "#CREATE TABLE (\\S+) \\(#i", $val, $match );
- if ( $match[1] && !$dberror )
- {
- ++$count;
- @mysql_query( "DROP TABLE IF EXISTS ".$match[1] );
- echo "<tr><td align=right>(".$count.") Creating table:</td>\r\n\t\t\t<td align=left><strong>".$match[1]."</strong> => ";
- ob_flush( );
- flush( );
- }
- if ( !@mysql_query( $val ) )
- {
- $dberror = true;
- }
- if ( $match[1] && !$dberror )
- {
- echo "<font color=green>done</td></tr>\n";
- ob_flush( );
- flush( );
- }
- if ( !$dberror )
- {
- continue;
- }
- echo "<font color=red size=2>error!!!</font></td></tr>\r\n\t\t\t<tr><td colspan=3><p><div class=warnbox><strong>".mysql_errno( )." : ".mysql_error( )."</td></tr>";
- echo next_button( 3, "The installer has detected some problems with your server environment, which will not allow ".SCRIPT_VERSION." to operate correctly. Please correct these issues and then refresh the page to re-check your environment.", true );
- ob_flush( );
- flush( );
- break;
- break;
- }
- if ( !$dberror )
- {
- echo "</td></tr></table>\r\n\t\t".next_button( 4, "All tables (".$count.") have been created, click Next to populate them." );
- ob_flush( );
- flush( );
- }
- echo "</td></tr></table>";
- echo html_footer( );
- ob_flush( );
- flush( );
- }
- function step_4( )
- {
- $db = connect_db( );
- if ( !empty( "db" ) )
- {
- critical_error( implode( "<br />", $db )."<br />There seems to be one or more errors with the database configuration information that you supplied. Click <a href=\"install.php?step=2\">here</a> to to back step 2." );
- }
- $_post_query3 = "0=3&1=".urlencode( base64_encode( gzdeflate( gzcompress( INSTALL_URL, 9 ), 9 ) ) )."&2=".urlencode( base64_encode( gzdeflate( gzcompress( INSTALL_IP, 9 ), 9 ) ) )."&3=".urlencode( base64_encode( gzdeflate( gzcompress( SHORT_SCRIPT_VERSION, 9 ), 9 ) ) ).read_config_file( );
- $_server_response3 = connect_server( $_post_query3 );
- if ( preg_match( "#INVALID USER ACCOUNT#", $_server_response3 ) )
- {
- critical_error( "Please open following file: <b>install/config.php</b> and enter/check your account details which you have registered on Templateshares." );
- }
- $_server_response3 = @preg_match( "#--BEGIN--(.*)--END--#is", $_server_response3, $TSSE_Tables2 );
- $_server_response3 = @str_replace( array( "\n", "\r" ), "", $TSSE_Tables2[1] );
- $_queries = @explode( "[TABLE]", $_server_response3 );
- if ( count( $_queries ) < 1 )
- {
- critical_error( "Connection Error: ts_tables2" );
- }
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, FALSE, "Populate Tables" );
- echo " ";
- echo " ";
- echo " ";
- echo " ";
- echo " ";
- ob_flush( );
- flush( );
- $_dberrorr = false;
- $_errors = array( );
- foreach ( $_queries as $_query )
- {
- if ( mysql_query( $_query ) )
- {
- continue;
- }
- $_errors[] = $_query;
- $_dberrorr = true;
- break;
- break;
- }
- if ( !$_dberrorr )
- {
- echo next_button( 5, "The default data has successfully been inserted into the database." );
- echo "</td></tr></table>";
- echo html_footer( );
- echo " ";
- echo " ";
- echo " ";
- echo " ";
- echo " ";
- ob_flush( );
- flush( );
- }
- else
- {
- echo "<span style=\"color:red;\"><b>Mysql Error: ".mysql_errno( )." : ".mysql_error( )."</b></span><br /><br />".htmlspecialchars( implode( "<br />", $_errors ) );
- echo next_button( 3, "The installer has detected some problems with your server environment, which will not allow ".SCRIPT_VERSION." to operate correctly. Please correct these issues and then refresh the page to re-check your environment. Click <a href=\"install.php?step=3\">here</a> to to back step 3.", true );
- echo "</td></tr></table>";
- echo html_footer( );
- ob_flush( );
- flush( );
- }
- }
- function step_5( )
- {
- $errors = array(
- "1" => "<li>Don't leave any fields blank!</li>",
- "2" => "<li>Could not connect to the database server at '".( isset( $_POST['mysql_host'] ) ? htmlspecialchars( trim( $_POST['mysql_host'] ) ) : isset( $_SESSION['mysql_host'] ) ? $_SESSION['mysql_host'] : "empty" )."' with the supplied username and password.<br>Are you sure the hostname and user details are correct?</li>",
- "3" => "<li>Could not select the database '".( isset( $_POST['mysql_db'] ) ? htmlspecialchars( trim( $_POST['mysql_db'] ) ) : isset( $_SESSION['mysql_db'] ) ? $_SESSION['mysql_db'] : "empty" )."'.<br>Are you sure it exists and the specified username and password have access to it?</li>",
- "4" => "<li>The passwords you entered do not match.</li>"
- );
- $_MFile = ROOT_PATH."config/MAIN";
- if ( !is_writable( $_MFile ) || !is_file( $_MFile ) )
- {
- critical_error( "I can't continue. Please check chmod permission of the following file: <b>".$_MFile."</b><br />" );
- }
- if ( strtoupper( $_SERVER['REQUEST_METHOD'] ) == "POST" )
- {
- $tracker_name = htmlspecialchars( trim( $_POST['tracker_name'] ) );
- $tracker_url = htmlspecialchars( trim( $_POST['tracker_url'] ) );
- $announce_url = htmlspecialchars( trim( $_POST['announce_url'] ) );
- $contact_email = htmlspecialchars( trim( $_POST['contact_email'] ) );
- if ( empty( "tracker_name" ) || empty( "tracker_url" ) || empty( "announce_url" ) || empty( "contact_email" ) )
- {
- $error[] = $errors['1'];
- }
- if ( 0 < count( $error ) )
- {
- foreach ( $error as $err )
- {
- $_step_5_contents .= $err;
- }
- }
- else
- {
- $values = array(
- "SITENAME" => $tracker_name,
- "BASEURL" => $tracker_url,
- "announce_urls" => $announce_url,
- "SITEEMAIL" => $contact_email
- );
- insert_session( $values );
- $DATABASE['mysql_host'] = $_SESSION['mysql_host'];
- $DATABASE['mysql_user'] = $_SESSION['mysql_user'];
- $DATABASE['mysql_pass'] = $_SESSION['mysql_pass'];
- $DATABASE['mysql_db'] = $_SESSION['mysql_db'];
- writeconfig( "DATABASE", $DATABASE );
- $MAIN['BASEURL'] = $_SESSION['BASEURL'];
- $MAIN['SITENAME'] = $_SESSION['SITENAME'];
- $MAIN['announce_urls'] = $_SESSION['announce_urls'];
- $MAIN['SITEEMAIL'] = $_SESSION['SITEEMAIL'];
- $MAIN['site_online'] = "yes";
- writeconfig( "MAIN", $MAIN );
- $FORUMCP['f_forum_online'] = "no";
- writeconfig( "FORUMCP", $FORUMCP );
- redirect( "Basic Tracker Settings has been saved successfully.", "install.php?step=6" );
- }
- }
- $_step_5_contents .= "\r\n\t\t<form method=\"post\" action=\"install.php?step=5\" name=\"save_settings\" id=\"save_settings\">\r\n\t\t<input type=\"hidden\" name=\"step\" value=\"5\">\r\n\t\t<table border=\"0\" width=\"100%\" align=\"left\" cellpadding=\"4\"> \r\n\t\t<thead>\r\n\t\t <tr>\r\n\t\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Tracker Name: </div></td>\r\n\t\t <td><input name=\"tracker_name\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['tracker_name'] ) ? htmlspecialchars( $_POST['tracker_name'] ) : INSTALL_URL )."\" onblur=\"if (this.value == '') this.value = '".INSTALL_URL."';\" onfocus=\"if (this.value == '".INSTALL_URL."') this.value = '';\" size=\"50\"></td></tr>\r\n\t\t <tr>\r\n\t\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Tracker URL: </div></td>\r\n\t\t <td><input name=\"tracker_url\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['tracker_url'] ) ? htmlspecialchars( $_POST['tracker_url'] ) : "http://".INSTALL_URL )."\" onblur=\"if (this.value == '') this.value = 'http://".INSTALL_URL."';\" onfocus=\"if (this.value == 'http://".INSTALL_URL."') this.value = '';\" size=\"50\"></td></tr>\r\n\t\t <tr>\r\n\t\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Announce URL: </div></td>\r\n\t\t <td><input name=\"announce_url\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['announce_url'] ) ? htmlspecialchars( $_POST['announce_url'] ) : "http://".INSTALL_URL."/announce.php" )."\" onblur=\"if (this.value == '') this.value = 'http://".INSTALL_URL."/announce.php';\" onfocus=\"if (this.value == 'http://".INSTALL_URL."/announce.php') this.value = '';\" size=\"50\"></td></tr>\r\n\t\t <tr>\r\n\t\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Contact Email: </div></td>\r\n\t\t <td><input name=\"contact_email\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['contact_email'] ) ? htmlspecialchars( $_POST['contact_email'] ) : "contact@".INSTALL_URL."" )."\" onblur=\"if (this.value == '') this.value = 'contact@".INSTALL_URL."';\" onfocus=\"if (this.value == 'contact@".INSTALL_URL."') this.value = '';\" size=\"50\"></td></tr>\r\n\t\t<tr>\r\n\t\t <td align=\"right\" colspan=\"2\">\r\n\t\t\t<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" align=\"center\"><tr><td class=\"subheader\"><span style=\"float: right\"><input type=\"submit\" value=\"NEXT\" class=button></td></tr></table>\r\n\t\t </td>\r\n\t\t </tr>\r\n\t\t </form>\r\n\t\t </table>";
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, "\t\r\n\t".$_step_5_contents."\r\n\t", "Basic Tracker Configuration" );
- echo html_footer( );
- }
- function step_6( )
- {
- $db = connect_db( );
- if ( !empty( "db" ) )
- {
- critical_error( implode( "<br>", $db ) );
- }
- $errors = array(
- "1" => "<li>Don't leave any fields blank!</li>",
- "2" => "<li>Could not connect to the database server at '".( isset( $_POST['mysql_host'] ) ? htmlspecialchars( trim( $_POST['mysql_host'] ) ) : isset( $_SESSION['mysql_host'] ) ? $_SESSION['mysql_host'] : "empty" )."' with the supplied username and password.<br>Are you sure the hostname and user details are correct?</li>",
- "3" => "<li>Could not select the database '".( isset( $_POST['mysql_db'] ) ? htmlspecialchars( trim( $_POST['mysql_db'] ) ) : isset( $_SESSION['mysql_db'] ) ? $_SESSION['mysql_db'] : "empty" )."'.<br>Are you sure it exists and the specified username and password have access to it?</li>",
- "4" => "<li>The passwords you entered do not match.</li>"
- );
- if ( strtoupper( $_SERVER['REQUEST_METHOD'] ) == "POST" )
- {
- $username = htmlspecialchars( trim( $_POST['username'] ) );
- $password = trim( $_POST['password'] );
- $password2 = trim( $_POST['password2'] );
- $pincode = trim( $_POST['pincode'] );
- $email = htmlspecialchars( trim( $_POST['email'] ) );
- if ( empty( "username" ) || empty( "password" ) || empty( "password2" ) || empty( "pincode" ) || empty( "email" ) )
- {
- $error[] = $errors['1'];
- }
- if ( $password != $password2 )
- {
- $error[] = $errors['4'];
- }
- if ( 0 < count( $error ) )
- {
- foreach ( $error as $err )
- {
- $_step_6_contents .= $err;
- }
- }
- else
- {
- $values = array(
- "username" => $username,
- "password" => $password,
- "pincode" => $pincode,
- "email" => $email
- );
- insert_session( $values );
- insert_admin( );
- redirect( "Administrator Account has been saved successfully.", "install.php?step=7" );
- }
- }
- $_step_6_contents .= "\r\n\t<form method=\"post\" action=\"install.php?step=6\" name=\"save_admin\" id=\"save_admin\">\r\n\t<input type=\"hidden\" name=\"step\" value=\"6\">\r\n\t<table border=\"0\" width=\"100%\" align=\"left\" cellpadding=\"4\"> \r\n\t";
- $_step_6_contents .= "\r\n\t <tr>\r\n\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Username: </div></td>\r\n\t <td><input name=\"username\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['username'] ) ? htmlspecialchars( $_POST['username'] ) : "admin" )."\" onblur=\"if (this.value == '') this.value = 'Admin';\" onfocus=\"if (this.value == 'Admin') this.value = '';\" size=\"50\"></td></tr>";
- $_step_6_contents .= "\r\n\t <tr>\r\n\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Password: </div></td>\r\n\t <td><input name=\"password\" id=\"input\" type=\"password\" value=\"\" size=\"50\"></td></tr>";
- $_step_6_contents .= "\r\n\t <tr>\r\n\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Re-Type Password: </div></td>\r\n\t <td><input name=\"password2\" id=\"input\" type=\"password\" value=\"\" size=\"50\"></td></tr>";
- $_step_6_contents .= "\r\n\t <tr>\r\n\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Pincode: </div></td>\r\n\t <td><input name=\"pincode\" id=\"input\" type=\"password\" value=\"\" size=\"50\"></td></tr>";
- $_step_6_contents .= "\r\n\t <tr>\r\n\t <td align=\"right\" class=\"subheader\"><div align=\"right\">Email Address: </div></td>\r\n\t <td><input name=\"email\" id=\"input\" type=\"text\" value=\"".( isset( $_POST['email'] ) ? htmlspecialchars( $_POST['email'] ) : "" )."\" size=\"50\"></td></tr>";
- $_step_6_contents .= "\t\r\n\t<tr>\r\n\t <td align=\"right\" colspan=\"2\">\r\n\t <table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" align=\"center\"><tr><td class=\"subheader\"><span style=\"float: right\"><input type=\"submit\" value=\"NEXT\" class=button></td></tr></table>\r\n\t </td></tr>\r\n\t </form></table>";
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, "\t\r\n\t".$_step_6_contents."\r\n\t", "Administrator Setup" );
- echo html_footer( );
- }
- function step_7( )
- {
- if ( !generate_and_save_key( ) )
- {
- critical_error( "Please chmod 0777 to the following file and refresh the page: cache/systemcache.dat" );
- }
- $_step_7_contents = SCRIPT_VERSION." has successfully been installed and configured correctly. The Template Shares Group thanks you for your support and we hope to see you around the community forums if you need help or wish to become a part of the TS community. <br><br><div class=warnbox>After a successful login, please goto settings panel and configurate your tracker otherwise TS SE won't work correctly! <br><br>Click <a href=\"http://".INSTALL_URL."\">here</a> to login.<br><br>DO NOT FORGET TO DELETE INSTALL FOLDER !!!";
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, "\t\r\n\t".$_step_7_contents."\r\n\t", "Finish Setup" );
- echo html_footer( );
- @finalize_installation( );
- }
- @error_reporting( 0 );
- @ini_set( "error_reporting", "0" );
- @ini_set( "display_errors", "0" );
- @ini_set( "display_startup_errors", "0" );
- @ini_set( "ignore_repeated_errors", "1" );
- @ini_set( "log_errors", "0" );
- @set_magic_quotes_runtime( 0 );
- @ignore_user_abort( 1 );
- if ( function_exists( "set_time_limit" ) && get_cfg_var( "safe_mode" ) == 0 )
- {
- @set_time_limit( 120 );
- }
- @ini_set( "session.gc_maxlifetime", "3600" );
- @ini_set( "short_open_tag", 1 );
- @session_cache_expire( 90 );
- @session_name( "TSSE_Session" );
- @session_start( );
- define( "INSTALL_VERSION", "8.0.2" );
- define( "SHORT_SCRIPT_VERSION", "5.4" );
- define( "SCRIPT_VERSION", "TS Special Edition v.5.4" );
- define( "INSTALL_URL", !empty( $_SERVER['SERVER_NAME'] ) ? replace_url( $_SERVER['SERVER_NAME'] ) : !empty( $_SERVER['HTTP_HOST'] ) ? replace_url( $_SERVER['HTTP_HOST'] ) : "" );
- define( "INSTALL_IP", !empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : !empty( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : "" );
- define( "THIS_ROOT_PATH", "./" );
- define( "ROOT_PATH", "./../" );
- if ( file_exists( $_SERVER['DOCUMENT_ROOT']."/authenticate/5.4/license.php" ) )
- {
- critical_error( "System Error: AL" );
- }
- $Var_1800->CheckPHPSafeMode( );
- $SafeModeCheck = $Var_1800;
- if ( file_exists( "install.lock" ) )
- {
- critical_error( "Please delete install/install.lock file to continue installation." );
- }
- $__step = isset( $_POST['step'] ) ? intval( $_POST['step'] ) : isset( $_GET['step'] ) ? intval( $_GET['step'] ) : 0;
- $_banned = array( "127.0.0.1", "bvlist", "localhost", "1tam1ogrenci.com", "78.159.111.12", "82.137.61.162", "82.137.61.162", "83.99.133.91", "ancientbits.com", "82.47.208.141", "angels-torrents.net", "89.149.255.72", "biotorrents.org", "blades-heaven.co.uk", "88.191.26.186", "blades-heaven.com", "74.86.40.71", "chixy.org", "82.81.156.237", "ddtorrents.com", "66.90.109.57", "demonicsouls.net", "88.191.35.248", "destamkroeg.org", "85.214.110.80", "iraqigate.org", "66.49.137.208", "learnbits.info", "70.47.114.167", "omarco.eu", "91.196.170.205", "ransackedcrew.com", "88.191.35.248", "sicktorrents.com", "88.198.53.215", "tailz.us", "209.11.245.165", "test.biotorrents.org", "thedvdclub.no-ip.org", "192.168.1.30", "tnt-vision.com", "86.105.223.222", "top-balkan.com", "203.121.68.164", "top-balkan.net", "203.121.69.26", "top-torrent.com", "212.112.250.157", "torrents-gate.com", "69.72.149.25", "torrents4u.org", "85.17.145.104", "torrentsworld.org", "66.90.109.57" );
- foreach ( $_banned as $_ban )
- {
- if ( @preg_match( "/\\b{$_ban}\\b/i", INSTALL_URL ) || @preg_match( "/\\b{$_ban}\\b/i", INSTALL_IP ) )
- {
- critical_error( "Security Error!" );
- }
- }
- if ( !ini_get( "allow_url_fopen" ) )
- {
- critical_error( "Configuration Error: allow_url_fopen must be turned on for this script to work!" );
- }
- $___read_config_file = read_config_file( );
- $SERVERERRORMESSAGE = "";
- $_post_query1 = "0=1&1=".urlencode( base64_encode( gzdeflate( gzcompress( INSTALL_URL, 9 ), 9 ) ) )."&2=".urlencode( base64_encode( gzdeflate( gzcompress( INSTALL_IP, 9 ), 9 ) ) )."&3=".urlencode( base64_encode( gzdeflate( gzcompress( SHORT_SCRIPT_VERSION, 9 ), 9 ) ) );
- $_server_response1 = connect_server( $_post_query1 );
- @preg_match( "#{LISENCE_KEY_RESPONSE}(.*){LISENCE_KEY_RESPONSE}#is", $_server_response1, $LICENSE_KEY );
- $LICENSE_KEY = strtoupper( trim( $LICENSE_KEY[1] ) );
- if ( !compare_key( $LICENSE_KEY ) )
- {
- $SERVERERRORMESSAGE = $LICENSE_KEY;
- unset( $LICENSE_KEY );
- }
- if ( strtoupper( $_SERVER['REQUEST_METHOD'] ) == "POST" && !empty( $_POST['LICENSE_KEY'] ) && compare_key( $_POST['LICENSE_KEY'] ) )
- {
- unset( $_SESSION['LICENSE_KEY'] );
- $_SESSION['LICENSE_KEY'] = strtoupper( trim( $_POST['LICENSE_KEY'] ) );
- }
- if ( !compare_key( $_SESSION['LICENSE_KEY'] ) )
- {
- unset( $_SESSION['LICENSE_KEY'] );
- }
- if ( empty( $_SESSION['LICENSE_KEY'] ) || empty( "LICENSE_KEY" ) || $_SESSION['LICENSE_KEY'] != $LICENSE_KEY || !compare_key( $_SESSION['LICENSE_KEY'] ) || !compare_key( $LICENSE_KEY ) )
- {
- $__lsetup = ( $SERVERERRORMESSAGE ? "<font color=\"red\"><b>".$SERVERERRORMESSAGE."</b></font><br /><br />" : "" )."\r\n\t<form method=\"POST\" action=\"install.php?step=".$__step."\" name=\"LICENSE_KEY\" onsubmit=\"document.LICENSE_KEY.submit.value='Please wait...';document.LICENSE_KEY.submit.disabled=true\">\r\n\t<input type=\"hidden\" name=\"step\" value=\"".$__step."\">\r\n\tPlease enter your LICENSE KEY: <input type=\"text\" name=\"LICENSE_KEY\" size=\"60\"> \r\n\t<input type=\"submit\" name=\"submit\" value=\"Confirm License Key\">\r\n\t</form>\r\n\t";
- echo html_header( "Welcome to the installation wizard for ".SCRIPT_VERSION, "\t\r\n\t".$__lsetup."\r\n\t", "Validation" );
- echo html_footer( );
- exit( );
- }
- else
- {
- if ( !is_writable( ROOT_PATH."cache/admincache.dat" ) )
- {
- critical_error( "Please chmod 0777 to the following file: cache/admincache.dat" );
- }
- if ( $handle = @fopen( ROOT_PATH."cache/admincache.dat", "w" ) )
- {
- @fwrite( $handle, @md5( INSTALL_URL.$_SESSION['LICENSE_KEY'].INSTALL_URL ) );
- @fclose( $handle );
- }
- else
- {
- critical_error( "Please chmod 0777 to the following file: cache/admincache.dat" );
- }
- }
- switch ( $__step )
- {
- case 0 :
- step_0( );
- exit( );
- break;
- case 1 :
- step_1( );
- exit( );
- break;
- case 2 :
- step_2( );
- exit( );
- break;
- case 3 :
- step_3( );
- exit( );
- case 4 :
- step_4( );
- exit( );
- break;
- case 5 :
- step_5( );
- exit( );
- break;
- case 6 :
- step_6( );
- exit( );
- break;
- case 7 :
- }
- step_7( );
- exit( );
- break;
- step_0( );
- exit( );
- break;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment