Location: PHPKode > scripts > GigKalender > news/backend_addNews.php
<?php
/*
    CREATIVE COMMONS - Attribution-No Derivative Works 3.0 Germany:
    - You may not alter, transform, or build upon this work.
    - Dieses Werk darf nicht bearbeitet oder in anderer Weise verändert werden.
*/
  if ( isset($_POST['senden']) ) $senden = true;
  else  $senden = false;
  if ( $senden
       && ($_POST['Title']!="")
       && ($_POST['Text']!="")
       && ($_POST['Publish']!="")
     )
  {
    $FormularKorrektAusgefuellt = true;
  }
  else 
  {
    $Title = '';
    $Text = '';
    $Publish = ''; 
    $FormularKorrektAusgefuellt = false;
  }
  $xUserRightAddNews = getCurrentUserVar('UserRightAddNews');
  $xUserRightEditNews = getCurrentUserVar('UserRightEditNews');
  if ( $xUserRightAddNews OR $xUserRightEditNews )
  {
    // Inhalt hier einfügen
      if ( !isset($_POST['senden']) )  // Gig editieren
      {
        if (isset($_REQUEST['newsid'])) { $NewsID = $_REQUEST['newsid']; }
          else { $NewsID = ''; }
        $sql = "SELECT * FROM ".$prefix."news WHERE NewsID = '$NewsID'";
        $resultat = mysql_query($sql);
        while ($row = mysql_fetch_array($resultat))
        {
          extract($row);
          $Title = $Title;
          $Text = $Text;
          $Publish = $Publish;
        }
      }
      else
      {
        // Post-Variablen in Variablen speichern
          foreach ($_POST as $key => $value)
          {
            if (get_magic_quotes_gpc()) $$key = stripslashes($value);
            else $$key = $value;
          }
      }


      if ($FormularKorrektAusgefuellt == true)
      {
        include ('news/functions.php');

        // News hinzufügen
        if ($_REQUEST['job']=='add')
        {
          if (addNews ($Title, $Text, $Publish) )
          {
            echo $L_News_successfully_added.'<br /><br />';
          }
          else
          {
            echo '<span class="ERROR">'.$L_ERROR_News_not_added.'</span><br /><br />';
          }
        }

        // News bearbeiten
        if ($_REQUEST['job']=='edit')
        {
          if (editNews ($NewsID, $Title, $Text, $Publish) )
          {
            echo $L_News_successfully_edited.'<br /><br />';
          }
          else
          {
            echo '<span class="ERROR">'.$L_ERROR_News_not_edited.'</span><br /><br />';
          }
        }

        echo '
          <form method="post" action="index.php?submenu=news&amp;page=backend_showAllNews">
            <fieldset>
              <input type="submit" value="'.$L_Button26.'" class="button" />
            </fieldset>
          </form>';
      }
      else
      {
        // Post-Variablen in Variablen speichern
          foreach ($_POST as $key => $value)
          {
            if (get_magic_quotes_gpc()) $$key = stripslashes($value);
            else $$key = $value;
          }
        echo '
          <form method="post" action="index.php?submenu=news&amp;page=backend_addNews&amp;job='.$_REQUEST['job'].'">
      	   <table summary="AddNews">
            ';
            // Title
              if ($senden && $_POST['Title']=="")
              { echo '<tr><td></td><td class="ERROR">'.$L_169.'</td><td></td></tr>'; }
              $Title = htmlspecialchars($Title);
              echo '<tr>
                  <td align="right" valign="top">'.$L_NewsTitle.':</td>
                  <td><input type="text" name="Title" value="'.$Title.'" maxlength="'.$CharsNewsTitle.'" /></td>
                  <td valign="top">*</td>
                </tr>';
            // Text
              if ($senden && $_POST['Text']=="")
              { echo '<tr><td></td><td class="ERROR">'.$L_170.'</td><td></td></tr>'; }
              $Text = htmlspecialchars($Text);
              echo '<tr>
                      <td align="right" valign="top">'.$L_NewsText.':</td>
                      <td><textarea name="Text" rows="15" cols="60" style="width:50em;">'.$Text.'</textarea></td>
                      <td valign="top">*</td>
                    </tr>';

            // Publish
              if ($senden && ($_POST['Publish']==""))
              { echo '<tr><td></td><td class="ERROR">'.$L_171.'</td><td></td></tr>'; }
            echo '<tr>
                    <td align="right" valign="top">'.$L_NewsPublish.':</td>
                    <td>
                      <select name="Publish">';
            if ( $Publish=='' ) echo '<option></option>';
            echo '<option value="1" '; if ($Publish=="1") echo ' selected="selected"'; echo'>'.$L_091.'</option>
                  <option value="0" '; if ($Publish=="0") echo ' selected="selected"'; echo'>'.$L_092.'</option>
                </select>
              </td>
              <td valign="top">*</td>
            </tr>';



          // Button
          echo '
        	   <tr>
              <td></td>
              <td>
                <input type="submit" name="senden" value="'.$L_Button01.'" class="button" />
                <input type="button" value="'.$L_Button03.'" onclick="self.location.href=\'index.php?submenu=news&amp;page=backend_showAllNews\'" class="button" />
                <input type="hidden" name="NewsID" value="'.$NewsID.'" />
                <input type="hidden" name="DEAKTIVIERT-http-equiv" value="showAllNews" />
              </td>
        	   </tr>
      	   </table>
    	 </form>
        ';
      }
    // Inhalt zuende
  }
  else
  { echo $L_015; }
?>
Return current item: GigKalender