Location: PHPKode > projects > ChiCoMaS - Chilek CMS > chicomas/install/install_operation.php
<?
function Install_Message(){

	$content = "
	<h3>"._CMN_INSTALL_."</h3>
	<p>"._CMN_INSTALL_MESSAGE_."</p>
	<form action='".basename($PHP_SELF)."?operation=install&step=1' method='post'>
	<input type=\"hidden\" name=\"install_ok\" value=\"1\" />
	<input type=submit value=\""._CMN_CONTINUE_."\" />
	</form>";

	return $content;
}

function Install_Step_1($request){

	$dbhost = $request['dbhost'];
	$dbname = $request['dbname'];
	$dbuser = $request['dbuser'];
	$dbpass = $request['dbpass'];
	$dbpass1 = $request['dbpass1'];
	$thisurl = $request['thisurl'];

	if ($dbhost==_CMN_NO_FILLED_)
		$dbhost="";
	if ($dbname==_CMN_NO_FILLED_)
		$dbname="";
	if ($dbuser==_CMN_NO_FILLED_)
		$dbuser="";
	if ($thisurl==_CMN_NO_FILLED_)
		$thisurl="";

	$content = "
	<h3>"._CMN_INSTALL_."</h3>
	<p>"._CMN_INSTALL_STEP_1_."</p>
	<form action='".basename($PHP_SELF)."?operation=install&step=2' method='post'>
	<input type=\"hidden\" name=\"install_ok\" value=\"1\" />
	<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" style=\"width:600\">
	<tr>
		<td colspan=2 align=center>
			<h4>"._CMN_CREATE_DATABASE_."</h4>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\" width=\"300\">
			<font size=\"-1\">"._CMN_DB_HOST_NAME_."</font>
		</td>
		<td width=\"300\">
			<input type=\"text\" name=\"dbhost\" size=\"40\" value=\"$dbhost\" />
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_NAME_."</font>
		</td>
		<td align=\"left\">
			<input type=\"text\" name=\"dbname\" size=\"40\" value=\"$dbname\" />
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_USERNAME_."</font>
		</td>
		<td align=\"left\">
			<input type=\"text\" name=\"dbuser\" size=\"40\" value=\"$dbuser\" />
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_PASSWORD_."</font>
		</td>
		<td align=\"left\">
			<input type=\"dbpass\" name=\"dbpass\" size=\"40\" value=\"$dbpass\" />
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_REPEAT_PASSWORD_."</font>
		</td>
		<td align=\"left\">
			<input type=\"dbpass\" name=\"dbpass1\" size=\"40\" value=\"$dbpass1\" />
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_SITE_URL_."</font>
		</td>
		<td align=\"left\">
			<input type=\"text\" name=\"thisurl\" value=\"$thisurl\" size=\"40\" />
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td colspan=2 align=center>
			<input type=submit value=\""._CMN_CONTINUE_."\" />
		</td>
	</tr>
	</table>
	</form>";

	return $content;
}

function Install_Step_2($request){

	//print_r($request);
	$dbhost = $request['dbhost'];
	$dbname = $request['dbname'];
	$dbuser = $request['dbuser'];
	$dbpass = $request['dbpass'];
	$dbpass1 = $request['dbpass1'];
	$thisurl = $request['thisurl'];

	$admin = $request['admin'];
	$adminuser = $request['adminuser'];
	$adminemail = $request['adminemail'];
	$adminemail1 = $request['adminemail1'];
	$adminpassword = $request['adminpassword'];
	$adminpassword1 = $request['adminpassword1'];

	if (($dbhost=="") || ($dbname=="") || ($dbuser=="") || ($thisurl==""))
		$no_filled = 1;

	if ($dbpass!=$dbpass1)
		$different_password = 1;

	if ($dbhost=="")
		$dbhost=_CMN_NO_FILLED_;
	if ($dbname=="")
		$dbname=_CMN_NO_FILLED_;
	if ($dbuser=="")
		$dbuser=_CMN_NO_FILLED_;
	if ($thisurl=="")
		$thisurl=_CMN_NO_FILLED_;


	$content = "
	<h3>"._CMN_INSTALL_."</h3>";
	
	$temp_content = "<p>"._CMN_INSTALL_STEP_2_."</p>";
	$temp_content .= "<form action='".basename($PHP_SELF)."?operation=install&step=3' method='post'>";

	if ($no_filled){
	  $temp_content = "<p>"._CMN_ERROR_NO_FILLED_."</p>";
	  $temp_content .= "<form action='".basename($PHP_SELF)."?operation=install&step=1' method='post'>";
	}

	if ($different_password){
	  $temp_content = "<p>"._CMN_ERROR_DIFFERENT_PASSWORD_."</p>";
	  $temp_content .= "<form action='".basename($PHP_SELF)."?operation=install&step=1' method='post'>";
	}

	$content .= $temp_content."
	<input type=\"hidden\" name=\"install_ok\" value=\"1\" />
	<input type=\"hidden\" name=\"dbhost\" value=\"$dbhost\" />
	<input type=\"hidden\" name=\"dbname\" value=\"$dbname\" />
	<input type=\"hidden\" name=\"dbuser\" value=\"$dbuser\" />
	<input type=\"hidden\" name=\"dbpass\" value=\"$dbpass\" />
	<input type=\"hidden\" name=\"dbpass1\" value=\"$dbpass1\" />
	<input type=\"hidden\" name=\"thisurl\" value=\"$thisurl\" />
	<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" style=\"width:600\">
	<tr>
		<td colspan=2 align=center>
			<h4>"._CMN_CREATE_DATABASE_."</h4>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\" width=\"300\">
			<font size=\"-1\">"._CMN_DB_HOST_NAME_."</font>
		</td>
		<td width=\"300\">
			<font size=\"-1\">$dbhost</font>
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_NAME_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$dbname</font>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_USERNAME_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$dbuser</font>
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_PASSWORD_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$dbpass</font>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_REPEAT_PASSWORD_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$dbpass1</font>
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_SITE_URL_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$thisurl</font>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td colspan=2 align=center>";
			$temp_content = _CMN_CONTINUE_;
			if (($no_filled) || ($different_password))
				$temp_content = _CMN_BACK_;
			$content .= "<input type=submit value=\"".$temp_content."\" />
		</td>
	</tr>";

	if (!(($no_filled) || ($different_password))){
		$content .= "
		<tr>
			<td colspan=2 align=center>
				<br><h4>"._CMN_CREATE_ADMINISTRATOR_."</h4>
			</td>
		</tr>
		<tr bgcolor=\"#FFB0B0\">
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_NAME_."</font>
			</td>
			<td align=\"left\">
				<input type=\"text\" name=\"admin\" size=\"40\" value=\"$admin\" />
			</td>
		</tr>
		<tr>
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_USERNAME_."</font>
			</td>
			<td align=\"left\">
				<input type=\"text\" name=\"adminuser\" size=\"40\" value=\"$adminuser\" />
			</td>
		</tr>
		<tr bgcolor=\"#FFB0B0\">
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_EMAIL_."</font>
			</td>
			<td align=\"left\">
				<input type=\"text\" name=\"adminemail\" size=\"40\" value=\"$adminemail\"/>
			</td>
		</tr>
		<tr>
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_EMAIL1_."</font>
			</td>
			<td align=\"left\">
				<input type=\"text\" name=\"adminemail1\" size=\"40\" value=\"$adminemail1\" />
			</td>
		</tr>
		<tr bgcolor=\"#FFB0B0\">
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_PASSWORD_."</font>
			</td>
			<td align=\"left\">
				<input type=\"password\" name=\"adminpassword\" size=\"40\" value=\"$adminpassword\"/>
			</td>
		</tr>
		<tr>
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_PASSWORD1_."</font>
			</td>
			<td align=\"left\">
				<input type=\"password\" name=\"adminpassword1\" size=\"40\" value=\"$adminpassword1\"/>
			</td>
		</tr>
		<tr>
			<td colspan=2 align=center>
				<input type=submit value=\""._CMN_CONTINUE_."\" />
			</td>
		</tr>";
	}
	$content .= "
	</table>
	</form>";


	return $content;
}

