예제 #1
0
 public function boards_threads_create($params = null)
 {
     // aka create thread
     if ($params && isset($params["__partial"])) {
         return null;
     }
     if ($params === null) {
         $this->requireRequestType("PUT");
         $params = $_POST;
         $put_params = $this->getPutDeleteParams();
         $params = array_merge($params, $put_params);
         $params["boardid"] = $_GET["boardid"];
     }
     $current_user = $this->requireLogin("You must be logged in to join a board");
     $params["authoringuser"] = $current_user;
     $board = new SCBoard($params["boardid"]);
     $thread = $board->addThread($params);
     return $thread;
 }
예제 #2
0
        if ($user->isMemberOf($board->boardid)) {
            $message_array = array("authorid" => $user_id, "text" => $sc_email->body, "source" => "email");
            if ($sc_email->attachment) {
                $message_array["type"] = "image";
                $message_array["attachment"] = array("uploadmedia" => $sc_email->attachment);
            }
            if ($sc_email->threadid) {
                if ($board->hasMessage($sc_email->threadid)) {
                    $thread = new SCThread($sc_email->threadid);
                    $thread->addMessage($message_array);
                } else {
                    throw new Exception("thread " . $sc_email->threadid . " not in board " . $sc_email->boardid);
                }
            } else {
                $message_array["subject"] = $sc_email->subject;
                $board->addThread($message_array);
            }
        } else {
            throw new Exception("you dont belong to board " . $sc_email->boardid);
        }
    } else {
        throw new Exception("no board id was passed");
    }
} catch (Exception $ex) {
    mail($sc_email->from_address, $ex->getMessage(), $ex->getMessage());
}
//mail("*****@*****.**", "message processed", $email);
return false;
?>