Example #1
0
    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);
        }
    }
Example #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());
        }
    }
Example #3
0
 /**
  *
  * @param <type> $return_result
  * @return <type> 
  */
 public function get_global_data_and_validate()
 {
     $result = array();
     $keys = array_keys($this->rules);
     foreach($keys as $key)
     {
         $rule = $this->get_rule($key);
         $attempt = false;
         if (!isset($rule[DataRules::METHOD]))
         {
             continue;
         }
         switch($rule[DataRules::METHOD])
         {
             case DataRules::METHOD_GET:
                 $attempt = IsSetGet($key, false);
                 break;
             case DataRules::METHOD_POST:
                 $attempt = IsSetPost($key, false);
                 break;
             case DataRules::METHOD_SESSION:
                 $attempt = IsSetSession($key, false);
                 break;
             case DataRules::METHOD_GETPOST:
                 $attempt = IsSetGetPost($key, false);
                 break;
         }
         if ($attempt !== false)
         {
             $result[$key] = $attempt;
         }
     }
     return $this->validate_data($result, true);
 }
Example #4
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());
        }
    }