Esempio n. 1
0
function view_get()
{
    global $DB, $Core, $Parse;
    if (!id() && !session('id')) {
        return to_index();
    }
    if (!id()) {
        set_cmd(2, session('name'));
    }
    // if member name is a number, overrride lookups
    if (is_numeric(id())) {
        if ($search = $Core->idfromname(id())) {
            $field = "m.id";
        }
    }
    if (!isset($field)) {
        if ($search = id(true)) {
            $field = "m.id";
        } else {
            $field = "LOWER(m.name)";
            $search = strtolower(id());
        }
    }
    $DB->query("SELECT\r\n                *,\r\n                extract(epoch from date_joined) as date_joined,\r\n                extract(epoch from last_view) as last_view,\r\n                extract(epoch from last_post) as last_post\r\n              FROM\r\n                member m\r\n              WHERE\r\n                {$field}=\$1", array($search));
    $member = $DB->load_array();
    $DB->query("SELECT\r\n                p.display as id,\r\n                mp.value as name\r\n              FROM\r\n                member_pref mp\r\n              LEFT JOIN\r\n                pref p\r\n              ON\r\n                p.id = mp.pref_id\r\n              WHERE\r\n                mp.member_id=\$1\r\n              AND\r\n                p.profile IS true\r\n              ORDER BY\r\n                ordering", array($member['id']));
    $pref = $DB->load_all_key();
    $Base = new Base();
    $Base->title($member['name']);
    $Base->type(VIEW_MEMBER);
    $Base->header();
    // show profile photo (if any)
    print "<div class=\"box clear\">\n";
    if ($photo = $DB->value("SELECT value FROM member_pref WHERE pref_id=1 AND member_id=\$1", array($member['id']))) {
        print $Parse->run("[img]{$photo}[/img]");
    } else {
        print "<div class=\"nophoto\"></div>";
    }
    // admin controllable member data
    print "<ul class=\"memberinfo\">\n";
    foreach ($pref as $key => $value) {
        if ($key == "email" && $Core->member_pref($member['id'], "show_email") != 'true') {
            continue;
        }
        $value = $Parse->run($value);
        print "  <li><div class=\"pref\">{$key}:</div> <div class=\"prefdata\">{$value}</div></li>\n";
    }
    print "<li style=\"padding-top:15px\">\n";
    print "  <div class=\"pref\">date joined:</div>\n";
    print "  <div class=\"prefdata\">" . date(VIEW_DATE_FORMAT, $member['date_joined']) . "</div>\n";
    print "</li>\n";
    print "<li>\n";
    print "  <div class=\"pref\">last posted:</div>\n";
    print "  <div class=\"prefdata\">" . date(VIEW_DATE_FORMAT, $member['last_post']) . "</div>\n";
    print "</li>\n";
    print "<li>\n";
    print "  <div class=\"pref\">last seen:</div>\n";
    print "  <div class=\"prefdata\">" . date(VIEW_DATE_FORMAT, $member['last_view']) . "</div>\n";
    print "</li>\n";
    print "<li>\n";
    print "  <div class=\"pref\">member:</div>\n";
    print "  <div class=\"prefdata\">{$member['id']}</div>\n";
    print "</li>\n";
    // total threads
    $threads_percent = 0;
    $total_threads = $Core->thread_count();
    if ($member['total_threads']) {
        $threads_percent = round($member['total_threads'] / $total_threads * 100, 3);
    }
    print "<li style=\"padding-top:15px\">\n";
    print "  <div class=\"pref\">total threads:</div>\n";
    print "  <div class=\"prefdata\"><strong>" . number_format($member['total_threads']) . "</strong>, {$threads_percent}% of " . number_format($total_threads) . "</div>\n";
    print "</li>\n";
    // total thread posts
    $thread_posts_percent = 0;
    $total_thread_posts = $Core->thread_post_count();
    if ($member['total_thread_posts']) {
        $thread_posts_percent = round($member['total_thread_posts'] / $total_thread_posts * 100, 3);
    }
    print "<li>\n";
    print "  <div class=\"pref\">total posts:</div>\n";
    print "  <div class=\"prefdata\"><strong>" . number_format($member['total_thread_posts']) . "</strong>, {$thread_posts_percent}% of " . number_format($total_thread_posts) . "</div>\n";
    print "</li>\n";
    if (IGNORE_ENABLED) {
        if (IGNORE_PUBLIC || $member['id'] == session('id')) {
            // ignoring
            if ($member['id'] == session('id')) {
                $listen = " <sup><a href=\"/member/listen/%name%/" . MD5(session_id()) . "/\">x</a></sup>";
            } else {
                $listen = "";
            }
            $ignoring = "";
            foreach ($Core->list_ignored($member['id']) as $id => $name) {
                $l = str_replace("%name%", $name, $listen);
                $ignoring .= $l . $Core->member_link($name) . ", ";
            }
            if ($ignoring == "") {
                $ignoring = "-";
            } else {
                $ignoring = substr($ignoring, 0, -2);
            }
            print "<li style=\"padding-top:15px\">\n";
            print "  <div class=\"pref\">ignoring:</div>\n";
            print "  <div class=\"prefdata\">{$ignoring}</div>\n";
            print "</li>\n";
        }
        if (IGNORE_PUBLIC) {
            // ignored by
            $ignoredby = "";
            foreach ($Core->list_ignoredby($member['id']) as $id => $name) {
                $ignoredby .= $Core->member_link($name) . ", ";
            }
            if ($ignoredby == "") {
                $ignoredby = "-";
            } else {
                $ignoredby = substr($ignoredby, 0, -2);
            }
            print "<li>\n";
            print "  <div class=\"pref\">ignored by:</div>\n";
            print "  <div class=\"prefdata\">{$ignoredby}</div>\n";
            print "</li>\n";
        }
    }
    print "</ul>\n";
    print "<div class=\"clear\"></div>\n";
    print "</div>\n";
    $Base->footer();
}
Esempio n. 2
0
function set_module($i, $value)
{
    $module = module();
    $module[$i] = value;
    set_cmd(0, implode("-", $module));
}
Esempio n. 3
0
// menu display
$_menu_ = array("create account" => array("link" => "/member/create/", "title" => "create an account", "code" => "", "show" => REGISTRATION_OPEN, "auth" => false), "threads" => array("title" => "back to the home page", "link" => "/", "code" => "", "show" => true, "auth" => false), "messages%MESSAGES%" => array("link" => "/message/list/", "title" => "view your messages", "code" => "", "show" => true, "auth" => true), "new thread" => array("link" => "/thread/create/", "title" => "create a new thread", "code" => "", "show" => true, "auth" => true), "new message" => array("link" => "/message/create/", "title" => "send a message to another member", "code" => "", "show" => true, "auth" => true), "search" => array("link" => "/search/", "title" => "search the board", "code" => "", "show" => true, "auth" => true), "chat%CHATTERS%" => array("link" => "/chat/", "title" => "chat in realtime", "code" => "", "show" => true, "auth" => true), "profile" => array("link" => "/member/view/", "title" => "view my profile", "code" => "", "show" => true, "auth" => true), "donate" => array("link" => "/donate/", "title" => "donate!", "code" => "", "show" => true, "auth" => false));
// parser find
$_bbc_ = array("", "[u]", "[/u]", "[i]", "[/i]", "[em]", "[/em]", "[quote]", "[/quote]", "[b]", "[/b]", "[strong]", "[/strong]", "[strike]", "[/strike]", "[code]", "[/code]", "[sub]", "[/sub]", "[sup]", "[/sup]", "[spoiler]", "[/spoiler]");
// parser replace
$_rep_ = array("", "<span style=\"text-decoration:underline;\">", "</span>", "<em>", "</em>", "<em>", "</em>", "<blockquote>", "</blockquote>", "<strong>", "</strong>", "<strong>", "</strong>", "<strike>", "</strike>", "<pre>", "</pre><div class=clear></div>", "<sub>", "</sub>", "<sup>", "</sup>", "<span class=\"spoiler\" onclick=\"\$(this).next().show();\$(this).remove()\">show spoiler</span><span style=\"display:none\">", "</span>");
/*
* Do not edit below this line unless you know what you're doing!
**/
define("VERSION", "2.9.5");
require_once "core.php";
// framework
ini_set("magic_gpc_quotes", false);
if (module(0) == "main" && !cmd(1)) {
    set_cmd(0, "thread");
    set_cmd(1, "list");
}
if (!isset($commandline)) {
    $cache = array();
    // no caching for the moment array("threadview","messageview");
    if (!in_array(module(0) . func(), $cache)) {
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
        header("Cache-Control: no-store, no-cache, must-revalidate");
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");
    } else {
        session_cache_limiter("private");
    }
    session_start();
}
require_once "error.php";