home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 March / PCWorld_2001-03_cd.bin / KOMUNIK / progweb / progweb.exe / phpnuke / html / admin / automated.php < prev    next >
PHP Script  |  2000-12-05  |  29KB  |  881 lines

  1. <?PHP
  2.  
  3. ######################################################################
  4. # PHP-NUKE: Web Portal System
  5. # ===========================
  6. #
  7. # Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
  8. # http://phpnuke.org
  9. #
  10. # This modules is for automatic articles publishing
  11. #
  12. # This program is free software. You can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License.
  15. ######################################################################
  16.  
  17. if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
  18. $hlpfile = "manual/automated.html";
  19. $result = mysql_query("select radminarticle, radminsuper from authors where aid='$aid'");
  20. list($radminarticle, $radminsuper) = mysql_fetch_row($result);
  21. if (($radminsurvey==1) OR ($radminsuper==1)) {
  22.  
  23. /*********************************************************/
  24. /* Automated News Publishing Programming                 */
  25. /*********************************************************/
  26.  
  27. function autoStory() {
  28.     global $hlpfile, $admin, $aid;
  29.     include ("header.php");
  30.     GraphicAdmin($hlpfile);
  31.     echo "<br>";
  32.     OpenTable();
  33.     echo "<center><b>".translate("Programmed Articles")."</b></center><br><br>";
  34.     echo "<table border=1 width=100% bgcolor=CCCCCC>";
  35.     $result = mysql_query("select anid, title, time from autonews order by time ASC");
  36.     while(list($anid, $title, $time) = mysql_fetch_row($result)) {
  37.     if ($anid != "") {
  38.         $time = ereg_replace(" ", "@", $time);
  39.             echo "<tr><td> <b>(<a href=admin.php?op=autoEdit&anid=$anid>".translate("Edit")."</a>-<a href=admin.php?op=autoDelete&anid=$anid>".translate("Delete")."</a>)</b> </td><td width=100%> $title </td><td> $time </td></tr>";
  40.     }
  41.     }
  42.     if ($anid=="") {
  43.     echo "</td></tr></table>";
  44.     } else {
  45.     echo "</table>";
  46.     }
  47.     
  48.     CloseTable();
  49.     echo "<br>";
  50.  
  51.     OpenTable();
  52.     $today = getdate();
  53.     $tday = $today[mday];
  54.     if ($tday < 10){
  55.     $tday = "0$tday";
  56.     }
  57.     $tmonth = $today[month];
  58.     $ttmon = $today[mon];
  59.     if ($ttmon < 10){
  60.     $ttmon = "0$ttmon";
  61.     }
  62.     $tyear = $today[year];
  63.     $thour = $today[hours];
  64.     if ($thour < 10){
  65.     $thour = "0$thour";
  66.     }
  67.     $tmin = $today[minutes];
  68.     if ($tmin < 10){
  69.     $tmin = "0$tmin";
  70.     }
  71.     $tsec = $today[seconds];
  72.     if ($tsec < 10){
  73.     $tsec = "0$tsec";
  74.     }
  75.     $date = "$tmonth $tday, $tyear @ $thour:$tmin:$tsec";
  76.     echo "<center><font size=4><b>".translate("New Automated Article")."</b></font></center><br><br>";
  77.     echo "<form action=admin.php method=post>";
  78.     echo "<p><b>".translate("Title")."</b><br>";
  79.     echo "<input class=textbox type=text name=subject size=50 value=\"\"><BR>";
  80.     echo "<BR>";
  81.     echo "<p><b>".translate("Topic")."</b>";
  82.     $toplist = mysql_query("select topicid, topictext from topics order by topictext");
  83.     echo "<SELECT class=textbox NAME=\"topic\">";
  84.     echo "<OPTION VALUE=\"\">".translate("Select Topic")."</option>\n";
  85.     while(list($topicid, $topics) = mysql_fetch_row($toplist)) {
  86.     if ($topicid==$topic) {
  87.         $sel = "selected ";
  88.     }
  89.         echo "<option $sel value=\"$topicid\">$topics</option>\n";
  90.     $sel = "";
  91.     }
  92.     echo "</SELECT>";
  93.     echo "
  94.     <P><B>".translate("The Story")."</B><br>
  95.     <textarea class=textbox wrap=virtual cols=70 rows=12 name=hometext></textarea><BR>
  96.     <P><B>".translate("Extended Text")."</B><br>
  97.     <textarea class=textbox wrap=virtual cols=70 rows=12 name=bodytext></textarea><BR>
  98.     <FONT size=2>".translate("(Are you sure you included a URL? Did ya test them for typos?)")."</FONT><P>
  99.     </select>";
  100.     echo "<font size=3><b>".translate("When do you want to publish this story?")."</b></font><br><br>";
  101.     echo "".translate("Now is:")." $date<br><br>";
  102.     $day = 1;
  103.     echo "".translate("Day:")." <select name=day>";
  104.     while ($day <= 31) {
  105.     if ($tday==$day) {
  106.         $sel = "selected";
  107.     } else {
  108.         $sel = "";
  109.     }
  110.     echo "<option name=day $sel>$day</option>";
  111.     $day++;
  112.     }
  113.     echo "</select>";
  114.     $month = 1;
  115.     echo "".translate("Month:")." <select name=month>";
  116.     while ($month <= 12) {
  117.     if ($ttmon==$month) {
  118.         $sel = "selected";
  119.     } else {
  120.         $sel = "";
  121.     }
  122.     echo "<option name=month $sel>$month</option>";
  123.     $month++;
  124.     }
  125.     echo "</select>";
  126.     $date = getdate();
  127.     $year = $date[year];
  128.     echo "".translate("Year:")." <input type=text name=year value=$year size=5 maxlength=4>";
  129.     echo "<br>".translate("Hour:")." <select name=hour>";
  130.     $hour = 0;
  131.     $cero = "0";
  132.     while ($hour <= 23) {
  133.     $dummy = $hour;
  134.     if ($hour < 10) {
  135.         $hour = "$cero$hour";
  136.     }
  137.     echo "<option name=hour>$hour</option>";
  138.     $hour = $dummy;
  139.     $hour++;
  140.     }
  141.     echo "</select>";
  142.     echo " : <select name=min>";
  143.     $min = 0;
  144.     while ($min <= 59) {
  145.     if (($min == 0) OR ($min == 5)) {
  146.         $min = "0$min";
  147.     }
  148.     echo "<option name=min>$min</option>";
  149.     $min = $min + 5;
  150.     }
  151.     echo "</select>";
  152.     echo " : 00<br><br>";
  153.     echo "<select class=textbox name=op>
  154.     <option value=autoPreviewStory SELECTED>".translate("PreviewAdminStory")."</option>
  155.     <option value=autoSaveStory>".translate("PostAdminStory")."</option>
  156.     </select>    
  157.     <INPUT type=submit value=\"".translate("Go!")."\">";
  158.  
  159.     echo "</form>";
  160.     CloseTable();
  161.     include("footer.php");
  162. }
  163.  
  164. function autoPreviewStory($year, $day, $month, $hour, $min, $subject, $hometext, $bodytext, $topic) {
  165.     global $aid, $admin, $language, $hlpfile, $tipath;
  166.     include ("header.php");
  167.     if ($topic<1) {
  168.         $topic = 1;
  169.     }
  170.     GraphicAdmin($hlpfile);
  171.     
  172.     OpenTable();
  173.     echo "<center><b>".translate("Programmed Articles")."</b></center><br><br>";
  174.     echo "<table border=1 width=100% bgcolor=CCCCCC>";
  175.     $result = mysql_query("select anid, title, time from autonews order by time ASC");
  176.     while(list($anid, $title, $time) = mysql_fetch_row($result)) {
  177.     if ($anid != "") {
  178.         $time = ereg_replace(" ", "@", $time);
  179.             echo "<tr><td> <b>(<a href=admin.php?op=autoEdit&anid=$anid>".translate("Edit")."</a>-<a href=admin.php?op=autoDelete&anid=$anid>".translate("Delete")."</a>)</b> </td><td width=100%> $title </td><td> $time </td></tr>";
  180.     }
  181.     }
  182.     if ($anid=="") {
  183.     echo "</td></tr></table>";
  184.     } else {
  185.     echo "</table>";
  186.     }
  187.     
  188.     CloseTable();
  189.     echo "<br>";    
  190.     
  191.     OpenTable();
  192.     $today = getdate();
  193.     $tday = $today[mday];
  194.     if ($tday < 10){
  195.     $tday = "0$tday";
  196.     }
  197.     $tmonth = $today[month];
  198.     $tyear = $today[year];
  199.     $thour = $today[hours];
  200.     if ($thour < 10){
  201.     $thour = "0$thour";
  202.     }
  203.     $tmin = $today[minutes];
  204.     if ($tmin < 10){
  205.     $tmin = "0$tmin";
  206.     }
  207.     $tsec = $today[seconds];
  208.     if ($tsec < 10){
  209.     $tsec = "0$tsec";
  210.     }
  211.     $date = "$tmonth $tday, $tyear @ $thour:$tmin:$tsec";        
  212.     echo "
  213.     <font size=4><b><center>".translate("Preview Automated Story")."</b></font><br><br><br>
  214.     <form action=\"admin.php\" method=post>
  215.     </b></center>";
  216.     $subject = stripslashes($subject);
  217.     $hometext = stripslashes($hometext);
  218.     $bodytext = stripslashes($bodytext);
  219.     $result=mysql_query("select topicimage from topics where topicid=$topic");
  220.     list($topicimage) = mysql_fetch_row($result);
  221.     echo "<center><br>
  222.     <table border=0 width=75% cellpadding=0 cellspacing=1 bgcolor=000000><tr><td>
  223.     <table border=0 width=100% cellpadding=8 cellspacing=1 bgcolor=FFFFFF><tr><td>";
  224.     echo "";
  225.     echo "<img src=$tipath$topicimage border=0 align=right>";
  226.     themepreview($subject, $hometext, $bodytext);
  227.     echo "</td></tr></table></td></tr></table></center>
  228.     <p><b>".translate("Title")."</b><br>
  229.     <input class=textbox type=text name=subject size=50 value=\"$subject\"><BR>
  230.     <p><b>".translate("Topic")."</b> <select name=topic>";
  231.     $toplist = mysql_query("select topicid, topictext from topics order by topictext");
  232.     echo "<OPTION VALUE=\"\">".translate("All Topics")."</option>\n";
  233.     while(list($topicid, $topics) = mysql_fetch_row($toplist)) {
  234.     if ($topicid==$topic) { $sel = "selected "; }
  235.         echo "<option $sel value=\"$topicid\">$topics</option>\n";
  236.     $sel = "";
  237.     }
  238.     echo "</select>
  239.     <p><b>".translate("The Story")."</b><br>
  240.     <textarea class=textbox wrap=virtual cols=50 rows=12 name=hometext>$hometext</textarea><BR><BR>
  241.     <p><b>".translate("Extended Text")."</b><br>
  242.     <textarea class=textbox wrap=virtual cols=50 rows=12 name=bodytext>$bodytext</textarea><BR><BR>";
  243.     echo "<font size=3><b>".translate("When do you want to publish this story?")."</b></font><br><br>";
  244.     echo "".translate("Now is:")." $date<br><br>";
  245.     $xday = 1;
  246.     echo "".translate("Day:")." <select name=day>";
  247.     while ($xday <= 31) {
  248.     if ($xday == $day) {
  249.         $sel = "selected";
  250.     } else {
  251.         $sel = "";
  252.     }
  253.     echo "<option name=day $sel>$xday</option>";
  254.     $xday++;
  255.     }
  256.     echo "</select>";
  257.     $xmonth = 1;
  258.     echo "".translate("Month:")." <select name=month>";
  259.     while ($xmonth <= 12) {
  260.     if ($xmonth == $month) {
  261.         $sel = "selected";
  262.     } else {
  263.         $sel = "";
  264.     }
  265.     echo "<option name=month $sel>$xmonth</option>";
  266.     $xmonth++;
  267.     }
  268.     echo "</select>";
  269.     echo "".translate("Year:")." <input type=text name=year value=$year size=5 maxlength=4>";
  270.     echo "<br>".translate("Hour:")." <select name=hour>";
  271.     $xhour = 0;
  272.     $cero = "0";
  273.     while ($xhour <= 23) {
  274.     $dummy = $xhour;
  275.     if ($xhour < 10) {
  276.         $xhour = "$cero$xhour";
  277.     }
  278.     if ($xhour == $hour) {
  279.         $sel = "selected";
  280.     } else {
  281.         $sel = "";
  282.     }
  283.     echo "<option name=hour $sel>$xhour</option>";
  284.     $xhour = $dummy;
  285.     $xhour++;
  286.     }
  287.     echo "</select>";
  288.     echo " : <select name=min>";
  289.     $xmin = 0;
  290.     while ($xmin <= 59) {
  291.     if (($xmin == 0) OR ($xmin == 5)) {
  292.         $xmin = "0$xmin";
  293.     }
  294.     if ($xmin == $min) {
  295.         $sel = "selected";
  296.     } else {
  297.         $sel = "";
  298.     }
  299.     echo "<option name=min $sel>$xmin</option>";
  300.     $xmin = $xmin + 5;
  301.     }
  302.     echo "</select>";
  303.     echo " : 00<br><br>    
  304.     <select class=textbox name=op>
  305.     <option value=autoPreviewStory SELECTED>".translate("Preview Again")."</option>
  306.     <option value=autoSaveStory>".translate("Save Auto Story")."</option>
  307.     </select>
  308.     <INPUT type=submit value=".translate("Go!").">
  309.     </form></td></tr></table></td></tr></table>";
  310.     include ('footer.php');
  311.  
  312. }
  313.  
  314. function autoSaveStory($year, $day, $month, $hour, $min, $subject, $hometext, $bodytext, $topic) {
  315.     global $aid, $admin, $ultramode;
  316.     if ($day < 10) {
  317.     $day = "0$day";
  318.     }
  319.     if ($month < 10) {
  320.     $month = "0$month";
  321.     }
  322.     $sec = "00";
  323.     $date = "$year-$month-$day $hour:$min:$sec";
  324.     $notes = "";
  325.     $author = $aid;
  326.     $subject = stripslashes(FixQuotes($subject));
  327.     $hometext = stripslashes(FixQuotes($hometext));
  328.     $bodytext = stripslashes(FixQuotes($bodytext));
  329.     $result = mysql_query("insert into autonews values (NULL, '$aid', '$subject', '$date', '$hometext', '$bodytext', '$topic', '$author', '$notes')");
  330.     if (!$result) {
  331.     echo mysql_errno(). ": ".mysql_error(). "<br>";
  332.     exit();
  333.     }
  334.     $result = mysql_query("update authors set counter=counter+1 where aid='$aid'");
  335.     if ($ultramode) {
  336.     ultramode();
  337.     }
  338.     Header("Location: admin.php?op=autoStory");
  339. }            
  340.  
  341. function QautoStory ($qid) {
  342.     global $user, $subject, $story, $tipath;
  343.     include ('header.php');
  344.     GraphicAdmin($hlpfile);
  345.     OpenTable();
  346.     echo "<center><b>".translate("Programmed Articles")."</b></center><br><br>";
  347.     echo "<table border=1 width=100% bgcolor=CCCCCC>";
  348.     $result = mysql_query("select anid, title, time from autonews order by time ASC");
  349.     while(list($anid, $title, $time) = mysql_fetch_row($result)) {
  350.     if ($anid != "") {
  351.         $time = ereg_replace(" ", "@", $time);
  352.             echo "<tr><td> <b>(<a href=admin.php?op=autoEdit&anid=$anid>".translate("Edit")."</a>-<a href=admin.php?op=autoDelete&anid=$anid>".translate("Delete")."</a>)</b> </td><td width=100%> $title </td><td> $time </td></tr>";
  353.     }
  354.     }
  355.     if ($anid=="") {
  356.     echo "</td></tr></table>";
  357.     } else {
  358.     echo "</table>";
  359.     }
  360.     
  361.     CloseTable();
  362.     echo "<br>";    
  363.     $result = mysql_query("SELECT qid, uid, uname, subject, story, topic FROM queue where qid=$qid");
  364.     list($qid, $uid, $uname, $subject, $story, $topic) = mysql_fetch_row($result);
  365.     mysql_free_result($result);
  366.     $subject = stripslashes($subject);
  367.     $story = stripslashes($story);
  368.     OpenTable();
  369.     $today = getdate();
  370.     $tday = $today[mday];
  371.     if ($tday < 10){
  372.     $tday = "0$tday";
  373.     }
  374.     $tmonth = $today[month];
  375.     $ttmon = $today[mon];
  376.     if ($ttmon < 10){
  377.     $ttmon = "0$ttmon";
  378.     }
  379.     $tyear = $today[year];
  380.     $thour = $today[hours];
  381.     if ($thour < 10){
  382.     $thour = "0$thour";
  383.     }
  384.     $tmin = $today[minutes];
  385.     if ($tmin < 10){
  386.     $tmin = "0$tmin";
  387.     }
  388.     $tsec = $today[seconds];
  389.     if ($tsec < 10){
  390.     $tsec = "0$tsec";
  391.     }
  392.     $date = "$tmonth $tday, $tyear @ $thour:$tmin:$tsec";    
  393.     echo "<form action=admin.php method=post>
  394.     <p><b>".translate("Name")."</b><br>
  395.     <input class=textbox type=text NAME=author SIZE=50 value=$uname>
  396.     <p><b>".translate("Subject")."</b><br>
  397.     <input class=textbox type=text name=subject size=50 value=\"$subject\">";
  398.     if($topic=="") {
  399.         $topic = 1;
  400.     }
  401.     $result = mysql_query("select topicimage from topics where topicid=$topic");
  402.     list($topicimage) = mysql_fetch_row($result);
  403.     echo "<br><br><center>
  404.     <table border=0 width=70% cellpadding=0 cellspacing=1 bgcolor=000000><tr><td>
  405.     <table border=0 width=100% cellpadding=8 cellspacing=1 bgcolor=FFFFFF><tr><td>
  406.     <img src=$tipath$topicimage border=0 align=right>";
  407.     themepreview($subject, $story);
  408.     echo "</td></tr></table></td></tr></table></center>";
  409.     echo "<p><b>Topic</b> <select name=topic>";
  410.     $toplist = mysql_query("select topicid, topictext from topics order by topictext");
  411.         echo "<OPTION VALUE=\"\">".translate("Select Topic")."</option>\n";
  412.         while(list($topicid, $topics) = mysql_fetch_row($toplist)) {
  413.         if ($topicid==$topic) { $sel = "selected "; }
  414.             echo "<option $sel value=\"$topicid\">$topics</option>\n";
  415.         $sel = "";
  416.         }
  417.     echo "</select>
  418.     <p><b>".translate("Intro Text")."</b><br>
  419.     <textarea class=textbox wrap=virtual cols=50 rows=7 name=hometext>$story</textarea>
  420.     <p><b>".translate("Full Text")."</b><br>
  421.     <textarea class=textbox wrap=virtual cols=50 rows=8 name=bodytext></textarea><BR>
  422.     <FONT size=2>".translate("(Did you check URLs?)")."</FONT><P>
  423.     <p><b>".translate("Notes")."</b><br>
  424.     <textarea class=textbox wrap=virtual cols=50 rows=4 name=notes></textarea><br>
  425.     <input type=hidden NAME=qid SIZE=50 value=$qid>
  426.     <input type=hidden NAME=uid SIZE=50 value=$uid>";
  427.     echo "<font size=3><b>".translate("When do you want to publish this story?")."</b></font><br><br>";
  428.     echo "".translate("Now is:")." $date<br><br>";
  429.     $day = 1;
  430.     echo "".translate("Day:")." <select name=day>";
  431.     while ($day <= 31) {
  432.     if ($tday==$day) {
  433.         $sel = "selected";
  434.     } else {
  435.         $sel = "";
  436.     }
  437.     echo "<option name=day $sel>$day</option>";
  438.     $day++;
  439.     }
  440.     echo "</select>";
  441.     $month = 1;
  442.     echo "".translate("Month:")." <select name=month>";
  443.     while ($month <= 12) {
  444.     if ($ttmon==$month) {
  445.         $sel = "selected";
  446.     } else {
  447.         $sel = "";
  448.     }
  449.     echo "<option name=month $sel>$month</option>";
  450.     $month++;
  451.     }
  452.     echo "</select>";
  453.     $date = getdate();
  454.     $year = $date[year];
  455.     echo "".translate("Year:")." <input type=text name=year value=$year size=5 maxlength=4>";
  456.     echo "<br>".translate("Hour:")." <select name=hour>";
  457.     $hour = 0;
  458.     $cero = "0";
  459.     while ($hour <= 23) {
  460.     $dummy = $hour;
  461.     if ($hour < 10) {
  462.         $hour = "$cero$hour";
  463.     }
  464.     echo "<option name=hour>$hour</option>";
  465.     $hour = $dummy;
  466.     $hour++;
  467.     }
  468.     echo "</select>";
  469.     echo " : <select name=min>";
  470.     $min = 0;
  471.     while ($min <= 59) {
  472.     if (($min == 0) OR ($min == 5)) {
  473.         $min = "0$min";
  474.     }
  475.     echo "<option name=min>$min</option>";
  476.     $min = $min + 5;
  477.     }
  478.     echo "</select>";
  479.     echo " : 00<br><br>";
  480.  
  481.     echo "<select name=op>
  482.         <option value=DeleteStory>".translate("DeleteStory")."</option>
  483.         <option value=QautoPreview SELECTED>".translate("PreviewAgain")."</option>
  484.         <option value=QautoSave>".translate("PostStory")."</option>
  485.     </select>
  486.     <INPUT type=submit value=".translate("Go!").">
  487.     </form></td></tr></table></td></tr></table>";
  488.     include ('footer.php');
  489. }
  490.  
  491. function QautoPreview($year, $day, $month, $hour, $min, $qid, $uid, $author, $subject, $hometext, $bodytext, $topic, $notes) {
  492.     global $user, $boxstuff, $tipath;
  493.     include ('header.php');
  494.     GraphicAdmin($hlpfile);
  495.  
  496.     OpenTable();
  497.     echo "<center><b>".translate("Programmed Articles")."</b></center><br><br>";
  498.     echo "<table border=1 width=100% bgcolor=CCCCCC>";
  499.     $result = mysql_query("select anid, title, time from autonews order by time ASC");
  500.     while(list($anid, $title, $time) = mysql_fetch_row($result)) {
  501.     if ($anid != "") {
  502.         $time = ereg_replace(" ", "@", $time);
  503.             echo "<tr><td> <b>(<a href=admin.php?op=autoEdit&anid=$anid>".translate("Edit")."</a>-<a href=admin.php?op=autoDelete&anid=$anid>".translate("Delete")."</a>)</b> </td><td width=100%> $title </td><td> $time </td></tr>";
  504.     }
  505.     }
  506.     if ($anid=="") {
  507.     echo "</td></tr></table>";
  508.     } else {
  509.     echo "</table>";
  510.     }
  511.     
  512.     CloseTable();
  513.     echo "<br>";
  514.  
  515.     $subject = stripslashes($subject);
  516.     $hometext = stripslashes($hometext);
  517.     $bodytext = stripslashes($bodytext);
  518.     $notes = stripslashes($notes);
  519.     OpenTable();
  520.     $today = getdate();
  521.     $tday = $today[mday];
  522.     if ($tday < 10){
  523.     $tday = "0$tday";
  524.     }
  525.     $tmonth = $today[month];
  526.     $tyear = $today[year];
  527.     $thour = $today[hours];
  528.     if ($thour < 10){
  529.     $thour = "0$thour";
  530.     }
  531.     $tmin = $today[minutes];
  532.     if ($tmin < 10){
  533.     $tmin = "0$tmin";
  534.     }
  535.     $tsec = $today[seconds];
  536.     if ($tsec < 10){
  537.     $tsec = "0$tsec";
  538.     }
  539.     $date = "$tmonth $tday, $tyear @ $thour:$tmin:$tsec";
  540.     echo "<form action=admin.php method=post>
  541.     <p><b>".translate("Name")."</b><br>
  542.     <input class=textbox type=text NAME=author SIZE=50 value=$author>
  543.     <p><b>".translate("Subject")."</b><br>
  544.     <input class=textbox type=text name=subject size=50 value=\"$subject\">";
  545.     $result = mysql_query("select topicimage from topics where topicid=$topic");
  546.     list($topicimage) = mysql_fetch_row($result);
  547.     echo "<br><br><center><table width=70% bgcolor=000000 cellpadding=0 cellspacing=1 border=0><tr><td>";
  548.     echo "<table width=100% bgcolor=FFFFFF cellpadding=8 cellspacing=1 border=0><tr><td>";
  549.     echo "<img src=$tipath$topicimage border=0 align=right>";
  550.     themepreview($subject, $hometext, $bodytext, $notes);
  551.     echo "</td></tr></table></td></tr></table></center>";
  552.     echo "<p><b>".translate("Topic")."</b> <select name=topic>";
  553.     $toplist = mysql_query("select topicid, topictext from topics order by topictext");
  554.         echo "<OPTION VALUE=\"\">".translate("All Topics")."</option>\n";
  555.         while(list($topicid, $topics) = mysql_fetch_row($toplist)) {
  556.         if ($topicid==$topic) { $sel = "selected "; }
  557.             echo "<option $sel value=\"$topicid\">$topics</option>\n";
  558.         $sel = "";
  559.         }
  560.     echo "</select>    
  561.     <p><b>".translate("Intro Text")."</b><br>
  562.     <textarea class=textbox wrap=virtual cols=50 rows=7 name=hometext>$hometext</textarea>
  563.     <p><b>".translate("Full Text")."</b><br>
  564.     <textarea class=textbox wrap=virtual cols=50 rows=10 name=bodytext>$bodytext</textarea><BR>
  565.     <FONT size=2>".translate("(Did you check URLs?)")."</FONT><P>
  566.     <p><b>".translate("Notes")."</b><br>
  567.     <textarea class=textbox wrap=virtual cols=50 rows=4 name=notes>$notes</textarea><br>
  568.     <input type=hidden NAME=qid SIZE=50 value=$qid>
  569.     <input type=hidden NAME=uid SIZE=50 value=$uid>";
  570.     echo "<font size=3><b>".translate("When do you want to publish this story?")."</b></font><br><br>";
  571.     echo "".translate("Now is:")." $date<br><br>";
  572.     $xday = 1;
  573.     echo "".translate("Day:")." <select name=day>";
  574.     while ($xday <= 31) {
  575.     if ($xday == $day) {
  576.         $sel = "selected";
  577.     } else {
  578.         $sel = "";
  579.     }
  580.     echo "<option name=day $sel>$xday</option>";
  581.     $xday++;
  582.     }
  583.     echo "</select>";
  584.     $xmonth = 1;
  585.     echo "".translate("Month:")." <select name=month>";
  586.     while ($xmonth <= 12) {
  587.     if ($xmonth == $month) {
  588.         $sel = "selected";
  589.     } else {
  590.         $sel = "";
  591.     }
  592.     echo "<option name=month $sel>$xmonth</option>";
  593.     $xmonth++;
  594.     }
  595.     echo "</select>";
  596.     echo "".translate("Year:")." <input type=text name=year value=$year size=5 maxlength=4>";
  597.     echo "<br>".translate("Hour:")." <select name=hour>";
  598.     $xhour = 0;
  599.     $cero = "0";
  600.     while ($xhour <= 23) {
  601.     $dummy = $xhour;
  602.     if ($xhour < 10) {
  603.         $xhour = "$cero$xhour";
  604.     }
  605.     if ($xhour == $hour) {
  606.         $sel = "selected";
  607.     } else {
  608.         $sel = "";
  609.     }
  610.     echo "<option name=hour $sel>$xhour</option>";
  611.     $xhour = $dummy;
  612.     $xhour++;
  613.     }
  614.     echo "</select>";
  615.     echo " : <select name=min>";
  616.     $xmin = 0;
  617.     while ($xmin <= 59) {
  618.     if (($xmin == 0) OR ($xmin == 5)) {
  619.         $xmin = "0$xmin";
  620.     }
  621.     if ($xmin == $min) {
  622.         $sel = "selected";
  623.     } else {
  624.         $sel = "";
  625.     }
  626.     echo "<option name=min $sel>$xmin</option>";
  627.     $xmin = $xmin + 5;
  628.     }
  629.     echo "</select>";
  630.     echo " : 00<br><br>    
  631.  
  632.     <select name=op>
  633.         <option value=DeleteStory>".translate("DeleteStory")."</option>
  634.         <option value=QautoPreview SELECTED>".translate("PreviewAgain")."</option>
  635.         <option value=QautoSave>".translate("PostStory")."</option>
  636.     </select>
  637.     <INPUT type=submit value=".translate("Go!")."></FORM>
  638.     </td></tr></table></td></tr></table>";
  639.     include ('footer.php');
  640. }
  641.  
  642. function QautoSave($year, $day, $month, $hour, $min, $qid, $uid, $author, $subject, $hometext, $bodytext, $topic, $notes) {
  643.     global $aid, $ultramode;
  644.     if ($day < 10) {
  645.     $day = "0$day";
  646.     }
  647.     if ($month < 10) {
  648.     $month = "0$month";
  649.     }
  650.     $sec = "00";
  651.     $date = "$year-$month-$day $hour:$min:$sec";    
  652.     if ($uid == -1) $author = "";
  653.     if ($hometext == $bodytext) $bodytext = "";
  654.     $subject = stripslashes(FixQuotes($subject));
  655.     $hometext = stripslashes(FixQuotes($hometext));
  656.     $bodytext = stripslashes(FixQuotes($bodytext));
  657.     $notes = stripslashes(FixQuotes($notes));
  658.     $result = mysql_query("insert into autonews values (NULL, '$aid', '$subject', '$date', '$hometext', '$bodytext', '$topic', '$author', '$notes')");
  659.     if (!$result) {
  660.         echo mysql_errno(). ": ".mysql_error(). "<br>";
  661.         return;
  662.     }
  663.     if ($uid == -1) {
  664.     } else {
  665.         mysql_query("update users set counter=counter+1 where uid='$uid'");
  666.     }
  667.         mysql_query("update authors set counter=counter+1 where aid='$aid'");
  668.     if ($ultramode) {
  669.             ultramode();
  670.     }
  671.     mysql_query("delete from queue where qid=$qid");
  672.     Header("Location: admin.php?op=submissions");
  673. }
  674.  
  675. function autoDelete($anid) {
  676.     mysql_query("delete from autonews where anid=$anid");
  677.     Header("Location: admin.php?op=autoStory");
  678. }
  679.  
  680. function autoEdit($anid) {
  681.     global $aid, $admin, $hlpfile, $tipath;
  682.     include ("header.php");
  683.     $result = mysql_query("select aid, title, time, hometext, bodytext, topic, informant, notes from autonews where anid=$anid");
  684.     list($aid, $title, $time, $hometext, $bodytext, $topic, $informant, $notes) = mysql_fetch_row($result);
  685.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
  686.     GraphicAdmin($hlpfile);
  687.     OpenTable();
  688.     $today = getdate();
  689.     $tday = $today[mday];
  690.     if ($tday < 10){
  691.     $tday = "0$tday";
  692.     }
  693.     $tmonth = $today[month];
  694.     $tyear = $today[year];
  695.     $thour = $today[hours];
  696.     if ($thour < 10){
  697.     $thour = "0$thour";
  698.     }
  699.     $tmin = $today[minutes];
  700.     if ($tmin < 10){
  701.     $tmin = "0$tmin";
  702.     }
  703.     $tsec = $today[seconds];
  704.     if ($tsec < 10){
  705.     $tsec = "0$tsec";
  706.     }
  707.     $date = "$tmonth $tday, $tyear @ $thour:$tmin:$tsec";        
  708.     echo "
  709.     <font size=4><b><center>".translate("Edit Automated Story")."</b></font><br><br><br>
  710.     <form action=\"admin.php\" method=post>
  711.     </b></center>";
  712.     $title = stripslashes($title);
  713.     $hometext = stripslashes($hometext);
  714.     $bodytext = stripslashes($bodytext);
  715.     $notes = stripslashes($notes);
  716.     $result=mysql_query("select topicimage from topics where topicid=$topic");
  717.     list($topicimage) = mysql_fetch_row($result);
  718.     echo "<center><br>
  719.     <table border=0 width=75% cellpadding=0 cellspacing=1 bgcolor=000000><tr><td>
  720.     <table border=0 width=100% cellpadding=8 cellspacing=1 bgcolor=FFFFFF><tr><td>";
  721.     echo "";
  722.     echo "<img src=$tipath$topicimage border=0 align=right>";
  723.     themepreview($title, $hometext, $bodytext);
  724.     echo "</td></tr></table></td></tr></table></center>
  725.     <p><b>".translate("Title")."</b><br>
  726.     <input class=textbox type=text name=title size=50 value=\"$title\"><BR>
  727.     <p><b>".translate("Topic")."</b> <select name=topic>";
  728.     $toplist = mysql_query("select topicid, topictext from topics order by topictext");
  729.     echo "<OPTION VALUE=\"\">".translate("All Topics")."</option>\n";
  730.     while(list($topicid, $topics) = mysql_fetch_row($toplist)) {
  731.     if ($topicid==$topic) { $sel = "selected "; }
  732.         echo "<option $sel value=\"$topicid\">$topics</option>\n";
  733.     $sel = "";
  734.     }
  735.     echo "</select>
  736.     <p><b>".translate("The Story")."</b><br>
  737.     <textarea class=textbox wrap=virtual cols=50 rows=12 name=hometext>$hometext</textarea><BR><BR>
  738.     <p><b>".translate("Extended Text")."</b><br>
  739.     <textarea class=textbox wrap=virtual cols=50 rows=12 name=bodytext>$bodytext</textarea><BR><BR>";
  740.     if ($aid != $informant) {
  741.         echo "<p><b>".translate("Notes")."</b><br>
  742.     <textarea class=textbox wrap=virtual cols=50 rows=4 name=notes>$notes</textarea><BR><BR>";
  743.     }
  744.     echo "<font size=3><b>".translate("When do you want to publish this story?")."</b></font><br><br>";
  745.     echo "".translate("Now is:")." $date<br><br>";
  746.     $xday = 1;
  747.     echo "".translate("Day:")." <select name=day>";
  748.     while ($xday <= 31) {
  749.     if ($xday == $datetime[3]) {
  750.         $sel = "selected";
  751.     } else {
  752.         $sel = "";
  753.     }
  754.     echo "<option name=day $sel>$xday</option>";
  755.     $xday++;
  756.     }
  757.     echo "</select>";
  758.     $xmonth = 1;
  759.     echo "".translate("Month:")." <select name=month>";
  760.     while ($xmonth <= 12) {
  761.     if ($xmonth == $datetime[2]) {
  762.         $sel = "selected";
  763.     } else {
  764.         $sel = "";
  765.     }
  766.     echo "<option name=month $sel>$xmonth</option>";
  767.     $xmonth++;
  768.     }
  769.     echo "</select>";
  770.     echo "".translate("Year:")." <input type=text name=year value=$datetime[1] size=5 maxlength=4>";
  771.     echo "<br>".translate("Hour:")." <select name=hour>";
  772.     $xhour = 0;
  773.     $cero = "0";
  774.     while ($xhour <= 23) {
  775.     $dummy = $xhour;
  776.     if ($xhour < 10) {
  777.         $xhour = "$cero$xhour";
  778.     }
  779.     if ($xhour == $datetime[4]) {
  780.         $sel = "selected";
  781.     } else {
  782.         $sel = "";
  783.     }
  784.     echo "<option name=hour $sel>$xhour</option>";
  785.     $xhour = $dummy;
  786.     $xhour++;
  787.     }
  788.     echo "</select>";
  789.     echo " : <select name=min>";
  790.     $xmin = 0;
  791.     while ($xmin <= 59) {
  792.     if (($xmin == 0) OR ($xmin == 5)) {
  793.         $xmin = "0$xmin";
  794.     }
  795.     if ($xmin == $datetime[5]) {
  796.         $sel = "selected";
  797.     } else {
  798.         $sel = "";
  799.     }
  800.     echo "<option name=min $sel>$xmin</option>";
  801.     $xmin = $xmin + 5;
  802.     }
  803.     echo "</select>";
  804.     echo " : 00<br><br>
  805.     <input type=hidden name=anid value=$anid>
  806.     <input type=hidden name=op value=autoSaveEdit>
  807.     <INPUT type=submit value=\"".translate("Save Changes")."\">
  808.     </form></td></tr></table></td></tr></table>";
  809.     include ('footer.php');
  810.  
  811. }
  812.  
  813. function autoSaveEdit($anid, $year, $day, $month, $hour, $min, $title, $hometext, $bodytext, $topic, $notes) {
  814.     global $aid, $admin, $ultramode;
  815.     if ($day < 10) {
  816.     $day = "0$day";
  817.     }
  818.     if ($month < 10) {
  819.     $month = "0$month";
  820.     }
  821.     $sec = "00";
  822.     $date = "$year-$month-$day $hour:$min:$sec";
  823.     $title = stripslashes(FixQuotes($title));
  824.     $hometext = stripslashes(FixQuotes($hometext));
  825.     $bodytext = stripslashes(FixQuotes($bodytext));
  826.     $notes = stripslashes(FixQuotes($notes));
  827.     $result = mysql_query("update autonews set title='$title', time='$date', hometext='$hometext', bodytext='$bodytext', topic='$topic', notes='$notes' where anid=$anid");
  828.     if (!$result) {
  829.     echo mysql_errno(). ": ".mysql_error(). "<br>";
  830.     exit();
  831.     }
  832.     if ($ultramode) {
  833.     ultramode();
  834.     }
  835.     Header("Location: admin.php?op=autoStory");
  836. }
  837.  
  838. switch($op) {
  839.         case "autoDelete":
  840.             autodelete($anid);
  841.             break;
  842.     
  843.         case "QautoPreview":
  844.             QautoPreview($year, $day, $month, $hour, $min, $qid, $uid, $author, $subject, $hometext, $bodytext, $topic, $notes);
  845.             break;
  846.             
  847.         case "QautoStory":
  848.             QautoStory($qid);
  849.             break;
  850.             
  851.         case "QautoSave":
  852.             QautoSave($year, $day, $month, $hour, $min, $qid, $uid, $author, $subject, $hometext, $bodytext, $topic, $notes);
  853.             break;
  854.         
  855.         case "autoStory":
  856.             autoStory();
  857.             break;
  858.             
  859.         case "autoSaveStory":
  860.             autoSaveStory($year, $day, $month, $hour, $min, $subject, $hometext, $bodytext, $topic);
  861.             break;
  862.         
  863.         case "autoPreviewStory":
  864.             autoPreviewStory($year, $day, $month, $hour, $min, $subject, $hometext, $bodytext, $topic);
  865.             break;
  866.  
  867.         case "autoEdit":
  868.             autoEdit($anid);
  869.             break;
  870.  
  871.         case "autoSaveEdit":
  872.             autoSaveEdit($anid, $year, $day, $month, $hour, $min, $title, $hometext, $bodytext, $topic, $notes);
  873.             break;
  874.  
  875. }
  876.  
  877. } else {
  878.     echo "Access Denied";
  879. }
  880.  
  881. ?>