Пример #1
0
 function previewAdminStory($automated, $year, $day, $month, $hour, $min, $subject, $hometext, $bodytext, $topic, $catid, $ihome, $alanguage, $acomm, $pollTitle, $optionText, $assotop)
 {
     global $user, $bgcolor1, $bgcolor2, $prefix, $db, $alanguage, $multilingual;
     include 'header.php';
     if ($topic < 1) {
         $topic = 1;
     }
     GraphicAdmin();
     OpenTable();
     echo "<center><font class=\"title\"><b>" . _ARTICLEADMIN . "</b></font></center>";
     CloseTable();
     echo "<br>";
     $today = getdate();
     $tday = $today[mday];
     if ($tday < 10) {
         $tday = "0{$tday}";
     }
     $tmonth = $today[month];
     $tyear = $today[year];
     $thour = $today[hours];
     if ($thour < 10) {
         $thour = "0{$thour}";
     }
     $tmin = $today[minutes];
     if ($tmin < 10) {
         $tmin = "0{$tmin}";
     }
     $tsec = $today[seconds];
     if ($tsec < 10) {
         $tsec = "0{$tsec}";
     }
     $date = "{$tmonth} {$tday}, {$tyear} @ {$thour}:{$tmin}:{$tsec}";
     OpenTable();
     echo "<center><font class=\"option\"><b>" . _PREVIEWSTORY . "</b></font></center><br><br>" . "<form action=\"admin.php\" method=\"post\">" . "<input type=\"hidden\" name=\"catid\" value=\"{$catid}\">";
     $subject = stripslashes($subject);
     $subject = ereg_replace("\"", "''", $subject);
     $hometext = stripslashes($hometext);
     $bodytext = stripslashes($bodytext);
     $result = $db->sql_query("select topicimage from " . $prefix . "_topics where topicid='{$topic}'");
     list($topicimage) = $db->sql_fetchrow($result);
     echo "<table border=\"0\" width=\"75%\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"{$bgcolor2}\" align=\"center\"><tr><td>" . "<table border=\"0\" width=\"100%\" cellpadding=\"8\" cellspacing=\"1\" bgcolor=\"{$bgcolor1}\"><tr><td>" . "<img src=\"images/topics/{$topicimage}\" border=\"0\" align=\"right\" alt=\"\">";
     themepreview($subject, $hometext, $bodytext);
     echo "</td></tr></table></td></tr></table>" . "<br><br><b>" . _TITLE . "</b><br>" . "<input type=\"text\" name=\"subject\" size=\"50\" value=\"{$subject}\"><br><br>" . "<b>" . _TOPIC . "</b><select name=\"topic\">";
     $toplist = $db->sql_query("select topicid, topictext from " . $prefix . "_topics order by topictext");
     echo "<option value=\"\">" . _ALLTOPICS . "</option>\n";
     while (list($topicid, $topics) = $db->sql_fetchrow($toplist)) {
         $topicid = intval($topicid);
         if ($topicid == $topic) {
             $sel = "selected ";
         }
         echo "<option {$sel} value=\"{$topicid}\">{$topics}</option>\n";
         $sel = "";
     }
     echo "</select><br><br>";
     for ($i = 0; $i < sizeof($assotop); $i++) {
         $associated .= "{$assotop[$i]}-";
     }
     $asso_t = explode("-", $associated);
     echo "<table border='0' width='100%' cellspacing='0'><tr><td width='20%'><b>" . _ASSOTOPIC . "</b></td><td width='100%'>" . "<table border='1' cellspacing='3' cellpadding='8'><tr>";
     $sql = "SELECT topicid, topictext FROM " . $prefix . "_topics ORDER BY topictext";
     $result = $db->sql_query($sql);
     while ($row = $db->sql_fetchrow($result)) {
         if ($a == 3) {
             echo "</tr><tr>";
             $a = 0;
         }
         for ($i = 0; $i < sizeof($asso_t); $i++) {
             if ($asso_t[$i] == $row[topicid]) {
                 $checked = "CHECKED";
                 break;
             }
         }
         echo "<td><input type='checkbox' name='assotop[]' value='{$row['topicid']}' {$checked}>{$row['topictext']}</td>";
         $checked = "";
         $a++;
     }
     echo "</tr></table></td></tr></table><br><br>";
     $cat = $catid;
     SelectCategory($cat);
     echo "<br>";
     puthome($ihome, $acomm);
     if ($multilingual == 1) {
         echo "<br><b>" . _LANGUAGE . ": </b>" . "<select name=\"alanguage\">";
         $handle = opendir('language');
         while ($file = readdir($handle)) {
             if (preg_match("/^lang\\-(.+)\\.php/", $file, $matches)) {
                 $langFound = $matches[1];
                 $languageslist .= "{$langFound} ";
             }
         }
         closedir($handle);
         $languageslist = explode(" ", $languageslist);
         sort($languageslist);
         for ($i = 0; $i < sizeof($languageslist); $i++) {
             if ($languageslist[$i] != "") {
                 echo "<option value=\"{$languageslist[$i]}\" ";
                 if ($languageslist[$i] == $alanguage) {
                     echo "selected";
                 }
                 echo ">" . ucfirst($languageslist[$i]) . "</option>\n";
             }
         }
         if ($alanguage == "") {
             $sellang = "selected";
         } else {
             $sellang = "";
         }
         echo "<option value=\"\" {$sellang}>" . _ALL . "</option></select>";
     } else {
         echo "<input type=\"hidden\" name=\"alanguage\" value=\"{$language}\">";
     }
     echo "<br><br><b>" . _STORYTEXT . "</b><br>" . "<textarea wrap=\"virtual\" cols=\"50\" rows=\"12\" name=\"hometext\">{$hometext}</textarea><br><br>" . "<b>" . _EXTENDEDTEXT . "</b><br>" . "<textarea wrap=\"virtual\" cols=\"50\" rows=\"12\" name=\"bodytext\">{$bodytext}</textarea><br><br>";
     if ($automated == 1) {
         $sel1 = "checked";
         $sel2 = "";
     } else {
         $sel1 = "";
         $sel2 = "checked";
     }
     echo "<br><b>" . _PROGRAMSTORY . "</b>&nbsp;&nbsp;" . "<input type=\"radio\" name=\"automated\" value=\"1\" {$sel1}>" . _YES . " &nbsp;&nbsp;" . "<input type=\"radio\" name=\"automated\" value=\"0\" {$sel2}>" . _NO . "<br><br>" . "" . _NOWIS . ": {$date}<br><br>";
     $xday = 1;
     echo "" . _DAY . ": <select name=\"day\">";
     while ($xday <= 31) {
         if ($xday == $day) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"day\" {$sel}>{$xday}</option>";
         $xday++;
     }
     echo "</select>";
     $xmonth = 1;
     echo "" . _UMONTH . ": <select name=\"month\">";
     while ($xmonth <= 12) {
         if ($xmonth == $month) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"month\" {$sel}>{$xmonth}</option>";
         $xmonth++;
     }
     echo "</select>";
     echo "" . _YEAR . ": <input type=\"text\" name=\"year\" value=\"{$year}\" size=\"5\" maxlength=\"4\">";
     echo "<br>" . _HOUR . ": <select name=\"hour\">";
     $xhour = 0;
     $cero = "0";
     while ($xhour <= 23) {
         $dummy = $xhour;
         if ($xhour < 10) {
             $xhour = "{$cero}{$xhour}";
         }
         if ($xhour == $hour) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"hour\" {$sel}>{$xhour}</option>";
         $xhour = $dummy;
         $xhour++;
     }
     echo "</select>";
     echo ": <select name=\"min\">";
     $xmin = 0;
     while ($xmin <= 59) {
         if ($xmin == 0 or $xmin == 5) {
             $xmin = "0{$xmin}";
         }
         if ($xmin == $min) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"min\" {$sel}>{$xmin}</option>";
         $xmin = $xmin + 5;
     }
     echo "</select>";
     echo ": 00<br><br>" . "<select name=\"op\">" . "<option value=\"PreviewAdminStory\" selected>" . _PREVIEWSTORY . "</option>" . "<option value=\"PostAdminStory\">" . _POSTSTORY . "</option>" . "</select>" . "<input type=\"submit\" value=\"" . _OK . "\">";
     CloseTable();
     echo "<br>";
     putpoll($pollTitle, $optionText);
     echo "</form>";
     include 'footer.php';
 }
