Пример #1
0
 public function memberships_index()
 {
     SC::loginRequired();
     global $current_user;
     $api = new SCApi();
     $memberships = $api->users_memberships_index();
     $vars = array("memberships" => $memberships);
     // $board & $view_counts
     $cs = array("title" => $current_user->displayname . "'s Boards", "content" => SCPartial::renderToString("user/memberships", $vars));
     SCLayout::render("main", $vars, $cs);
 }
Пример #2
0
 public function delete()
 {
     SC::loginRequired();
     global $current_user;
     try {
         $api = new SCApi();
         if ($api->memberships_delete()) {
             SC::transfer(SCRoutes::set("users", "memberships_index", array("userid" => $current_user->userid)));
         } else {
             throw new Exception("something went wrong");
         }
     } catch (Exception $ex) {
         SC::setFlashMessage($ex->getMessage(), "error");
         $this->show(true);
     }
 }
Пример #3
0
 public function create()
 {
     SC::loginRequired();
     global $current_user;
     switch ($_GET["__content_type"]) {
         case "json":
             $api = new SCApi();
             $thread = $api->boards_threads_create();
             $output = array("transfer" => SCRoutes::set("threads", "show", array("boardid" => $thread->boardid, "threadid" => $thread->messageid)));
             echo SC::jsonify($output);
             break;
         case "html":
         default:
             try {
                 $api = new SCApi();
                 $thread = $api->boards_threads_create();
                 SC::transfer(SCRoutes::set("threads", "show", array("boardid" => $thread->boardid, "threadid" => $thread->messageid)));
             } catch (Exception $ex) {
                 SC::setFlashMessage($ex->getMessage(), "error");
                 $this->_new();
             }
     }
 }
Пример #4
0
 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);
 }