Beispiel #1
0
function show_message($group, $group_filter, $start, $msg, $search, $threaded)
{
    global $PHP_SELF, $_COOKIE, $options;
    //  print("<!-- show_message(group='$group', group_filter='$group_filter', "
    //       ."start=$start, msg=$msg, search='$search', threaded=$threaded) -->\n");
    // Figure out which messages to show...
    $stream = nntp_connect();
    $matches = nntp_search($stream, $group, $search, $threaded);
    $count = count($matches);
    if ($msg[0] == ':') {
        // Lookup a specific message ID...
        $msg = (int) substr($msg, 1);
        for ($i = 0; $i < $count; $i++) {
            $fields = explode("\t", $matches[$i]);
            if ($msg == $fields[0]) {
                break;
            }
        }
        if ($i >= $count) {
            nntp_error("We were unable to show the requested message for the following " . "reason:", "The message number ({$msg}) is out of range.", $group);
            nntp_close($stream);
            return;
        }
        $msg = $i;
    } else {
        // Lookup index into search...
        if ($msg < 1 || $msg > $count) {
            nntp_error("We were unable to show the requested message for the following " . "reason:", "The message number is out of range.", $group);
            nntp_close($stream);
            return;
        }
        $fields = explode("\t", $matches[$msg - 1]);
    }
    //  print("<!-- fields =");
    //  print_r($fields);
    //  print("-->\n");
    $msgnum = (int) $fields[0];
    $subject = htmlspecialchars(eregi_replace("\\[[a-z]+\\.[a-z]+\\] ", "", $fields[1]), ENT_QUOTES);
    $author = sanitize_email($fields[2]);
    $date = format_date($fields[3]);
    if ($subject == "") {
        $subject = "(No Subject)";
    }
    // Save last message read...
    $cookie = str_replace(".", "_", $group);
    if ($search == "" && (!array_key_exists($group, $_COOKIE) || (int) $_COOKIE[$cookie] < $msgnum)) {
        setcookie($cookie, $msgnum, time() + 90 * 86400, "/");
    }
    $status = nntp_command($stream, "BODY {$msgnum}", 222);
    if ((int) $status != 222) {
        nntp_close($stream);
        nntp_error("We were unable to show the requested message for the following " . "reason:", $status, $group);
        return NULL;
    }
    $body = "";
    while ($line = fgets($stream, 1024)) {
        $line = rtrim($line);
        if ($line == ".") {
            break;
        }
        $body = $body . $line . "\n";
    }
    nntp_close($stream);
    $body = quote_text($body);
    nntp_header("{$subject}", array("All Forums" => "forums.php?g{$options}", "Back to {$group}" => "forums.php?g{$group}+s{$start}{$options}"));
    show_prevnext_msg($group, $group_filter, $start, $count, $msg, $threaded);
    html_start_table(array($subject, $author, $date), "", "", TRUE);
    html_start_row();
    print "<td colspan='3'><tt>{$body}</tt><br />\n" . "[&nbsp;<a href='{$PHP_SELF}?g{$group}+v:{$msgnum}'>Direct&nbsp;Link" . "&nbsp;to&nbsp;Message</a>&nbsp;]</td>";
    html_end_row();
    html_end_table();
    show_prevnext_msg($group, $group_filter, $start, $count, $msg, $threaded);
    html_footer();
}
Beispiel #2
0
            $ce = "</th>";
        } else {
            $cs = "<td align='center'>";
            $ce = "</td>";
        }
        if ($fversion != $curversion) {
            if ($curversion != "") {
                html_start_row("header");
                print "<th colspan='4'></th>";
                html_end_row();
            }
            $curversion = $fversion;
            html_start_row();
            print "{$cs}<a name='{$fversion}'>{$fversion}</a>{$ce}";
        } else {
            html_start_row();
            print "{$cs}{$ce}";
        }
        if (file_exists("/home/ftp.easysw.com/pub/{$filename}")) {
            $kbytes = (int) ((filesize("/home/ftp.easysw.com/pub/{$filename}") + 1023) / 1024);
        } else {
            $kbytes = "???";
        }
        print "{$cs}<a href='{$PHP_SELF}?VERSION={$version}&amp;FILE={$filename}'>" . "<tt>{$basename}</tt></a>{$ce}" . "{$cs}{$kbytes}k{$ce}" . "{$cs}<tt>{$md5}</tt>{$ce}";
        html_end_row();
    }
    html_end_table();
    print "<h1><a name='SVN'>Subversion Access</a></h1>\n" . "<p>The {$PROJECT_NAME} software is available via Subversion " . "using the following URL:</p>\n" . "<pre>\n" . "    <a href='http://svn.easysw.com/public/{$PROJECT_MODULE}/'>" . "http://svn.easysw.com/public/{$PROJECT_MODULE}/</a>\n" . "</pre>\n" . "<p>The following command can be used to checkout the current " . "{$PROJECT_NAME} source from Subversion:</p>\n" . "<pre>\n" . "    <kbd>svn co http://svn.easysw.com/public/{$PROJECT_MODULE}/trunk/ {$PROJECT_MODULE}</kbd>\n" . "</pre>\n";
}
// Show the standard footer...
html_footer();