<?php
error_reporting(E_ERROR);
include('../include/config.php');
include('functions.php');
?>
<!DOCTYPE html>
<html>
<head>
    <!-- Script Charset -->
	<meta charset="UTF-8">
	<!-- Style Viewport for Responsive purpose -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!-- The Script Base URL -->
		<title>MediaCloud | Installation</title>
		<!-- CSS Files -->
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<link rel="stylesheet" href="css/bootstrap-theme.min.css">
		<link rel="stylesheet" href="css/font-awesome.min.css">
		<link rel="stylesheet" href="css/style.css">
		<!-- Javascript Files -->
		<script src="js/jquery.min.js"></script>
		<script src="js/bootstrap.min.js"></script>
	</head>
	<body>
	<div class="container">
	<div class="row">
		<div class="col-md-4 col-md-push-4 logo"><i class="fa fa-cloud"></i> MediaCloud</div>
	</div>
	<div class="row">
<?php
	switch($_GET['step']) {
	case 'finish';
	$mysqli = new mysqli($db_config['host'], $db_config['user'], $db_config['pass'], $db_config['name']);
	$user = $mysqli->query("SELECT * FROM users WHERE super_admin='1'");
	$row = $user->fetch_assoc();
	?>
	<div class="content">
	<div class="steps row">
		<div class="col-xs-2"><span><i class="fa fa-smile-o"></i> Welcome</span></div>
		<div class="col-xs-2"><span><i class="fa fa-database"></i> Check Connection</span></div>
		<div class="col-xs-2"><span><i class="fa fa-server"></i> Install Database</span></div>
		<div class="col-xs-2"><span><i class="fa fa-cogs"></i> Configurations</span></div>
		<div class="col-xs-2"><span><i class="fa fa-user"></i> Admin Account</span></div>
		<div class="col-xs-2"><span class="selected-span"><i class="fa fa-check"></i> Finish</span></div>
	</div>
	<div class="step-content">
	<div class="page-header page-heading">
		<h1>Finish</h1>
	</div>
	<div class="alert alert-success">Congratulation, you have installed the script successfully.</div>
	<p>to enter your site dashboard <a href="../admin/">Dashboard</a>.
	Use the following details : <br />
	Username : <code><?php echo $row['username']; ?></code><br />
	Password : <code>as inserted before</code></p>
	<div class="alert alert-warning">For Security Purposes, You Should Delete or Rename the <b>install folder</b>.</div>
	<div class="action-div">
	<a href="../admin/" class="btn btn-success pull-right">Dashboard</a>
	</div>
	</div>
	</div>
	<?php
	break;
	case 'admin_account';
	$mysqli = new mysqli($db_config['host'], $db_config['user'], $db_config['pass'], $db_config['name']);
	if (isset($_POST['save'])) {
		$username = make_safe($_POST['username']);
		$password = make_safe($_POST['password']);
		$email = make_safe($_POST['email']);
		if (empty($username)) {
		$message = notification('warning',"Insert Username Please.");
		} elseif (empty($email)) {
		$message = notification('warning',"Insert E-Mail Please.");
		} elseif (empty($password)) {
		$message = notification('warning',"Insert Password Please");
		} elseif (mb_strlen($password,'UTF-8') < 6) {
		$message = notification('warning',"Password Must be 6 Characters at least.");
		} else {
		$datetime = time();
		$encoded_password = hash('sha256', md5($password));
		$activation_code = genRandomString(24);
		$day = date('j');
		$month = date('n');
		$year = date('Y');
		$ip_address = getRealIpAddr();
		$add = $mysqli->query("INSERT INTO users (username,password,email,provider,activation_code,ip_address,datetime,last_login,day,month,year,active,super_admin) VALUES ('$username','$encoded_password','$email','site','$activation_code','$ip_address','$datetime','$datetime','$day','$month','$year','1','1')");
		if ($add) {
		$saved = true;	
		$message = notification('success','Admin Account is Saved Successfully.');	
		} else {
		$message = notification('danger',"Error Happened");
		}
		}
	}
	?>
	<div class="content">
	<div class="steps row">
		<div class="col-xs-2"><span><i class="fa fa-smile-o"></i> Welcome</span></div>
		<div class="col-xs-2"><span><i class="fa fa-database"></i> Check Connection</span></div>
		<div class="col-xs-2"><span><i class="fa fa-server"></i> Install Database</span></div>
		<div class="col-xs-2"><span><i class="fa fa-cogs"></i> Configurations</span></div>
		<div class="col-xs-2"><span class="selected-span"><i class="fa fa-user"></i> Admin Account</span></div>
		<div class="col-xs-2"><span><i class="fa fa-check"></i> Finish</span></div>
	</div>
	<div class="step-content">
	<div class="page-header page-heading">
		<h1>Creating Admin Account</h1>
	</div>
	<?php if (isset($message)) {echo $message;} ?>
	<form role="form" method="POST" action="">
		  <div class="form-group">
			<label for="email">Email</label>
			<input type="text" class="form-control" name="email" id="email" />
		  </div>
		  <div class="form-group">
			<label for="username">Username</label>
			<input type="text" class="form-control" name="username" id="username" />
		  </div>
		  <div class="form-group">
			<label for="password">Password</label>
			<input type="password" class="form-control" name="password" id="password" />
		  </div>
		  <button type="submit" name="save" class="btn btn-primary">Save</button>
		</form>
	<?php if (isset($saved)) { ?>
	<div class="action-div">
	<a href="install.php?step=finish" class="btn btn-default pull-right">Finish</a>
	</div>
	<?php } ?>
	</div>
	</div>
	<?php		
	break;	
	case 'configurations';
	$mysqli = new mysqli($db_config['host'], $db_config['user'], $db_config['pass'], $db_config['name']);
	function get_options($set) {
	global $mysqli;
	$options = array();
	$query = $mysqli->query("SELECT * FROM options WHERE option_set='$set' ORDER BY id ASC");
	while ($row = $query->fetch_assoc()) {
		$options[$row["option_name"]] = $row["option_value"];
	}  
	return $options;
	}
	function set_options($data,$set) {
	unset($data['save']);
	global $mysqli;
	foreach ($data AS $key=>$value) {
	$check = $mysqli->query("SELECT option_name FROM options WHERE option_name='$key'");
	$value = $mysqli->real_escape_string(htmlspecialchars($value,ENT_QUOTES));	
	if ($check->num_rows == 0) {
	$excute = $mysqli->query("INSERT INTO options (option_name,option_value,option_default,option_set) VALUES ('$key','$value','$value','$set')");	
	} else {
	$excute = $mysqli->query("UPDATE options SET option_value='$value' WHERE option_name='$key'");		
	}
	if ($excute) {
	$message = notification('success','All Changes Saved.');
	} else {
	$message = notification('danger','Error Happened.');
	}
	}
	return $message;
	}
	if (isset($_POST['save'])) {
	$message = set_options($_POST,'General');
	}
	?>
	<div class="content">
	<div class="steps row">
		<div class="col-xs-2"><span><i class="fa fa-smile-o"></i> Welcome</span></div>
		<div class="col-xs-2"><span><i class="fa fa-database"></i> Check Connection</span></div>
		<div class="col-xs-2"><span><i class="fa fa-server"></i> Install Database</span></div>
		<div class="col-xs-2"><span class="selected-span"><i class="fa fa-cogs"></i> Configurations</span></div>
		<div class="col-xs-2"><span><i class="fa fa-user"></i> Admin Account</span></div>
		<div class="col-xs-2"><span><i class="fa fa-check"></i> Finish</span></div>
	</div>
	<div class="step-content">
	<div class="page-header page-heading">
		<h1>Configurations</h1>
	</div>
	<?php 
	$options = get_options('General');
	if (isset($message)) {echo $message;}
	?>
	<form role="form" method="POST" action="">
		  <div class="form-group">
			<label for="siteurl">Site Url</label>
			<input type="text" class="form-control" name="siteurl" id="siteurl" placeholder="http://www.domain.com" value="<?php echo str_replace('/install/install.php?step=configurations','',curPageURL()); ?>" />
		  </div>
		  <div class="form-group">
			<label for="seo_title">Site Name</label>
			<input type="text" class="form-control" name="seo_title" id="seo_title" placeholder="your site title" value="<?php echo $options['seo_title']; ?>" />
		  </div>
		  <div class="form-group">
			<label for="site_language">Site Language</label>
			<select name="site_language" id="site_language" class="form-control">
				<?php
				$lpath = '../languages/';
				$lresults = glob($lpath . "*");
					foreach ($lresults as $lresult) {
						if ($lresult === '.' or $lresult === '..') continue;
						if(is_dir($lresult)) {
						
						echo "
						<option value='".str_replace($lpath,'',$lresult)."' ";
						if (isset($options['site_language']) AND $options['site_language'] == str_replace($lpath,'',$lresult)) {
						echo 'SELECTED';
						}
						echo ">".ucfirst(str_replace($lpath,'',$lresult))."</option>";		
						}
						}
						?>						
			</select>
		   </div>
		   <div class="form-group">
			<label for="site_theme">Site Theme</label>
			<select name="site_theme" id="site_theme" class="form-control">
				<?php
				$path = '../themes/';
				$results = glob($path . "*");
					foreach ($results as $result) {
						if ($result === '.' or $result === '..') continue;
						if(is_dir($result)) {
						
						echo "
						<option value='".str_replace($path,'',$result)."'";
						if (isset($options['site_theme']) AND $options['site_theme'] == str_replace($path,'',$result)) {
						echo 'SELECTED';
						}
						echo ">".ucfirst(str_replace($path,'',$result))."</option>";		
						}
						}
						?>						
			</select>
		   </div>
		  <button type="submit" name="save" class="btn btn-primary">Save</button>
		</form>
	<div class="action-div">
	<a href="install.php?step=admin_account" class="btn btn-default pull-right">Create Admin Acount</a>
	</div>
	</div>
	</div>
	<?php		
	break;
	case 'install_database';
		$mysqli = new mysqli($db_config['host'], $db_config['user'], $db_config['pass'], $db_config['name']);
		
		$categories_sql = "CREATE TABLE IF NOT EXISTS `categories` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `category` varchar(255) NOT NULL,
						  `seo_keywords` varchar(255) NOT NULL,
						  `seo_description` varchar(255) NOT NULL,
						  `category_order` int(12) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
						
		$channels_sql = "CREATE TABLE IF NOT EXISTS `channels` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `video_site` varchar(20) NOT NULL,
						  `title` varchar(255) NOT NULL,
						  `link` varchar(255) NOT NULL,
						  `category_id` int(12) NOT NULL,
						  `media_number` int(12) NOT NULL,
						  `add_time` int(12) NOT NULL,
						  `latest_activity` int(12) NOT NULL,
						  `auto_update` int(1) NOT NULL,
						  `auto_update_period` int(12) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
		$lists_sql = "CREATE TABLE IF NOT EXISTS `lists` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `title` varchar(100) NOT NULL,
						  `user_id` int(12) NOT NULL,
						  `create_datetime` int(12) NOT NULL,
						  `privacy` int(1) NOT NULL,
						  `hits` int(12) NOT NULL,
						  `featured` int(1) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM DEFAULT CHARSET=utf8";
		$lists_media_sql = "CREATE TABLE IF NOT EXISTS `lists_media` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `list_id` int(12) NOT NULL,
						  `user_id` int(12) NOT NULL,
						  `media_id` int(12) NOT NULL,
						  `media_order` int(12) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM DEFAULT CHARSET=utf8";
		$media_sql = "CREATE TABLE IF NOT EXISTS `media` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `user_id` int(12) NOT NULL,
						  `channel_id` int(12) NOT NULL,
						  `title` varchar(255) NOT NULL,
						  `video_site` varchar(20) NOT NULL,
						  `permalink` varchar(255) NOT NULL,
						  `details` text NOT NULL,
						  `thumbnail` varchar(255) NOT NULL,
						  `category_id` int(12) NOT NULL,
						  `datetime` int(12) NOT NULL,
						  `publish_time` int(12) NOT NULL,
						  `day` int(2) NOT NULL,
						  `month` int(2) NOT NULL,
						  `year` int(4) NOT NULL,
						  `hits` int(12) NOT NULL,
						  `published` int(1) NOT NULL,
						  `deleted` int(1) NOT NULL,
						  `tags` varchar(255) NOT NULL,
						  `video_id` varchar(255) NOT NULL,
						  `duration` int(12) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
		$options_sql = "CREATE TABLE IF NOT EXISTS `options` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `option_name` varchar(100) NOT NULL,
						  `option_value` text NOT NULL,
						  `option_default` text NOT NULL,
						  `option_set` varchar(100) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
		$pages_sql = "CREATE TABLE IF NOT EXISTS `pages` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `title` varchar(255) NOT NULL,
						  `content` text NOT NULL,
						  `seo_keywords` varchar(255) NOT NULL,
						  `seo_description` varchar(255) NOT NULL,
						  `page_order` int(12) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM DEFAULT CHARSET=utf8";
		$users_sql = "CREATE TABLE IF NOT EXISTS `users` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `username` varchar(40) NOT NULL,
						  `password` varchar(255) NOT NULL,
						  `email` varchar(100) NOT NULL,
						  `avatar` varchar(255) NOT NULL,
						  `provider` varchar(30) NOT NULL,
						  `social_id` varchar(255) NOT NULL,
						  `datetime` int(12) NOT NULL,
						  `last_login` int(12) NOT NULL,
						  `activation_code` varchar(255) NOT NULL,
						  `ip_address` varchar(50) NOT NULL,
						  `active` int(1) NOT NULL,
						  `day` int(2) NOT NULL,
						  `month` int(2) NOT NULL,
						  `year` int(4) NOT NULL,
						  `super_admin` int(1) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
		$users_votes_sql = "CREATE TABLE IF NOT EXISTS `user_votes` (
						  `id` int(12) NOT NULL AUTO_INCREMENT,
						  `media_id` int(12) NOT NULL,
						  `user_id` int(12) NOT NULL,
						  `vote_up` int(12) NOT NULL,
						  `vote_down` int(12) NOT NULL,
						  PRIMARY KEY (`id`)
						) ENGINE=MyISAM DEFAULT CHARSET=utf8";
		$options_data_sql = "INSERT INTO `options` (`id`, `option_name`, `option_value`, `option_default`, `option_set`) VALUES
						(1, 'siteurl', 'http://www.site.com', 'http://www.site.com', 'General'),
						(2, 'seo_title', 'MediaCloud', 'MediaCloud', 'General'),
						(3, 'seo_keywords', 'youtube,vimeo,dailymotion', 'youtube,vimeo,dailymotion', 'General'),
						(4, 'seo_description', 'mediacloud script allow you to create multi-sources video cms that import videos from youtube, vimeo and dailymotion.', 'mediacloud script allow you to create multi-sources video cms that import videos from youtube, vimeo and dailymotion.', 'General'),
						(5, 'site_language', 'english', 'english', 'General'),
						(6, 'site_theme', 'default', 'default', 'General'),
						(7, 'category_sitemap', '1', '1', 'General'),
						(8, 'lists_sitemap', '1', '1', 'General'),
						(9, 'sitemap_items', '1000', '1000', 'General'),
						(10, 'activate_new_users', 'direct', 'direct', 'Users'),
						(11, 'cookie_name', 'MediaCloud', 'MediaCloud', 'Users'),
						(12, 'cookie_expiration_time', '3', '3', 'Users'),
						(13, 'facebook_app_id', '', '', 'Users'),
						(14, 'facebook_app_secret', '', '', 'Users'),
						(15, 'twitter_consumer_key', '', '', 'Users'),
						(16, 'twitter_consumer_secret', '', '', 'Users'),
						(17, 'media_publishing', '1', '1', 'Users'),
						(18, 'max_lists_number', '10', '10', 'Users'),
						(19, 'max_media_list_number', '24', '24', 'Users'),
						(20, 'site_logo', '&lt;i class=&quot;fa fa-cloud&quot;&gt;&lt;/i&gt; MediaCloud', '&lt;i class=&quot;fa fa-cloud&quot;&gt;&lt;/i&gt; MediaCloud', 'Theme'),
						(21, 'pagination_load', 'ajax', 'ajax', 'Theme'),
						(22, 'display_featured_slider', '1', '1', 'Theme'),
						(23, 'featured_content', 'media', 'media', 'Theme'),
						(24, 'featured_slider_items_number', '12', '12', 'Theme'),
						(25, 'home_media_number', '24', '24', 'Theme'),
						(26, 'category_media_number', '24', '24', 'Theme'),
						(27, 'search_media_number', '24', '24', 'Theme'),
						(28, 'related_media_number', '12', '12', 'Theme'),
						(29, 'public_lists_number', '24', '24', 'Theme'),
						(30, 'user_lists_number', '24', '24', 'Theme'),
						(31, 'active_instant_search', '1', '1', 'Theme'),
						(32, 'display_media_video_site', '1', '1', 'Theme'),
						(33, 'facebook_account', 'http://facebook.com', 'http://facebook.com', 'Social'),
						(34, 'twitter_account', 'http://twitter.com', 'http://twitter.com', 'Social'),
						(35, 'google_plus_account', 'http://google.com', 'http://google.com', 'Social'),
						(36, 'youtube_account', 'http://youtube.com', 'http://youtube.com', 'Social'),
						(37, 'vimeo_account', 'http://vimeo.com', 'http://vimeo.com', 'Social'),
						(38, 'dailymotion_account', 'http://dailymotion.com', 'http://dailymotion.com', 'Social'),
						(39, 'disqus_shortname', '', '', 'Comments'),
						(40, 'recaptcha_public', '', '', 'API'),
						(41, 'recaptcha_private', '', '', 'API'),
						(42, 'youtube_apikey', '', '', 'API'),
						(43, 'mail_method', 'mail', 'mail', 'Mail'),
						(44, 'send_email', 'site@email.com', 'site@email.com', 'Mail'),
						(45, 'smtp_host', '', '', 'Mail'),
						(46, 'smtp_port', '', '', 'Mail'),
						(47, 'smtp_username', '', '', 'Mail'),
						(48, 'smtp_password', '', '', 'Mail')";
		?>
		<div class="content">
	<div class="steps row">
		<div class="col-xs-2"><span><i class="fa fa-smile-o"></i> Welcome</span></div>
		<div class="col-xs-2"><span><i class="fa fa-database"></i> Check Connection</span></div>
		<div class="col-xs-2"><span class="selected-span"><i class="fa fa-server"></i> Install Database</span></div>
		<div class="col-xs-2"><span><i class="fa fa-cogs"></i> Configurations</span></div>
		<div class="col-xs-2"><span><i class="fa fa-user"></i> Admin Account</span></div>
		<div class="col-xs-2"><span><i class="fa fa-check"></i> Finish</span></div>
	</div>
	<div class="step-content">
	<div class="page-header page-heading">
		<h1>Install Database Tables</h1>
	</div>
	<table class="table">
	<thead>
	<tr>
		<th>Table</th>
		<th class="text-right">Installed</th>
	</tr>
	</thead>
	<tbody>
	<?php
		echo '<tr><td>categories table</td><td class="text-right">';
		if ($mysqli->query($categories_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>channels table</td><td class="text-right">';
		if ($mysqli->query($channels_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>lists table</td><td class="text-right">';
		if ($mysqli->query($lists_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>lists_media table</td><td class="text-right">';
		if ($mysqli->query($lists_media_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>media table</td><td class="text-right">';
		if ($mysqli->query($media_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>options table</td><td class="text-right">';
		if ($mysqli->query($options_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>pages table</td><td class="text-right">';
		if ($mysqli->query($pages_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>users table</td><td class="text-right">';
		if ($mysqli->query($users_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>users_votes table</td><td class="text-right">';
		if ($mysqli->query($users_votes_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
		echo '<tr><td>options table default rows</td><td class="text-right">';
		if ($mysqli->query($options_data_sql)) {
			echo '<i class="fa fa-check text-success"></i> Success';
		} else {
			echo '<i class="fa fa-remove text-danger"></i> Failed';
		}
		echo '</td></tr>';
	?>
	</tbody>
	</table>
	<div class="action-div">
	<a href="install.php?step=install_database" class="btn btn-danger pull-left">Install Again</a>
	<a href="install.php?step=configurations" class="btn btn-default pull-right">Configurations</a>
	</div>
	</div>
	</div>
<?php
		
	break;	
	case 'check_connection';
		$mysqli = new mysqli($db_config['host'], $db_config['user'], $db_config['pass'], $db_config['name']);

?>
	<div class="content">
	<div class="steps row">
		<div class="col-xs-2"><span><i class="fa fa-smile-o"></i> Welcome</span></div>
		<div class="col-xs-2"><span class="selected-span"><i class="fa fa-database"></i> Check Connection</span></div>
		<div class="col-xs-2"><span><i class="fa fa-server"></i> Install Database</span></div>
		<div class="col-xs-2"><span><i class="fa fa-cogs"></i> Configurations</span></div>
		<div class="col-xs-2"><span><i class="fa fa-user"></i> Admin Account</span></div>
		<div class="col-xs-2"><span><i class="fa fa-check"></i> Finish</span></div>
	</div>
	<div class="step-content">
	<div class="page-header page-heading">
		<h1>Checking Database Connection</h1>
	</div>
	<?php
	/* check connection */
	if (mysqli_connect_errno()) {
		echo notification('danger','The script isn\'t connected to Database. Please check your <b>config.php</b> file and insert correct details to continue.');
			echo '<div class="action-div">
				<a href="install.php?step=check_connection" class="btn btn-danger pull-right">Check Again</a>
			</div>';
			} else {
		echo notification('success','The script is connected to Database.');
		echo '<div class="action-div">
				<a href="install.php?step=install_database" class="btn btn-default pull-right">Install Database Tables</a>
			</div>';
	}
	?>
	</div>
	</div>
<?php
	break;	
	default;
?>
	<div class="content">
	<div class="steps row">
		<div class="col-xs-2"><span class="selected-span"><i class="fa fa-smile-o"></i> Welcome</span></div>
		<div class="col-xs-2"><span><i class="fa fa-database"></i> Check Connection</span></div>
		<div class="col-xs-2"><span><i class="fa fa-server"></i> Install Database</span></div>
		<div class="col-xs-2"><span><i class="fa fa-cogs"></i> Configurations</span></div>
		<div class="col-xs-2"><span><i class="fa fa-user"></i> Admin Account</span></div>
		<div class="col-xs-2"><span><i class="fa fa-check"></i> Finish</span></div>
	</div>
	<div class="step-content">
	<div class="page-header page-heading">
		<h1>Welcome to MediaCloud Installation Process</h1>
	</div>
	<p>Please Be Sure that you have insert the correct database details in <code>config.php</code> file which is located at <code>include/config.php</code><br />
<pre>$db_config = array(
	'host' => 'localhost',
	'user' => 'your_database_username',
	'pass' => 'your_database_password',
	'name' => 'your_database_name'
);</pre>
	</p>
	<p>Also there are some folders which should be writable <code>CHMOD to 0777 or 0755</code><br />
	<ul>
	<li><i class="fa fa-folder"></i> cache</li>
	<li><i class="fa fa-folder-open"></i> upload
		<ul>
			<li><i class="fa fa-folder"></i> avatars</li>
			<li><i class="fa fa-folder"></i> media</li>
		</ul>
	</li>
	</ul>
	</p>
	<div class="action-div">
	<a href="install.php?step=check_connection" class="btn btn-default pull-right">Check Connection</a>
	</div>
	</div>
	</div>
<?php	
	}
?>
	</div>
	</div>
</body>
</html>
