Exemplo n.º 1
0
function htmldb_render_table($result, $options = 0)
{
    $row = db_fetch_assoc($result);
    if (!$row) {
        echo "Table empty";
        return;
    }
    if (!$options) {
        $options = array();
    }
    if (isset($options['SHOW_COLS'])) {
        $show_cols = $options['SHOW_COLS'];
    } else {
        if (isset($options['SKIP_COLS'])) {
            $skip_cols = $options['SKIP_COLS'];
        }
    }
    html_start_table();
    $headers = array_keys($row);
    if (isset($options['ROW_NUM'])) {
        $headers = array_merge(array('#'), $headers);
    }
    html_render_th_row($headers);
    $row_no = 1;
    do {
        $cells = array();
        /* If so was requested, number the row */
        if (isset($options['ROW_NUM'])) {
            $cells[] = $row_no;
        }
        foreach ($row as $fld => $val) {
            if (isset($show_cols) && !isset($show_cols[$fld])) {
                continue;
            } else {
                if (isset($skip_cols) && isset($skip_cols[$fld])) {
                    continue;
                }
            }
            if (isset($options[$fld])) {
                $val = _option_process($val, $row, $options[$fld]);
            }
            $cells[] = $val;
        }
        html_render_table_row($cells);
        $row_no++;
    } while ($row = db_fetch_assoc($result));
    html_end_table();
}
Exemplo n.º 2
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();
}
Exemplo n.º 3
0
if ($file != "") {
    print "<h1>Download</h1>\n";
    print "<p>Your download should begin shortly. If not, please " . "<a href='{$site}/{$file}'>click here</a> to download the file " . "from the current mirror.</p>\n" . "<form action='{$PHP_SELF}' method='GET' name='download'>\n" . "<input type='hidden' name='FILE' value='" . htmlspecialchars($file, ENT_QUOTES) . "'>\n" . "<input type='hidden' name='VERSION' value='" . htmlspecialchars($version, ENT_QUOTES) . "'>\n";
    reset($MIRRORS);
    while (list($key, $val) = each($MIRRORS)) {
        print "<input type='radio' name='SITE' value='{$key}' " . "onClick='document.download.submit();'";
        if ($site == $key) {
            print "  checked";
        }
        print ">{$val['0']}<br>\n";
    }
    print "<p><input type='submit' value='Change Mirror Site'>\n" . "</form>\n";
} else {
    // Show files...
    print "<h1>Releases</h1>\n";
    html_start_table(array("Version", "Filename", "Size", "MD5 Sum"));
    $curversion = "";
    for ($i = 0; $i < sizeof($files); $i++) {
        // Grab the data for the current file...
        $data = explode(" ", $files[$i]);
        $md5 = $data[0];
        $fversion = $data[1];
        $filename = $data[2];
        $basename = basename($filename);
        if ($fversion == $version) {
            $cs = "<th>";
            $ce = "</th>";
        } else {
            $cs = "<td align='center'>";
            $ce = "</td>";
        }
Exemplo n.º 4
0
 }
 if ($count > $PAGE_MAX) {
     print "<table border='0' cellspacing='0' cellpadding='0' " . "width='100%'>\n";
     print "<tr><td>";
     if ($index > 0) {
         print "<a href='{$PHP_SELF}?L+I{$prev}+Q" . urlencode($search) . "'>Previous&nbsp;{$PAGE_MAX}</a>";
     }
     print "</td><td align='right'>";
     if ($end < $count) {
         $next_count = min($PAGE_MAX, $count - $end);
         print "<a href='{$PHP_SELF}?L+I{$next}+Q" . urlencode($search) . "'>Next&nbsp;{$next_count}</a>";
     }
     print "</td></tr>\n";
     print "</table>\n";
 }
 html_start_table(array("ID", "Title", "Last Modified", "Comment(s)"));
 db_seek($result, $index);
 for ($i = 0; $i < $PAGE_MAX && ($row = db_next($result)); $i++) {
     html_start_row();
     $id = $row['id'];
     $link = "<a href='{$PHP_SELF}?L{$id}{$options}' alt='Article #{$id}'>";
     print "<td nowrap>";
     if ($LOGIN_LEVEL >= AUTH_DEVEL) {
         print "<input type='checkbox' name='ID_{$row['id']}'>";
     }
     print "{$link}{$id}</a></td>";
     $temp = htmlspecialchars($row['title']);
     if ($row['is_published'] == 0) {
         $temp .= " <img src='images/private.gif' width='16' height='16' " . "border='0' align='absmiddle' alt='Private'>";
     }
     print "<td align='center' width='67%'>{$link}{$temp}</a></td>";
Exemplo n.º 5
0
 html_header("Polls");
 if ($LOGIN_LEVEL > AUTH_USER) {
     // Show all polls and allow poll creation...
     $result = db_query("SELECT * FROM poll ORDER BY id DESC");
     html_start_links(1);
     html_link("Add New Poll", "{$PHP_SELF}?n");
     html_end_links(1);
 } else {
     // Only show published polls...
     $result = db_query("SELECT * FROM poll WHERE is_published = 1 " . "ORDER BY id DESC");
 }
 print "<h1>Polls</h1>\n";
 if (db_count($result) == 0) {
     print "<p>No polls found.</p>\n";
 } else {
     html_start_table(array("ID", "Question::2"));
     while ($row = db_next($result)) {
         $id = $row['id'];
         $votes = $row['votes'];
         $question = htmlspecialchars($row['question']);
         $ccount = count_comments("poll.php_r{$id}");
         if ($ccount == 1) {
             $ccount .= " comment";
         } else {
             $ccount .= " comments";
         }
         html_start_row();
         print "<td align='center'>#{$row['id']}</td>" . "<td align='center' width='67%'>{$question}";
         if (!$row['is_published']) {
             print " <img src='images/private.gif' width='16' height='16' " . "align='middle' alt='private'/>";
         }
Exemplo n.º 6
0
             $link = "<a href='links.php?UL{$id}'>";
         }
         html_start_row();
         print "<td align='center' nowrap>{$link}{$id}</a></td>" . "<td width='67%' align='center'>{$link}{$title}</a></td>" . "<td align='center'>{$link}{$date}</a></td>";
         html_end_row();
     }
     html_end_table();
 }
 db_free($result);
 print "<h2>New/Pending STRs:</h2>\n";
 $result = db_query("SELECT * FROM str WHERE status >= {$STR_STATUS_PENDING} " . "AND (manager_email == '' OR manager_email = '{$email}') " . "ORDER BY status DESC, priority DESC, scope DESC, " . "modify_date");
 $count = db_count($result);
 if ($count == 0) {
     print "<p>No new/pending STRs found.</p>\n";
 } else {
     html_start_table(array("Id", "Priority", "Status", "Scope", "Summary", "Version", "Last Updated", "Assigned To"));
     while ($row = db_next($result)) {
         $date = date("M d, Y", $row['modify_date']);
         $summary = htmlspecialchars($row['summary'], ENT_QUOTES);
         $summabbr = htmlspecialchars(abbreviate($row['summary'], 80), ENT_QUOTES);
         $prtext = $priority_text[$row['priority']];
         $sttext = $status_text[$row['status']];
         $sctext = $scope_text[$row['scope']];
         if ($row['is_published'] == 0) {
             $summabbr .= " <img src='images/private.gif' width='16' height='16' " . "border='0' align='middle' alt='Private'>";
         }
         html_start_row();
         print "<td nowrap>" . "<a href='str.php?L{$row['id']}{$options}' alt='STR #{$row['id']}: {$summary}'>" . "{$row['id']}</a></td>" . "<td align='center'>{$prtext}</td>" . "<td align='center'>{$sttext}</td>" . "<td align='center'>{$sctext}</td>" . "<td align='center'><a href='str.php?L{$row['id']}{$options}' " . "alt='STR #{$row['id']}: {$summary}'>{$summabbr}</a></td>" . "<td align='center'>{$row['str_version']}</td>" . "<td align='center'>{$date}</td>";
         if ($row['manager_email'] != "") {
             $email = sanitize_email($row['manager_email']);
         } else {