- <?php
- session_start();
- error_reporting(E_ALL ^ E_NOTICE);
- @set_magic_quotes_runtime(0);
- define('PMDROOT',str_replace('/install/','',dirname(str_replace('\\','/',__FILE__)).'/'));
- define('BASE_URL','http://'.str_replace(array('/install/install.php','/install/'),'',$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']));
- include('./includes/functions.php');
- if(isset($_POST['complete'])) {
- include('../includes/class_database.php');
- $db = new Database(null);
- $db_host = $_POST['hostname'];
- $db_user = $_POST['db_user'];
- $db_pass = $_POST['db_pass'];
- $db_name = $_POST['db_name'];
- if(!(@$db->Connect($db_host, $db_user, $db_pass, $db_name)) OR $db_host == "" OR $db_user == "" OR $db_pass == "" OR $db_name == "" ) {
- $errors['database_connect'] = "Database connection details are incorrect.<br>";
- } else {
- if($_POST['prefix'] == '') {
- $errors['prefix_exists'] = 'Please enter a table prefix. (Ex: pmd_)';
- } else {
- if(count($existing_tables = $db->GetCol("SHOW TABLES LIKE '".$db->Clean($_POST['prefix'])."%'")) > 0 AND !isset($_POST['prefix_overwrite'])) {
- $errors['prefix_exists'] = 'Table prefix in use. Change prefix or choose to overwrite tables.';
- }
- }
- }
- if(!validLicense($_POST['license'])) {
- $errors['license_format'] = 'The license number entered is not in the correct format. (ex: PMDGL-xxxxxxxxxxxx)';
- }
- if($_POST['admin_email'] == '' OR $_POST['admin_pass'] == '') {
- $errors['admin_details'] = 'Please fill in all administrator details.<br>';
- }
- if($_POST['admin_pass'] != $_POST['admin_pass2']) {
- $errors['password_mismatch'] = 'The passwords entered do not match.<br>';
- }
- if(!isset($_POST['terms_agree'])) {
- $errors['terms'] = 'You must agree to the terms before installing.';
- }
- //if(file_exists(PMDROOT.'/defaults.php.dist') AND !file_exists(PMDROOT.'/defaults.php')) {
- // $errors['defaults'] = 'Failed - defaults.php.dist must be renamed to defaults.php';
- //}
- $variables = array(
- 'license'=>$_POST['license'],
- 'URL'=>BASE_URL,
- 'hostname'=>$_POST['hostname'],
- 'db_user'=>$_POST['db_user'],
- 'db_pass'=>$_POST['db_pass'],
- 'db_name'=>$_POST['db_name'],
- 'prefix'=>$_POST['prefix'],
- 'admin_email'=>$_POST['admin_email'],
- 'admin_pass'=>$_POST['admin_pass']
- );
- if(sizeof($errors) < 1) {
- if(isset($_POST['prefix_overwrite'])) {
- foreach((array) $existing_tables as $table) {
- $db->Execute("DROP TABLE ".$table);
- }
- }
- importSQL('./database_structure.sql',$variables);
- importSQL('./database_data.sql',$variables);
- $defaults_content = buildDefaults($variables);
- if(!writeDefaults($defaults_content)) {
- $_SESSION['defaults_content'] = $defaults_content;
- $install_instructions = "<span class=\"Failed\">There was a problem saving your configuration file (defaults.php).</span><br /><br />";
- $install_instructions .= "Please download this file by pressing the button below and upload it to your installation folder.<br /><br />";
- $install_instructions .= '<form name="downloadfile" action="download_defaults.php" method="post">';
- $install_instructions .= '<input class="button" type="submit" name="download" value="Download Configuration File (defaults.php)"><br /><br />';
- $install_instructions .= "</form><span class=\"Failed\">Make sure to delete the /install/ folder for security reasons.</span><br /><br />Once defaults.php is uploaded the installation is complete. ";
- } else {
- $install_instructions = "<span class=\"Failed\">Make sure to delete the /install/ folder for security reasons.<br />Secondly, set permissions on the defaults.php to 644.</span><br /><br /><br /><b>The installation is now complete.</b>";
- }
- $install_instructions .= '
- <br /><br /><br />
- <a href="../index.php">View Directory Home Page</a><br /><br />
- <a href="../cp/index.php">View Administrator Control Panel</a><br /><br />
- <a href="./import/index.php">Import from Old Versions / Other Scripts</a>';
- }
- }
- if(!isset($_POST['complete']) OR sizeof($errors) > 0) {
- $javascript = '<script type="text/javascript" src="'.BASE_URL.'/includes/jquery/jquery.js"></script>';
- $javascript .= '<script type="text/javascript" src="'.BASE_URL.'/includes/jquery/jquery_custom.js"></script>';
- $javascript .= '<script type="text/javascript" src="'.BASE_URL.'/includes/jquery/qTip/jquery_qtip.js"></script>';
- $error = 0;
- $folders = validPermissions();
- if($folders != -1) {
- $error = 1;
- $results['folder']['result'] = 'Failed - defaults.php and all folders in /files/ must be writable.';
- } else {
- $results['folder']['result'] = 'OK';
- }
- if(validPHPVersion('5.2.1')) {
- $results['php']['result'] = 'OK';
- } else {
- $error = 1;
- $results['php']['result'] = 'Failed (Version: '.phpversion().') - Must be version 5.2.1 or above.';
- }
- if(validGD()) {
- $results['gd']['result'] = 'OK';
- } else {
- $error = 1;
- $results['gd']['result'] = 'Warning - The GD2 or Image Magick must be installed to process images.';
- }
- if(validCURL()) {
- $results['curl']['result'] = 'OK';
- } else {
- $error = 1;
- $results['curl']['result'] = 'Warning - CURL is required for many payment gateways and link checking.';
- }
- if(validionCube()) {
- $results['ioncube']['result'] = 'OK';
- } else {
- $error = 1;
- $results['ioncube']['result'] = 'Failed - ionCube must be installed.';
- }
- $phpversion = phpversion();
- }
- include('./template/header.tpl');
- include('./template/install.tpl');
- include('./template/footer.tpl');
- ?>
SHARE
TWEET
caleb2003
a guest
Feb 20th, 2010
137
Never
RAW Paste Data
