date_saving=$date_saving;
$this->logid=$logid;
$this->act=$act;
}
public function proceed() {
global $msg;
//Actions possibles :
//delete : suppression des jeux cochés
//restore : restoration immédiate des jeux cochés
//chaine vide : affichage
switch ($this->act) {
case "delete":
if (!is_array($this->logid)) {
echo "";
} else {
for ($i=0; $ilogid); $i++) {
$requete="select sauv_log_file from sauv_log where sauv_log_id=".$this->logid[$i];
$resultat=pmb_mysql_query($requete) or die(pmb_mysql_error());
$file_to_del=pmb_mysql_result($resultat,0,0);
@unlink("admin/backup/backups/".$file_to_del);
$requete="delete from sauv_log where sauv_log_id=".$this->logid[$i];
pmb_mysql_query($requete) or die(pmb_mysql_error());
}
}
break;
default:
//Do nothing
break;
}
return $this->showForm();
}
public function read_infos($filename) {
$tInfo=array();
$f=@fopen($filename,"r");
if (!$f) return $tInfo;
$line=fgets($f,4096);
$line=rtrim($line);
while ((!feof($f))&&($line!="#data-section")) {
$tLine=explode(" : ",$line);
$tInfo[substr($tLine[0],1)]=$tLine[1];
$line=fgets($f,4096);
$line=rtrim($line);
}
return $tInfo;
}
public function showForm() {
global $form;
global $msg;
//Récupération des dates présentes dans la base
if (!is_array($this->date_saving)) $this->date_saving=array();
$date_list="";
$form=str_replace("!!date_saving!!",$date_list,$form);
$requete="select sauv_log_id,sauv_log_start_date,sauv_log_file,sauv_log_succeed,sauv_log_messages,concat(prenom,' ',nom) as name from sauv_log,users where sauv_log_userid=userid";
if (count($this->date_saving)!=0) {
$dates=implode("','",$this->date_saving);
$dates="'".$dates."'";
$requete.=" and sauv_log_start_date in (".$dates.")";
}
$requete.=" order by sauv_log_start_date desc";
$resultat=pmb_mysql_query($requete);
$sty="class='brd center'";
$sty0="class='brd2 center'";
$sauvegarde_list="
\n";
$sauvegarde_list.="
";
$sauvegarde_list.="
".$msg["sauv_list_th_info_set"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_info_file"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_actions"]."
";
$sauvegarde_list.="
";
$sauvegarde_list.="
";
$sauvegarde_list.="
".$msg["sauv_list_th_filename"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_date"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_final_state"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_user"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_set"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_hour"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_compr"]."
";
$sauvegarde_list.="
".$msg["sauv_list_th_crypt"]."
";
$sauvegarde_list.="
\n";
while ($res=pmb_mysql_fetch_object($resultat)) {
$sauvegarde_list.="
sauv_log_id."\">
";
$sauvegarde_list.="
";
if ($res->sauv_log_succeed==1) {
$infos=$this->read_infos("admin/backup/backups/".$res->sauv_log_file);
if (count($infos)==0) {
$res->sauv_log_succeed=0;
}
}
if ($res->sauv_log_succeed==1) {
$succeed="sauv_succeed.png";
$succeed_message=$msg["sauv_list_succeed"];
} else {
$succeed="sauv_failed.png";
//Recherche du message d'erreur
$tMessages=explode("\n",$res->sauv_log_messages);
$succeed_message="";
for ($i=0; $i
";
$sauvegarde_list.="
".$res->sauv_log_file."
";
$sauvegarde_list.="
".$res->sauv_log_start_date."
";
$sauvegarde_list.="
".$succeed_message."
";
$sauvegarde_list.="
".$res->name."
";
if ($res->sauv_log_succeed==1) {
$sauvegarde_list.="
".$infos["Name"]."
";
$sauvegarde_list.="
".$infos["Start time"]."
";
$sauvegarde_list.="
";
if (isset($infos["Compress"]) && $infos["Compress"]=="1") $sauvegarde_list.="";
else $sauvegarde_list.=" ";
$sauvegarde_list.="
";
$sauvegarde_list.="
";
if (isset($infos["Crypt"]) && $infos["Crypt"]=="1") $sauvegarde_list.="";
else $sauvegarde_list.="";
$sauvegarde_list.="