public function __construct() { parent::__construct(); $user_id = IsSetGetPost(USERS_USERID); if (!$user_id) { $user_id = BoydsnestSession::GetInstance()->get(USERS_USERID); } try { $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL); $this->data = $user_factory->select_first($user_id, array( DBFactory::SELECT_GET_ONLY => array( USERS_USERID, USERS_USERNAME, USERS_SCHEMEUSING, USERS_EMAIL, USERS_SECRETANSWER, USERS_SECRETQUESTION, USERS_EXPIRESWHEN, USERS_CREATEDWHEN ) )); } catch(DBFactoryException $e) { throw new UserActionException( "An Error Occurred While Trying To Get The Profile", $e); } }
public function attempt_login() { $template = "userlogin"; $message = ""; try { // all it needs to do is attempt the action, it will // throw a DataCollection error if username and password // is not filled out, and it will throw a ValidationException // if the combination of the two is does not match $this->load_local_object("AttemptLogin"); $template = "loginmessage"; $session = BoydsnestSession::GetInstance(); $message = "Welcome ".$session->get(USERS_USERNAME)."!!!"; } catch(UserActionException $e) { $message = $e->getMessage(); } $page = $this->ready_master(); $page->apply_param( "main_content", $this->load_local_php_view( $template, array( 'message' => $message, 'username' => IsSetPost(USERS_USERNAME, "") )) ); $page->commit_applies(); return $page->get_page(); }
public function do_action() { DBMessage::DeleteMessagesForOrigin( $this->message_ids, USERS, BoydsnestSession::GetInstance()->get(USERS_USERID)); }
public function __construct() { parent::__construct(); $message_id = IsSetGet(DBMessage::MESSAGE_ID); if ($message_id === false) { throw new UserActionException( "a message must be specified"); } $user_id = IsSetGet(USERS_USERID); if ($user_id === false) { $user_id = BoydsnestSession::GetInstance()->get(USERS_USERID); } if ($user_id != BoydsnestSession::GetInstance()->get(USERS_USERID) && !BoydsnestSession::GetInstance()->get(USERS_ISMASTER)) { throw new SecurityException( "you must be the master to view other users messages"); } $this->data = DBMessage::GetMessage($message_id); $this->data = $this->data[0]; $this->data[DBMessage::MESSAGE] = DBMessage::GetMessageContent($message_id); $this->data[USERS_USERID] = $this->data[DBMessage::ORIGIN_ID]; }
public function __construct() { $page_id = IsSetPost(DBForum::POST_ID); if (!is_numeric($page_id)) { throw new UserActionException( "a page id must be specified", null); } $forum = DBForum::GetForum( BN_DATATYPE_USERPAGES, BoydsnestSession::GetInstance()->get(USERS_USERID)); if ($forum == null) { throw new UserActionException( "an error occurred while trying to get the forum", null); } $new_parent = IsSetPost(DBForum::POSTPARENT); $new_order = IsSetPost(DBForum::POSTORDER); if (!is_bool($new_parent) && !is_numeric($new_parent)) { throw new UserActionException( "parent id is not in the correct format", null); } if (!is_bool($new_order) && !is_numeric($new_order)) { throw new UserActionException( "order id is not in the correct format", null); } $page = $forum->post_get($page_id, false); if ($new_order == $page[DBForum::POSTORDER] || $new_parent == $page[DBForum::POSTPARENT]) { return; } try { $forum->post_update( $page_id, false, $new_parent, $new_order, false); } catch(DBForumException $e) { throw new UserActionException( "An error occurred while trying to update the page: ".$e->getMessage(), $e); } }
public function __construct() { if (!BoydsnestSession::GetInstance()->get(USERS_CANMESSAGE)) { throw new SecurityException( "you are not allowed to send messages"); } $message = IsSetPost(DBMessage::MESSAGE); $title = IsSetPost(DBMessage::TITLE); $users_to = IsSetPost(DBMessage::FCORE_MESSAGE_TOS); $user_from = BoydsnestSession::GetInstance()->get(USERS_USERID); if ($message === false) { $message = ''; } if ($title === false || $title == '') { $title = "none"; } if (!is_array($users_to) || sizeof($users_to) == 0) { throw new UserActionException("no user to is specified"); } if ($user_from === false) { throw new UserActionException("cannot find user from id"); } try { DBMessage::CreateMessage( $message, $title, array( DBMessage::ORIGIN_ID => $user_from, DBMessage::ORIGIN_TYPE => USERS ), $users_to); } catch(Exception $e) { throw new UserActionException($e->getMessage()); } }
public function __construct() { $session = BoydsnestSession::GetInstance(); if (!$session->IsLoggedIn()) { throw new SecurityException( "You Must Be The Site Master To Preform This Action"); } else if(!$session->get(USERS_ISMASTER)) { throw new SecurityException( "You Must Be The Site Master To Preform This Action"); } }
public function default_request() { $session = BoydsnestSession::GetInstance(); $username = $session->get(USERS_USERNAME); $session->ResetSession(); $master = $this->ready_master(); $master->apply_param( "main_content", $this->load_local_php_view( "content", array("username" => $username) ) ); $master->commit_applies(); return $master->get_page(); }
public function __construct() { parent::__construct(); try { $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL); $this->data = $user_factory->select( array( array( DBFactory::ID_KEY => USERS_USERNAME, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => "guest", ), "AND", array( DBFactory::ID_KEY => USERS_USERNAME, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => "system", ), "AND", array( DBFactory::ID_KEY => USERS_USERID, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => BoydsnestSession::GetInstance()->get(USERS_USERID), ), "AND", array( DBFactory::ID_KEY => USERS_ISACTIVE, DBFactory::ID_SIGN => "=", DBFactory::ID_VAL => 1, ), ), array( DBFactory::SELECT_GET_ONLY => array( USERS_USERID, USERS_USERNAME, USERS_DEFAULTRIGHT ), DBFactory::SELECT_ORDER_BY => USERS_USERNAME )); } catch(Exception $e) { throw new DataCollection($e->getMessage()); } }
public function __construct() { parent::__construct(); $user_factory = false; try { $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL); $this->data = $user_factory->select( array( array( DBFactory::ID_KEY => USERS_USERNAME, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => "system" ), "AND", array( DBFactory::ID_KEY => USERS_USERNAME, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => "Guest" ), "AND", array( DBFactory::ID_KEY => USERS_USERID, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => BoydsnestSession::GetInstance()->get(USERS_USERID) ), ), array( DBFactory::SELECT_GET_ONLY => array( USERS_USERID, USERS_USERNAME, USERS_CREATEDWHEN, USERS_ISACTIVE, USERS_LASTUPDATE, USERS_ISLOGGED ) )); } catch(Exception $e) { throw new UserActionException($e->getMessage()); } }
public function ready_master($request) { $page = FCore::LoadMaster(); $page->apply_string("title", "Boyds Nest"); $page->apply_string("meta", ""); $page->apply_string("style", Html::CssInclude(BN_URL_CSS . "/sidemenu/sidemenu_1.php")."\n"); $page->apply_string("style", Html::CssInclude(BN_URL_CSS . "/usermanual.css")."\n"); $page->apply_string("javascript", ""); $page_list = $this->load_local_object("actions/GetUserManualPageList"); $params = array(); $params["sidemenu_0"] = FCore::LoadViewPHP( "sidemenu/layout_1", array( 'content' => $this->load_local_php_view( "views/sidemenu_pagelist", array('pagelist' => $page_list->get_data())), 'title' => 'Manuals' )); if (BoydsnestSession::GetInstance()->get(USERS_ISMASTER)) { $params["sidemenu_1"] = FCore::LoadViewPHP( "sidemenu/layout_1", array( 'content' => $this->load_local_php_view("views/mastermenu"), 'title' => 'Master\'s Menu' )); } $page->apply_param( "main_content", FCore::LoadViewPHP("content/mainAndSideMenus",$params) ); $page->commit_applies(); return $page; }
public function get_route_map() { return array( self::REDIRECTS => array( array( self::REDIRECT_IF => !BoydsnestSession::GetInstance()->IsLoggedIn(), self::REDIRECT_TO => 'ERROR_MESSAGE', self::REDIRECT_DATA => 'you must be logged in to view this page', ) ), 'ERROR_MESSAGE' => 'error_message', ACTION_DEFAULT => ACTION_VIEW."content", //================================================================= // everything about CONTENT ACTION_VIEW."content" => 'view_content', //================================================================= ); }
public function __construct() { $page_id = IsSetPost(DBForum::POST_ID); if (!is_numeric($page_id)) { throw new UserActionException( "a page id must be specified", null); } $forum = DBForum::GetForum( BN_DATATYPE_USERPAGES, BoydsnestSession::GetInstance()->get(USERS_USERID)); try { $forum->post_delete($page_id, true); $meta = unserialize($forum->get_metadata()); $new_meta = array(); foreach($forum->post_get_id_list() as $page) { if (array_key_exists($page, $meta)) { $new_meta[$page] = $meta[$page]; } } $forum->set_metadata(serialize($new_meta)); DBForum::DeleteForum( BN_DATATYPE_PAGERESPONSES, $page_id); } catch(DBForumException $e) { throw new UserActionException( "An error occurred while trying to delete the page: ".$e->getMessage(), $e); } }
public function __construct() { $new_master_id = IsSetPost(USERS_USERID); if (!$new_master_id) { throw new UserActionException("a user must be selected to update"); } if (!is_numeric($new_master_id)) { throw new UserActionException("a user id must be numeric"); } try { $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL); $user_factory->update(array(USERS_ISMASTER => "0"), ""); $user_factory->update(array(USERS_ISMASTER => "1"), $new_master_id); BoydsnestSession::GetInstance()->set(USERS_ISMASTER, 0); } catch(Exception $e) { throw new UserActionException($e->getMessage()); } }
public function do_security_check() { $this->user_id = IsSetGet(USERS_USERID); if ($this->user_id === false) { $this->user_id = IsSetPost(USERS_USERID); } if ($this->user_id === false) { $this->user_id = BoydsnestSession::GetInstance()->get(USERS_USERID); } if (!is_numeric($this->user_id)) { throw new UserActionException( 'user_id must be numeric'); } if ($this->user_id != BoydsnestSession::GetInstance()->get(USERS_USERID) && !BoydsnestSession::GetInstance()->get(USERS_ISMASTER)) { throw new SecurityException( "must be the master to view other peoples messages"); } }
public function __construct() { // get page id $page_id = IsSetPost(DBForum::POST_ID); if (!$page_id || !is_numeric($page_id)) { throw new UserActionException("no page selected", null); } // get the user ids and make sure that they are in the correct format $user_ids = IsSetPost("user_ids"); if (!$user_ids) { throw new UserActionException("no users selected", null); } $user_ids = preg_split('/\:/', $user_ids); if (!is_array($user_ids)) { throw new UserActionException("no users selected", null); } foreach($user_ids as $user_id) { if (!is_numeric($user_id)) { throw new UserActionException( "an error occurred with the format of user ids", null); } } // get the forum for the user $forum = DBForum::GetForum( BN_DATATYPE_USERPAGES, BoydsnestSession::GetInstance()->get(USERS_USERID)); if ($forum == null) { throw new UserActionException( "error occurred while trying to load the user pages", null); } $metadata = unserialize($forum->get_metadata()); if (!array_key_exists($page_id, $metadata)) { $metadata[$page_id] = array(); } // get the list of rights for all the users $user_rights = array(); try { $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL); $raw_rights = $user_factory->select( $user_ids, array( DBFactory::SELECT_GET_ONLY => array( USERS_USERID, USERS_DEFAULTRIGHT ) )); foreach($raw_rights as $right) { $user_rights[$right[USERS_USERID]] = $right[USERS_DEFAULTRIGHT]; } } catch(Exception $e) { throw new UserActionException($e->getMessage(), $e); } foreach($user_ids as $user_id) { if (!array_key_exists($user_id, $user_rights)) { throw new UserActionException( "system error occurred with user ids 1", null); } $defaultright = $user_rights[$user_id]; $askedright = IsSetPost($user_id); if ($askedright === false) { throw new UserActionException( "system error occurred with user ids 2", null); } if ($askedright != USERS_DEFAULTRIGHT_NONE && $askedright != USERS_DEFAULTRIGHT_SEE && $askedright != USERS_DEFAULTRIGHT_COMMENT && $askedright != USERS_DEFAULTRIGHT_WRITE) { throw new UserActionException( "system error occurred with user ids 3", null); } if ($askedright < $defaultright) { throw new UserActionException( "system error occurred with user ids 4", null); } if ($askedright == $defaultright) { if (array_key_exists($user_id, $metadata[$page_id][PAGERIGHTS])) { unset($metadata[$page_id][PAGERIGHTS][$user_id]); } } else if($askedright > $defaultright) { $metadata[$page_id][PAGERIGHTS][$user_id] = $askedright; } } $forum->set_metadata(serialize($metadata)); }
<div class="clear"> <a href="<?php echo buildurl(BN_URL_PAGE_ADMIN, array(ACTION => ACTION_VIEW."profile")); ?>"> My Profile </a> </div> <?php if (BoydsnestSession::GetInstance()->get(USERS_CANMESSAGE)) { ?> <div class="clear"> <a href="<?php echo buildurl(BN_URL_PAGE_ADMIN, array(ACTION => ACTION_WRITE."message")); ?>"> Compose Message </a> </div> <?php } ?> <div class="clear"> <a href="<?php echo buildurl(BN_URL_PAGE_ADMIN, array(ACTION => ACTION_LIST."receivedmessages")); ?>"> Received Messages </a> </div> <div class="clear"> <a href="<?php echo buildurl(BN_URL_PAGE_ADMIN, array(ACTION => ACTION_LIST."sentmessages")); ?>"> Sent Messages </a> </div>
public function __construct($user_id = false) { parent::__construct(); $user_factory = false; try { $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL); if (!$user) { $this->data = $user_factory->select( array( array( DBFactory::ID_KEY => USERS_USERNAME, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => "guest" ), "AND", array( DBFactory::ID_KEY => USERS_USERNAME, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => "system" ), "AND", array( DBFactory::ID_KEY => USERS_ISACTIVE, DBFactory::ID_SIGN => "=", DBFactory::ID_VAL => 1 ), "AND", array( DBFactory::ID_KEY => USERS_USERID, DBFactory::ID_SIGN => "!=", DBFactory::ID_VAL => BoydsnestSession::GetInstance()->get(USERS_USERID) ), ), array( DBFactory::SELECT_GET_ONLY => array( USERS_USERID, USERS_USERNAME ), DBFactory::SELECT_ORDER_BY => USERS_USERNAME )); } else { $this->data = $user_factory->select( $user_id, array( DBFactory::SELECT_GET_ONLY => array( USERS_USERID, USERS_USERNAME ), DBFactory::SELECT_ORDER_BY => USERS_USERNAME )); } } catch(Exception $e) { throw new UserActionException($e->getMessage()); } }
public function __construct($data = null) { parent::__construct(); $user_id = BoydsnestSession::GetInstance()->get(USERS_USERID); $page_root = 0; $extended = false; if (is_array($data)) { if (array_key_exists(USERS_USERID, $data)) { $user_id = $data[USERS_USERID]; } if (array_key_exists("page_id", $data)) { $page_root = $data["page_id"]; } if (array_key_exists("extended", $data)) { $extended = $data["extended"]; } } else if (is_numeric($data)) { $user_id = $data; } $forum = DBForum::GetForum(BN_DATATYPE_USERPAGES, $user_id); if ($forum == null) { $this->data = null; return; } $data; if ($extended) { $data = $forum->build_hierarchy($page_root); } else { $data = $forum->post_get_children($page_root); } if ($data == null) { $this->data = null; return; } foreach($data as $page) { $meta = unserialize($page[DBForum::METADATA]); if (is_array($meta)) { if (array_key_exists(PAGETITLE, $meta)) { $page[PAGETITLE] = $meta[PAGETITLE]; } if (array_key_exists(PAGEPRIVATE, $meta)) { $page[PAGEPRIVATE] = $meta[PAGEPRIVATE]; } if (array_key_exists(PAGETYPE, $meta)) { $page[PAGETYPE] = $meta[PAGETYPE]; } } $this->data[] = $page; } }
public function content_create($request, $message = "") { $object = null; if ($request == ACTION.ACTION_CREATE."content") { try { $object = $this->load_local_object( "content/objects/CreateUserPage"); $object->do_action(); return $this->content_view( $request, "successfully created page", $object->get(DBForum::POST_ID)); } catch(UserActionException $e) { $message = $e->getMessage(); $prev = $e->getPrevious(); if ($prev != null) { FCore::GetLogger()->log( Logger::LEVEL_ERROR, $prev->getMessage()); } } } $hierarchy = false; try { $hierarchy = FCore::LoadObject( "pages/GetUserPageHierarchy", array("extended" => true)); $hierarchy = $hierarchy->get_data(); if ($hierarchy == null) { $hierarchy = false; } } catch(UserActionException $e) { $prev = $e->getPrevious(); if ($prev != null) { DBLogger::log( BN_LOGTYPE_ERROR, $prev->getMessage()); FCore::GetLogger()->log( Logger::LEVEL_ERROR, $e->getMessage()); } $message = $e->getMessage(); } return $this->ready_master_common( "content/views/content_create", array( 'hierarchy' => $hierarchy, 'message' => $message, 'user_id' => BoydsnestSession::GetInstance()->get(USERS_USERID), 'data' => is_a($object, "DataCollection") ? $object->get_data() : array() )); }
<?php if (!isset($session)){ $session = BoydsnestSession::GetInstance(); } ?><!DOCTYPE html> <html> <head> <title><?php IsSetEcho($title); ?></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <?php IsSetEcho($meta); ?> <link href='<?php echo BN_URL_CSS . "/variable.php"; ?>' rel='stylesheet' type='text/css' /> <link href='<?php echo BN_URL_CSS . "/common.css"; ?>' rel='stylesheet' type='text/css' /> <?php IsSetEcho($style); ?> <?php IsSetEcho($javascript); ?> </head> <body> <!-- Begin Header Menu Layout --> <div class="background_color_accent" id="_headercontainer"> <div id="_hc_upper"> <a class="text_color" href="<?php echo BN_URL_PAGE_INDEX; ?>">
<?php require_once FCORE_FILE_BBCONSUMER; $viewer = array(); $viewer['title'] = isset($title) ? $title : "No Title"; $viewer['content'] = isset($content) ? BBConsumer::consume($content) : "No Content"; if (isset($user_id) && BoydsnestSession::GetInstance()->get(USERS_CANMESSAGE) && BoydsnestSession::GetInstance()->get(USERS_USERID) != $user_id) { ?> <a style="float: left" href="<?php echo buildurl(BN_URL_PAGE_ADMIN, array(ACTION => ACTION_WRITE."message", USERS_USERID => $user_id)); ?>">Respond</a> <?php } if (isset($message_id)) { ?> <form style="float: left" action="<?php echo buildurl(BN_URL_PAGE_ADMIN, array(ACTION => ACTION.ACTION_DELETE."readmessage")); ?>" method="post"> <input type="submit" value="Delete" /> <input type="hidden" name="<?php echo DBMessage::MESSAGE_ID; ?>[]" value="<?php echo $message_id; ?>" /> </form> <?php } ?>
public function __construct() { $page_id = IsSetPost(DBForum::POST_ID); if (!is_numeric($page_id)) { throw new UserActionException( "a page id must be specified", null); } $forum = DBForum::GetForum( BN_DATATYPE_USERPAGES, BoydsnestSession::GetInstance()->get(USERS_USERID)); if ($forum == null) { throw new UserActionException( "an error occurred while trying to get the forum", null); } $page_data = $forum->post_get($page_id); if ($page_data == null) { throw new UserActionException( "an error occurred while trying to find the page", null); } $metadata = unserialize($page_data[DBForum::METADATA]); $title = IsSetPost(PAGETITLE, ''); if (strlen($title) < 5) { throw new UserActionException( "title must be longer then 5 characters", null); } if (strlen($title) > 20) { throw new UserActionException( "title must be no longer then 20 characters", null); } $metadata[PAGETITLE] = $title; $private = IsSetPost(PAGEPRIVATE, 0); if (!is_numeric($private)) { throw new UserActionException( "input error with private", null); } $metadata[PAGEPRIVATE] = $private ? true : false; $content = IsSetPost(DBDataType::CONTENT, false); try { $forum->post_update( $page_id, $content, false, false, serialize($metadata)); } catch(DBForumException $e) { throw new UserActionException( "An error occurred while trying to update the page: ".$e->getMessage(), $e); } }
public function do_action() { $user = $this->user_factory->select_first($this->user_id); $session = BoydsnestSession::GetInstance(); $session->setupUser($user); DBLogger::log(BN_LOGTYPE_USERLOG(), "logged in"); }
public static function init() { self::$instance = new BoydsnestSession(); FCore::$SESSION = self::$instance; }