| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
if (!$_REQUEST['table_foreign'] || !$_REQUEST['row_foreign'] || !$_REQUEST['data_foreign']) {
|
|
|
4 |
die("Fehlende Parameter! Skript kann nicht ausgeführt werden");
|
|
|
5 |
}
|
|
|
6 |
|
|
|
7 |
// dokumente Modul: Ma
|
|
|
8 |
error_reporting(E_ALL & ~E_NOTICE);
|
|
|
9 |
ini_set("register_globals", "On");
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
define ("Range",100);
|
|
|
13 |
define ("modul_name", "Warenwirtschaft");
|
|
|
14 |
define ("tool_name", "bestellung");
|
|
|
15 |
define ("propertie", "dokument");
|
|
|
16 |
|
|
|
17 |
require "../Online-Shop/connect2.php";
|
|
|
18 |
require "includes/splitModProps.function.php";
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
// Global select
|
|
|
22 |
$sql = "SELECT * FROM dokumente";
|
|
|
23 |
$result = mysql_query ($sql) or die (mysql_errno().": ".mysql_error()."<hr>".nl2br($sql)."<hr>");
|
|
|
24 |
|
|
|
25 |
// Propertie Daten
|
|
|
26 |
// $web_rechte_fieldData = explode(";", $web_rechte[modul_name][tool_name][propertie]);
|
|
|
27 |
$web_rechte_fieldData = splitModProps($web_rechte);
|
|
|
28 |
|
|
|
29 |
// Upload Verzeichnis
|
|
|
30 |
$uploadPath = $webs['verzeichnis']."/images/dokumente/";
|
|
|
31 |
// Upload Felder (Einstellen im CMS: Daten;Daten;Felder:4;)
|
|
|
32 |
$numFields = !isset($web_rechte_fieldData['Felder']) ? 1 : $web_rechte_fieldData['Felder'];
|
|
|
33 |
$fileFilter = !isset($web_rechte_fieldData['Filter']) ? "(.jpg|.gif|.png)" : $web_rechte_fieldData['Filter'];
|
|
|
34 |
|
|
|
35 |
// DatenbankFelder
|
|
|
36 |
// table_foreign row_foreign data_foreign document letzte_aenderung_am letzte_aenderung_von
|
|
|
37 |
|
|
|
38 |
if (isset($user_rechte[modul_name][tool_name][propertie]))
|
|
|
39 |
{
|
|
|
40 |
if ($_POST['action']) {
|
|
|
41 |
$error=array();
|
|
|
42 |
foreach (array_keys($_FILES['file']) as $fileId)
|
|
|
43 |
{
|
|
|
44 |
foreach (array_keys($_FILES['file'][$fileId]) AS $number)
|
|
|
45 |
{
|
|
|
46 |
/* Fehler abfangen */
|
|
|
47 |
switch($fileId)
|
|
|
48 |
{
|
|
|
49 |
case 'name':
|
|
|
50 |
if (!ereg($fileFilter,$_FILES['file'][$fileId][$number])){
|
|
|
51 |
$error['name'][$number]="Fehler im Dateinamen!";
|
|
|
52 |
}
|
|
|
53 |
break;
|
|
|
54 |
case 'type':
|
|
|
55 |
/*
|
|
|
56 |
if (!ereg("(image)",$_FILES['file'][$fileId][$number])){
|
|
|
57 |
$error['type'][$number]="Fehler im Dateityp!";
|
|
|
58 |
}
|
|
|
59 |
*/
|
|
|
60 |
break;
|
|
|
61 |
case 'tmp_name':
|
|
|
62 |
//
|
|
|
63 |
break;
|
|
|
64 |
case 'error':
|
|
|
65 |
if ($_FILES['file'][$fileId][$number]==1){
|
|
|
66 |
$error['error'][$number]="Externer Fehler beim upload!";
|
|
|
67 |
}
|
|
|
68 |
break;
|
|
|
69 |
case 'size':
|
|
|
70 |
if ($_FILES['file'][$fileId][$number]>1028000){
|
|
|
71 |
$error['size'][$number]="Datei zu gross fuer den Upload: > ".$_FILES['file'][$fileId][$number];
|
|
|
72 |
}
|
|
|
73 |
break;
|
|
|
74 |
$i++;
|
|
|
75 |
}
|
|
|
76 |
}
|
|
|
77 |
}
|
|
|
78 |
// Upload
|
|
|
79 |
if(sizeof($error[$fileId])==0)
|
|
|
80 |
{
|
|
|
81 |
foreach (array_keys($_FILES['file']['name']) AS $number)
|
|
|
82 |
{
|
|
|
83 |
$file = $_FILES['file']['name'][$number];
|
|
|
84 |
if (is_uploaded_file($_FILES['file']['tmp_name'][$number]))
|
|
|
85 |
{
|
|
|
86 |
// $_REQUEST['table_foreign'] || !$_REQUEST['row_foreign'] || !$_REQUEST['data_foreign']
|
|
|
87 |
// id table_foreign row_foreign data_foreign document letzte_aenderung_am letzte_aenderung_von
|
|
|
88 |
$sql =
|
|
|
89 |
"
|
|
|
90 |
REPLACE INTO dokumente
|
|
|
91 |
(
|
|
|
92 |
table_foreign,
|
|
|
93 |
row_foreign,
|
|
|
94 |
data_foreign,
|
|
|
95 |
document,
|
|
|
96 |
letzte_aenderung_am,
|
|
|
97 |
letzte_aenderung_von
|
|
|
98 |
)
|
|
|
99 |
VALUES
|
|
|
100 |
(
|
|
|
101 |
'".$_REQUEST['table_foreign']."',
|
|
|
102 |
'".$_REQUEST['row_foreign']."',
|
|
|
103 |
'".$_REQUEST['data_foreign']."',
|
|
|
104 |
'".$file."',
|
|
|
105 |
NOW(),
|
|
|
106 |
'".$PHP_AUTH_USER."'
|
|
|
107 |
)
|
|
|
108 |
";
|
|
|
109 |
$result = mysql_query ($sql) or die (mysql_errno().": ".mysql_error()."<hr>".nl2br($sql)."<hr>");
|
|
|
110 |
|
|
|
111 |
if (!$result) {
|
|
|
112 |
$error[] = $sql;
|
|
|
113 |
} else {
|
|
|
114 |
$msg[] = "Der SQL wurde ausgeführt";
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
if (move_uploaded_file($_FILES['file']['tmp_name'][$number], $uploadPath . $file))
|
|
|
118 |
{
|
|
|
119 |
$msg[$number] = "Datei wurde kopiert nach ".$uploadPath . $file."<br>";
|
|
|
120 |
|
|
|
121 |
//copy($_FILES['userfile'], $uploadPath);
|
|
|
122 |
} else {
|
|
|
123 |
//echo "Mögliche Dateiupload-Attacke: Dateiname '$_FILES[userfile]'.";
|
|
|
124 |
$msg[$number] = "Dateiupload-Hack: Dateiname ".$uploadPath . $file."<br>";
|
|
|
125 |
}
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
}
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
if ($_REQUEST['action']=='unlink') {
|
|
|
132 |
// Global select
|
|
|
133 |
$sql =
|
|
|
134 |
"
|
|
|
135 |
|
|
|
136 |
DELETE FROM dokumente WHERE
|
|
|
137 |
table_foreign = '".$_REQUEST['table_foreign']."'
|
|
|
138 |
AND
|
|
|
139 |
row_foreign = '".$_REQUEST['row_foreign']."'
|
|
|
140 |
AND
|
|
|
141 |
data_foreign = '".$_REQUEST['data_foreign']."'
|
|
|
142 |
|
|
|
143 |
";
|
|
|
144 |
|
|
|
145 |
$result = mysql_query ($sql) or die (mysql_errno().": ".mysql_error()."<hr>".nl2br($sql)."<hr>");
|
|
|
146 |
|
|
|
147 |
if ($result) {
|
|
|
148 |
$unlink=true;
|
|
|
149 |
$msg[] = "Datei wurde gelöscht";
|
|
|
150 |
}
|
|
|
151 |
}
|
|
|
152 |
?>
|
|
|
153 |
|
|
|
154 |
<html>
|
|
|
155 |
<head>
|
|
|
156 |
<title>Content-Management-System - Webagentur Niewerth</title>
|
|
|
157 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
158 |
<meta name="description" content="Redaktionssystem">
|
|
|
159 |
<meta name="author" content="Webagentur Niewerth">
|
|
|
160 |
<meta name="robots" content="noindex">
|
|
|
161 |
|
|
|
162 |
<link rel=stylesheet type="text/css" href="/styles/styles.php">
|
|
|
163 |
<style type="text/css">
|
|
|
164 |
<!--
|
|
|
165 |
/* Anpassung Markus Niewerth */
|
|
|
166 |
/* Druckbarer Bereich */
|
|
|
167 |
@media print {
|
|
|
168 |
#noprint { display:none; }
|
|
|
169 |
.lightgray {color: #000000; background-color: #EEEEEE; text-decoration:underline}
|
|
|
170 |
.darkgray {color: #000000; background-color: #CCCCCC; text-decoration:underline}
|
|
|
171 |
.status_off {color: #000000; text-decoration : none ; }
|
|
|
172 |
.status_red {color: #FFFFFF; background-color: #FF0000; text-decoration:underline}
|
|
|
173 |
.status_yellow {color: #000000; background-color: #FFFF00; text-decoration:underline}
|
|
|
174 |
.status_blue {color: #FFFFFF; background-color: #0000FF; text-decoration:underline}
|
|
|
175 |
.status_green {color: #000000; background-color: #00FF00; text-decoration:underline}
|
|
|
176 |
.status_white {color: #000000; background-color: #FFFFFF; text-decoration:underline}
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
/* Sichtbarer Bereich */
|
|
|
180 |
@media screen {
|
|
|
181 |
.lightgray {color: #000000; background-color: #EEEEEE; text-decoration:none}
|
|
|
182 |
.darkgray {color: #000000; background-color: #CCCCCC; text-decoration:none}
|
|
|
183 |
.status_off {color: #000000; text-decoration : none ; }
|
|
|
184 |
.status_red {color: #FFFFFF; background-color: #FF0000; text-decoration:none}
|
|
|
185 |
.status_yellow {color: #000000; background-color: #FFFF00; text-decoration:none}
|
|
|
186 |
.status_blue {color: #FFFFFF; background-color: #0000FF; text-decoration:none}
|
|
|
187 |
.status_green {color: #000000; background-color: #00FF00; text-decoration:none}
|
|
|
188 |
.status_white {color: #000000; background-color: #FFFFFF; text-decoration:none}
|
|
|
189 |
}
|
|
|
190 |
-->
|
|
|
191 |
</style>
|
|
|
192 |
|
|
|
193 |
<script>
|
|
|
194 |
function openerReturn()
|
|
|
195 |
{
|
|
|
196 |
opener.formname.action = "bestellungen.php?update[current]";
|
|
|
197 |
opener.formname.submit();
|
|
|
198 |
self.close();
|
|
|
199 |
}
|
|
|
200 |
<?php
|
|
|
201 |
if((!sizeof($error) && $_POST['action']) || $unlink)
|
|
|
202 |
echo "openerReturn();"
|
|
|
203 |
?>
|
|
|
204 |
</script>
|
|
|
205 |
<body bgcolor="#FFFFFF" leftmargin="20" topmargin="10" marginwidth="20" marginheight="10" text="#000096">
|
|
|
206 |
<form method="post" action="#" name="formname" enctype="multipart/form-data">
|
|
|
207 |
<?php
|
|
|
208 |
if ($_GET['action']=="edit" || empty($_GET['action']))
|
|
|
209 |
{
|
|
|
210 |
?>
|
|
|
211 |
<table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
|
|
|
212 |
<?php
|
|
|
213 |
for($i=0;$i<$numFields;$i++) {
|
|
|
214 |
?>
|
|
|
215 |
<tr>
|
|
|
216 |
<td width="13%" valign="top" class="links">Datei</td>
|
|
|
217 |
<td class="rechts">
|
|
|
218 |
<input type="file" name="file[]" id="file[]">
|
|
|
219 |
</td>
|
|
|
220 |
</tr>
|
|
|
221 |
<?php
|
|
|
222 |
}
|
|
|
223 |
?>
|
|
|
224 |
<tr>
|
|
|
225 |
<td align="right" colspan="2" class="links">
|
|
|
226 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
227 |
<tr>
|
|
|
228 |
<td width="13%" class="links"> </td>
|
|
|
229 |
<td width="87%" align="right" class="rechts">
|
|
|
230 |
<!-- table_foreign row_foreign data_foreign document letzte_aenderung_am letzte_aenderung_von -->
|
|
|
231 |
<input name="id" type="hidden" id="id" value="<?php echo $zeile['id'] ?>">
|
|
|
232 |
<input name="table_foreign" type="hidden" id="table_foreign" value="<?php echo $_GET['table_foreign'] ?>">
|
|
|
233 |
<input name="row_foreign" type="hidden" id="row_foreign" value="<?php echo $_GET['row_foreign'] ?>">
|
|
|
234 |
<input name="data_foreign" type="hidden" id="data_foreign" value="<?php echo $_GET['data_foreign'] ?>">
|
|
|
235 |
<input type="hidden" name="action" value="update">
|
|
|
236 |
<input type="submit" value="OK">
|
|
|
237 |
<input type="reset" name="Button" value="Zurücksetzen">
|
|
|
238 |
</td>
|
|
|
239 |
</tr>
|
|
|
240 |
</table>
|
|
|
241 |
</td>
|
|
|
242 |
</tr>
|
|
|
243 |
</table>
|
|
|
244 |
<?php
|
|
|
245 |
echo is_array($error) ? nl2br(returnMessage($error)) : "";
|
|
|
246 |
echo is_array($msg) ? nl2br(returnMessage($msg)) : "";
|
|
|
247 |
}//_POST['action']
|
|
|
248 |
}else{
|
|
|
249 |
echo "Zugriff verweigert!";
|
|
|
250 |
}
|
|
|
251 |
?>
|
|
|
252 |
</form>
|
|
|
253 |
</body>
|