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(); }
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" . "[ <a href='{$PHP_SELF}?g{$group}+v:{$msgnum}'>Direct Link" . " to Message</a> ]</td>"; html_end_row(); html_end_table(); show_prevnext_msg($group, $group_filter, $start, $count, $msg, $threaded); html_footer(); }
$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}&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(); // // End of "$Id$". //