Beispiel #1
0
function format_messages($messages)
{
    global $PHP_SELF;
    $out .= "<table class='messages'>";
    if (count($messages) == 0 or !is_array($messages)) {
        $out .= '<tr><td>No posts on this page</td></tr>';
    } else {
        foreach ($messages as $row) {
            extract($row);
            $shaded = !$shaded;
            $out .= '<tr class="' . ($shaded ? 'shaded' : 'unshaded') . '">';
            $out .= "<td rowspan='2' valign='top' class='poster'>{$poster}<br />{$date}</td>";
            $out .= "<td class='subject'>{$subject}</td>";
            $out .= "</tr>";
            $out .= '<tr class="' . ($shaded ? 'shaded' : 'unshaded') . '">';
            $out .= "<td class='body'>" . wiki_render($body) . "</td>";
            $out .= '</tr>';
        }
    }
    $out .= '</table>';
    if (authorized($USERNAME, 'postcomment')) {
        $out .= hyperlink("{$PHP_SELF}/Comment", 'Post Comment');
    }
    return "<center>" . $out . "</center>";
}
Beispiel #2
0
function motd()
{
    $motd = join('', file(MOTD_FILE));
    $stat = stat(MOTD_FILE);
    $mtime = $stat['mtime'];
    if ($mtime > time() - 60 * 60 * 24 * 7 and trim($motd)) {
        return heading(2, "Message of the Day") . "<blockquote>" . wiki_render(date('M d, Y @ H:i', $mtime) . "\n\n" . $motd) . "</blockquote>";
    }
}
Beispiel #3
0
function handle_content($data, $contenttype)
{
    if (!$contenttype) {
        $contenttype = 'text/html';
    }
    $contenttype = parse_content_type($contenttype);
    if ($contenttype['type'] == 'text') {
        if ($contenttype['subtype'] == "wiki") {
            $data = wiki_render($data, $contenttype['params']);
        } elseif ($contenttype == 'text/plain') {
            $data = '<pre>\\n' . $data . '</pre>';
        }
    } else {
        $data = 'Unable to process Content-type';
        print_r($contenttype);
    }
    return $data;
}
Beispiel #4
0
     fputs($f2, html(body(wiki_render($page['body'] . "\n"))));
     fclose($f2);
     $p = popen("xhtmldiff {$fn1} {$fn2}", 'r');
     $html = '';
     while (!feof($p)) {
         $html .= fread($p, 1024);
     }
     pclose($p);
     unlink($fn1);
     unlink($fn2);
     /* print("HTML: ".htmlentities($html)); */
     $html = preg_replace("#^.*<body>(.*)</body>.*\$#mis", '\\1', $html);
     print $html;
 } else {
     if ($page) {
         print wiki_render($page['body'] . "\n");
     } else {
         http_404();
         while (ob_get_level()) {
             ob_end_clean();
         }
         include "http://community.nbtsc.org/missing/index.php";
         exit;
     }
 }
 print "<hr /><p>";
 $links = array();
 if (WIKI_ANONYMOUS_CONTROLS or is_logged_in()) {
     if (WIKI_ANONYMOUS_EDIT or is_logged_in()) {
         if (is_editable($WIKI_PAGEDIR . "{$pagename}")) {
             $links[] = hyperlink($_SERVER['PHP_SELF'] . "?edit", "Edit This Page");
Beispiel #5
0
        } elseif (is_dir($n . '/' . $e) and file_exists($n . '/' . $e . '/index.php')) {
            print "<p><a href='../{$e}/index.php/index-frame'>{$e}</a></p>";
        } elseif (is_dir($n . '/' . $e)) {
            print "<p><a href='../{$e}/'>{$e}</a></p>";
        }
    }
    ?>
	</body>
</html>
	<?php 
} elseif ($_SERVER['PATH_INFO'] == '/view-frame') {
    print doctype("XHTML/1.0") . "\n";
    ?>
<html>
	<head><title></title>
		<meta http-equiv='Content-type' value='text/html; charset=UTF-8' />
		<?php 
    if (STYLESHEET_BASE) {
        $ss = STYLESHEET_BASE . "/style.css";
        print "<link rel='StyleSheet' href='{$ss}' type='text/css'/>";
    }
    ?>
	</head>
	<body><?php 
    $text = @join('', @file('main.txt'));
    print wiki_render($text);
    ?>
</body>
</html>
	<?php 
}
Beispiel #6
0
if (!defined('JOURNAL_DISPLAYLIMIT')) {
    define('JOURNAL_DISPLAYLIMIT', 15);
}
$q = "SELECT date, timezone, subject, data, contenttype FROM journal \n\t\tWHERE username = '******'" . (($date and $time) ? " AND date = '{$date} {$time}' " : ($date ? " AND date_format(date, '%Y-%m-%d') = '{$date}'" : "") . ($time ? " AND date_format(date, '%H:%i:%s') = '{$time}'" : "")) . " ORDER BY date DESC";
if (JOURNAL_DISPLAYMODE == 'oneentry') {
    $q .= " LIMIT 1";
} else {
    $q .= " LIMIT " . (JOURNAL_DISPLAYLIMIT + 1);
}
$r = mysql_query($q);
if ($nsidebars = JOURNAL_SIDEBARS) {
    $sidebars = mysql_fetch_all(mysql_query("SELECT * FROM sidebars \n\t\t\t\tWHERE username = '******' \n\t\t\t\tORDER BY timestamp DESC\n\t\t\t\tLIMIT {$nsidebars}"));
    print "<div class='sidebars'>";
    foreach ($sidebars as $sidebar) {
        extract($sidebar);
        print "<div class='sidebar'><h2\n\t\t\tclass='title'>{$title}</h2><div class='content'>" . wiki_render($data) . "</div></div>";
    }
    print "</div>";
}
if ($r) {
    $r = mysql_fetch_all($r);
    if (count($r) > 1) {
        print format_rows($r, JOURNAL_DISPLAYLIMIT);
    } else {
        print format_entry(array_shift($r));
    }
    if ($date and !$time) {
        $q = "SELECT date_format(date, '%Y-%m-%d') AS date \n\t\t\t\tFROM journal \n\t\t\t\tWHERE username = '******' \n\t\t\t\t\tAND date_format(date, '%Y-%m-%d') > '{$date}' \n\t\t\t\tORDER BY date LIMIT 1";
        $r = mysql_query($q);
        $row = mysql_fetch_assoc($r);
        $nextdate = $row['date'];