".I_SQL_ERROR.""; // if importing sql if ($_GET['import'] || $_GET['imp_ALL']) { // get start time to calculate duration if (function_exists("microtime")) { $microtime=explode(" ",microtime()); $starttime=($microtime[0]+$microtime[1]); } else { $starttime=time(); } if ($_GET['import']) { $import_files[]=$_GET['import']; } else { $all_files=PMBP_get_backup_files(); foreach($all_files as $file) { $db=PMBP_file_info("db","./".PMBP_EXPORT_DIR.$file); $time=PMBP_file_info("time","./".PMBP_EXPORT_DIR.$file); // define variable and set time if (!isset($last_files[$db])) $last_files[$db][1]=-1; // update time if ($time>$last_files[$db][1]) { $last_files[$db][0]=$file; $last_files[$db][1]=$time; } } if (isset($last_files)) foreach($last_files as $last_file) $import_files[]=$last_file[0]; } if (isset($import_files)) { // set php timelimit @set_time_limit($CONF['timelimit']); @ignore_user_abort(TRUE); // import each file foreach($import_files as $import_file) { // check if a db with the name of the backup file still exists and select it $db=@mysql_select_db($dbname=PMBP_file_info("db","./".PMBP_EXPORT_DIR.$import_file)); if (!$db) { printf(".
".PMBP_EX_NO_AVAILABLE."
\n",$dbname); } else { $error=""; // extract zip file if (PMBP_file_info("comp",PMBP_EXPORT_DIR.$import_file)=="zip") { include_once("pclzip.lib.php"); $pclzip = new PclZip(PMBP_EXPORT_DIR.$import_file); $extracted_file=$pclzip->extractByIndex(0,"./".PMBP_EXPORT_DIR,""); if ($pclzip->error_code!=0) $error="plczip: ".$pclzip->error_string."
".BI_BROKEN_ZIP."!"; $import_file=substr($import_file,0,strlen($import_file)-4); unset($pclzip); } // execute sql queries if (!$error) { if ($file=@gzopen(PMBP_EXPORT_DIR.$import_file,"r")) extract(PMBP_exec_sql($file,$con),EXTR_OVERWRITE); else $error=F_MAIL_3; if ($file) @gzclose($file); if (file_exists(PMBP_EXPORT_DIR.$import_file.".zip")) unlink(PMBP_EXPORT_DIR.$import_file); $import_file.=".zip"; } // echo success if ($error) { echo "
".$import_file.": ".$error."
\n"; } else { echo "
".IM_SUCCESS." ".$insertQueries." ".IM_TABLES." ".$tableQueries." ".IM_ROWS." (".$import_file.")
"; } } } } // show execution duration if (function_exists("microtime")) { $microtime=explode(" ",microtime()); $endtime=($microtime[0]+$microtime[1]); } else { $endtime=time(); } echo "
".F_DURATION.": ".number_format($endtime-$starttime,3)." ".F_SECONDS."

\n"; } // remove old backup files and get list of backup files $all_files=PMBP_get_backup_files(); // delete ALL backup files if the link was clicked if ($_GET['del_ALL']) { $result=false; if (is_array($all_files)) $result=PMBP_delete_backup_files($all_files); if (!$result) echo "
".B_DELETED_ALL.".
\n"; else echo "
".$result."
\n"; } // empty ALL db if the link was clicked if ($_GET['empty_ALL']) { $all_db=PMBP_get_db_list(); foreach($all_db as $dbname) { $db=mysql_select_db($dbname,$con); $res=mysql_list_tables($dbname,$con); for ($i=0;$i".B_EMPTIED_ALL.".\n"; } // empty db if the link was clicked if ($_GET['empty_all']) { $db=mysql_select_db($_GET['empty_all']); if (!$db) { printf(".
".PMBP_EX_NO_AVAILABLE."
\n",$_GET['empty_all']); } else { $res=mysql_list_tables($_GET['empty_all']); for ($i=0;$i".B_EMPTIED.".\n"; } } // delete all backup files of selected db if the link was clicked if ($_GET['del_all']) { if (is_array($all_files)) foreach($all_files as $filename) { if ($_GET['del_all']==PMBP_file_info("db","./".PMBP_EXPORT_DIR.$filename)) { $del_files[]=$filename; } } $result=PMBP_delete_backup_files($del_files); if (!$result) echo "
".B_DELETED_ALL.".
\n"; else echo "
".$result."
\n"; } // delete selected backup file if the link was clicked if ($_GET['del']) { $out=PMBP_delete_backup_files($_GET['del']); if($out) echo $out; else echo "
".B_DELETED.".
\n"; } // get new list of backup files $all_files=PMBP_get_backup_files(); echo "\n"; // list all backup files if (is_array($all_files)) { $last_backup=0; $size_sum=0; // print html table foreach($all_files as $filename) { $file="./".PMBP_EXPORT_DIR.$filename; // generate one row for the db name if (!isset($printed_title[$db=PMBP_file_info("db",$file)])) { $printed_title[$db]=TRUE; echo "\n"; } echo "\n\n"; echo "\n"; if ($time>$last_backup) $last_backup=$time; $size_sum+=$size=PMBP_file_info("size",$file); $size=PMBP_size_type($size); echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($con) echo "\n"; else echo B_IMPORT_FRAG."\n"; echo "\n\n"; } // print delete ALL backups and empty ALL dbs links if backup files are available $size_sum=PMBP_size_type($size_sum); echo "\n"; echo "\n\n"; } else { // if there are no backup files echo "\n\n\n"; } echo "
".$db." ".PMBP_confirm(B_CONF_EMPTY_DB,"import.php?empty_all=".$db,"[".B_EMPTY_DB."]"); echo " ".PMBP_confirm(B_CONF_DEL_ALL,"import.php?del_all=".$db,"[".B_DELETE_ALL."]")."
\n".$filename."".strftime($CONF['date'],$time=PMBP_file_info("time",$file))."".$size['value']." ".$size['type']."".PMBP_pop_up("file_info.php?file=".$filename,B_INFO,"info")."".PMBP_pop_up("get_file.php?view=".$file,B_VIEW,"view")."".B_DOWNLOAD."".PMBP_confirm(B_CONF_IMP,"import.php?import=".$filename,B_IMPORT)." \n"; else echo "".B_IMPORT." \n"; if ($con) echo "(".PMBP_confirm(B_CONF_IMP,"big_import.php?fn=".PMBP_EXPORT_DIR.$filename."&dbn=".$db,B_IMPORT_FRAG,"info").")".PMBP_confirm(B_CONF_DEL,"import.php?del=".$filename,B_DELETE)."

".B_SIZE_SUM.": ".$size_sum['value']." ".$size_sum['type']." - ".B_LAST_BACKUP.": ".strftime($CONF['date'],$last_backup)."
".PMBP_confirm(B_CONF_EMPT_ALL,"import.php?empty_ALL=TRUE","[".B_EMPTY_ALL."]"); echo " ".PMBP_confirm(B_CONF_IMP_ALL,"import.php?imp_ALL=TRUE","[".B_IMPORT_ALL."]")."\n"; echo " ".PMBP_confirm(B_CONF_DEL_ALL_2,"import.php?del_ALL=TRUE","[".B_DELETE_ALL_2."]")."
 
".B_NO_FILES.".
\n
\n"; PMBP_print_footer(); ?>