Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?
        $self=basename($PHP_SELF);
        $DB="gaestebuch_eintraege";
        require_once "../connect2.php";
        require_once "../webs.php";
        
        session_start();

        if ($_GET[selectGB])                    {$_SESSION[$self][selectGB]=$_GET[selectGB];}
        if ($_SESSION[$self][selectGB]) {$site=$_SESSION[$self][selectGB];}
        
        if ($action=="update")
        {
                if (!$ID)
                {       // insert Dummy-Entry
                        $query = "insert into $DB (erstellt_am,erstellt_von,letzte_Aenderung_am,letzte_Aenderung_von) VALUES (NOW(),'$PHP_AUTH_USER',NOW(),'$PHP_AUTH_USER')";
                        $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>".$query."<hr>");
                        $ID=mysql_insert_id();
                }

                unset($HTTP_POST_VARS[action]);
                unset($HTTP_POST_VARS[ID]);

                foreach(array_keys($HTTP_POST_VARS) as $elem)
                {
                        if ($elem[0] == "_")
                        {
                                unset($HTTP_POST_VARS[$elem]);
                                $button=$$elem;
                                $elem=substr($elem,1);
                                $Pfad=$HTTP_POST_VARS[$elem."_Pfad"];
                                unset($HTTP_POST_VARS[$elem."_Pfad"]);
                                $image=$$elem;
                                $image_name=$elem."_name";
                                $image_name=urlencode($$image_name);
                                switch ($button) 
                                {
                                        case 0:
                                                break;
                                        case 1:
                                                $HTTP_POST_VARS[$elem]='';
                                                break;
                                        case 2:
                                                if ($image != "none")
                                                {
                                                        $image_name=$ID."_".$image_name;
                                                        //$image_name=$ID.strrchr($image_name,".");
                                                        $HTTP_POST_VARS[$elem]=$image_name;
                                                        copy($image,$Pfad.$image_name);
                                                }
                                        break;
                                    default:
                                        break;
                            }
                        }
                }
                $names=array();
                foreach(array_keys($HTTP_POST_VARS) as $elem)
                {
                        array_push($names,"$elem='$HTTP_POST_VARS[$elem]'");
                }
                $query="update $DB set letzte_Aenderung_am=NOW(), letzte_Aenderung_von='$PHP_AUTH_USER', ".join($names,', ');
                $query=$query." where ID = '$ID'";
                $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());

                if ($webs[FTP_server])
                {
                        require_once "update_file.php";
                }
                header("Location: ".$self);
                exit;
        }

        if ($action=="delete")
        {
                if ($ID)
                {
                        $condition=array();
                        foreach ($ID as $elem) 
                        {
                                array_push($condition," ID = '$elem'");
                        }
                        $cond=join(" or ",$condition);
                        $query = "DELETE FROM $DB WHERE $cond";
                        $result = mysql_query ("$query") or die (mysql_errno().": ".mysql_error());

                        $request="http://forum.$site/gaestebuch/$site.php";
                        $content=join("",file($request));
                        
                        if ($webs[FTP_server])
                        {
                                require_once "update_file.php";
                        }

                        header("Location: ".$self);  
                        exit;
                }
        }
        if (!$action) 
        {
                $action="select_edit";
        }
        if (!$sort) {$sort='erstellt_am DESC';}
?>