function Install_Step_3($request){

	$dbhost = $request['dbhost'];
	$dbname = $request['dbname'];
	$dbuser = $request['dbuser'];
	$dbpass = $request['dbpass'];
	$dbpass1 = $request['dbpass1'];
	$thisurl = $request['thisurl'];

	$admin = $request['admin'];
	$adminuser = $request['adminuser'];
	$adminemail = $request['adminemail'];
	$adminemail1 = $request['adminemail1'];
	$adminpassword = $request['adminpassword'];
	$adminpassword1 = $request['adminpassword1'];

	if (($admin=="") || ($adminuser=="") || ($adminemail=="") || ($adminemail1=="") || ($adminpassword=="") || ($adminpassword1==""))
		$no_filled = 1;

	if ($adminemail!=$adminemail1)
		$different_email = 1;

	if ($adminpassword!=$adminpassword1)
		$different_password = 1;

	if ($admin=="")
		$admin=_CMN_NO_FILLED_;
	if ($adminuser=="")
		$adminuser=_CMN_NO_FILLED_;
	if ($adminemail=="")
		$adminemail=_CMN_NO_FILLED_;
	if ($adminemail1=="")
		$adminemail1=_CMN_NO_FILLED_;
	if ($adminpassword=="")
		$adminpassword=_CMN_NO_FILLED_;
	if ($adminpassword1=="")
		$adminpassword1=_CMN_NO_FILLED_;


	$content = "
	<h3>"._CMN_INSTALL_."</h3>";

	$temp_content = "<p>"._CMN_INSTALL_STEP_3_."</p>";
	$temp_content .= "<form action='".basename($PHP_SELF)."?operation=install&step=4' method='post'>";

	if ($no_filled){
	  $temp_content = "<p>"._CMN_ERROR_NO_FILLED_."</p>";
	  $temp_content .= "<form action='".basename($PHP_SELF)."?operation=install&step=2' method='post'>";
	}

	if ($different_email){
	  $temp_content = "<p>"._CMN_ERROR_DIFFERENT_EMAIL_."</p>";
	  $temp_content .= "<form action='".basename($PHP_SELF)."?operation=install&step=2' method='post'>";
	}

	if ($different_password){
	  $temp_content = "<p>"._CMN_ERROR_DIFFERENT_PASSWORD_."</p>";
	  $temp_content .= "<form action='".basename($PHP_SELF)."?operation=install&step=2' method='post'>";
	}

	$content .= $temp_content."
	<input type=\"hidden\" name=\"install_ok\" value=\"1\" />
	<input type=\"hidden\" name=\"dbhost\" value=\"".$dbhost."\" />
	<input type=\"hidden\" name=\"dbname\" value=\"".$dbname."\" />
	<input type=\"hidden\" name=\"dbuser\" value=\"".$dbuser."\" />
	<input type=\"hidden\" name=\"dbpass\" value=\"".$dbpass."\" />
	<input type=\"hidden\" name=\"dbpass1\" value=\"".$dbpass1."\" />
	<input type=\"hidden\" name=\"thisurl\" value=\"".$thisurl."\" />

	<input type=\"hidden\" name=\"admin\" value=\"".$admin."\" />
	<input type=\"hidden\" name=\"adminuser\" value=\"".$adminuser."\" />
	<input type=\"hidden\" name=\"adminemail\" value=\"".$adminemail."\" />
	<input type=\"hidden\" name=\"adminemail1\" value=\"".$adminemail1."\" />
	<input type=\"hidden\" name=\"adminpassword\" value=\"".$adminpassword."\" />
	<input type=\"hidden\" name=\"adminpassword1\" value=\"".$adminpassword1."\" />
	<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" style=\"width:600\">
	<tr>
		<td colspan=2 align=center>
			<h4>"._CMN_CREATE_DATABASE_."</h4>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\" width=\"300\">
			<font size=\"-1\">"._CMN_DB_HOST_NAME_."</font>
		</td>
		<td width=\"300\">
			<font size=\"-1\">$dbhost</font>
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_NAME_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$dbname</font>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_USERNAME_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$dbuser</font>
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_PASSWORD_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$dbpass</font>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td align=\"right\">
			<font size=\"-1\">"._CMN_DB_REPEAT_PASSWORD_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$dbpass1</font>
		</td>
	</tr>
	<tr>
		<td align=\"right\">
			<font size=\"-1\">"._CMN_SITE_URL_."</font>
		</td>
		<td align=\"left\">
			<font size=\"-1\">$thisurl</font>
		</td>
	</tr>
	<tr bgcolor=\"#B0B0B0\">
		<td colspan=2 align=center>
			<br>
		</td>
	</tr>";

	if ((!$no_filled) || (!$different_password)){
		$content .= "
		<tr>
			<td colspan=2 align=center>
				<h4>"._CMN_CREATE_ADMINISTRATOR_."</h4>
			</td>
		</tr>
		<tr bgcolor=\"#FFB0B0\">
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_NAME_."</font>
			</td>
			<td align=\"left\">
				<font size=\"-1\">$admin</font>
			</td>
		</tr>
		<tr>
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_USERNAME_."</font>
			</td>
			<td align=\"left\">
				<font size=\"-1\">$adminuser</font>
			</td>
		</tr>
		<tr bgcolor=\"#FFB0B0\">
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_EMAIL_."</font>
			</td>
			<td align=\"left\">
				<font size=\"-1\">$adminemail</font>
			</td>
		</tr>
		<tr>
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_EMAIL1_."</font>
			</td>
			<td align=\"left\">
				<font size=\"-1\">$adminemail1</font>
			</td>
		</tr>
		<tr bgcolor=\"#FFB0B0\">
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_PASSWORD_."</font>
			</td>
			<td align=\"left\">
				<font size=\"-1\">$adminpassword</font>
			</td>
		</tr>
		<tr>
			<td align=\"right\">
				<font size=\"-1\">"._CMN_CA_PASSWORD1_."</font>
			</td>
			<td align=\"left\">
				<font size=\"-1\">$adminpassword1</font>
			</td>
		</tr>
		<tr>
			<td colspan=2 align=center>";
				$temp_content = _CMN_CONTINUE_;
				if (($no_filled) || ($different_email) || ($different_password))
					$temp_content = _CMN_BACK_;
				$content .= "<input type=submit value=\"".$temp_content."\" />
			</td>
		</tr>";
	}
	$content .= "
	</table>
	</form>";

	return $content;
}

