' . $lang['L_LOGFILENOTWRITABLE'] . ' (' . $logfile . ')
'; - } - } else { - $fp = @fopen($logfile, "ab"); - if ($fp) { - @fwrite($fp, $log); - @fclose($fp); - } else { - echo '' . $lang['L_LOGFILENOTWRITABLE'] . ' (' . $logfile . ')
'; - } - } + $fp=@gzopen($logfile,'a'); + if ($fp) + { + @gzwrite($fp,$log).''.$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) +function ErrorLog($dest, $db, $sql, $error, $art=1) { - //$art=0 -> Fehlermeldung - //$art=1 -> Hinweis + //$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 . '`|:|'; + 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 ($art==0) + { + $errormsg.='Error-Message: '.$error.'|:|'; + } + else + { + $errormsg.='Notice: '.$error.'|:|'; + } - if ($sql > '') { - $errormsg .= 'SQL: ' . $sql . "\n"; - } + 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); - } - } + //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 = "") +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'); - } + 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; + if ($warn!='') $warn=''.$warn.''; + return $warn; } function TestWorkDir() { - global $config; + 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']); - } + $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; + 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) +function SetFileRechte($file, $is_dir=1, $perm=0777) { - global $lang; - $ret = true; - if ($is_dir == 1) { - if (substr($file, -1) != "/") { - $file .= "/"; - } - } - clearstatcache(); + 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); - } - } - } + // 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; + // 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 (is_string($index)) { - // name given - $dbNames = array_flip($databases['Name']); - if (array_key_exists($index, $dbNames)) { - $index = $dbNames[$index]; - } - } - 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'] = ''; - } + global $databases; + if (is_string($index)) { + // name given + $dbNames = array_flip($databases['Name']); + if (array_key_exists($index, $dbNames)) { + $index = $dbNames[$index]; + } + } + 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(); - @mysqli_query($GLOBALS["___mysqli_ston"], 'SET FOREIGN_KEY_CHECKS=0'); - $res = mysqli_query($config['dbconnection'], 'SHOW TABLE STATUS FROM `' . $dbn . '`') or die('EmptyDB: ' - . ((is_object($GLOBALS["___mysqli_ston"])) - ? mysqli_error($GLOBALS["___mysqli_ston"]) - : (($___mysqli_res - = mysqli_connect_error()) ? $___mysqli_res : false))); - WHILE ($row = mysqli_fetch_array($res, MYSQLI_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 < count($t_sql); $i++) { - $res = mysqli_query($GLOBALS["___mysqli_ston"], $t_sql[$i]) or die('EmptyDB-Error: ' . ((is_object( - $GLOBALS["___mysqli_ston"] - )) ? mysqli_error($GLOBALS["___mysqli_ston"]) - : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); - } - } - @mysqli_query($GLOBALS["___mysqli_ston"], 'SET FOREIGN_KEY_CHECKS=1'); + 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 .= '
'.$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 ""; + $tmp=explode(",",$s); + //echo "
";print_r($tmp);echo ""; - for ($i = 0; $i < count($tmp); $i++) { - $t = strtolower($tmp[$i]); + for ($i=0; $i
| " . $str->name . " | \n"; @@ -369,7 +369,7 @@ function ExportHTML() $res=MSD_query($dsql); if ($res) { - $anz=mysqli_num_rows($res); + $anz=mysql_num_rows($res); $content.="
|---|