<html>
<head>
<title>Redaktionssystem: Gästebuch</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel=stylesheet type="text/css" href="../buttons.css">
<style type="text/css" link="redaktion.css"><MM:BeginLock translatorClass="MM_SSI" type="ssi" orig="%3C? require_once %22../buttons.css%22; ?%3E" fileRef="../buttons.css" depFiles="file:///L|/content-management/buttons.css">span {text-decoration:underline; color:#000000}
p {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #000000}
p.error {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold}
span {font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
span.blue {font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; background-color:#0000A0; font-size: 10pt}
span.small {font-family: Arial, Helvetica, sans-serif; font-size: 8pt; text-decoration: none}
td {font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
td.timeout {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #FF0000;}
td.small {font-family: Arial, Helvetica, sans-serif; font-size: 8pt}
td.headline {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #FFFFFF; font-weight: bold}
td.haupt {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold}
input {font-family: Arial, Helvetica, sans-serif; font-size: 8pt}
select {font-family: Arial, Helvetica, sans-serif; font-size: 8pt}
textarea {font-family: Arial, Helvetica, sans-serif; font-size: 8pt}a {  text-decoration: none}
<MM:EndLock></style>
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

//-->
</script>
<meta name="description" content="Redaktionssystem">
<meta name="author" content="Webagentur Niewerth">
<meta name="robots" content="noindex">
</head>

<body leftmargin="20" topmargin="10" marginwidth="20" marginheight="10" onLoad="MM_preloadImages('images/navigation/bt_bearbeiten_f2.gif','images/navigation/bt_delete_f2.gif')" bgcolor="#<? echo $webs[bgcolor_seite] ?>" text="#<? echo $webs[font_color_seite] ?>" alink="#<? echo $webs[font_color_seite] ?>" vlink="#<? echo $webs[font_color_seite] ?>">
<form method="post" action="#" name="formname" enctype="multipart/form-data">
  <table border="0" cellspacing="0" cellpadding="2">
    <tr valign="top"> 
      <td width="485">
        <!--  Auswahl Löschen START  -->
        <?  
        if ($action=="delete") 
        {
                $query="SELECT * FROM $DB where site='$site' ";
                $query=$query."order by $sort";
                $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
                if (mysql_num_rows($result) == 0)
                {
?>
<p><b><font color="#<? echo $webs[font_color_seite] ?>">Es sind keine Daten eingetragen !</font></b></p>
<p></p>
<?
                }
                else
                {
?>
        <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>"> 
            <td colspan="3" class="headline"><font color="#<? echo $webs[font_color_links] ?>">Eintrag: L&ouml;schen</font></td>
          </tr>
          <tr bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
            <td width="50%" class="haupt"><a href="<? echo $self?>?action=delete&sort=Name">Name</a></td>
            <td class="haupt" colspan="2"><a href="<? echo $self?>?action=delete&sort=erstellt_am">erstellt</a></td>
          </tr>
          <?
        while ($zeile=mysql_fetch_array($result))
        {
?>
          <tr bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
            <td width="50%"><a href="<? echo $self?>?action=edit&ID=<? echo $zeile[ID]; ?>"> 
              <? echo $zeile[Name]?>
              </a></td>
            <td> 
             <? $Zeit=datetime2human($zeile[erstellt_am]); ?>
              <? echo $Zeit[Datum] ?>
              &nbsp; </td>
            <td width="5%" align="center"> 
              <input type="checkbox" name="ID[]" value="<?  echo $zeile[ID] ?>">
            </td>
          </tr>
          <?
        }
?>
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>"> 
            <td colspan="3" align="right"> 
              <input type="hidden" name="action" value='delete'>
              <input type="submit" value="LÖSCHEN">
              <input type="reset" name="Button22" value="Zur&uuml;cksetzen">
            </td>
          </tr>
        </table>
        <?
                }
?>
        <?
        }
?>
        <!--  Auswahl Löschen ENDE  -->
        <!--  Auswahl SELECT_EDIT START  -->
        <?

  if ($action=="select_edit") 
        {
        $query="SELECT * FROM $DB where site='$site' ";
        $query=$query."order by $sort";

        $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
        if (mysql_num_rows($result) == 0)
        {
        ?>
<p><b><font color="#<? echo $webs[font_color_seite] ?>">Es sind keine Daten eingetragen !</font></b></p>
<p></p>
        <?
        }
        else
        {
        ?>
        <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>"> 
            <td class="headline" colspan="3"><font color="#<? echo $webs[font_color_links] ?>">Eintrag: Bearbeiten</font></td>
          </tr>
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>"> 
            <td width="50%" class="haupt"><a href="<? echo $self?>?action=select_edit&sort=Name"><font color="#<? echo $webs[font_color_links] ?>">Name</font></a></td>
            <td width="50%" class="haupt"><a href="<? echo $self?>?action=select_edit&sort=erstellt_am"><font color="#<? echo $webs[font_color_links] ?>">erstellt</font></a></td>
          </tr>
          <?
        while ($zeile=mysql_fetch_array($result))
        {
?>
          <tr bgcolor="#<? echo $webs[bgcolor_rechts] ?>">
            <td width="50%"><a href="<? echo $self?>?action=edit&ID=<? echo $zeile[ID]; ?>"> 
              <font color="#<? echo $webs[font_color_rechts] ?>"><? echo $zeile[Name]?></font></a></td>
            <td width="50%"> 
<? $Zeit=datetime2human($zeile[erstellt_am]); ?>
<font color="#<? echo $webs[font_color_rechts] ?>">
              <? echo $Zeit[Datum] ?></font>
              &nbsp; </td>
          </tr>
          <?
        }
?>
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>"> 
            <td colspan="3"> 
              <div align="right">&nbsp; 
                <input type="hidden" name="action" value='edit'>
              </div>
            </td>
          </tr>
        </table>
 <?
        }
?> 
        <?
        }
?> 
<!--  Auswahl SELECT_EDIT ENDE  -->

<?
        if ($action=="edit")
        {
                if ($ID)
                {
                        $result = mysql_query ("SELECT * FROM $DB where ID = '$ID'") or die (mysql_errno().": ".mysql_error());
                        $zeile=mysql_fetch_array($result);
                }
        ?> 
            <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>"> 
            <td colspan="3" class="headline"><font color="#<? echo $webs[font_color_links] ?>">Eintrag: 
              <?
                                        if ($ID)
                                        {
                                         ?>
              Bearbeiten 
              <?
                                        }
                                        else
                                        {
                                         ?>
              Neueintrag 
              <?
                                        }
                                ?>
              </font> </td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="middle" width="14%"><font color="#<? echo $webs[font_color_links] ?>">&Uuml;berschrift:</font></td>
            <td colspan="2" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
              <input type="text" name="headline" value="<? echo $zeile[headline] ?>" >
            </td></tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="top" width="14%"><font color="#<? echo $webs[font_color_links] ?>">Text:</font></td>
            <td colspan="2" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
              <textarea name="text" cols="60" rows="10"><? echo $zeile[text] ?></textarea>
            </td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="middle" colspan="3"><font color="#<? echo $webs[font_color_links] ?>">Personendaten:</font></td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="middle" width="14%"><font color="#<? echo $webs[font_color_links] ?>">Name:</font></td>
            <td colspan="2" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> <input type="text" name="Name" value="<? echo $zeile[Name] ?>" ></td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="middle" width="14%"><font color="#<? echo $webs[font_color_links] ?>">E-Mail:</font></td>
            <td colspan="2" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
              <input type="text" name="mail" value="<? echo $zeile[mail] ?>" >
            </td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="middle" width="14%"><font color="#<? echo $webs[font_color_links] ?>">Homepage:</font></td>
            <td colspan="2" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
              <input type="text" name="homepage" value="<? echo $zeile[homepage] ?>" >
            </td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="middle" width="14%"><font color="#<? echo $webs[font_color_links] ?>">Stadt:</font></td>
            <td colspan="2" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
              <input type="text" name="Stadt" value="<? echo $zeile[Stadt] ?>" >
            </td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="middle" width="14%"><font color="#<? echo $webs[font_color_links] ?>">Bundesland:</font></td>
            <td colspan="2" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
              <input type="text" name="Bundesland" value="<? echo $zeile[Bundesland] ?>" >
            </td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" valign="middle" width="14%"><font color="#<? echo $webs[font_color_links] ?>">Staat:</font></td>
            <td colspan="2" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"> 
              <input type="text" name="Staat" value="<? echo $zeile[Staat] ?>" >
            </td>
          </tr>
          <? if ($ID) {?>
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>"> 
            <td class="headline" colspan="4"><font color="#<? echo $webs[font_color_links] ?>">Datensatz:</font></td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" width="20%"><font color="#<? echo $webs[font_color_links] ?>">erstellt:</font></td>
            <td colspan="3" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"><font color="#<? echo $webs[font_color_rechts] ?>">am: 
              <? $erstellt_am=datetime2human($zeile[erstellt_am]); ?>
              <? echo $erstellt_am[Datum] ?>
              &nbsp;&nbsp;um: 
              <? echo $erstellt_am[Zeit] ?>
              &nbsp;&nbsp;von: 
              <? echo $zeile[erstellt_von] ?></font>
            </td>
          </tr>
          <tr> 
            <td bgcolor="#<? echo $webs[bgcolor_links] ?>" class="headline" width="20%" nowrap><font color="#<? echo $webs[font_color_links] ?>">letzte 
              &Auml;nderung:</font></td>
            <td colspan="3" bgcolor="#<? echo $webs[bgcolor_rechts] ?>"><font color="#<? echo $webs[font_color_rechts] ?>">am: 
              <? $letzte_Aenderung_am=datetime2human($zeile[letzte_Aenderung_am]); ?>
              <? echo $letzte_Aenderung_am[Datum] ?>
              &nbsp;&nbsp;um: 
              <? echo $letzte_Aenderung_am[Zeit] ?>
              &nbsp;&nbsp;von: 
              <? echo $zeile[letzte_Aenderung_von] ?></font>
            </td>
          </tr>
          <? } ?>
          <tr bgcolor="#<? echo $webs[bgcolor_links] ?>"> 
            <td align="right" colspan="3"> 
              <input type="hidden" name="ID" value="<? echo $ID ?>">
              <input type="hidden" name="action" value="update">
              <input type="submit" value="OK">
              <input type="reset" name="Button" value="Zur&uuml;cksetzen">
            </td>
          </tr>
        </table>
        <?
        }
?> </td>
      <td width="70" align="right"> 
        <table width="67" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#FFFFFF" bordercolordark="#999999">
          <tr> 
            <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>
          </tr>
          <tr> 
            <td><a href="<? echo $self ?>?action=delete<? if (($action=="edit") && ($ID > 0)) { ?>&ID[]=<?=$ID?>" onClick="return confirm('Diesen Eintrag wirklich löschen ?');"<? } else { ?>"<? } ?> 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>
          </tr>
        </table>
<?
        //if ($PHP_AUTH_USER == "admin")
        //{
        if ($web_rechte[gaestebuch][basisdaten][databases])
        {
                ?>
        <br>
        Gästebücher:<ul>
<?      
                foreach(explode(";",$web_rechte[gaestebuch][basisdaten][databases]) as $GaestebuchSite)
                {
                        ?><li><a href="<?=$self?>?selectGB=<?=$GaestebuchSite;?>"><?=$GaestebuchSite;?></a></li><?
                }
        }
        //}
?>
        </ul>
      </td>
</tr>
</table>
</form>
</body>