Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- header('Content-Type: text/html; charset=utf-8');
- ini_set("magic_quotes_gpc", "0");
- ini_set("display_errors", "1");
- error_reporting(E_ALL ^ E_NOTICE);
- define('__DIR__', pathinfo(__FILE__, PATHINFO_DIRNAME));
- define('__BASEDIR__', substr(pathinfo(__FILE__, PATHINFO_DIRNAME), 0 , -6));
- require(__BASEDIR__."/includes/classes/class.parser.php");
- $Parser = new TemplateParser();
- if(file_exists(__DIR__."/setup.lock")){
- header("Location: /index.php");
- }
- if(isset($_POST['install'])){
- if(!@mysqli_connect("".$_POST['dbhost']."", "".$_POST['dbuser']."", "".$_POST['dbpass']."", "".$_POST['dbname']."")){
- $error = "<tr><td class=\"red\">Error! Could not connect to the database!</td></tr>";
- }
- if(empty($error)){
- require(__BASEDIR__."/includes/classes/class.db.php");
- $DB = new db_driver($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname']);
- $DB->table_prefix = "syrup";
- $DB->development_mode = TRUE;
- //write the config file
- $file = fopen(__BASEDIR__."/includes/config.php", "w");
- $string = '<?php
- $mysql_host = "'.$_POST['dbhost'].'"; //Mysql host...
- $mysql_user = "'.$_POST['dbuser'].'"; //Mysql user...
- $mysql_password = "'.$_POST['dbpass'].'"; //Mysql password
- $mysql_database = "'.$_POST['dbname'].'"; //Mysql database...
- $mysql_tableprefix = "syrup"; //Table prefix...
- ?>';
- fwrite($file, $string);
- fclose($file);
- //create the database tables
- $DB->query("CREATE TABLE `syrup_bcomments` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `bid` int(11) NOT NULL,
- `author_id` int(11) unsigned NOT NULL,
- `feedback` int(1) NOT NULL,
- `date` varchar(32) NOT NULL,
- `comment` text NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1", 0);
- $DB->query("CREATE TABLE `syrup_ecomments` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `eid` int(11) NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1", 0);
- $DB->query("CREATE TABLE `syrup_events` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(50) NOT NULL,
- `author` varchar(16) NOT NULL,
- `date` varchar(32) NOT NULL,
- `type` varchar(32) NOT NULL,
- `status` int(1) unsigned NOT NULL,
- `content` text NOT NULL,
- `views` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1", 0);
- $DB->query("CREATE TABLE `syrup_news` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(50) NOT NULL,
- `author` varchar(16) NOT NULL,
- `date` varchar(32) NOT NULL,
- `type` varchar(32) NOT NULL,
- `content` text NOT NULL,
- `views` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1", 0);
- $DB->query("CREATE TABLE `syrup_gmblog` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(50) NOT NULL,
- `author` varchar(16) NOT NULL,
- `date` varchar(32) NOT NULL,
- `content` text NOT NULL,
- `views` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1", 0);
- $DB->query("CREATE TABLE `syrup_gdcache` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `hash` varchar(32) NOT NULL,
- `name` varchar(20) NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1", 0);
- $DB->query("CREATE TABLE `syrup_profiles` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `aid` int(11) unsigned NOT NULL,
- `profile_name` varchar(30) NOT NULL,
- `mainchar_id` int(11) unsigned DEFAULT NULL,
- `gender` tinyint(1) DEFAULT NULL,
- `about_me` text,
- `country` varchar(50) DEFAULT NULL,
- `private` tinyint(1) DEFAULT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1", 0);
- `login_port` varchar(4) DEFAULT NULL,
- `server_name` varchar(30) DEFAULT NULL,
- `slogan` varchar(50) DEFAULT NULL,
- `gmlvl_for_mod` int(11) unsigned NOT NULL,
- `gmlvl_for_admin` int(11) unsigned NOT NULL,
- `gmlvl_for_gmstyle` int(11) unsigned NOT NULL,
- `template` varchar(30) DEFAULT NULL,
- `voteurl` varchar(100) DEFAULT NULL,
- `votebanner` varchar(30) DEFAULT NULL,
- `launcherurl` varchar(100) DEFAULT NULL,
- `launchername` varchar(30) DEFAULT NULL,
- `installerurl` varchar(100) DEFAULT NULL,
- `nxtimespan` int(11) unsigned NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC", 0);
- $DB->query("CREATE TABLE `syrup_votes` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `aid` int(11) NOT NULL,
- `lastvote` int(11) NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1", 0);
- $DB->query("INSERT INTO `syrup_settings` (`id`,`server_version`,`exp_rate`,`meso_rate`,`drop_rate`,`bossdrop_rate`,`max_players`,`date_format`,`date_pfix`,`date_sfix`,`server_ip`,`login_port`,`server_name`,`slogan`,`gmlvl_for_mod`,`gmlvl_for_admin`,`gmlvl_for_gmstyle`,`template`,`voteurl`,`votebanner`,`launcherurl`,`launchername`,`installerurl`,`installername`,`charclasses`,`nxammount`,`nxtimespan`) VALUES (1,'0.62',1,1,1,1,500,'d.m.y','[',']','127.0.0.1','8484','YourServer','Because my server is tasty!!! XD',0,0,0,'default','#','vote.png','#','','#','',1,0,0)", 0);
- $DB->query("SELECT `id`, `name` FROM `accounts`", 1);
- while($field = $DB->get_field_data(1)){
- $DB->query("INSERT INTO syrup_profiles (`aid`, `profile_name`) VALUES (".$field['id'].", '".$field['name']."')", 0);
- }
- $file = fopen(__DIR__."/setup.lock", "w");
- fclose($file);
- $succes = 1;
- }
- }
- if($succes == 1){
- $content = "Congratulations! You have installed MapleSyrup succesfully! Click <a href=\"/index.php\">here</a> to go to the homepage. Then log in with your account and go to Configuration in the menu to configure MapleSyrup.";
- } else {
- $Parser->loadfile(__BASEDIR__."/templates/default/installform.html");
- $Parser->assignvars(array('{currentpage}', '{installerror}'),array($_SERVER['PHP_SELF'], $error));
- $content = $Parser->output();
- }
- $Parser->loadfile(__BASEDIR__."/templates/default/maininstall.html");
- $Parser->assignblock(array('[content]'), array($content));
- echo($Parser->output());
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement