Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?
2
	require_once "connect2.php";
3
 
4
	function get_images($db_data)
5
	{
6
		$db_data=explode(".",$db_data);
7
		$buffer=array();
8
		$result = mysql_query ("select ".$db_data[1]." from ".$db_data[0]." where ".$db_data[1]." != ''");
9
		while ($zeile=mysql_fetch_array($result)) {$buffer[]=$zeile[0];}
10
		return $buffer;
11
	}
12
 
13
	function get_files($path)
14
	{
15
		global $webs;
16
		$buffer=array();
17
		$handle=opendir($webs[verzeichnis].$path);
18
		while (false !== ($file = readdir ($handle)))
19
		{
20
			if
21
			(
22
				($file != ".")
23
				&&
24
				($file != "..")
25
				&&
26
				(is_file($webs[verzeichnis].$path."/".$file))
27
			)
28
			{
29
				$buffer[$file]=filesize($webs[verzeichnis].$path."/".$file);
30
			}
31
		}
32
		closedir($handle);
33
		return $buffer;
34
	}
35
 
36
	$combos=array
37
	(
38
		array
39
		(
40
			"artikel.bild_1_url",
41
			"/images/Bild_1",
42
			array("keinbild.gif")
43
		),
44
		array
45
		(
46
			"artikel.bild_2_url",
47
			"/images/Bild_2"
48
		)
49
		,
50
		array
51
		(
52
			"artikel.bild_3_url",
53
			"/images/Bild_3"
54
		),
55
		array
56
		(
57
			"artikel.bild_4_url",
58
			"/images/Bild_4"
59
		),
60
		array
61
		(
62
			"directory.bild_url",
63
			"/images/directory/1"
64
		),
65
		array
66
		(
67
			"directory.bild_url2",
68
			"/images/directory/2"
69
		)
70
	);
71
?>
72
<html>
73
<head>
74
<title>Filechecker</title>
75
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
76
<style type="text/css">
77
<!--
78
td {  font-family: Arial, Helvetica, sans-serif; font-size: 10px}
79
li {  font-family: Arial, Helvetica, sans-serif; font-size: 12px}
80
a {  color: #0000FF; text-decoration: none}
81
-->
82
</style>
83
</head>
84
 
85
<body bgcolor="#FFFFFF" text="#000000">
86
<a name="0"></a>
87
<ol>
88
<?
89
	$anker=0;
90
	foreach ($combos as $combo)
91
	{
92
		?><li><a href="#<? echo ++$anker ?>"><? echo $combo[0]." : ".$combo[1]; ?></a></li><?
93
	}
94
?>
95
</ol>
96
<table width="100%" border="0" cellspacing="5" cellpadding="0" bgcolor="#DDDDDD">
97
  <?
98
	$anker=0;
99
	foreach ($combos as $combo)
100
	{
101
		$trashdir=$webs[verzeichnis].$combo[1]."/trash";
102
 
103
		if (!is_dir($trashdir))
104
		{
105
			mkdir($trashdir, 0755);
106
		}
107
 
108
		unset($fs_files);
109
		unset($db_files);
110
		$db_files=get_images($combo[0]);
111
		$fs_files=get_files($combo[1]);
112
		if ($combo[2])
113
		{
114
			$db_files=array_merge($db_files, $combo[2]);
115
		}
116
?>
117
  <tr>
118
    <td align="center" width="50%" colspan="2" bgcolor="#FFFFFF"><a name="<? echo ++$anker;?>"></a>
119
      Dateien die in <b>
120
      <? echo $combo[1]; ?>
121
      </b> gefunden wurden, die aber nicht in <b>
122
      <? echo $combo[0]; ?>
123
      </b> eingetragen sind. </td>
124
    <td align="center" width="50%" colspan="2" bgcolor="#FFFFFF">Dateien die in
125
      <b>
126
      <? echo $combo[0]; ?>
127
      </b> eingetragen sind, die aber nicht in <b>
128
      <? echo $combo[1]; ?>
129
      </b> gefunden werden konnten. </td>
130
  </tr>
131
  <tr>
132
    <td align="center" valign="top"><a href="#<? echo $anker-1;?>">&#x25B2;</a>
133
      <hr noshade>
134
      <a href="#<? echo $anker+1;?>">&#x25BC;</a></td>
135
    <td valign="top" width="50%">
136
      <table width="100%" border="0" cellspacing="2" cellpadding="0" bgcolor="#FFFFFF">
137
        <?
138
			foreach (array_diff(array_keys($fs_files),$db_files) as $elem)
139
			{
140
				rename ($webs[verzeichnis].$combo[1]."/".$elem, $trashdir."/".$elem);
141
				continue;
142
		?>
143
        <tr>
144
          <td>
145
            &nbsp;<a href="http://www.<? echo $webs[domain] ?>/<? echo $combo[1]; ?>/<? echo $elem ?>" target="_blank"><? echo $elem ?></a>
146
          </td>
147
          <td>
148
            <? echo $fs_files[$elem] ?> Bytes
149
          </td>
150
        </tr>
151
        <? } ?>
152
      </table>
153
    </td>
154
    <td valign="top" width="50%" bgcolor="#FFFFFF">&nbsp;
155
      <? echo implode(array_diff($db_files,array_keys($fs_files)),"<br>&nbsp;&nbsp;"); ?>
156
    </td>
157
    <td>&nbsp;</td>
158
  </tr>
159
  <tr bgcolor="#FFFFFF">
160
    <td colspan="4">&nbsp;</td>
161
  </tr>
162
  <?
163
	}
164
?>
165
</table>
166
</body>
167
</html>