Пример #1
0
function account_track_site()
{
    global $theme, $user, $site_name;
    $period = 259200;
    // 3 days
    $sresult = db_query("SELECT s.subject, s.id, COUNT(c.lid) AS count FROM comments c LEFT JOIN stories s ON c.lid = s.id WHERE s.status = '2' AND c.link = 'story' AND " . time() . " - c.timestamp < {$period} GROUP BY c.lid ORDER BY s.timestamp DESC LIMIT 10");
    while ($story = db_fetch_object($sresult)) {
        $output .= "<LI>" . format_plural($story->count, "comment", "comments") . " " . t("attached to story") . " '<A HREF=\"story.php?id={$story->id}\">" . check_output($story->subject) . "</A>':</LI>";
        $cresult = db_query("SELECT c.subject, c.cid, c.pid, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author WHERE c.lid = '{$story->id}' AND c.link = 'story' ORDER BY timestamp DESC LIMIT {$story->count}");
        $output .= "<UL>\n";
        while ($comment = db_fetch_object($cresult)) {
            $output .= " <LI>'<A HREF=\"story.php?id={$story->id}&cid={$comment->cid}&pid={$comment->pid}#{$comment->cid}\">" . check_output($comment->subject) . "</A>' " . t("by") . " " . format_username($comment->userid) . "</LI>\n";
        }
        $output .= "</UL>\n";
    }
    $theme->header();
    $theme->box(strtr(t("Track %a"), array("%a" => $site_name)), $output ? $output : t("No comments or stories posted recently."));
    $theme->footer();
}
Пример #2
0
include_once "includes/story.inc";
function story_render($id, $cid)
{
    global $theme, $user;
    $story = db_fetch_object(db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = '{$id}'"));
    if (story_visible($story)) {
        $theme->story($story, "[ <A HREF=\"story.php?op=reply&id={$id}&pid=0\">" . t("reply to this story") . "</A> ]");
        comment_render($id, $cid);
    } else {
        $theme->box(t("Warning message"), t("The story you requested is not available or does not exist."));
    }
}
switch ($op) {
    case t("Preview comment"):
        $theme->header();
        comment_preview(check_input($pid), check_input($id), $subject ? check_output($subject) : "", $comment ? check_output($comment) : "");
        $theme->footer();
        break;
    case t("Post comment"):
        comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment));
        $theme->header();
        story_render(check_input($id), check_input($cid));
        $theme->footer();
        break;
    case "reply":
        $theme->header();
        comment_reply(check_input($pid), check_input($id));
        $theme->footer();
        break;
    case t("Update settings"):
        comment_settings(check_input($mode), check_input($order), check_input($threshold));
Пример #3
0
        }
    }
    $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();
}
function submit_submit($subject, $abstract, $article, $section)
{
    global $user, $theme;
    // Add log entry:
    watchdog("story", "story: added '{$subject}'");
    // Add submission to SQL table:
    db_query("INSERT INTO stories (author, subject, abstract, article, section, timestamp) VALUES ('{$user->id}', '{$subject}', '{$abstract}', '{$article}', '{$section}', '" . time() . "')");
    // Display confirmation message:
    $theme->header();
    $theme->box(t("Submission completed"), t("Thank you for your submission. Your submission has been whisked away to our submission queue where our registered users will frown at it, poke at it and hopefully carry it to the front page for discussion."));
    $theme->footer();
}
switch ($op) {
    case t("Preview submission"):
        submit_preview($subject ? check_output($subject) : "", $abstract ? check_output($abstract) : "", $article ? check_output($article) : "", check_output($section));
        break;
    case t("Submit submission"):
        submit_submit(check_input($subject), check_input($abstract), check_input($article), check_input($section));
        break;
    default:
        submit_enter();
        break;
}