Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?
        require_once "connect2.php";

        function get_images($db_data)
        {
                $db_data=explode(".",$db_data);
                $buffer=array();
                $result = mysql_query ("select ".$db_data[1]." from ".$db_data[0]." where ".$db_data[1]." != ''");
                while ($zeile=mysql_fetch_array($result)) {$buffer[]=$zeile[0];}
                return $buffer;
        }

        function get_files($path)
        {
                global $webs;
                $buffer=array();
                $handle=opendir($webs[verzeichnis].$path);
                while (false !== ($file = readdir ($handle)))
                {
                        if 
                        (
                                ($file != ".")
                                && 
                                ($file != "..")
                                &&
                                (is_file($webs[verzeichnis].$path."/".$file))
                        )
                        {
                                $buffer[$file]=filesize($webs[verzeichnis].$path."/".$file);
                        }
                }
                closedir($handle); 
                return $buffer;
        }

        $combos=array
        (
                array
                (
                        "artikel.bild_1_url",
                        "/images/Bild_1",
                        array("keinbild.gif")
                ),
                array
                (
                        "artikel.bild_2_url",
                        "/images/Bild_2"
                )
                ,
                array
                (
                        "artikel.bild_3_url",
                        "/images/Bild_3"
                ),
                array
                (
                        "artikel.bild_4_url",
                        "/images/Bild_4"
                ),
                array
                (
                        "directory.bild_url",
                        "/images/directory/1"
                ),
                array
                (
                        "directory.bild_url2",
                        "/images/directory/2"
                )
        );
?>
<html>
<head>
<title>Filechecker</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
td {  font-family: Arial, Helvetica, sans-serif; font-size: 10px}
li {  font-family: Arial, Helvetica, sans-serif; font-size: 12px}
a {  color: #0000FF; text-decoration: none}
-->
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<a name="0"></a>
<ol>
<?
        $anker=0;
        foreach ($combos as $combo)
        {
                ?><li><a href="#<? echo ++$anker ?>"><? echo $combo[0]." : ".$combo[1]; ?></a></li><?
        }
?>
</ol>
<table width="100%" border="0" cellspacing="5" cellpadding="0" bgcolor="#DDDDDD">
  <?
        $anker=0;
        foreach ($combos as $combo)
        {
                $trashdir=$webs[verzeichnis].$combo[1]."/trash";

                if (!is_dir($trashdir))
                {
                        mkdir($trashdir, 0755);
                }

                unset($fs_files);
                unset($db_files);
                $db_files=get_images($combo[0]);
                $fs_files=get_files($combo[1]);
                if ($combo[2])
                {
                        $db_files=array_merge($db_files, $combo[2]);
                }
?>
  <tr> 
    <td align="center" width="50%" colspan="2" bgcolor="#FFFFFF"><a name="<? echo ++$anker;?>"></a> 
      Dateien die in <b> 
      <? echo $combo[1]; ?>
      </b> gefunden wurden, die aber nicht in <b> 
      <? echo $combo[0]; ?>
      </b> eingetragen sind. </td>
    <td align="center" width="50%" colspan="2" bgcolor="#FFFFFF">Dateien die in 
      <b> 
      <? echo $combo[0]; ?>
      </b> eingetragen sind, die aber nicht in <b> 
      <? echo $combo[1]; ?>
      </b> gefunden werden konnten. </td>
  </tr>
  <tr> 
    <td align="center" valign="top"><a href="#<? echo $anker-1;?>">&#x25B2;</a>
      <hr noshade>
      <a href="#<? echo $anker+1;?>">&#x25BC;</a></td>
    <td valign="top" width="50%"> 
      <table width="100%" border="0" cellspacing="2" cellpadding="0" bgcolor="#FFFFFF">
        <?
                        foreach (array_diff(array_keys($fs_files),$db_files) as $elem)
                        {
                                rename ($webs[verzeichnis].$combo[1]."/".$elem, $trashdir."/".$elem);
                                continue;
                ?>
        <tr> 
          <td> 
            &nbsp;<a href="http://www.<? echo $webs[domain] ?>/<? echo $combo[1]; ?>/<? echo $elem ?>" target="_blank"><? echo $elem ?></a>
          </td>
          <td> 
            <? echo $fs_files[$elem] ?> Bytes
          </td>
        </tr>
        <? } ?>
      </table>
    </td>
    <td valign="top" width="50%" bgcolor="#FFFFFF">&nbsp; 
      <? echo implode(array_diff($db_files,array_keys($fs_files)),"<br>&nbsp;&nbsp;"); ?>
    </td>
    <td>&nbsp;</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td colspan="4">&nbsp;</td>
  </tr>
  <?
        }
?>
</table>
</body>
</html>