Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?
2
	$self=basename($PHP_SELF);
3
	$tab="WarenTesterLogos";
4
	define ("modul_name", "online_shop");
5
	define ("tool_name", "tester");
6
	require_once "../Online-Shop/connect2.php";
7
 
8
	if ($action=="update")
9
	{
10
		if (!$ID)
11
		{	// insert Dummy-Entry
12
			$query = "insert into $tab (erstellt_am,erstellt_von) VALUES (NOW(),'$PHP_AUTH_USER')";
13
			$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>".$query."<hr>");
14
			$ID=mysql_insert_id();
15
		}
16
 
17
		unset($HTTP_POST_VARS[action]);
18
		unset($HTTP_POST_VARS[ID]);
19
 
20
		foreach(array_keys($HTTP_POST_VARS) as $elem)
21
		{
22
			if ($elem[0] == "_")
23
			{
24
				unset($HTTP_POST_VARS[$elem]);
25
				$button=$$elem;
26
				$elem=substr($elem,1);
27
				$Pfad=$HTTP_POST_VARS[$elem."_Pfad"];
28
				unset($HTTP_POST_VARS[$elem."_Pfad"]);
29
				$image=$$elem;
30
				$image_name=$elem."_name";
31
				$image_name=urlencode($$image_name);
32
				switch ($button)
33
				{
34
					case 0:
35
						break;
36
					case 1:
37
						$HTTP_POST_VARS[$elem]='';
38
	   					break;
39
	   				case 2:
40
						//$image_name=$ID."_".$image_name;
41
						$image_name=$ID.strrchr($image_name,".");
42
						$HTTP_POST_VARS[$elem]=$image_name;
43
 
44
						/* ------------------------------------------------------------------------------------------ */
45
						// $Imagenummer extrahieren
46
						$DatenID = $elem;
47
						$Imagedaten = explode(";", $web_rechte[modul_name][tool_name][$DatenID]);
48
						/*
49
							Imagedaten möglich Werte:
50
								0: Titel des Feldes
51
								1: max. Breite für Bild1
52
								2: max. Höhe für Bild1
53
 
54
								3: Pfad für mittleres Bild1
55
								4: max. Breite für mittleres Bild1
56
								5: max. Höhe für mittleres Bild1
57
 
58
								6: Pfad für kleines Bild1
59
								7: max. Breite für kleines Bild1
60
								8: max. Höhe für kleines Bild1
61
						*/
62
 
63
						// Höhe und Breite des Bildes bestimmen
64
						$imgsize = GetImageSize ($image);
65
						// $imgsize[0] $imgsize[1]
66
 
67
						// ---- Hier wird abgefragt ob das grosse Bild angepasst werden soll ---- //
68
						$resize=false;
69
						if (count($Imagedaten) > 1) {$resize = true;}
70
						if (($imgsize[0] < $Imagedaten[1]) and ($imgsize[1] < $Imagedaten[2])) {$resize = false;}
71
 
72
						if ($resize==true)
73
						{
74
							exec("convert -scale ".$Imagedaten[1]."x".$Imagedaten[2]." ".$image." ".$Pfad.$image_name);
75
						}
76
						else
77
						{
78
							copy($image,$Pfad.$image_name);
79
						}
80
						/* ------------------------------------------------------------------------------------------ */
81
 
82
				        break;
83
				    default:
84
				        break;
85
			    }
86
			}
87
		}
88
		$names=array();
89
		foreach(array_keys($HTTP_POST_VARS) as $elem)
90
		{
91
			array_push($names,"$elem='$HTTP_POST_VARS[$elem]'");
92
		}
93
		$query="update $tab set ".join($names,', ');
94
		$query=$query.", letzte_Aenderung_am=NOW(), letzte_Aenderung_von='$PHP_AUTH_USER' where ID = '$ID'";
95
		$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
96
		header("Location: ".$self);
97
	}
98
 
99
	if ($action=="delete")
