Subversion Repositories personal-webbase

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. if (!defined('WBLEGAL')) die('Kann nicht ohne Personal WebBase ausgef&uuml;hrt werden.');
  4.  
  5. echo str_replace('<body', '<body onload="self.focus();document.getElementById(\'category\').focus();"', $header);
  6.  
  7. if (isset($sent) && ($sent == '1'))
  8. {
  9.         if ((!isset($category)) || ((isset($category)) && ($category == ''))) die(); // Alternativ: Prüfen, ob die Kategorie wirklich existiert!
  10.  
  11.         $ary = explode("\n", $eintraege);
  12.  
  13.         for ($i=0; $i <= count($ary); $i++)
  14.         {
  15.                 $res3 = db_query("SELECT MAX(`nr`) AS `mx` FROM `".$WBConfig->getMySQLPrefix()."mediacollection_entries` WHERE `category` = '".$category."' AND `user_cnid` = '".$benutzer['id']."'");
  16.                 $row3 = db_fetch($res3);
  17.                 $new = $row3['mx'];
  18.  
  19.                 if (isset($ary[$i]) && ($ary[$i] != ''))
  20.                 {
  21.                         if (strpos($ary[$i], '*'))
  22.                         {
  23.                                 $ary[$i] = str_replace('*', '', $ary[$i]);
  24.                                 $gebrannt = '1';
  25.                         }
  26.                         else
  27.                         {
  28.                                 $gebrannt = '0';
  29.                         }
  30.                         db_query("INSERT INTO `".$WBConfig->getMySQLPrefix()."mediacollection_entries` (`nr`, `name`, `category`, `einstellungsdatum`, `gebrannt`, `user_cnid`) VALUES ('".($new+1)."', '".db_escape($ary[$i])."', '".db_escape($category)."', NOW(), '".db_escape($gebrannt)."', '".$benutzer['id']."')");
  31.                 }
  32.         }
  33. }
  34.  
  35. echo '<h1>Neue Eintr&auml;ge erstellen</h1>';
  36.  
  37. $res2 = db_query("SELECT `nummer`, `spalte`, `name` FROM `".$WBConfig->getMySQLPrefix()."mediacollection_categories` WHERE `user_cnid` = '".$benutzer['id']."' ORDER BY `spalte`, `nummer` ASC");
  38.  
  39. if (db_num($res2) == 0) {
  40.         echo '<p>Es existieren keine Kategorieren.</p>';
  41.         echo '<p><a href="'.$_SERVER['PHP_SELF'].'?modul='.$modul.'&amp;seite=newkat">Eine Kategorie anlegen</a></p>';
  42.         echo '<p><a href="'.$_SERVER['PHP_SELF'].'?modul='.$modul.'&amp;seite=main">Zur&uuml;ck zum Hauptmen&uuml;</a></p>';
  43. } else {
  44.         echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="mainform">';
  45.         echo '<input type="hidden" name="modul" value="'.$modul.'">';
  46.         echo '<input type="hidden" name="seite" value="'.$seite.'">';
  47.         echo '<input type="hidden" name="sent" value="1">';
  48.  
  49.         echo 'Kategorie: <select name="category" id="category">';
  50.         while ($row2 = db_fetch($res2)) {
  51.                 echo '<option value="'.$row2['spalte'].$row2['nummer'].'">'.$row2['spalte'].$row2['nummer'].' - '.$row2['name'].'</option>';
  52.         }
  53.         echo '</select><br><br>';
  54.  
  55.         echo '<textarea name="eintraege" cols="70" rows="10"></textarea><br>';
  56.  
  57.         echo '<br><input type="submit" class="button" onmouseover="this.className=\'button_act\';" onmouseout="this.className=\'button\';" value="Eintr&auml;ge erstellen"> <input type="button" value="Abbrechen" onclick="document.location.href=\''.$_SERVER['PHP_SELF'].'?modul='.$modul.'&amp;seite=main\'" class="button" onmouseover="this.className=\'button_act\';" onmouseout="this.className=\'button\';">';
  58.  
  59.         echo '</form>';
  60. }
  61.  
  62. echo $footer;
  63.  
  64. ?>