Welcome to HoloCMS. Before you can start using your new website, we'll need to set up a few things. In order for the installation to be successfull, you will need to know all of the following things.
n";
echo "n";
echo "
MySQL Database name
n";
echo "
MySQL Username
n";
echo "
MySQL Password
n";
echo "
MySQL Host (if not on localhost)
n";
echo "n";
echo "
In order for this installation to complete successfully, the installer script must have access to write to config.php. For assistance with giving write permissions or connecting to your MySQL database, please consult your host/ISP.
n";
echo "
Please be aware that this installer will override (and thus empty) any existing (and required) CMS tables in your MySQL Database, and possibly modify Holograph Emulator tables where needed. Please read the compatability information below for optimal performance and integration.
n";
///////////////////////////////////////////////////////////////////////////////////////////////
} elseif($step == 1){
if(isset($_POST['name'])){
$write = WriteConfig($_POST['host'], $_POST['username'], $_POST['pass'], $_POST['name'], $_POST['path']);
if(!$write){
$message = "Unable to write config file, this script may not have the correct read/write permissions; please CHMOD config.php to 777, but remember to return it to normal after you finish using the installer.";
} else {
$db_connect = @mysql_connect($_POST['host'], $_POST['username'], $_POST['pass']);
$db_select = @mysql_select_db($_POST['name']);
if (!$db_connect) {
$message = "Unable to connect to MySQL server. Please double-check the hostname, username, and password you have provided.";
} elseif (!$db_select) {
$message = "Unable to select database. Please double-check the database name you have provided.";
} else {
$hideform = true;
}
}
}
if(empty($_POST['name'])){ $_POST['name'] = "holodb"; }
if(empty($_POST['username'])){ $_POST['username'] = "root"; }
if(empty($_POST['host'])){ $_POST['host'] = "localhost"; }
if(empty($_POST['path'])){ $_POST['path'] = "http://www.mysite.com/cms/"; }
if($hideform !== true){
echo "";
} else {
echo "
Successfully connected to MySQL database.
n";
echo "
The configuration file has been written and the MySQL connection has been set up successfully. Press 'Start Installation' to start the automated installation process, or press 'Change Settings' to go back to the previous step.
Warning This will rebuild any existing HoloCMS database tables and add new ones where needed, and thus also reset them. You will be given to oppertunity to create a admin user later on during the installation process.
n";
}
///////////////////////////////////////////////////////////////////////////////////////////////
} elseif($step == 2){
// We've written the config, so let's use that
require_once('config.php');
require_once('./includes/mysql.php');
// note that the script would have died in a mysql error if there was a problem with the mysql config by now
// so we should be safe to do anything we please here!
echo "
Installation
n";
echo "
The installation is now in process, this should take only a second or two on an average system to complete.
n";
echo "
Dropping existing tables where needed..";
// Valid, current tables
mysql_query ("DROP TABLE IF EXISTS `cms_alerts`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_content`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_forum_posts`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_forum_threads`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_help`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_homes_catalouge`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_homes_group_linker`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_homes_stickers`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_homes_inventory`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_minimail`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_news`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_system`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_tags`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_transactions`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_wardrobe`;") or die(mysql_error());
// Old/dev-only tables
mysql_query ("DROP TABLE IF EXISTS `cms_threads`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_posts`;") or die(mysql_error());
mysql_query ("DROP TABLE IF EXISTS `cms_homes`;") or die(mysql_error());
echo "done! n";
echo "Creating tables..";
mysql_query ("CREATE TABLE `cms_alerts` (
`id` int(11) NOT NULL auto_increment,
`userid` int(11) NOT NULL,
`alert` text NOT NULL,
`type` enum('1','2') NOT NULL default '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query("CREATE TABLE IF NOT EXISTS `cms_content` (
`contentkey` text NOT NULL,
`contentvalue` text NOT NULL,
`setting_title` text NOT NULL,
`setting_desc` text NOT NULL,
`fieldtype` enum('1','2','3') NOT NULL default '1',
`category` int(11) NOT NULL default '1'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_forum_posts` (
`id` int(11) NOT NULL auto_increment,
`threadid` int(11) NOT NULL default '0',
`message` text NOT NULL,
`author` varchar(25) NOT NULL,
`date` varchar(30) NOT NULL,
`edit_date` varchar(30) NOT NULL,
`edit_author` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_forum_threads` (
`id` int(4) NOT NULL auto_increment,
`type` tinyint(4) NOT NULL,
`title` varchar(30) NOT NULL,
`author` varchar(25) NOT NULL,
`date` varchar(35) NOT NULL,
`lastpost_author` varchar(25) NOT NULL,
`lastpost_date` varchar(35) NOT NULL,
`views` int(11) NOT NULL,
`posts` tinyint(4) NOT NULL,
`unix` varchar(40) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_help` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(25) collate latin1_general_ci NOT NULL,
`ip` varchar(50) collate latin1_general_ci NOT NULL,
`message` mediumtext collate latin1_general_ci NOT NULL,
`date` varchar(50) collate latin1_general_ci NOT NULL,
`picked_up` enum('0','1') collate latin1_general_ci NOT NULL,
`subject` varchar(50) collate latin1_general_ci NOT NULL,
`roomid` int(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='HoloCMS' AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_homes_catalouge` (
`id` int(11) NOT NULL auto_increment,
`name` text NOT NULL,
`type` varchar(1) NOT NULL,
`subtype` varchar(1) NOT NULL,
`data` text NOT NULL,
`price` int(11) NOT NULL,
`amount` int(11) NOT NULL default '1',
`category` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_homes_group_linker` (
`userid` int(11) NOT NULL,
`groupid` int(11) NOT NULL,
`active` varchar(1) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_homes_inventory` (
`id` int(11) NOT NULL auto_increment,
`userid` int(11) NOT NULL,
`type` varchar(1) NOT NULL,
`subtype` varchar(1) NOT NULL,
`data` text NOT NULL,
`amount` varchar(3) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_homes_stickers` (
`id` int(11) NOT NULL auto_increment,
`userid` int(11) NOT NULL,
`x` varchar(6) NOT NULL default '1' COMMENT 'left',
`y` varchar(6) NOT NULL default '1' COMMENT 'top',
`z` varchar(6) NOT NULL default '1' COMMENT 'z-index',
`data` text NOT NULL,
`type` varchar(1) NOT NULL default '1',
`subtype` varchar(1) NOT NULL default '0' COMMENT 'Widget Type (if widget)',
`skin` text NOT NULL,
`groupid` int(11) NOT NULL default '-1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query("CREATE TABLE `cms_minimail` (
`userid` int(11) NOT NULL,
`senderid` int(11) NOT NULL,
`subject` varchar(30) NOT NULL,
`date` varchar(30) NOT NULL,
`message` text NOT NULL,
`read` enum('0','1') NOT NULL default '0',
`id` int(11) NOT NULL auto_increment,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_news` (
`num` int(4) NOT NULL auto_increment,
`title` text collate latin1_general_ci NOT NULL,
`category` text collate latin1_general_ci NOT NULL,
`topstory` varchar(100) collate latin1_general_ci NOT NULL,
`short_story` text collate latin1_general_ci NOT NULL,
`story` longtext collate latin1_general_ci NOT NULL,
`date` date NOT NULL,
`author` text collate latin1_general_ci NOT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='HoloCMS' AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_system` (
`sitename` varchar(30) collate latin1_general_ci NOT NULL,
`shortname` varchar(30) collate latin1_general_ci NOT NULL,
`site_closed` enum('0','1') collate latin1_general_ci NOT NULL COMMENT 'Maintenance Mode',
`enable_sso` enum('0','1') collate latin1_general_ci NOT NULL,
`language` varchar(2) collate latin1_general_ci NOT NULL,
`ip` varchar(50) collate latin1_general_ci NOT NULL,
`port` varchar(5) collate latin1_general_ci NOT NULL,
`texts` varchar(250) collate latin1_general_ci NOT NULL,
`variables` varchar(250) collate latin1_general_ci NOT NULL,
`dcr` varchar(250) collate latin1_general_ci NOT NULL,
`reload_url` varchar(250) collate latin1_general_ci NOT NULL,
`localhost` enum('0','1') collate latin1_general_ci NOT NULL COMMENT 'Local server?',
`start_credits` int(11) NOT NULL default '0',
`admin_notes` text collate latin1_general_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='HoloCMS';") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_tags` (
`id` int(255) NOT NULL auto_increment,
`ownerid` int(11) NOT NULL default '0',
`tag` varchar(25) collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='HoloCMS' AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_transactions` (
`id` int(11) NOT NULL auto_increment,
`date` varchar(20) NOT NULL,
`amount` varchar(10) NOT NULL,
`descr` text NOT NULL,
`userid` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;") or die(mysql_error());
mysql_query ("CREATE TABLE `cms_wardrobe` (
`userid` int(11) NOT NULL,
`slotid` varchar(1) NOT NULL,
`figure` text NOT NULL,
`gender` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;") or die(mysql_error());
echo "done! n";
echo "Inserting data and building default content..";
mysql_query("INSERT INTO `cms_news` (`num`, `title`, `category`, `topstory`, `short_story`, `story`, `date`, `author`) VALUES (2, 'Installation Complete', 'HoloCMS', 'http://images.habbohotel.com/c_images/Top_Story_Images/Rel22_commu_topstory_300x187.gif', 'Welcome, to your brand new HoloCMS installation!', 'Hello, and thank you very much for choosing HoloCMS; a rich and complete website and content management system for Holograph Emulator, that you''ve just installed .. successfully. And guess what? Everything seems to be working just fine!rnrnI hope you enjoy using HoloCMS and Holograph Emulator - if you need any future support, just ask away on the RaGEZONE Habbo board.rnrnYou can edit or delete this example news article by logging into Housekeeping (accessible through the green ''Housekeeping'' tab in the navigation). Once you are logged in in Housekeeping, you will find yourself on the Dashboard. You will find the page ''Manage News Articles'' under the site tab.rnrnThanks again, and have fun!rnrnrnOn behalf of everyone involved,', '0000-00-00', 'Meth0d');") or die(mysql_error());
mysql_query("INSERT INTO `cms_system` (`sitename`, `shortname`, `site_closed`, `enable_sso`, `language`, `ip`, `port`, `texts`, `variables`, `dcr`, `reload_url`, `localhost`, `start_credits`, `admin_notes`) VALUES ('Holo Hotel', 'Holo', '0', '1', 'en', '127.0.0.1', '21', 'http://www.habbohotel.co.uk/gamedata/external?id=external_texts', 'http://www.habbohotel.co.uk/gamedata/external?id=external_variables', 'http://images.habbohotel.co.uk/dcr/r22_20080519_1524_5590_66afcf07d8b708feecf6e2e0e797ec09/habbo.dcr', '".$path."client.php', '0', 500, 'You can use this to keep notes for yourself, other mods or admins, etc');") or die(mysql_error());
mysql_query("UPDATE users SET postcount = '0'") or die(mysql_error());
mysql_query("INSERT INTO `cms_content` (`contentkey`, `contentvalue`, `setting_title`, `setting_desc`, `fieldtype`, `category`) VALUES
('credits1', 'Credits are the hotel's currency. You can use them to buy all kinds of things, from rubber ducks and sofas, to Habbo Club membership, jukeboxes and teleports.', 'Credits Content Box 1', 'The text within a content box on the credits page.', '1', '3'),
('credits2', 'To buy furniture or play games, you need credits. We provide you with free credits on registration, and if you run out, there are several ways you can earn more credits:
* Refer a friend to the hotel and earn credits
* Ask a staff member ingame
* Redeem a voucher if you have one
* Trade your furniture with others for credit furniture
The tables have been created, truncated and modified where needed, and required data has been inserted. Your site is technically ready for use now, but let's take a moment to set up an administrator account for you first.
";
echo "
Proceedn";
///////////////////////////////////////////////////////////////////////////////////////////////
} elseif($step == 3){
// We've written the config, so let's use that
require_once('config.php');
require_once('./includes/mysql.php');
if(isset($_POST['username'])){
$name = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password-retyped'];
$email = $_POST['email'];
$filter = preg_replace("/[^a-zd]/i", "", $name);
$email_check = preg_match("/^[a-z0-9_.-]+@([a-z0-9]+([-]+[a-z0-9]+)*.)+[a-z]{2,7}$/i", $email);
if($password !== $password2){
$fail = true;
$error = "The passwords do not match.";
} elseif($email_check !== 1){
$fail = true;
$error = "Invalid e-mail address.";
} elseif($filter !== $name){
$fail = true;
$error = "Invalid username.";
} else {
$sql = mysql_query("SELECT id FROM users WHERE name = '".addslashes($name)."' LIMIT 1") or die(mysql_error());
$already_exists = mysql_num_rows($sql);
if($already_exists > 0){
$fail = true;
$error = "Username already in use!";
} else {
$password = HoloHash($password);
$scredits = 5000;
$dob = "1-1-1980";
$figure = "hr-802-61.hd-190-1.ch-260-62.lg-280-110.sh-295-91.fa-1207-103";
$gender = "M";
mysql_query("INSERT INTO users (name,password,email,birth,figure,sex,rank,hbirth,ipaddress_last,postcount,tickets,credits,lastvisit) VALUES ('".$name."','".$password."','".$email."','".$dob."','".$figure."','".$gender."','7','".$date_normal."','".$remote_ip."','0','0','".$scredits."','".$date_full."')") or die(mysql_error());
$check = mysql_query("SELECT id FROM users WHERE name = '".addslashes($name)."' ORDER BY id ASC LIMIT 1") or die(mysql_error());
$row = mysql_fetch_assoc($check);
$userid = $row['id'];
$fail = false;
}
}
} elseif(isset($_GET['do']) && $_GET['do'] == "skip"){
$fail = false;
}
if(!isset($_POST['username'])){ $_POST['username'] = "admin"; }
if(!isset($_POST['email'])){ $_POST['email'] = "defaultuser@meth0d.org"; }
if(!isset($fail) || $fail == true || isset($error)){
if(isset($error)){ echo "
".$error."
n"; }
echo "
Alright, we've finished the installation. Now let's take a moment to set up an administrator account for you. Fill in the form below, and an administrator account will automaticly be created for you.