コード例 #1
0
 function canUserViewPage($pageID)
 {
     $page = $this->_pageManager->newPage();
     $page->initFromDatabaseID($pageID);
     if ($pageID == -1) {
         morgosBacktrace();
     }
     $userM =& $this->getUserManager();
     $user =& $userM->getCurrentUser();
     if ($user) {
         if ($page->isAdminPage()) {
             if ($user->hasPermission('edit_admin', false)) {
                 return true;
             } else {
                 return $user->hasPermission('edit_admin_' . $pageID, true);
             }
         } else {
             return $user->hasPermission('view_page_' . $pageID, true);
         }
     } else {
         if ($page->isAdminPage()) {
             return false;
         } else {
             return true;
         }
     }
 }
コード例 #2
0
 /**
  * Returns the value of a user setting.
  *
  * @since 0.3
  * @public
  * @param $name (string) the name of the user setting
  * @return (mixed)
  */
 function getUserSetting($name)
 {
     if ($name == 'pageLang') {
         morgosBacktrace();
         die;
     } else {
         return new Error('USER_SETTING_DOESNT_EXIST');
     }
 }
コード例 #3
0
 function getParameters($default)
 {
     if ($default == array()) {
         if ($this->_method == 'GET') {
             $a = $_GET;
         } else {
             $a = $_POST;
         }
     } else {
         $a = $default;
     }
     $vals = array();
     $errors = array();
     foreach ($this->_requiredOptions as $option) {
         if (is_string($option)) {
             morgosBacktrace();
             die("Old actionmanager API used");
         }
         $cI = $option->checkInput($this->_method);
         if (!isError($cI)) {
             $vals[$option->getName()] = $option->getValue($this->_method);
         } else {
             $errors[] = $cI;
         }
     }
     foreach ($this->_notRequiredOptions as $option) {
         $cI = $option->checkInput($this->_method);
         if (!isError($cI)) {
             $vals[$option->getName()] = $option->getValue($this->_method);
         } elseif ($cI->is('EMPTY_INPUT')) {
             $vals[$option->getName()] = null;
         } else {
             $errors[] = $cI;
         }
     }
     if ($errors != array()) {
         return new Error('ACTIONMANAGER_INVALID_INPUT', $errors);
     }
     return $vals;
 }