Ejemplo n.º 1
0
function submit_preview($subject, $abstract, $article, $section)
{
    global $allowed_html, $theme, $user;
    include "includes/story.inc";
    $output .= "<FORM ACTION=\"submit.php\" METHOD=\"post\">\n";
    $output .= "<B>" . t("Your name") . ":</B><BR>\n";
    $output .= format_username($user->userid) . "<P>";
    $output .= "<B>" . t("Subject") . ":</B><BR>\n";
    $output .= "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\" VALUE=\"" . check_textfield($subject) . "\"><P>\n";
    $output .= "<B>" . t("Section") . ":</B><BR>\n";
    foreach ($sections = section_get() as $value) {
        $options .= "  <OPTION VALUE=\"{$value}\"" . ($section == $value ? " SELECTED" : "") . ">{$value}</OPTION>\n";
    }
    $output .= "<SELECT NAME=\"section\">{$options}</SELECT><P>\n";
    $output .= "<B>" . t("Abstract") . ":</B><BR>\n";
    $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"abstract\">" . check_textarea($abstract) . "</TEXTAREA><BR>\n";
    $output .= "<SMALL><I>" . t("Allowed HTML tags") . ": " . htmlspecialchars($allowed_html) . ".</I></SMALL><P>\n";
    $output .= "<B>" . t("Extended story") . ":</B><BR>\n";
    $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"article\">" . check_textarea($article) . "</TEXTAREA><BR>\n";
    $output .= "<SMALL><I>" . t("Allowed HTML tags") . ": " . htmlspecialchars($allowed_html) . ".</I></SMALL><P>\n";
    $duplicate = db_result(db_query("SELECT COUNT(id) FROM stories WHERE subject = '" . check_input($subject) . "'"));
    if (empty($subject)) {
        $output .= "<FONT COLOR=\"red\">" . t("Warning: you did not supply a subject.") . "</FONT><P>\n";
        $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"" . t("Preview submission") . "\">\n";
    } else {
        if (empty($abstract)) {
            $output .= "<FONT COLOR=\"red\">" . t("Warning: you did not supply an abstract.") . "</FONT><P>\n";
            $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"" . t("Preview submission") . "\">\n";
        } else {
            if ($duplicate) {
                $output .= "<FONT COLOR=\"red\">" . t("Warning: there is already a story with that subject.") . "</FONT><P>\n";
                $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"" . t("Preview submission") . "\">\n";
            } else {
                $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"" . t("Preview submission") . "\">\n";
                $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"" . t("Submit submission") . "\">\n";
            }
        }
    }
    $output .= "</FORM>\n";
    $theme->header();
    $theme->story(new Story($user->userid, $subject, $abstract, $article, $section, time()), "[ " . t("reply to this story") . " ]");
    $theme->box(t("Submit a story"), $output);
    $theme->footer();
}
Ejemplo n.º 2
0
<?php

include_once "includes/common.inc";
function find_module($name, $module)
{
    global $options, $type;
    if ($module["find"]) {
        $options .= "<OPTION VALUE=\"{$name}\"" . ($name == $type ? " SELECTED" : "") . ">{$name}</OPTION>\n";
    }
}
module_iterate("find_module");
$search .= "<FORM ACTION=\"search.php\" METHOD=\"POST\">\n";
$search .= " <INPUT SIZE=\"50\" VALUE=\"" . check_textfield($keys) . "\" NAME=\"keys\" TYPE=\"text\">\n";
$search .= " <SELECT NAME=\"type\">{$options}</SELECT>\n";
$search .= " <INPUT TYPE=\"submit\" VALUE=\"" . t("Search") . "\">\n";
$search .= "</FORM>\n";
$output = search_data(check_input($keys), check_input($type));
$theme->header();
$theme->box(t("Search"), $search);
$theme->box(t("Result"), $output);
$theme->footer();