'.$lang['logfilenotwritable'].' ('.$logfile.')
'; } else { $fp = @fopen($logfile, "ab"); if($fp) { @fwrite ($fp,$log); @fclose ($fp); } else echo ''.$lang['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.'|:|'; } $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['wrong_rights'],$config['paths']['work'],'0777'); if(!is_writable($config['paths']['config'])) $warn.=sprintf($lang['wrong_rights'],$config['paths']['config'],'0777'); if(!is_writable($config['paths']['backup'])) $warn.=sprintf($lang['wrong_rights'],$config['paths']['backup'],'0777'); if(!is_writable($config['paths']['structure'])) $warn.=sprintf($lang['wrong_rights'],$config['paths']['structure'],'0777'); if(!is_writable($config['paths']['log'])) $warn.=sprintf($lang['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']['structure']); 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['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['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; //$res=mysql_query("DROP DATABASE `$dbn`") or die(mysql_error().""); //$res=mysql_query("CREATE DATABASE `$dbn`") or die(mysql_error().""); $t_sql=Array(); $tabellen = mysql_list_tables($dbn,$config['dbconnection']); $num_tables = mysql_num_rows($tabellen); for($i=0;$i<$num_tables;$i++) { $t=mysql_tablename($tabellen,$i); $t_sql[]="DROP TABLE `$t`;"; } for($i=0;$i".$ll."
";
$r.= $delfile[3]."
";
WriteLog("autodeleted ($function) '$delfile[3]'.");
unlink($config['paths']['backup'].$delfile[3]);
$r.= "
";print_r($tmp);echo ""; for($i=0;$i