Exemple #1
0
 public function setRights($userID, $rightLevel){
     logger_FuncCall(__FILE__, __LINE__, __FUNCTION__);
     if (!is_numeric($userID)){ throw new InvalidParamException(0, _T::NUMBER); }
     if (!is_numeric($rightLevel)){ throw new InvalidParamException(0, _T::NUMBER); }
     if (!_FCORE::ValidateNumeric($rightLevel, 0, 3)){ throw new InvalidValueException('$rightLevel'); }
     if ($rightLevel == 0){
         return $this->dbRef->Delete(
             PAGERIGHTS,
             PAGERIGHTS_PAGEID."=$this->pageID AND ".PAGERIGHTS_USERID."=$userID");
     } else {
         if ($this->dbRef->DoesRecordExist(
                 PAGERIGHTS,
                 PAGERIGHTS_PAGEID."=$this->pageID AND ".PAGERIGHTS_USERID."=$userID")){
             return $this->dbRef->Update(
                     PAGERIGHTS,
                     PAGERIGHTS_USERRIGHT."=$rightLevel",
                     PAGERIGHTS_PAGEID."=$this->pageID AND ".PAGERIGHTS_USERID."=$userID");
         } else {
             return $this->dbRef->Insert(
                     PAGERIGHTS,
                     PAGERIGHTS_PAGEID."=$this->pageID, ".PAGERIGHTS_USERID."=$userID, ".PAGERIGHTS_USERRIGHT."=$rightLevel");
         }
     }
 }
Exemple #2
0
 public function absolutePreProcessing(){
     $action = _FCORE::IsSetPostDefault(ACTION, false);
     $db = _DB::_Connect();
     if ($action !== false){
         $valid = true;
         $this->crossInfo[RESULTS] = "";
         //==================================================================
         $this->crossInfo[PAGES_USERID] = _FCORE::IsSetPost(PAGES_USERID);
         $this->CreatePageUserIDCheck($this->crossInfo[PAGES_USERID]);
         //==================================================================
         $this->crossInfo[PAGES_FORUMTYPE] = _FCORE::IsSetPostDefault(PAGES_FORUMTYPE, 0);
         if (!_FCORE::ValidateNumeric($this->crossInfo[PAGES_FORUMTYPE], 0, 2)){
             $this->crossInfo[RESULTS] .= "<div>Invalid Forum Type</div>";
             $valid = false;
         }
         //==================================================================
         $this->crossInfo[PAGES_CHILDOF] = _FCORE::IsSetPostDefault(PAGES_CHILDOF, 0);
         if (!is_numeric($this->crossInfo[PAGES_CHILDOF])){
             $this->crossInfo[RESULTS] .= "<div>Invalid Parent Node</div>";
             $valid = false;
         } else {
             $this->crossInfo[PAGES_RANK] = DB_PAGE::_GetNextRankForPageID($db, 
                     $this->crossInfo[PAGES_CHILDOF],
                     $this->crossInfo[PAGES_USERID]);
             if (!$this->crossInfo[PAGES_RANK]){ $this->crossInfo[PAGES_RANK] = 0; }
             //==================================================================
             $this->crossInfo[PAGES_ISPRIVATE] = (_FCORE::IsSetPostDefault(PAGES_ISPRIVATE, 0) != 0);
             if (!$this->crossInfo[PAGES_ISPRIVATE]){
                 if ($db->DoesRecordExist(
                         PAGES,
                         PAGES_ISPRIVATE."=1 AND ".
                         PAGES_PAGEID."=".$this->crossInfo[PAGES_CHILDOF])){
                     $this->crossInfo[RESULTS] .= "<div>Cannot Have A Non-Private Page Child To A Private Page</div>";
                     $valid = false; 
                 }
             }
         }
         //==================================================================
         $this->crossInfo[PAGES_TITLE] = _FCORE::IsSetPOST(PAGES_TITLE);
         if ($this->crossInfo[PAGES_TITLE] == null){
             $this->crossInfo[RESULTS] .= "<div>Invalid Title</div>";
             $valid = false;
         }
         //==================================================================
         if ($valid){
             try {
                 DB_PAGE::_CreatePage(
                         $db,
                         $this->crossInfo[PAGES_USERID],
                         $this->crossInfo[PAGES_CHILDOF],
                         $this->crossInfo[PAGES_TITLE],
                         $this->crossInfo[PAGES_RANK],
                         "", // content = ""
                         $this->crossInfo[PAGES_ISPRIVATE],
                         $this->crossInfo[PAGES_FORUMTYPE]);
                 unset($this->crossInfo[PAGES_TITLE]);
                 unset($this->crossInfo[PAGES_RANK]);
                 unset($this->crossInfo[PAGES_FORUMTYPE]);
                 $this->crossInfo[RESULTS] .= "<div>Successfully Made Page</div>";
             } catch(Exception $e) {
                 $this->crossInfo[RESULTS] .= "<div>Message From System: ".$e->getMessage()."</div>";
             }
         }
     }
     $this->UserSelectOption_Get($db);
     $this->crossInfo[_ADMINPAGE::PAGES_LIST] = DB_PAGE::_GetPageListForUserID($db, $this->crossInfo[PAGES_USERID]);
                 // '$this->crossInfo[PAGES_USERID]' comes from '$this->UserSelectOption_Get' call
     $db->disconnect();
 }