Exemplo n.º 1
0
function reply_message($group, $group_filter, $start, $msg, $search, $threaded, $sender)
{
    // Figure out which messages to show...
    $stream = nntp_connect();
    $matches = nntp_search($stream, $group, $search, $threaded);
    $count = count($matches);
    if ($msg < 1 || $msg > $count) {
        nntp_close($stream);
        return;
    }
    $fields = explode("\t", $matches[$msg - 1]);
    $msgnum = (int) $fields[0];
    $subject = eregi_replace("\\[[a-z]+\\.[a-z]+\\] ", "", $fields[1]);
    $author = sanitize_email($fields[2]);
    $date = htmlspecialchars($fields[3], ENT_QUOTES);
    if (strncasecmp($subject, "re:", 3)) {
        $subject = "Re: " . $subject;
    }
    $status = nntp_command($stream, "BODY {$msgnum}", 222);
    if ((int) $status != 222) {
        nntp_close($stream);
        nntp_error("We were unable to reply to the requested message for the following " . "reason:", $status, $group);
        return;
    }
    $body = "";
    while ($line = fgets($stream, 1024)) {
        $line = rtrim($line);
        if ($line == ".") {
            break;
        }
        $body = $body . "> " . $line . "\n";
    }
    nntp_close($stream);
    new_message($group, $group_filter, $start, $subject, $sender, $body);
}
Exemplo n.º 2
0
<?php

// new_message.php
// Write a new message
if (!isset($inIndex) || !$inIndex) {
    include "../../redirect.php";
} else {
    new_message();
}
function new_message()
{
    global $baseURL, $loggedUser, $objObserver, $objMessages, $dateformat, $objPresentations, $instDir;
    if ($loggedUser != "") {
        if (isset($_GET["id"])) {
            $id = $_GET["id"];
        } else {
            $id = -1;
        }
        $senderName = $objObserver->getObserverProperty($loggedUser, "firstname") . "&nbsp;" . $objObserver->getObserverProperty($loggedUser, "name");
        echo "<div>";
        echo "<form class=\"form-horizontal\" role=\"form\" action=\"" . $baseURL . "index.php\" method=\"post\" enctype=\"multipart/form-data\">";
        echo "<input type=\"hidden\" name=\"indexAction\"   value=\"validate_message\" />";
        echo "<h4>" . LangNewMessage;
        $content = "<button class=\"pull-right btn btn-success\" type=\"submit\" name=\"newmessage\" />" . LangSendMessage . "</button>";
        echo $content;
        echo "</h4>";
        if ($id != -1) {
            $receiverId = $objMessages->getSender($id);
        } else {
            $receiverId = $_GET['receiver'];
        }