Location: PHPKode > projects > ChiCoMaS - Chilek CMS > chicomas/modules/mysql/mysql_operation.php
<?
defined( '_VALID_DA_' ) or die( 'Direct Access to this location is not allowed.' );

function Begin_Script($request){

	$content = "

	<div id=\"navcontainer\">
	<ul id=\"navlist\">";

	$sf = $request['sf'];
	$all = $request['all'];
	if (!isset($all))
		$all=0;

	$current = "id=\"current\"";
	$active = "id=\"active\"";

	$content .= "<li><a href=\"".basename($PHP_SELF)."?mode=admin\">"._CONTROL_PANEL_."</a></li>";

	$content .= "<li $active><a href=\"".basename($PHP_SELF)."?f=mysql\" $current>"._CP_MYSQL_ADMINISTRATION_."</a></li>";

	$content .= "
	</ul>
	</div>";

	return $content;

};

function End_Script(){
	$content = "
	</center>";

	return $content;

};

function Create_Init_File($request){

	global $dbhost;
	global $dbuser;
	global $dbpass;
	global $dbname;
	//global $defaultlanguage;

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

	$initfilename = "mysqlbackuppro.init.php";

	if (file_exists( $initfilename )) {
		unlink($initfilename);
	}

	$config_file=$initfilename;
	$config_file_content="<?\n";

	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"dbhost\"] = \"$dbhost\";\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"dbname\"] = \"$dbname\";\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"dbuser\"] = \"$dbuser\";\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"dbpass\"] = \"$dbpass\";\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"dbtype\"] = \"mysql\";\n";
	$config_file_content.="\n\n";

	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"compression\"] = array(\"bz2\",\"zlib\");\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"compression_default\"] = \"zlib\";\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"login\"] = \"admin\";\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"pass\"] = \"backup\";\n";
	$config_file_content.="\n\n";

	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"locale\"] = \"".$_SESSION["lang"]."\";\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"pagedisplay\"] = \"10\";\n";
	$config_file_content.=chr(36);
	$config_file_content.="GonxAdmin[\"mysqldump\"] = \"/usr/bin/mysqldump\";\n";
	$config_file_content.="\n\n";

	$config_file_content.="require_once(\"tools/mysqlbackuppro/libs/db.class.php\");\n";
	$config_file_content.="require_once(\"tools/mysqlbackuppro/libs/gonxtabs.class.php\");\n";
	$config_file_content.="require_once(\"tools/mysqlbackuppro/libs/backup.class.php\");\n";
	$config_file_content.="require_once(\"tools/mysqlbackuppro/libs/locale.class.php\");\n";

	$config_file_content.="?>";
	
	$handle=fopen($config_file,"w");
	fwrite($handle,$config_file_content);
	fclose($handle);
}

//*****************************************************************************
function Run_MysqlBackupPro($request){

	Create_Init_File($request);

	$content = "
	<center>
	<form>
	<fieldset>
	<img style=\"float:right;\" src=\"./images/icon48/mysql.png\" width=\"48\" height=\"48\" border=\"0\">
	<legend>"._CP_MYSQL_ADMINISTRATION_."</legend>
		<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">
		<tr>
			<td align=\"left\">
			<br>
			<input type=button value=\"Mysql Backup Pro\" onClick=\"myRef = window.open('tools/mysqlbackuppro/','mysqlbackuppro', 'left=20,top=20,width=800,height=600,toolbar=0,resizable=0,location=0,status=0,menubar=0'); myRef.focus()\">
			</td>
		</tr>
		</table>
			<br>
	</fieldset>
	</form>
	</center>";

	return $content;
}

//*****************************************************************************
function Mysql_Operation($request){

	global $module;
	global $module_path;
	global $process;

	$sf = $request['sf'];

	$content = Begin_Script($request);

	switch ($sf){
	default:
		$content .= Run_MysqlBackupPro($request);
	break;
	}

	$content .= End_Script();

	return $content;
}

?>
Return current item: ChiCoMaS - Chilek CMS