Beispiel #1
0
    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];
    }
Beispiel #2
0
    public function __construct($user_id = false)
    {
        parent::__construct();

        // getting the user id
        if (!$user_id)
        {
            $user_id = IsSetGetPost(USERS_USERID);
            if (!$user_id)
            {
                throw new UserActionException("no user selected");
            }
            if (!is_numeric($user_id))
            {
                throw new UserActionException("user id must be numeric");
            }
        }

        // getting the user data
        try
        {
            $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
            $this->data = $user_factory->select_first($user_id);
        }
        catch(Exception $e)
        {
            throw new UserActionException($e->getMessage());
        }
    }
    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 __construct()
 {
     parent::__construct();
     $this->collect();
     $this->validate();
     $this->do_action();
 }
 public function __construct($origin = 'to')
 {
     parent::__construct();
     $this->origin = $origin;
     $this->do_security_check();
     $this->collect();
     $this->do_action();
 }
Beispiel #6
0
 /**
  * Parameters constructor.
  * @param $parameters
  */
 public function __construct(array $parameters)
 {
     foreach ($parameters as $key => $value) {
         $parameters[str_replace('_', '-', strtolower($key))] = $value;
         if (!static::$preserveOriginal) {
             unset($parameters[$key]);
         }
     }
     parent::__construct($parameters);
 }
Beispiel #7
0
    public function __construct($data)
    {
        parent::__construct();

        if (!isset($data["user_id"]) || !is_numeric($data["user_id"]))
        {
            throw new UserActionException("user_id must be numeric", null);
        }
        if (!isset($data["page_id"]) || !is_numeric($data["page_id"]))
        {
            throw new UserActionException("page_id must be numeric", null);
        }

        $forum = DBForum::GetForum(BN_DATATYPE_USERPAGES, $data["user_id"]);
        
        $this->data   = $forum->post_get($data["page_id"]);
        if ($this->data[DBForum::METADATA] != null)
        {
            $extra = unserialize($this->data[DBForum::METADATA]);

            $this->data[PAGETITLE] =
                    array_key_exists(PAGETITLE, $extra)
                    ? $extra[PAGETITLE] : "";
            $this->data[PAGETYPE] =
                    array_key_exists(PAGETYPE, $extra)
                    ? $extra[PAGETYPE] : BN_PAGETHREADTYPE_NONE;
            $this->data[PAGEPRIVATE] =
                    array_key_exists(PAGEPRIVATE, $extra)
                    ? $extra[PAGEPRIVATE] : false;
            if ($this->data[DBDataType::CONTENT] == null)
            {
                $this->data[DBDataType::CONTENT] = "";
            }
        }

        $this->data[PAGEFOLLOWERS] = array();
        $this->data[PAGERIGHTS] = array();
        $forum_meta = unserialize($forum->get_metadata());
        if (is_array($forum_meta) &&
            array_key_exists($data["page_id"], $forum_meta))
        {
            $this_meta = $forum_meta[$data["page_id"]];
            if (array_key_exists(PAGEFOLLOWERS, $this_meta))
            {
                $this->data[PAGEFOLLOWERS] = $this_meta[PAGEFOLLOWERS];
            }
            if (array_key_exists(PAGERIGHTS, $this_meta))
            {
                $this->data[PAGERIGHTS] = $this_meta[PAGERIGHTS];
            }
        }
    }
    public function __construct($page_id)
    {
        parent::__construct();

        if (!is_numeric($page_id))
        {
            throw new UserActionException('page id must be numeric', null);
        }

        $forum = DBForum::GetForum(BN_DATATYPE_PAGERESPONSES, $page_id);
        if ($forum == null)
        {
            return;
        }

        $this->data = $forum->build_hierarchy();
    }
 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($data)
    {
        parent::__construct();

        if (!is_array($data))
        {
            throw new UserActionException("invalid data type", null);
        }
        if (!array_key_exists("page_id", $data))
        {
            throw new UserActionException("no page id specified", null);
        }
        if (!array_key_exists("post_id", $data))
        {
            throw new UserActionException("no post id specified", null);
        }

        $forum = DBForum::GetForum(BN_DATATYPE_PAGERESPONSES, $data["page_id"]);

        $this->data = $forum->post_get($data["post_id"]);
    }
