public static final function _GetPageRights(DBConnect &$db, $pageID){ logger_FuncCall(__FILE__, __LINE__, __FUNCTION__); if (!is_numeric($pageID)){ throw new InvalidParamException(1, _T::NUMBER); } $result = $db->makeQuery("SELECT * FROM pageRights WHERE pageID=$pageID"); $orderResults = array(); $count = sizeof($result); for($i=0; $i<$count; $i++){ $orderResults[ $result[$i][PAGERIGHTS_USERID] ] = $result[$i][PAGERIGHTS_USERRIGHT]; } $allUserIDs = DB_USER::_GetUserList($db); $count = sizeof($allUserIDs); $returning = array(); for($i=0; $i<$count; $i++){ $returning[$i][USERS_USERID] = $allUserIDs[$i][USERS_USERID]; $returning[$i][USERS_USERNAME] = $allUserIDs[$i][USERS_USERNAME]; if (isset($orderResults[ $allUserIDs[$i][USERS_USERID] ])){ $returning[$i][PAGERIGHTS_USERRIGHT] = $orderResults[ $allUserIDs[$i][USERS_USERID] ]; } else { $returning[$i][PAGERIGHTS_USERRIGHT] = 0; } } return $returning; }
protected function thisPagePreProcessing(){ $this->crossInfo[_HOMEPAGE::DATABASE] = false; $this->crossInfo[_HOMEPAGE::MENULIST] = _FCORE::IsSetPostDefault(_HOMEPAGE::MENULIST, false); if (!$this->crossInfo[_HOMEPAGE::MENULIST]){ $this->crossInfo[_HOMEPAGE::DATABASE] = _DB::_Connect(); $this->crossInfo[_HOMEPAGE::MAINVIEW_USERID] = _SESSION::GetIsFamily() ? _SESSION::GetUserID() : false; $this->crossInfo[_HOMEPAGE::MENULIST] = array(); if ($this->crossInfo[_HOMEPAGE::MAINVIEW_USERID]){ $raw = DB_PAGE::_GetUserRoots( $this->crossInfo[_HOMEPAGE::DATABASE], $this->crossInfo[_HOMEPAGE::MAINVIEW_USERID]); $this->crossInfo[_HOMEPAGE::MENULIST] = new _FORUM(); $this->crossInfo[_HOMEPAGE::MENULIST]->placeNodeArray($raw); } $this->crossInfo[_HOMEPAGE::FAMILYLIST] = DB_USER::_GetFamilyOnlyUserList($this->crossInfo[_HOMEPAGE::DATABASE]); } $this->absolutePreProcessing(); }
} else { echo "Access Denied"; } } else { echo "Invalid Param"; } break; case "admin_pagesmanage": $userID = _FCORE::IsSetPostDefault(PAGES_USERID, false); if ($userID){ if (($userID == _SESSION::GetUserID() && _SESSION::GetCanCDSelf()) || ($userID != _SESSION::GetUserID() && _SESSION::GetCanCDOther())){ $db = _DB::_Connect(); $bypase = ($userID == _SESSION::GetUserID() || _SESSION::GetDefaultRight() > 0); $arr = $bypase ? DB_USER::_GetAllPageRightsForUser($db, $userID) : array(); $forum = ThreadedForumBuilder::MakeFolderHierarchyForUser( DB_PAGE::_GetPageListForUserID($db, $userID), $arr, 1, $bypase); echo ThreadedForumViewer::BuildViewForAdminPageManage($forum, $userID == _SESSION::GetUserID() ? _SESSION::GetCanCDSelf() : _SESSION::GetCanCDOther()); $db->disconnect(); } else { echo "Access Denied"; } } else {
public function absolutePreProcessing() { $pageID = _FCORE::IsSetPostDefault( PAGES_PAGEID, _FCORE::IsSetGetDefault( PAGES_PAGEID, false)); if ($pageID){ $db = _DB::_Connect(); $this->crossInfo[_ADMINPAGE::PAGES_INFO] = DB_PAGE::_GetPage($db, $pageID); $this->crossInfo[_ADMINPAGE::USERS_LIST] = DB_USER::_GetUser($db, $this->crossInfo[_ADMINPAGE::PAGES_INFO]->getUserID()); $action = _FCORE::IsSetPostDefault(ACTION_GO, false); if ($action){ switch($action){ case ACTION_RIGHTS: $userID = $this->crossInfo[_ADMINPAGE::PAGES_INFO]->getUserID(); if (_SESSION::GetIsMaster() || $userID == _SESSION::GetUserID()){ $rightsList = explode("&",_FCORE::IsSetPost(_ADMINPAGE::RIGHTS_LIST)); $count = sizeof($rightsList); for($i=0; $i<$count; $i++){ try { $this->crossInfo[_ADMINPAGE::PAGES_INFO]->setRights( $rightsList[$i], _FCORE::IsSetPOST($rightsList[$i])); $this->crossInfo[RESULTS] .= "<div>Right Updated</div>"; } catch(Exception $e){ $this->crossInfo[RESULTS] .= "<div>Exception".$e->getMessage().$e->getLine().$e->getFile()."</div>"; } } } else { $this->crossInfo[RESULTS] .= "<div>Failed</div>"; } break; case ACTION_UPDATE: $title = _FCORE::IsSetPostDefault(PAGES_TITLE, false); $content = _FCORE::IsSetPostDefault(PAGES_CONTENT, false); if ($title && $content){ if ((($this->crossInfo[_ADMINPAGE::PAGES_INFO]->getUserID() == _SESSION::GetUserID()) && _SESSION::GetCanCDSelf()) || (($this->crossInfo[_ADMINPAGE::PAGES_INFO]->getUserID() != _SESSION::GetUserID()) && _SESSION::GetCanCDOther())) { try { $this->crossInfo[_ADMINPAGE::PAGES_INFO]->setTitle($title); $this->crossInfo[_ADMINPAGE::PAGES_INFO]->setContent($content); $this->crossInfo[RESULTS] .= "Successfully Updated Content"; } catch(Exception $e){ $this->crossInfo[RESULTS] .= "An Internal Error Occurred: ".$e->getMessage(); } } else { _FCORE::Redirect(ERROR_HTTP_ACCESSDENIED); } } else { } break; } } $this->crossInfo[_ADMINPAGE::RIGHTS_LIST] = DB_PAGE::_GetPageRights($db, $pageID); $db->disconnect(); } else { _FCORE::Redirect(ERROR_HTTP_UNKNOWNACTION); } }