'.$lang['L_LOGFILENOTWRITABLE'].' ('.$logfile.')
'; } else { $fp=@fopen($logfile,"ab"); if ($fp) { @fwrite($fp,$log); @fclose($fp); } else echo ''.$lang['L_LOGFILENOTWRITABLE'].' ('.$logfile.')
'; } } function ErrorLog($dest, $db, $sql, $error, $art=1) { //$art=0 -> Fehlermeldung //$art=1 -> Hinweis global $config; if (strlen($sql)>100) $sql=substr($sql,0,100)." ... (snip)"; //Error-Zeile generieren $errormsg=date('d.m.Y H:i:s').': '; $errormsg.=($dest=='RESTORE') ? ' Restore of db `'.$db.'`|:|' : ' Dump of db `'.$db.'`|:|'; if ($art==0) { $errormsg.='Error-Message: '.$error.'|:|'; } else { $errormsg.='Notice: '.$error.'|:|'; } if ($sql>'') $errormsg.='SQL: '.$sql."\n"; //Datei öffnen und schreiben if ($config['logcompression']==1) { $fp=@gzopen($config['paths']['log'].'error.log.gz','ab'); if ($fp) { @gzwrite($fp,($errormsg)); @gzclose($fp); } } else { $fp=@fopen($config['paths']['log'].'error.log','ab'); if ($fp) { @fwrite($fp,($errormsg)); @fclose($fp); } } } function DirectoryWarnings($path="") { global $config,$lang; $warn=''; if (!is_writable($config['paths']['work'])) $warn.=sprintf($lang['L_WRONG_RIGHTS'],$config['paths']['work'],'0777'); if (!is_writable($config['paths']['config'])) $warn.=sprintf($lang['L_WRONG_RIGHTS'],$config['paths']['config'],'0777'); if (!is_writable($config['paths']['backup'])) $warn.=sprintf($lang['L_WRONG_RIGHTS'],$config['paths']['backup'],'0777'); if (!is_writable($config['paths']['log'])) $warn.=sprintf($lang['L_WRONG_RIGHTS'],$config['paths']['log'],'0777'); if ($warn!='') $warn=''.$warn.''; return $warn; } function TestWorkDir() { global $config; $ret=SetFileRechte($config['paths']['work']); if ($ret===true) $ret=SetFileRechte($config['paths']['backup']); if ($ret===true) $ret=SetFileRechte($config['paths']['log']); if ($ret===true) $ret=SetFileRechte($config['paths']['config']); if ($ret===true) { if (!file_exists($config['files']['parameter'])) SetDefault(true); if (!file_exists($config['files']['log'])) DeleteLog(); } return $ret; } function SetFileRechte($file, $is_dir=1, $perm=0777) { global $lang; $ret=true; if ($is_dir==1) { if (substr($file,-1)!="/") $file.="/"; } clearstatcache(); // erst pruefen, ob Datei oder Verzeichnis existiert if (!file_exists($file)) { // Wenn es sich um ein Verzeichnis handelt -> anlegen if ($is_dir==1) { $ret=@mkdir($file,$perm); if (!$ret===true) { // Hat nicht geklappt -> Rueckmeldung $ret=sprintf($lang['L_CANT_CREATE_DIR'],$file); } } } // wenn bisher alles ok ist -> Rechte setzen - egal ob Datei oder Verzeichnis if ($ret===true) { $ret=@chmod($file,$perm); if (!$ret===true) $ret=sprintf($lang['L_WRONG_RIGHTS'],$file,decoct($perm)); } return $ret; } function SelectDB($index) { global $databases; if (isset($databases['Name'][$index])) { $databases['db_actual']=$databases['Name'][$index]; if (isset($databases['praefix'][$index])) $databases['praefix'][$databases['db_selected_index']]=$databases['praefix'][$index]; else $databases['praefix'][$databases['db_selected_index']]=''; if (isset($databases['db_selected_index'])) $databases['db_selected_index']=$index; else $databases['db_selected_index']=0; } else { // keine DB vorhanden $databases['praefix'][$databases['db_selected_index']]=''; $databases['db_selected_index']=0; $databases['db_actual']=''; } } function EmptyDB($dbn) { global $config; $t_sql=array(); @mysql_query('SET FOREIGN_KEY_CHECKS=0'); $res=mysql_query('SHOW TABLE STATUS FROM `'.$dbn.'`',$config['dbconnection']) or die('EmptyDB: '.mysql_error()); WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) { if (substr(strtoupper($row['Comment']),0,4)=='VIEW') { $t_sql[]='DROP VIEW `'.$dbn.'``'.$row['Name'].'`'; } else { $t_sql[]='DROP TABLE `'.$dbn.'`.`'.$row['Name'].'`'; } } if (sizeof($t_sql)>0) { for ($i=0; $i'.$lang['L_FM_AUTODEL1'].'
';
$r.=$delfile[3]."
";
$part=$delfile[2];
if ($part>0)
{
for ($i=$part; $i>0; $i--)
{
$delete=@unlink($config['paths']['backup'].$delfile[3]);
if ($delete) WriteLog("autodeleted ($function) '$delfile[3]'.");
}
}
else
{
WriteLog("autodeleted ($function) '$delfile[3]'.");
unlink($config['paths']['backup'].$delfile[3]);
}
$r.='
";print_r($tmp);echo ""; for ($i=0; $i