public function show($use_params = null) { SC::loginRequired(); global $current_user; $api = new SCApi(); if ($use_params) { $use_params = $_GET; } $membership = $api->memberships_show($use_params); $vars = array("membership" => $membership); $cs = array("title" => $current_user->displayname . "' s membership in " . $membership->board->boardname, "util_links" => SCPartial::renderToString("board/util_links", $vars), "content" => SCPartial::renderToString("membership/show", $vars)); SCLayout::render("main", $vars, $cs); }
static function newMessageEmail($message) { $mail = new SCEmail(); $mail->bcc = $mail->loadMessageEmailRecipients($message); //$mail->from = SC_MESSAGE_EMAIL_FROM . "<" . str_replace(":boardid", $message->boardid, SC_MESSAGE_EMAIL_FROM_ADDRESS) . ">"; $mail->to = ""; $mail->author = $message->author(); $thread = $message->threadid ? new SCThread($message->threadid) : $message; $mail->from = SC_MESSAGE_EMAIL_FROM . "<" . $thread->emailAddress() . ">"; //$mail->body = "Posted By: " . $mail->author->displayname . "\n\n" .str_replace("<br/>", "\n", $message->text); //mail body $mail->body = "Posted By: " . $mail->author->displayname . "\n\n" . SCPartial::renderToString("message/" . $message->type . "_body", array("message" => $message, "linebreak" => "\n")); $mail->subject = $thread->subject; //subject $mail->headers = "From: " . $mail->from . "\r\n" . "Bcc: " . $mail->bcc . "\r\n" . "Reply-To: " . $thread->emailAddress() . "\r\n" . "X-Mailer: PHP/" . phpversion(); return $mail; }
public function _new() { SC::loginRequired(); global $current_user; $type = $_GET["type"] or $type = "text"; $parent = new SCBoard($_GET["boardid"]); $route_params = array("boardid" => $parent->boardid); $vars = array("subject" => SC::getParam("subject", true), "text" => SC::getParam("text", true), "type" => $type, "parent" => $parent, "controller" => "threads", "route_params" => $route_params, "action" => SCRoutes::set("threads", "create", $route_params)); switch ($_GET["__content_type"]) { case "json": $output = array("content" => SCPartial::renderToString("message/new", $vars)); echo SC::jsonify($output); break; case "html": default: $cs = array("title" => "Create Thread", "head" => SCPartial::renderToString("shared/head"), "util_links" => SCPartial::renderToString("board/newthread_util_links", $vars), "content" => SCPartial::renderToString("message/new", $vars)); SCLayout::render("main", $vars, $cs); } }
public function handleResponse($resp, $methodname) { $content_type = $this->getResponseContentType(); switch ($content_type) { case "html": $partial = $this->{$methodname}(array("__partial" => true)); if ($partial) { $partial_name = $partial["partial"]; if (isset($partial["val"])) { $resp = array($partial["val"] => $resp); } return SCPartial::renderToString($partial_name, $resp); } throw new APIException("There is no html associated with this.", 400); break; case "json": return SC::jsonify(SC::toArrayAll($resp)); break; } }
public function invitations_redeem() { SC::loginRequired(false, SCRoutes::set("boards", "invitations_redeem", array("invitecode" => $_GET["invitecode"]))); global $current_user; if (!$_GET["invitecode"]) { //throw new Exception("You must supply an invitation code that you wish to redeem", 400); } $invite = new SCInvite($_GET["invitecode"]); $vars = array("invite" => $invite); $cs = array("head" => SCPartial::renderToString("shared/head")); if ($invite->isValid()) { $cs["title"] = "Would you like to join " . $invite->board()->boardname . "?"; $cs["content"] = SCPartial::renderToString("board/invitations_redeem", $vars); } else { $cs["title"] = "This is not a valid invite code."; } SCLayout::render("main", $vars, $cs); }
public function _new() { $vars = array("username" => SC::getParam("username", true), "email" => SC::getParam("email", true), "displayname" => SC::getParam("displayname", true)); $cs = array("title" => "Register", "content" => SCPartial::renderToString("user/new", $vars)); SCLayout::render("main", $vars, $cs); }