100
	{
101
		if ($ID)
102
		{
103
			$condition=array();
104
			foreach ($ID as $elem)
105
			{
106
				array_push($condition," ID = '$elem'");
107
			}
108
			$cond=join(" or ",$condition);
109
			$query = "DELETE FROM $tab WHERE $cond";
110
			$result = mysql_query ("$query") or die (mysql_errno().": ".mysql_error());
111
			header("Location: ".$self);
112
		}
113
	}
114
	if (!$action)
115
	{
116
		$action="select_edit";
117
	}
118
	if (!$sort) {$sort='Name';}
119
?>
120
<html>
121
<head>
122
<title>Vorlage: Redaktionssystem</title>
123
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
124
<link rel=stylesheet type="text/css" href="../buttons.css">
125
<script language="javascript" src="../checkDate.js"></script>
126
<script language="JavaScript">
127
<!--
128
function MM_swapImgRestore() { //v3.0
129
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
130
}
131
 
132
function MM_preloadImages() { //v3.0
133
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
134
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
135
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
136
}
137
 
138
function MM_findObj(n, d) { //v4.01
139
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
140
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
141
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
142
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
143
  if(!x && d.getElementById) x=d.getElementById(n); return x;
144
}
145
 
146
function MM_swapImage() { //v3.0
147
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
148
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
149
}
150
//-->
151
</script>
152
<script language="JavaScript" src="../checkDate.js"></script>
153
<meta name="description" content="Redaktionssystem">
154
<meta name="author" content="Webagentur Niewerth">
155
<meta name="robots" content="noindex">
156
<style type="text/css">
157
<!--
158
a {  color: #<? echo $webs[font_color_rechts] ?>}
159
-->
160
</style>
161
</head>
162
<body bgcolor="#<? echo $webs[bgcolor_seite]; ?>" leftmargin="20" topmargin="10" marginwidth="20" marginheight="10" onLoad="MM_preloadImages('../images/navigation/bt_neu_f2.gif','../images/navigation/bt_delete_f2.gif','../images/navigation/bt_bearbeiten_f2.gif')" text="#<? echo $webs[font_color_seite]; ?>">
163
<form method="post" action="<? echo $PHP_SELF ?>" name="formname" enctype="multipart/form-data">
164
  <table width="662" border="0" cellspacing="0" cellpadding="0">
165
    <tr valign="top">
166
      <td width="585">
167
        <!--  Auswahl Löschen START  -->
168
        <?
169
	if ($action=="delete")
170
	{
171
		$query="SELECT * FROM $tab ";
172
		$query=$query."order by $sort";
173
		$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
174
		if (mysql_num_rows($result) == 0)
175
		{
176
?>
177
        <p class="error"><font color="#<? echo $webs[font_color_seite] ?>">Es
178
          sind keine Daten eingetragen !</font></p>
179
        <p></p>
180
        <?
181
		}
182
		else
183
		{
184
?>
185
        <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
186
          <tr>
187
            <td colspan="2" class="headline" bgcolor="#<? echo $webs[bgcolor_links] ?>"><font color="#<? echo $webs[font_color_links] ?>">Tester</font><font color="#<? echo $webs[font_color_links] ?>">:
188
              L&ouml;schen</font></td>
189
          </tr>
190
          <?
191
	while ($zeile=mysql_fetch_array($result))
192
	{
193
?>
194
          <tr>
195
            <td bgcolor="#<? echo $webs[bgcolor_rechts] ?>"><a href="<? echo $self?>?action=edit&ID=<? echo $zeile[ID]; ?>">
196
              <? echo $zeile[Name]?>
197
              </a> </td>
198
            <td width="5%" align="center" bgcolor="#<? echo $webs[bgcolor_rechts] ?>">
199
              <input type="checkbox" name="ID[]" value="<?  echo $zeile[ID] ?>">
200
            </td>
201
          </tr>
202
          <?
203
	}
204
?>
205
          <tr>
206
            <td colspan="2" align="right" bgcolor="#<? echo $webs[bgcolor_links] ?>">
207
              <a href="<? echo $self?>?action=edit&ID=<? echo $zeile[ID]; ?>">
208
              <? echo $zeile[Vorname]?>
209
              </a>
210
              <input type="hidden" name="action" value='delete'>
211
              <input type="submit" value="LÖSCHEN">
212
              <input type="reset" value="Zur&uuml;cksetzen">
213
            </td>
214
          </tr>
215
        </table>
216
        <?
217
		}
218
?>
219
        <?
220
 	}
221
?>
222
        <!--  Auswahl Löschen ENDE  -->
223
        <!--  Auswahl SELECT_EDIT START  -->
224
        <?
225
 
226
  if ($action=="select_edit")
227
	{
228
	$query="SELECT * FROM $tab ";
229
	$query=$query."order by $sort";
230
 
231
	$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
232
	if (mysql_num_rows($result) == 0)
233
	{
234
	?>
235
        <p class="error"><font color="#<? echo $webs[font_color_seite] ?>">Es
236
          sind keine Daten eingetragen !</font></p>
237
        <p></p>
238
        <?
239
	}
240
	else
241
	{
242
	?>
243
        <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
244
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>">
245
            <td class="headline" bgcolor="#<? echo $webs[bgcolor_links] ?>"><font color="#<? echo $webs[font_color_links] ?>">Tester:
246
              Bearbeiten</font></td>
247
          </tr>
248
          <!--          <tr>
249
            <td colspan="2"><a href="<? echo $self ?>?action=select_edit&sort=name">Name</a>,
250
              <a href="<? echo $self ?>?action=select_edit&sort=plz">PLZ</a>
251
              <a href="<? echo $self ?>?action=select_edit&sort=ort">Ort</a></td>
252
          </tr>-->
253
          <?
254
	while ($zeile=mysql_fetch_array($result))
255
	{
256
?>
257
          <tr>
258
            <td bgcolor="#<? echo $webs[bgcolor_rechts] ?>"><a href="<? echo $self?>?action=edit&ID=<? echo $zeile[ID]; ?>">
259
              <? echo $zeile[Name] ?>
260
              </a><font color="#<? echo $webs[font_color_rechts] ?>"> </font></td>
261
            <? if (isset($user_rechte[modul_name][tool_name][kategorie]))
262
			  {?>
263
            <?
264
			  }
265
			  ?>
266
          </tr>
267
          <?
268
	}
269
?>
270
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>">
271
            <td>
272
              <div align="right">&nbsp; </div>
273
            </td>
274
          </tr>
275
        </table>
276
        <?
277
	}
278
?>
279
        <?
280
 	}
281
?>
282
        <!--  Auswahl SELECT_EDIT ENDE  -->
283
        <?
284
	if ($action=="edit")
285
	{
286
		if ($ID)
287
		{
288
			$result = mysql_query ("SELECT * FROM $tab where ID = '$ID'") or die (mysql_errno().": ".mysql_error());
289
			$zeile=mysql_fetch_array($result);
290
		}
291
	$zeile[gueltig_von]=date2human($zeile[gueltig_von]);
292
	$zeile[gueltig_bis]=date2human($zeile[gueltig_bis]);
293
	?>
294
        <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
295
          <tr>
296
            <td colspan="2" class="headline" bgcolor="#<? echo $webs[bgcolor_links] ?>"><font color="#<? echo $webs[font_color_links] ?>">Tester</font><font color="#<? echo $webs[font_color_links] ?>">:
297
              <?
298
					if ($ID)
299
					{
300
					 ?>
301
              Bearbeiten
302
              <?
303
					}
304
					else
305
					{
306
					 ?>
307
              Neueintrag
308
              <?
309
					}
310
				?>
311
              </font> </td>
312
          </tr>
313
          <?
314
	$Feld="Name";
315
	if (isset($user_rechte[modul_name][tool_name][$Feld]))
316
	{
317
?>
318
          <tr>
319
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" width="20%"><font color="#<? echo $webs[font_color_links] ?>"><b>
320
              <?
321
				if ($web_rechte[modul_name][tool_name][$Feld])
322
				{
323
					echo $web_rechte[modul_name][tool_name][$Feld];
324
				}
325
				else
326
				{
327
			  ?>
328
              Name:
329
              <?
330
				}
331
			  ?>
332
              </b></font></td>
333
            <td bgcolor="#<? echo $webs[bgcolor_rechts] ?>">
334
              <input type="text" name="Name" size="40" value="<? echo htmlentities($zeile[Name]) ?>" maxlength="255">
335
            </td>
336
          </tr>
337
          <?
338
				}
339
			 ?>
340
          <?
341
	$Feld="Link";
342
	if (isset($user_rechte[modul_name][tool_name][$Feld]))
343
	{
344
?>
345
          <tr>
346
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" width="20%"><font color="#<? echo $webs[font_color_links] ?>"><b>
347
              <?
348
				if ($web_rechte[modul_name][tool_name][$Feld])
349
				{
350
					echo $web_rechte[modul_name][tool_name][$Feld];
351
				}
352
				else
353
				{
354
			   ?>
355
              Link:
356
              <?
357
				}
358
			  ?>
359
              </b></font></td>
360
            <td bgcolor="#<? echo $webs[bgcolor_rechts] ?>">
361
              <input type="text" name="Link" size="40" value="<? echo htmlentities($zeile[Link]) ?>" maxlength="255">
362
            </td>
363
          </tr>
364
          <?
365
}
366
?>
367
          <?
368
	for ($bild_nr = 1; $bild_nr < 2 ; $bild_nr++)
369
	{
370
		$Feld="Logo$bild_nr";
371
		if (isset($user_rechte[modul_name][tool_name][$Feld]))
372
		{
373
?>
374
          <tr>
375
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" valign="top" width="21%">
376
              <font color="#<? echo $webs[font_color_links] ?>"><b>
377
              <?
378
				$outp=explode(";",$web_rechte[modul_name][tool_name][$Feld]);
379
				if ($outp[0]) { echo $outp[0]; } else { ?>
380
              Logo
381
              <? echo $bild_nr; ?>
382
              <? } ?>
383
              </b></font> </td>
384
            <td bgcolor="#<? echo $webs[bgcolor_rechts] ?>" width="79%">
385
              <table border="0" width="100%" cellspacing="0" cellpadding="0">
386
                <tr>
387
                  <td width="55%" nowrap colspan="2"> <font color="#<? echo $webs[font_color_rechts] ?>">
388
                    <?
389
							$image_name="Logo".$bild_nr."";
390
							$image_Path1="/images/TesterLogos/".$bild_nr."/";
391
							$image_Path=$webs[verzeichnis].$image_Path1;
392
					 ?>
393
                    <input type="hidden" name="<? echo $image_name ?>_Pfad" value="<? echo $image_Path ?>">
394
                    <?
395
							if ($zeile[$image_name] != "")
396
							{
397
					 ?>
398
                    <input type="radio" name="_<? echo $image_name ?>" value="0" checked>
399
                    <a href="http://www.<? echo $site.$image_Path1.$zeile[$image_name] ?>" target="blank">
400
                    <? echo $zeile[$image_name]; ?>
401
                    </a>
402
                    <?
403
								$size= filesize ($image_Path.$zeile[$image_name]) >> 10;
404
								$imgsize = GetImageSize ($image_Path.$zeile[$image_name]);
405
								echo "&nbsp;( $size KB $imgsize[0]x$imgsize[1])<BR>";
406
							}
407
					 ?>
408
                    <input type="radio" name="_<? echo $image_name ?>" value="1" <? if ($zeile[$image_name] == "") {echo "checked";}?>>
409
                    kein Bild<br>
410
                    <input type="radio" name="_<? echo $image_name ?>" value="2">
411
                    <input type="File" name="<? echo $image_name ?>" size="17" maxlength="255" onFocus="this.form._<? echo $image_name ?>[<? if ($zeile[$image_name] != "") {echo "2";} else {echo "1";} ?>].checked=true;">
412
                    </font> </td>
413
                  <td width="45%" nowrap align="center">
414
                    <? if ($zeile[$image_name] != "") {?>
415
                    <a href="http://www.<? echo $site.$image_Path1.$zeile[$image_name] ?>" target="blank"><img height="60" src="http://www.<? echo $site.$image_Path1.$zeile[$image_name] ?>" border="0"></a>
416
                    <? } ?>
417
                  </td>
418
                </tr>
419
              </table>
420
            </td>
421
          </tr>
422
          <?
423
		}
424
 	}
425
?>
426
          <?
427
	if ($ID)
428
	{
429
		  ?>
430
          <tr>
431
            <td class="headline" width="20%" bgcolor="#<? echo $webs[bgcolor_links] ?>"><font color="#<? echo $webs[font_color_links] ?>"><b>
432
              erstellt am:
433
              </b></font></td>
434
            <? $erstellt_am=datetime2human($zeile[erstellt_am]); ?>
435
            <td class="headline" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"><font color="#<? echo $webs[font_color_rechts] ?>">am:
436
              <? echo $erstellt_am[Datum] ?>
437
              um:
438
              <? echo $erstellt_am[Zeit] ?>
439
              von:
440
              <? echo $zeile[erstellt_von] ?>
441
              </font> </td>
442
          </tr>
443
          <tr>
444
            <td class="headline" width="20%" bgcolor="#<? echo $webs[bgcolor_links] ?>"><font color="#<? echo $webs[font_color_links] ?>"><b>
445
              letzte &Auml;nderung:
446
              </b></font></td>
447
            <? $letzte_Aenderung_am=datetime2human($zeile[letzte_Aenderung_am]); ?>
448
            <td class="headline" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"><font color="#<? echo $webs[font_color_rechts] ?>">am:
449
              <? echo $letzte_Aenderung_am[Datum] ?>
450
              um:
451
              <? echo $letzte_Aenderung_am[Zeit] ?>
452
              von:
453
              <? echo $zeile[letzte_Aenderung_von] ?>
454
              </font> </td>
455
          </tr>
456
          <? } ?>
457
          <tr>
458
            <td align="right" colspan="2" bgcolor="#<? echo $webs[bgcolor_links] ?>">
459
              <input type="hidden" name="ID" value="<? echo $ID ?>">
460
              <input type="hidden" name="action" value="update">
461
              <input type="submit" value="   OK   ">
462
              <input type="reset" name="Button" value="Abbrechen">
463
            </td>
464
          </tr>
465
        </table>
466
          <?
467
			 }
468
			 ?>
469
      </td>
470
      <td width="77" align="right">
471
        <table width="67" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#FFFFFF" bordercolordark="#999999">
472
          <tr>
473
            <td><a href="<? echo $self ?>?action=edit" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('new','','../images/navigation/bt_neu_f2.gif',1)"><img name="new" border="0" src="../images/navigation/bt_neu.gif" width="67" height="40" alt="Neueintrag"></a></td>
474
          </tr>
475
          <tr>
476
            <td><a href="<? echo $self ?>?action=select_edit" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('edit','','../images/navigation/bt_bearbeiten_f2.gif',1)"><img name="edit" border="0" src="../images/navigation/bt_bearbeiten.gif" width="67" height="40" alt="Eintrag bearbeiten"></a></td>
477
          </tr>
478
          <tr>
479
            <td><a href="<? echo $self ?>?action=delete" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('delete','','../images/navigation/bt_delete_f2.gif',1)"><img name="delete" border="0" src="../images/navigation/bt_delete.gif" width="67" height="40" alt="Eintrag l&ouml;schen"></a></td>
480
          </tr>
481
        </table>
482
      </td>
483
    </tr>
484
  </table>
485
</form>
486
</body>