function Install_Step_4($request){

	$dbhost = $request['dbhost'];
	$dbname = $request['dbname'];
	$dbuser = $request['dbuser'];
	$dbpass = $request['dbpass'];
	$dbpass1 = $request['dbpass1'];
	$thisurl = $request['thisurl'];

	$admin = $request['admin'];
	$adminuser = $request['adminuser'];
	$adminemail = $request['adminemail'];
	$adminemail1 = $request['adminemail1'];
	$adminpassword = $request['adminpassword'];
	$adminpassword1 = $request['adminpassword1'];

	/*********************************************************/
	/* Write info to the configuration file */
	/*********************************************************/
	
	$config_file_content.="##ChiCoMaS\n";
	$config_file_content.="##Configuration File\n";

	$config_file_content.="dbhost                    = '".$dbhost."'\n";
	$config_file_content.="dbuser                    = '".$dbuser."'\n";
	$config_file_content.="dbpass                    = '".$dbpass."'\n";
	$config_file_content.="dbname                    = '".$dbname."'\n";
	$config_file_content.="dbtype                    = 'mysql'\n";
	$config_file_content.="title                     = 'ChiCoMaS - Chilek Content Management System'\n";
	$config_file_content.="width                     = '800px'\n";
	$config_file_content.="keywords                  = 'chicomas, content, management, system, cms, tinymce, quixplorer, mysqlbackuppro, php, mysql'\n";
	$config_file_content.="description               = 'ChiCoMaS - Chilek Content Management System'\n";
	$config_file_content.="logoname                  = ''\n";
	$config_file_content.="bodyposition              = 'center'\n";
	$config_file_content.="thisurl                   = '".$thisurl."'\n";
	$config_file_content.="textlogo                  = 'http://www.chicomas.com/'\n";
	$config_file_content.="defaultlanguage           = 'en'\n";
	$config_file_content.="user_signup               = 0\n";
	$config_file_content.="user_getpassword          = 0\n";
	$config_file_content.="user_default_group        = 2\n";
	$config_file_content.="user_send_confirm_email   = 0\n";

	$handle=fopen(CONFIGFILE, "w");
	fwrite($handle,$config_file_content);
	fclose($handle);

	$content = "
	<h3>"._CMN_INSTALL_."</h3>

	<p>
	"._CMN_CONFIG_FILE_CREATED_."<b>".CONFIGFILE."</b><br>
	"._CMN_FILE_SIZE_."<b>".filesize(CONFIGFILE)."</b><br>
	</p>
	";

	flush();

	/*********************************************************/
	/* Create the DB */
	/*********************************************************/
	mysql_connect("$dbhost","$dbuser","$dbpass") or die(_CMN_MYSQL_ERROR_.mysql_error());
	
	mysql_query("DROP DATABASE IF EXISTS `".strtolower($dbname)."`");
	
	mysql_query("CREATE DATABASE `".strtolower($dbname)."`");

	$content .= "
	<p>
	"._CMN_DB_CREATED_."<b>".strtolower($dbname)."</b><br>
	";

	/*********************************************************/
	/* Connect the DB */
	/*********************************************************/
	mysql_connect("$dbhost","$dbuser","$dbpass") or die(_CMN_MYSQL_ERROR_.mysql_error());

	mysql_select_db("$dbname") or die(_CMN_MYSQL_ERROR_.mysql_error());

	/*********************************************************/
	/* Table structure for table `contact_us` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `contact_us`");

	mysql_query("CREATE TABLE `contact_us` (
	`contact_us_id` int(11) NOT NULL auto_increment,
	`active` tinyint(1) NOT NULL default '1',
	`read_message` tinyint(1) NOT NULL default '0',
	`published` tinyint(1) NOT NULL default '0',
	`post_name` varchar(64) NOT NULL default '',
	`post_email` varchar(64) NOT NULL default '',
	`post_header` varchar(64) NOT NULL default '',
	`post_content` text NOT NULL,
	`post_date` datetime NOT NULL default '2006-01-01 00:00:00',
	`read_date` datetime NOT NULL default '2006-01-01 00:00:00',
	`sent_reply` tinyint(1) NOT NULL default '0',
	`reply_header` varchar(64) NOT NULL default '',
	`reply_content` text NOT NULL,
	`reply_date` datetime NOT NULL default '2006-01-01 00:00:00',
	KEY `contact_us_id` (`contact_us_id`)
	) TYPE=MyISAM AUTO_INCREMENT=1 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>contact_us</b><br>
	";

	/*********************************************************/
	/* Table structure for table `contents` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `contents`");

	mysql_query("CREATE TABLE `contents` (
	`content_id` int(11) NOT NULL auto_increment,
	`lang` varchar(4) NOT NULL default '',
	`page_id` int(3) NOT NULL default '0',
	`type` enum('name','content') NOT NULL default 'name',
	`context` text NOT NULL,
	`hit_counter` int(11) NOT NULL default '0',
	KEY `content_id` (`content_id`)
	) TYPE=MyISAM AUTO_INCREMENT=1 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>contents</b><br>
	";

	/*********************************************************/
	/* Table structure for table `group_permissions` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `group_permissions`");

	mysql_query("CREATE TABLE `group_permissions` (
	`group_permission_id` int(11) NOT NULL auto_increment,
	`group_id` int(11) NOT NULL default '0',
	`permission_id` int(11) NOT NULL default '0',
	KEY `group_permission_id` (`group_permission_id`)
	) TYPE=MyISAM AUTO_INCREMENT=11 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	mysql_query("INSERT INTO `group_permissions` VALUES (1, 1, 1);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (2, 1, 2);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (3, 1, 3);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (4, 1, 4);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (5, 1, 5);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (6, 1, 6);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (7, 1, 7);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (8, 1, 8);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (9, 1, 9);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `group_permissions` VALUES (10, 1, 10);") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>group_permissions</b><br>
	";


	/*********************************************************/
	/* Table structure for table `groups` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `groups`");

	mysql_query("CREATE TABLE `groups` (
	`group_id` int(11) NOT NULL auto_increment,
	`active` tinyint(1) NOT NULL default '1',
	`group_name` varchar(32) NOT NULL default '',
	`description` varchar(255) NOT NULL default '',
	UNIQUE KEY `group_name` (`group_name`),
	KEY `group_id` (`group_id`)
	) TYPE=MyISAM AUTO_INCREMENT=3 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	mysql_query("INSERT INTO `groups` VALUES (1, 1, 'Administrator', 'Site Administration');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `groups` VALUES (2, 1, 'Users', 'Default Users');") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>groups</b><br>
	";


	/*********************************************************/
	/* Table structure for table `languages` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `languages`");

	mysql_query("CREATE TABLE `languages` (
	`language_id` int(11) NOT NULL auto_increment,
	`default_lang` tinyint(1) NOT NULL default '0',
	`active` tinyint(1) NOT NULL default '1',
	`language` varchar(16) NOT NULL default 'English',
	`lang` varchar(4) NOT NULL default 'en',
	`image_path` varchar(64) NOT NULL default '',
	PRIMARY KEY  (`language_id`),
	KEY `language_id` (`language_id`)
	) TYPE=MyISAM AUTO_INCREMENT=4 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	/*********************************************************/
	/* Dumping data for table `languages` */
	/*********************************************************/
	mysql_query("INSERT INTO `languages` VALUES (1, 0, 1, 'TURKCE', 'tr', 'images/flags/turkce.jpg');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `languages` VALUES (2, 1, 1, 'ENGLISH', 'en', 'images/flags/english.jpg');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `languages` VALUES (3, 0, 0, 'DEUTSCH', 'de', 'images/flags/deutsch.jpg');") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>languages</b><br>
	";


	/*********************************************************/
	/* Table structure for table `page_types` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `page_types`");

	mysql_query("CREATE TABLE `page_types` (
	`page_type_id` int(3) NOT NULL auto_increment,
	`active` tinyint(1) NOT NULL default '1',
	`page_type` varchar(16) NOT NULL default '',
	`page_file` varchar(64) NOT NULL default '',
	UNIQUE KEY `page_type` (`page_type`),
	KEY `page_type_id` (`page_type_id`)
	) TYPE=MyISAM AUTO_INCREMENT=3 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	/*********************************************************/
	/* Dumping data for table `page_types` */
	/*********************************************************/
	mysql_query("INSERT INTO `page_types` VALUES (1, 1, 'Default', './pages/default.php');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `page_types` VALUES (2, 1, 'Contact Us', './modules/contact/contact_us.php');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	//mysql_query("INSERT INTO `page_types` VALUES (3, 1, 'Berkant Modulu', './pages/sanatcilar.php');") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>page_types</b><br>
	";

	/*********************************************************/
	/* Table structure for table `pages` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `pages`");

	mysql_query("CREATE TABLE `pages` (
	`page_id` int(3) NOT NULL auto_increment,
	`ref_id` int(3) NOT NULL default '0',
	`order_id` int(3) NOT NULL default '0',
	`description` text NOT NULL,
	`keywords` text NOT NULL,
	`alias` varchar(128) NOT NULL default '',
	`active` tinyint(1) NOT NULL default '0',
	`menu_item` tinyint(1) NOT NULL default '0',
	`topmenu_item` tinyint(1) NOT NULL default '0',
	`page_type_id` int(3) NOT NULL default '1',
	PRIMARY KEY  (`page_id`),
	KEY `page_id` (`page_id`)
	) TYPE=MyISAM AUTO_INCREMENT=1 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>pages</b><br>
	";

	/*********************************************************/
	/* Table structure for table `permissions` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `permissions`");

	mysql_query("CREATE TABLE `permissions` (
	`permission_id` int(11) NOT NULL auto_increment,
	`active` tinyint(1) NOT NULL default '1',
	`permission_name` varchar(32) NOT NULL default '',
	`permission_tag` varchar(16) NOT NULL default '',
	`description` varchar(255) NOT NULL default '',
	UNIQUE KEY `permission_tag` (`permission_tag`),
	KEY `permission_id` (`permission_id`)
	) TYPE=MyISAM AUTO_INCREMENT=11 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	/*********************************************************/
	/* Dumping data for table `permissions` */
	/*********************************************************/
	mysql_query("INSERT INTO `permissions` VALUES (1, 1, 'Page Manager', 'structure', 'Page Structure Management');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (2, 1, 'File Manager', 'filemanager', 'File Management');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (3, 1, 'Content Manager', 'content', 'Content Management');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (4, 1, 'Style Manager', 'style', 'Style Management');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (5, 1, 'User Manager', 'user', 'User Management');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (6, 1, 'Language Manager', 'language', 'Language Management');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (7, 1, 'Contact Manager', 'contact', 'Contact Management');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (8, 1, 'Module Manager', 'extra', 'Module Management');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (9, 1, 'Module Installer', 'modinst', 'Module Installer');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `permissions` VALUES (10, 1, 'Backup/Restore Manager', 'mysql', 'Backup/Restore Manager');") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>permissions</b><br>
	";

	/*********************************************************/
	/* Table structure for table `styles` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `styles`");

	mysql_query("CREATE TABLE `styles` (
	`style_id` int(3) NOT NULL auto_increment,
	`name` varchar(32) NOT NULL default '',
	`bgcol` varchar(8) NOT NULL default '',
	`bgim` varchar(100) NOT NULL default '',
	`bgrep` varchar(50) NOT NULL default '',
	`bgpos` varchar(15) NOT NULL default '',
	`font` varchar(150) NOT NULL default '',
	`fsize` int(10) NOT NULL default '0',
	`fcol` varchar(8) NOT NULL default '',
	`hsize` int(10) NOT NULL default '0',
	`hcol` varchar(8) NOT NULL default '',
	`hbgcol` varchar(8) NOT NULL default '',
	`hbgim` varchar(100) NOT NULL default '',
	`hbgrep` varchar(50) NOT NULL default '',
	`hbgpos` varchar(15) NOT NULL default '',
	`docbgcol` varchar(8) NOT NULL default '',
	`docbgim` varchar(100) NOT NULL default '',
	`docbgrep` varchar(50) NOT NULL default '',
	`docbgpos` varchar(15) NOT NULL default '',
	`docborstyle` varchar(20) NOT NULL default '',
	`docborw` varchar(10) NOT NULL default '',
	`docborcol` varchar(8) NOT NULL default '',
	`mmbgcol` varchar(8) NOT NULL default '',
	`mmborstyle` varchar(20) NOT NULL default '',
	`mmborw` varchar(10) NOT NULL default '',
	`mmborcol` varchar(8) NOT NULL default '',
	`mmfcol` varchar(8) NOT NULL default '',
	`mmhcol` varchar(8) NOT NULL default '',
	`smbgcol` varchar(8) NOT NULL default '',
	`smborstyle` varchar(20) NOT NULL default '',
	`smborw` varchar(10) NOT NULL default '',
	`smborcol` varchar(8) NOT NULL default '',
	`smfcol` varchar(8) NOT NULL default '',
	`smhcol` varchar(8) NOT NULL default '',
	`ah` varchar(8) NOT NULL default '',
	`al` varchar(8) NOT NULL default '',
	`av` varchar(8) NOT NULL default '',
	`active` int(1) NOT NULL default '0',
	UNIQUE KEY `style_id` (`style_id`)
	) TYPE=MyISAM AUTO_INCREMENT=2 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	/*********************************************************/
	/* Dumping data for table `styles` */
	/*********************************************************/
	mysql_query("INSERT INTO `styles` VALUES (1, 'ChiCoMaS', '#7EBD3F', '', 'repeat', '50% 0%', 'Trebuchet MS, sans-serif', 95, '#00003F', 100, '#FFFFFF', '#FCBD3F', '', 'repeat', '50% 50%', '#FCFCBD', '', 'repeat', '50% 50%', 'dotted', '1px', '#BDBD7E', '#7EBD7E', 'dotted', '1px', '#007E00', '#FFFFFF', '#FF0000', '#999966', 'dotted', '1px', '#FFFFFF', '#FFFFFF', '#FF0000', '#4D4DFD', '#0000FC', '#0000B0', 1);") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>styles</b><br>
	";


	/*********************************************************/
	/* Table structure for table `user_groups` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `user_groups`");

	mysql_query("CREATE TABLE `user_groups` (
	`user_group_id` int(11) NOT NULL auto_increment,
	`user_id` int(11) NOT NULL default '0',
	`group_id` int(11) NOT NULL default '0',
	UNIQUE KEY `user_id` (`user_id`),
	KEY `user_group_id` (`user_group_id`)
	) TYPE=MyISAM AUTO_INCREMENT=3 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());

	/*********************************************************/
	/* Dumping data for table `user_groups` */
	/*********************************************************/
	mysql_query("INSERT INTO `user_groups` VALUES (1, 1, 1);") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `user_groups` VALUES (2, 2, 1);") or die (_CMN_MYSQL_ERROR_.mysql_error());


	/*********************************************************/
	/* Table structure for table `users` */
	/*********************************************************/
	mysql_query("DROP TABLE IF EXISTS `users`");

	mysql_query("CREATE TABLE `users` (
	`user_id` int(11) NOT NULL auto_increment,
	`active` tinyint(1) NOT NULL default '1',
	`name_surname` varchar(64) NOT NULL default '',
	`username` varchar(64) NOT NULL default '',
	`password` varchar(128) NOT NULL default '',
	`email` varchar(128) NOT NULL default '',
	`permission` varchar(8) NOT NULL default '--------',
	`reg_date` datetime NOT NULL default '0000-00-00 00:00:00',
	`last_login` datetime NOT NULL default '0000-00-00 00:00:00',
	PRIMARY KEY  (`user_id`),
	UNIQUE KEY `username` (`username`)
	) TYPE=MyISAM AUTO_INCREMENT=3 ;") or die (_CMN_MYSQL_ERROR_.mysql_error());


	/*********************************************************/
	/* Dumping data for table `users` */
	/*********************************************************/
	mysql_query("INSERT INTO `users` VALUES (1, 1, 'Administrator', 'admin', 'da39a3ee5e6b4b0d3255bfef95601890afd80709', 'hide@address.com', '--------', '".get_datetime()."', '".get_datetime()."');") or die (_CMN_MYSQL_ERROR_.mysql_error());
	mysql_query("INSERT INTO `users` VALUES (2, 1, '".$admin."', '".$adminuser."', '".sha1($adminpassword)."', '".$adminemail."', ''--------',', '".get_datetime()."', '".get_datetime()."')") or die (_CMN_MYSQL_ERROR_.mysql_error());

	$content .= "
	<p>
	"._CMN_DB_CONTENT_CREATED_."<b>users</b><br>
	";

	/*********************************************************/
	/* File and Directory Permissions */
	/*********************************************************/
	$siteimagesdir="../siteimages";
	if (!file_exists($siteimagesdir)){
		mkdir($siteimagesdir, 0777);
		chmod($siteimagesdir, 0777);
	}

	$sectionsdir="../sections";
	if (!file_exists($sectionsdir)){
		mkdir($sectionsdir, 0777);
		chmod($sectionsdir, 0777);
	}

	$content .= "
	<p>
	"._CMN_FILE_AND_DIRECTORY_PERMISSIONS_."<b>$siteimagesdir</b><br>
	"._CMN_FILE_AND_DIRECTORY_PERMISSIONS_."<b>$sectionsdir</b><br>
	";

	/*********************************************************/
	/* Create Style Sheet */
	/*********************************************************/
	$result=mysql_query("SELECT * FROM styles WHERE active='1' limit 0,1");
	$row=mysql_fetch_row($result);
	
	$bgcol=$row[2];
	$bgim=$row[3];
	$bgrep=$row[4];
	$bgpos=$row[5];
	$font=$row[6];
	$fsize=$row[7];
	if ($fsize>16)
		$fsize = $fsize."%";
	$fcol=$row[8];
	$hsize=$row[9];
	$hcol=$row[10];
	$hbgcol=$row[11];
	$hbgim=$row[12];
	$hbgrep=$row[13];
	$hbgpos=$row[14];
	$docbgcol=$row[15];
	$docbgim=$row[16];
	$docbgrep=$row[17];
	$docbgpos=$row[18];
	$docborstyle=$row[19];
	$docborw=$row[20];
	$docborcol=$row[21];
	$mmbgcol=$row[22];
	$mmborstyle=$row[23];
	$mmborw=$row[24];
	$mmborcol=$row[25];
	$mmfcol=$row[26];
	$mmhcol=$row[27];
	$smbgcol=$row[28];
	$smborstyle=$row[29];
	$smborw=$row[30];
	$smborcol=$row[31];
	$smfcol=$row[32];
	$smhcol=$row[33];
	$ah=$row[34];
	$al=$row[35];
	$av=$row[36];

	/*********************************************************/
	/* Define the style sheet elements */
	/*********************************************************/
	/* Define the style sheet elements */
	$body="\nbody {margin:5px; background-color:$bgcol; ";
	if ($bgim!=""){
		$body.="background-image:url('$bgim'); background-repeat:$bgrep; background-position:$bgpos;";
	}
	$body.="vertical-align:top}\n";
	
	$headers = "\nh3{color: $fcol;}\n";

	$headers .= "\nh4{color: $fcol;}\n";

	$tables = "\ntable {border-collapse:collapse}\n";
	
	$tables .= "\ntd {font-family: $font; font-size:$fsize; color:$fcol; border-width:0px}\n";
	
	$head="\n#head td {font-size:$fsize; color:$hcol; background-color: $hbgcol;";
	
	if ($hbgim!="")
		$head.="background-image:url('$hbgim'); background-repeat:$hbgrep; background-position: $hbgpos;";
	$head.="}\n";
	
	$head.="\n#head a {color:$hcol;}\n";

	$head.="\n#head a:hover {color:$hcol; text-decoration:none}\n";

	$head.="\n#head a:link {color:$hcol; text-decoration:none}\n";

	$head.="\n#head a:visited {color:$hcol; text-decoration:none}\n";
	
	$doctable="\n.indocument {border: $docborstyle $docborw $docborcol; background-color:$docbgcol;";
	
	if ($docbgim!="")
		$doctable.="background-image:url('$docbgim'); background-repeat:$docbgrep; background-position: $docbgpos;";
	$doctable.="}\n";

	$doctd="\n.document {border: $docborstyle $docborw $docborcol}\n";

	$a="\na {font-family:$font; font-size:$fsize; text-decoration:none}\n";

	$ah="\na:hover {color:$ah; text-decoration:underline}\n";

	$al="\na:link {color:$al}\n";

	$av="\na:visited {color:$av}\n";

	$dhtmlmenu = "\n#dhtmlgoodies_menu{font-family:$font; font-size:$fsize; width:160px;}\n";

	$dhtmlmenu .= "\n#dhtmlgoodies_menu li{list-style-type:none; margin:0px;}\n";

	$dhtmlmenu .= "\n#dhtmlgoodies_menu ul{margin:0px; padding:0px;}\n";

	$dhtmlmenu .= "\n#dhtmlgoodies_menu ul li ul{padding-left:10px;}\n";

	$dhtmlmenu .= "\n#dhtmlgoodies_menu	li a{text-decoration:none; color:$mmfcol; height:20px; line-height:20px; vertical-align:middle; border:$mmborstyle $mmborw $mmborcol; background-color:$mmbgcol; margin:1px; padding:1px; display:block;}\n";
	
	$dhtmlmenu .= "\n#dhtmlgoodies_menu	li a:hover,#dhtmlgoodies_menu .activeMainMenuItem{color:#FFF; background-color:$mmhcol;}\n";	
	
	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu{font-family:$font; font-size:$fsize; visibility:hidden; position:absolute; overflow:hidden; border:$smborstyle $smborw $smborcol; background-color:$smbgcol;}\n";

	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu ul{font-family:$font; font-size:$fsize; margin:0px; padding:0px;}\n";

	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu ul li{list-style-type:none; margin:0px; padding:1px;}\n";

	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu ul li a{white-space:nowrap; text-decoration:none; color:$smfcol; height:16px; line-height:16px; padding:1px; display:block;}\n";

	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu ul li a:hover{color:#FFF; background-color:$smhcol;}\n";

	$flags = "\nimg.flags {float:right; width:25px; margin:2px 2px 2px 2px; padding:1px; border:0px solid black; text-align:center;}\n";

	$mainpages = "\np.mainpages {float:left; margin:2px 2px 2px 2px; padding:0px; text-align:left; font-size:$fsize;}\n";

	$subpages = "\np.subpages {float:right; margin:0px 0px 0px 0px; padding:0px; text-align:left;}\n";

	$topmenu = "\np.topmenu {float:left; margin:2px 8px 2px 8px; padding:1px; text-align:left;}\n";

	$navlist = "\n#navlist{ padding: 2px 0; margin-left: 0; border-bottom: 1px solid #778; font: bold 12px; font-family:$font; }\n";

	$navlist .= "\n#navlist li{ list-style: none; margin: 0; display: inline; }\n";

	$navlist .= "\n#navlist li a{ padding: 2px 0.5em; margin-left: 3px; border: 1px solid #778; border-bottom: none; background: #DDE; text-decoration: none; }\n";

	$navlist .= "\n#navlist li a:link { color: #448; }\n";

	$navlist .= "\n#navlist li a:visited { color: #667; }\n";

	$navlist .= "\n#navlist li a:hover{ color: #000; background: #AAE; border-color: #227; }\n";

	$navlist .= "\n#navlist li a#current{ background: white; border-bottom: 1px solid white; }\n";

	$button = "\n.inline-button { _width:12em; font: bold $fsize/1 $font; margin: 0 0.2em; padding: 0.1em 0; _padding:0; border: 1px solid black; white-space:nowrap; text-decoration: none; vertical-align:middle; background: #ccc; color: black; text-align:center; }\n";

	$button .= "\n.inline-button em { _width:1em; _cursor:hand; font-style: normal; margin:0; padding: 0.1em 0.5em; background: white; color: black; }\n";

	$button .= "\n.inline-button span { _width:1em; _cursor:hand; margin:0; padding: 0.1em 0.5em 0.1em 0.3em; }\n";

	$button .= "\n.inline-button:hover { background: #666; color: white; }\n";

	$button .= "\n.inline-button:hover em { background: black; color: white; }\n";

	$button .= "\n.orange { background: orange; color: black; }\n";

	$button .= "\n.orange em { background: white; color: #c60; }\n";

	$button .= "\n.blue { background: #06c; color: white }\n";

	$button .= "\n.blue em { background: white; color: #06c }\n";

	$button .= "\n.green { background: green; color: white }\n";

	$button .= "\n.green em { background: white; color: green }\n";

	$forms .= "\nlabel{ float: left; text-align: justify; margin-right: 1.5em display: block; font-size:$fsize; }\n";

	$forms .= "\ninput { color: #781351; background: #fee3ad; border: 1px solid #781351; cursor:auto ; font-size:$fsize; float: center; text-align: left; }\n";

	$forms .= "\ntextarea { background-color: #fee3ad; border: #781351 1px solid; color: #781351; font-family:$font; font-size: $fsize; font-weight: normal }\n";

	$forms .= "\nselect { background-color: #fee3ad; border: #781351 1px solid; color: #781351; font-family:$font; font-size: $fsize; font-weight: normal }\n";

	$forms .= "\n.submit input { margin-left: 4.5em; color: #000; background: #ffa20f; cursor:pointer; border: 2px outset #d7b9c9 }\n";

	$forms .= "\n.submitimage { border: 0px; background-color:$docbgcol; margin:0.1em 0.1em 0.1em 0.1em; position:absolute; }\n";

	$forms .= "\nfieldset { border: 1px solid $mmborcol; padding: 2px 2px; font-size:$fsize; }\n";

	$forms .= "\nlegend { color:$mmfcol; background:$mmbgcol; border: 1px solid $mmborcol; padding: 2px 6px; font-size:$fsize; }\n";

	$notes = "\n.note { background-color: $docbgcol; font-family:$font; padding-bottom: 1em; border: 1px #cce solid; margin-top: 1em; text-align:center; }\n";

	$notes .= "\n.note h3 { background-color: #ffa20c; font-family:$font; color: #339; padding: 0.25em 1em; border-bottom: 2px white solid; margin-top: 0; }\n";

	$notes .= "\n.note p { padding: 0 1em; }\n";

	$notes .= "\n.note pre { margin: 1em 1em 0 1em; }\n";

	$codes = "\ncode { color: #900; font-family:$font; font-size:$fsize; text-align:left;}\n";

	$codes .= "\npre { background-color: #ddd; white-space: normal; font: 1em $font; padding: 0 1em 1em 1em; border: 2px #222 dotted; margin-top: 1em; overflow: auto; width: 100%; width: auto; float=left;}\n";

	$codes .= "\npre strong { color: #c00; }\n";

	$codes .= "\npre code { display: block; color: black; padding: 1em 0 0 0; margin: 0; }\n";

	$codes .= "\npre .m1 { margin-left: 2em; }\n";

	$codes .= "\npre .m2 { margin-left: 4em; }\n";

	$codes .= "\npre .m3 { margin-left: 6em; }\n";

	$codes .= "\npre .m4 { margin-left: 8em; }\n";

	$codes .= "\npre .m5 { margin-left: 10em; }\n";

	$codes .= "\npre .m6 { margin-left: 12em; }\n";

	$others .= "\n.dropcap { float: left; font: normal 60pt/0.8em $font; color: chocolate; margin-right: 3px; }\n";

	$others .= "\n.rowdata { background-color: #EAECEE; }\n";

	$others .= "\n.rowdatasel { background-color: #D8E1EB; }\n";

	$others .= "\nsmall { font-size: 10; }\n";

//	$codes .= "\n\n";

	$thesheet="$body $headers $tables $head $doctable $doctd $a $ah $al $av $dhtmlmenu $flags $mainpages $subpages $topmenu $navlist $button $forms $notes $codes $others";
	
	$style_file="../style.css";
	$handle=fopen($style_file,"w");
	fwrite($handle,$thesheet);
	fclose($handle);
	

	$content .= "
	<p>
	"._CMN_STYLE_FILE_CREATED_."<b>".$style_file."</b><br>
	"._CMN_FILE_SIZE_."<b>".filesize($style_file)."</b><br>
	</p>
	";

	/*********************************************************/
	/* Create a new styleedit file - for edition in the Content Management */
	/*********************************************************/
	$body="body {margin:5px; background-color:$docbgcol; ";
	if ($docbgim!=""){
		$docbgim=str_replace("./","../",$docbgim);
		$body.="background-image:url('$docbgim'); background-repeat:$docbgrep; background-position:$docbgpos;";
	}
	$body.="vertical-align:top; font-family: $font; font-size: $fsize; color:$fcol}";
	
	$table="table {border-collapse: collapse}";
	
	$a="a {font-family:$font; font-size:100%; text-decoration:none; color:$al}";
	
	$theeditsheet="$body \n $table \n $a \n $ahe \n $ale \n $ave";
	
	$styleedit_file="../styleedit.css";
	$handle=fopen($styleedit_file,"w");
	fwrite($handle,$theeditsheet);
	fclose($handle);

	$content .= "
	<p>
	"._CMN_STYLE_EDIT_FILE_CREATED_."<b>".$styleedit_file."</b><br>
	"._CMN_FILE_SIZE_."<b>".filesize($styleedit_file)."</b><br>
	</p>";

	$content = "
	<h2><font color=\"#ff0000\">"._CMN_INSTALLATION_COMPLETED_."</font></h2>
	"._CMN_SITE_ADDRESS_."$thisurl<br>
	"._CMN_CA_USERNAME_."$admin<br>
	"._CMN_DATE_.get_datetime()."<br>
	<hr>
	"._CMN_DELETE_INSTALL_DIR_."
	<hr>
	<form action='$thisurl' method='post'>
		<input type=submit value=\""._CMN_GO_TO_NEW_SITE_."\" />
	</form>
	";

	/*********************************************************/
	/* Send an Email */
	/*********************************************************/
	$optional_subject = _CMN_ADDED_NEW_SITE_;
	
	$header="MIME-Version: 1.0\r\n";
	$header.="Content-type: text/html; charset=utf-8\r\n";
	
	$body_email  = "
	<html>
	<title>"._CMN_CILEKCMS_."</title>
	</head>
	<body>
	<center>
	
	<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" style=\"width: 600\" bgcolor=\"#F8EFDE\">
	<tr>
		<td>
			<div align=\"center\">
				<h2><font color=\"#ff0000\">"._CMN_INSTALLATION_COMPLETED_."</font></h2>
				"._CMN_SITE_ADDRESS_."$thisurl<br>
				"._CMN_CA_USERNAME_."$admin<br>
				"._CMN_DATE_.get_datetime()."<br>
				<hr>
				"._CMN_DELETE_INSTALL_DIR_."
				<hr>
				<form action='$thisurl' method='post'>
					<input type=submit value=\""._CMN_GO_TO_NEW_SITE_."\" />
				</form>
			</div>
		</td>
	</tr>
	</table>
	
	</center>
	</body>
	</html>
	";
	
	
	$results = mail ($email, $optional_subject, $body_email, $header);
	
	$results = mail (PROJECT_AUTHOR_EMAIL, $optional_subject, $body_email, $header);
	
	return $content;
}

function Install_Operation($request){

	$step = $request['step'];

//	if (file_exists( "../config.inc" )) {
//		ReDirection("index.php?operation=repair");
//		exit();
//	}

	if (!isset($step))
		$step="0";

	switch ($step){
	default:
	case '0':
		$content = Install_Message();
	break;
	case '1':
		$content = Install_Step_1($request);
	break;
	case '2':
		$content = Install_Step_2($request);
	break;
	case '3':
		$content = Install_Step_3($request);
	break;
	case '4':
		$content = Install_Step_4($request);
	break;
	}

	return $content;

};
?>
Return current item: ChiCoMaS - Chilek CMS