Beispiel #11
0
    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 __construct()
    {
        parent::__construct();

        try
        {
            $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
            $rules = $user_factory->get_db_data_rules();

            foreach($rules->get_rule_keys() as $key)
            {
                $rule = $rules->get_rule($key);
                if (isset($rule[DataRules::DEFAULT_]))
                {
                    $this->data[$key] = $rule[DataRules::DEFAULT_];
                }
            }
        }
        catch(Exception $e)
        {
            throw new UserActionException($e->getMessage());
        }
    }
Beispiel #13
0
    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());
        }
    }
Beispiel #14
0
 public function __construct()
 {
     parent::__construct();
 }
    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;
        }
    }
 /**
  * ParameterCollection constructor.
  * @param array $parameters
  */
 public function __construct(array $parameters)
 {
     parent::__construct($parameters);
 }
    public function __construct($selected = null)
    {
        parent::__construct();

        $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
        if (!$user_factory)
        {
            throw new UserActionException(
                    "could not connect to the user database", null);
        }

        try
        {
            $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_ISACTIVE,
                            DBFactory::ID_SIGN  => "=",
                            DBFactory::ID_VAL   => "1",
                        ),
                        "AND",
                        array(
                            DBFactory::ID_KEY   => USERS_ISFAMILY,
                            DBFactory::ID_SIGN  => "=",
                            DBFactory::ID_VAL   => "1",
                        ),
                    ),
                    array(
                        DBFactory::SELECT_GET_ONLY => array(
                            USERS_USERID, USERS_USERNAME, 
                        ),
                        DBFactory::SELECT_ORDER_BY => USERS_USERNAME
                    ));
        }
        catch(DBFactoryException $e)
        {
            throw new UserActionException(
                    "an error occurred while getting user data", $e);
        }

        if ($selected)
        {
            foreach($this->data as $key => $user)
            {
                if ($user[USERS_USERID] == $selected[USERS_USERID])
                {
                    $this->data[$key][DBForum::POSTCHILDREN] = FCore::LoadObject(
                        "pages/GetUserPageHierarchy",
                        array(
                            USERS_USERID    => $selected[USERS_USERID],
                            "extended"      => true,
                        ));
                    if (is_a($this->data[$key][DBForum::POSTCHILDREN], "DataCollection"))
                    {
                        $this->data[$key][DBForum::POSTCHILDREN] =
                                $this->data[$key][DBForum::POSTCHILDREN]->get_data();
                    }
                    break;
                }
            }
        }
    }
 public function __construct()
 {
     parent::__construct();
     $this->collect();
 }
Beispiel #19
0
    public function __construct()
    {
        parent::__construct();

        // getting the user id
        $this->user_id = IsSetGetPost(USERS_USERID);
        if (!$this->user_id)
        {
            throw new UserActionException("no user selected");
        }
        if (!is_numeric($this->user_id))
        {
            throw new UserActionException("user id must be numeric");
        }

        $this->start  = IsSetGetPost('start', 0);
        $this->amount = IsSetGetPost('amount', 20);

        if (!is_numeric($this->start))
        {
            $this->start = 0;
        }
        if (!is_numeric($this->amount))
        {
            $this->amount = 20;
        }

        // get the username
        try
        {
            $user_factory = FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
            $this->username = $user_factory->select_first(
                    $this->user_id,
                    array(
                        DBFactory::SELECT_GET_ONLY => array(
                            USERS_USERNAME
                        )
                    ));
            if ($this->username == null)
            {
                $this->username = "******";
            }
            else
            {
                $this->username = $this->username[USERS_USERNAME];
            }
        }
        catch(Exception $e)
        {
            FCore::GetLogger()->log(Logger::LEVEL_ERROR, $e->getMessage());
            DBLogger::log(BN_LOGTYPE_ERROR, $e->getMessage());
            $this->username = "******";
        }

        // getting the user logs
        try
        {
            $this->data = DBLogger::GetLimitedBy(
                    USERS.$this->user_id, $this->start, $this->amount);
        }
        catch(DBLoggerException $e)
        {
            throw new UserActionException($e->getMessage());
        }
    }