Пример #2
0
 function previewAdminStory($automated, $year, $day, $month, $hour, $min, $subject, $hometext, $bodytext, $topic, $catid, $ihome, $alanguage, $acomm, $pollTitle, $optionText, $assotop)
 {
     global $user, $bgcolor1, $bgcolor2, $prefix, $db, $alanguage, $multilingual, $admin_file;
     include 'header.php';
     if ($topic < 1) {
         $topic = 1;
     }
     GraphicAdmin();
     OpenTable();
     echo "<center><font class=\"title\"><b>" . _ARTICLEADMIN . "</b></font></center>";
     CloseTable();
     echo "<br>";
     $today = getdate();
     $tday = $today['mday'];
     if ($tday < 10) {
         $tday = "0{$tday}";
     }
     $tmonth = $today['month'];
     $tyear = $today['year'];
     $thour = $today['hours'];
     if ($thour < 10) {
         $thour = "0{$thour}";
     }
     $tmin = $today['minutes'];
     if ($tmin < 10) {
         $tmin = "0{$tmin}";
     }
     $tsec = $today['seconds'];
     if ($tsec < 10) {
         $tsec = "0{$tsec}";
     }
     $nowdate = "{$tmonth} {$tday}, {$tyear} @ {$thour}:{$tmin}:{$tsec}";
     OpenTable();
     echo "<center><font class=\"option\"><b>" . _PREVIEWSTORY . "</b></font></center><br>" . "<form action=\"" . $admin_file . ".php\" method=\"post\">" . "<input type=\"hidden\" name=\"catid\" value=\"{$catid}\">";
     $subject = filter($subject, "nohtml", 0, preview);
     $hometext = filter($hometext);
     $bodytext = filter($bodytext);
     $result = $db->sql_query("select topicimage from " . $prefix . "_topics where topicid='{$topic}'");
     list($topicimage) = $result->fetch_row();
     echo "<table border=\"0\" width=\"75%\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"{$bgcolor2}\" align=\"center\"><tr><td>" . "<table border=\"0\" width=\"100%\" cellpadding=\"8\" cellspacing=\"1\" bgcolor=\"{$bgcolor1}\"><tr><td>" . "<img src=\"images/topics/{$topicimage}\" border=\"0\" align=\"right\" alt=\"\">";
     themepreview($subject, $hometext, $bodytext);
     echo "</td></tr></table></td></tr></table><br><br>" . "<table width=\"100%\" border=\"0\" cellspacing=\"6\">" . "<tr><td nowrap><b>" . _TITLE . ":</b></td><td>" . "<input type=\"text\" name=\"subject\" size=\"50\" value=\"{$subject}\"></td></tr>" . "<tr><td nowrap><b>" . _TOPIC . ":</b></td><td><select name=\"topic\">";
     $toplist = $db->sql_query("select topicid, topictext from " . $prefix . "_topics order by topictext");
     echo "<option value=\"\">" . _ALLTOPICS . "</option>\n";
     while (list($topicid, $topics) = $toplist->fetch_row()) {
         $topicid = intval($topicid);
         $topics = filter($topics, "nohtml");
         if ($topicid == $topic) {
             $sel = "selected ";
         }
         echo "<option {$sel} value=\"{$topicid}\">{$topics}</option>\n";
         $sel = "";
     }
     echo "</select></td></tr>";
     for ($i = 0; $i < sizeof($assotop); $i++) {
         $associated .= "{$assotop[$i]}-";
     }
     $asso_t = explode("-", $associated);
     echo "<tr><td nowrap><b>" . _ASSOTOPIC . ":</b></td><td>";
     $sql = "SELECT topicid, topictext FROM " . $prefix . "_topics ORDER BY topictext";
     $result = $db->sql_query($sql);
     echo "<select multiple name=\"assotop[]\" size=\"3\">";
     while ($row = $db->sql_fetchrow($result)) {
         for ($i = 0; $i < sizeof($asso_t); $i++) {
             if ($asso_t[$i] == $row['topicid']) {
                 $checked = "selected";
                 break;
             }
         }
         $row['topicid'] = intval($row['topicid']);
         $row['topictext'] = filter($row['topictext'], "nohtml");
         echo "<option value='" . $row['topicid'] . "' {$checked}>" . $row['topictext'] . "</option>";
         $checked = "";
     }
     echo "</select></td></tr>";
     $cat = $catid;
     $selcat = $db->sql_query("select catid, title from " . $prefix . "_stories_cat order by title");
     $a = 1;
     echo "<tr><td nowrap><b>" . _CATEGORY . ":</b></td><td>";
     echo "<select name=\"catid\">";
     if ($cat == 0) {
         $sel = "selected";
     } else {
         $sel = "";
     }
     echo "<option name=\"catid\" value=\"0\" {$sel}>" . _ARTICLES . "</option>";
     while (list($catid, $title) = $selcat->fetch_row()) {
         $catid = intval($catid);
         $title = filter($title, "nohtml");
         if ($catid == $cat) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"catid\" value=\"{$catid}\" {$sel}>{$title}</option>";
         $a++;
     }
     echo "</select> &nbsp; <a href=\"" . $admin_file . ".php?op=AddCategory\"><img src=\"images/add.gif\" alt=\"" . _ADD . "\" title=\"" . _ADD . "\" border=\"0\" width=\"17\" height=\"17\"></a>  <a href=\"" . $admin_file . ".php?op=EditCategory\"><img src=\"images/edit.gif\" alt=\"" . _EDIT . "\" title=\"" . _EDIT . "\" border=\"0\" width=\"17\" height=\"17\"></a>  <a href=\"" . $admin_file . ".php?op=DelCategory\"><img src=\"images/delete.gif\" alt=\"" . _DELETE . "\" title=\"" . _DELETE . "\" border=\"0\" width=\"17\" height=\"17\"></a>" . "</td></tr>" . "<tr><td nowrap><b>" . _PUBLISHINHOME . "</b></td><td>";
     if ($ihome == 0 or empty($ihome)) {
         $sel1 = "checked";
         $sel2 = "";
     }
     if ($ihome == 1) {
         $sel1 = "";
         $sel2 = "checked";
     }
     echo "<input type=\"radio\" name=\"ihome\" value=\"0\" {$sel1}>" . _YES . "&nbsp;" . "<input type=\"radio\" name=\"ihome\" value=\"1\" {$sel2}>" . _NO . "" . "&nbsp;&nbsp;<font class=\"content\">[ " . _ONLYIFCATSELECTED . " ]</font></td></tr>" . "<tr><td nowrap><b>" . _ACTIVATECOMMENTS . "</b></td><td>";
     if ($acomm == 0 or empty($acomm)) {
         $sel1 = "checked";
         $sel2 = "";
     }
     if ($acomm == 1) {
         $sel1 = "";
         $sel2 = "checked";
     }
     echo "<input type=\"radio\" name=\"acomm\" value=\"0\" {$sel1}>" . _YES . "&nbsp;" . "<input type=\"radio\" name=\"acomm\" value=\"1\" {$sel2}>" . _NO . "</font></td></tr>";
     if ($multilingual == 1) {
         echo "<tr><td nowrap><b>" . _LANGUAGE . ": </b>" . "<select name=\"alanguage\">";
         $handle = opendir('language');
         while ($file = readdir($handle)) {
             if (preg_match("/^lang\\-(.+)\\.php/", $file, $matches)) {
                 $langFound = $matches[1];
                 $languageslist .= "{$langFound} ";
             }
         }
         closedir($handle);
         $languageslist = explode(" ", $languageslist);
         sort($languageslist);
         for ($i = 0; $i < sizeof($languageslist); $i++) {
             if (!empty($languageslist[$i])) {
                 echo "<option value=\"{$languageslist[$i]}\" ";
                 if ($languageslist[$i] == $alanguage) {
                     echo "selected";
                 }
                 echo ">" . ucfirst($languageslist[$i]) . "</option>\n";
             }
         }
         if (empty($alanguage)) {
             $sellang = "selected";
         } else {
             $sellang = "";
         }
         echo "<option value=\"\" {$sellang}>" . _ALL . "</option></select></td></tr>";
     } else {
         echo "<input type=\"hidden\" name=\"alanguage\" value=\"{$language}\"></td></tr>";
     }
     echo "<tr><td nowrap><b>" . _STORYTEXT . ":</b></td><td>" . "<textarea wrap=\"virtual\" cols=\"70\" rows=\"15\" name=\"hometext\">{$hometext}</textarea></td></tr>" . "<tr><td nowrap><b>" . _EXTENDEDTEXT . ":</b></td><td>" . "<textarea wrap=\"virtual\" cols=\"70\" rows=\"15\" name=\"bodytext\">{$bodytext}</textarea></td></tr>";
     if ($automated == 1) {
         $sel1 = "checked";
         $sel2 = "";
     } else {
         $sel1 = "";
         $sel2 = "checked";
     }
     echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>" . "<tr><td nowrap><b>" . _SCHEDULENEWS . ":</b></td><td>" . "<input type=\"radio\" name=\"automated\" value=\"1\" {$sel1}>" . _YES . " &nbsp;&nbsp;" . "<input type=\"radio\" name=\"automated\" value=\"0\" {$sel2}>" . _NO . "</td></tr>";
     $xday = 1;
     echo "<tr><td nowrap><b>" . _PUBLISHON . ":</b></td><td>" . "" . _DAY . ": <select name=\"day\">";
     while ($xday <= 31) {
         if ($xday == $day) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"day\" {$sel}>{$xday}</option>";
         $xday++;
     }
     echo "</select>";
     $xmonth = 1;
     echo " " . _UMONTH . ": <select name=\"month\">";
     while ($xmonth <= 12) {
         if ($xmonth == $month) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"month\" {$sel}>{$xmonth}</option>";
         $xmonth++;
     }
     echo "</select>";
     echo " " . _YEAR . ": <input type=\"text\" name=\"year\" value=\"{$year}\" size=\"5\" maxlength=\"4\">";
     echo " <b>@</b>" . _HOUR . ": <select name=\"hour\">";
     $xhour = 0;
     $cero = "0";
     while ($xhour <= 23) {
         $dummy = $xhour;
         if ($xhour < 10) {
             $xhour = "{$cero}{$xhour}";
         }
         if ($xhour == $hour) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"hour\" {$sel}>{$xhour}</option>";
         $xhour = $dummy;
         $xhour++;
     }
     echo "</select>";
     echo " : <select name=\"min\">";
     $xmin = 0;
     while ($xmin <= 59) {
         if ($xmin == 0 or $xmin == 5) {
             $xmin = "0{$xmin}";
         }
         if ($xmin == $min) {
             $sel = "selected";
         } else {
             $sel = "";
         }
         echo "<option name=\"min\" {$sel}>{$xmin}</option>";
         $xmin = $xmin + 5;
     }
     echo "</select>";
     echo " : 00</td></tr>" . "<tr><td>&nbsp;</td><td>" . _NOWIS . ": {$nowdate}</td></tr>" . "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>" . "<tr><td>&nbsp;</td><td><select name=\"op\">" . "<option value=\"PreviewAdminStory\" selected>" . _PREVIEWSTORY . "</option>" . "<option value=\"PostAdminStory\">" . _POSTSTORY . "</option>" . "</select>" . "&nbsp;&nbsp;<input type=\"submit\" value=\"" . _OK . "\"></td></tr></table>";
     CloseTable();
     echo "<br>";
     putpoll($pollTitle, $optionText);
     echo "</form>";
     include 'footer.php';
 }