Exemplo n.º 1
0
            } 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 {
Exemplo n.º 2
0
    public function absolutePreProcessing(){
        $db = _DB::_Connect();
        $this->crossInfo[RESULTS] = "";
        $action = _FCORE::IsSetPostDefault(ACTION_GO, false);
        if ($action){
            if (_SESSION::GetCanWritePage($db, $pageID)){
                $pageID = _FCORE::IsSetPostDefault(PAGES_PAGEID, false);
                if ($pageID){
                    switch($action){
                        case ACTION_DELETE:
                                try {
                                    DB_PAGE::_DeletePage($db, $pageID);
                                    $this->crossInfo[RESULTS] .= "<div>Successfully Deleted Page</div>";
                                } catch(Exception $e) {
                                    $this->crossInfo[RESULTS] .= "<div>Message From System: ".$e->getMessage()."</div>";
                                }
                            break;
                        case ACTION_PASS:
                            $childOf = _FCORE::IsSetPostDefault(PAGES_CHILDOF, false);
                            if ($childOf){
                                try {
                                    $page = DB_PAGE::_GetPage($db, $pageID);
                                    $newParent = DB_PAGE::_GetPage($db, $childOf);
                                    if ($newParent->getIsPrivate() && !$page->getIsPrivate()){
                                        $this->crossInfo[RESULTS] .= "<div>Cannot Have Public Folder Inside A Private Folder</div>";
                                    } else {
                                        $page->setChildOf($childOf);
                                        $this->crossInfo[RESULTS] .= "<div>Successfully Moved Page</div>";
                                    }
                                } catch(Exception $e) {
                                    $this->crossInfo[RESULTS] .= "<div>Message From System: ".$e->getMessage()."</div>";
                                }
                            } else {
                                $this->crossInfo[RESULTS] .= "<div>pageID=".var_dump($pageID,false).",childOf=".var_dump($childOf,false)."</div>";
                            }
                            break;
                        case ACTION_UPDATE:
                            $rank = _FCORE::IsSetPostDefault(PAGES_RANK, false);
                            if ($rank !== false){
                                try {
                                    $page = DB_PAGE::_GetPage($db, $pageID);
                                    $page->setRank($rank);
                                    $this->crossInfo[RESULTS] .= "<div>Successfully Updated Rank</div>";
                                } catch(Exception $e){
                                    $this->crossInfo[RESULTS] .= "<div>Message From System: ".$e->getMessage()."</div>";
                                }
                            } else {
                                $this->crossInfo[RESULTS] .= "<div>pageID=".var_export($pageID,true).",rank=".var_export($rank,true)."</div>";
                            }
                            break;
                        case ACTION_VIEW:
                                try {
                                    $page = DB_PAGE::_GetPage($db, $pageID);
                                    if ($page->getIsPrivate()){
                                        $parent = DB_PAGE::_GetPage($db, $page->getChildOf());
                                        if ($parent->getIsPrivate()){
                                            $this->crossInfo[RESULTS] .= "<div>A Public Folder Cannot Be A Child Of A Private Folder<div>";
                                        } else {
                                            $page->setIsPrivate(false);
                                        }
                                    } else {
                                        if (DB_PAGE::_PageHasPublicChildren($db, $page->getPageID())){

                                        }
                                    }
                                } catch(Exception $e){
                                    $this->crossInfo[RESULTS] .= "<div>Message From System: ".$e->getMessage()."</div>";
                                }
                            break;
                    }
                }
            }
        }
        //$this->UserSelectOption_GET($db);

        if (_SESSION::GetCanCDOther()){
            if (_SESSION::GetCanCDSelf()){
                $this->crossInfo[PAGES_USERID] = _FCORE::IsSetPostDefault(PAGES_USERID,
                        _FCORE::IsSetGetDefault(PAGES_USERID, _SESSION::GetUserID()));
                $userList = DB_USER::_GetUserList($db);
                $count = sizeof($userList);
                $found = 0;
                $this->crossInfo[_ADMINPAGE::USERS_LIST] = array();
                for($i=0; $i<$count; $i++){
                    if ($userList[$i][USERS_USERNAME]!=_SESSION::GUEST){
                        $this->crossInfo[_ADMINPAGE::USERS_LIST][$found] = $userList[$i];
                        $found++;
                    }
                }
            } else {
                $this->crossInfo[PAGES_USERID] = _FCORE::IsSetPostDefault(PAGES_USERID,
                        _FCORE::IsSetPostDefault(PAGES_USERID, null));
                $userList = DB_USER::_GetUserList($db);
                $count = sizeof($userList);
                $found = 0;
                $this->crossInfo[_ADMINPAGE::USERS_LIST] = array();
                for($i=0; $i<$count; $i++){
                    if ($userList[$i][PAGES_USERID]!=_SESSION::GetUserID() &&
                        $userList[$i][USERS_USERNAME]!=_SESSION::GUEST){
                        if ($this->crossInfo[PAGES_USERID]==null){
                            $this->crossInfo[PAGES_USERID] = $userList[$i][PAGES_USERID];
                        }
                        $this->crossInfo[_ADMINPAGE::USERS_LIST][$found] = $userList[$i];
                        $found++;
                    }
                }
            }
        } else {
            $this->crossInfo[PAGES_USERID] = _SESSION::GetUserID();
        }

        $bypase = ($this->crossInfo[PAGES_USERID] == _SESSION::GetUserID() || _SESSION::GetDefaultRight() > 0);
        $arr = $bypase ? DB_USER::_GetAllPageRightsForUser($db, $this->crossInfo[PAGES_USERID]) : array();
        $this->crossInfo["arrayHierarchy"] = ThreadedForumBuilder::MakeFolderHierarchyForUser(
                DB_PAGE::_GetPageListForUserID($db, $this->crossInfo[PAGES_USERID]),
                $arr,
                1,
                $bypase);

        $db->disconnect();
    }