Esempio n. 1
0
 /**
  * Load the page model to the permalink.
  * @return {ae_PageModel} The loaded page model.
  */
 public static function getPageModel()
 {
     if (!self::isPage()) {
         $msg = sprintf('[%s] Permalink does not represent a page.', get_class());
         throw new Exception($msg);
     }
     $model = new ae_PageModel();
     if (isset($_GET[PERMALINK_GET_PAGE]) && ae_Validate::id($_GET[PERMALINK_GET_PAGE])) {
         if (!$model->load($_GET[PERMALINK_GET_PAGE])) {
             return FALSE;
         }
     } else {
         $permalink = mb_substr(self::$url, 1);
         $permalink = preg_replace(';^' . PERMALINK_BASE_PAGE . ';i', '', $permalink);
         if (!$model->loadFromPermalink($permalink)) {
             return FALSE;
         }
     }
     return $model;
 }
Esempio n. 2
0
     $editArea = 'Comment';
     $areaId = 'comment';
     $model = new ae_CommentModel();
     $model->load($_GET['comment']);
 } else {
     if (isset($_GET['media']) && ae_Validate::id($_GET['media'])) {
         $editArea = 'Media';
         $areaId = 'media';
         $model = new ae_MediaModel();
         $model->load($_GET['media']);
     } else {
         if (isset($_GET['page']) && ae_Validate::id($_GET['page'])) {
             $editArea = 'Page';
             $areaId = 'page';
             $model = new ae_PageModel();
             $model->load($_GET['page']);
         } else {
             if (isset($_GET['post']) && ae_Validate::id($_GET['post'])) {
                 $editArea = 'Post';
                 $areaId = 'post';
                 $model = new ae_PostModel();
                 $model->load($_GET['post']);
                 $model->loadCategoryIds();
             } else {
                 if (isset($_GET['user']) && ae_Validate::id($_GET['user'])) {
                     $editArea = 'User';
                     $areaId = 'user';
                     $model = new ae_UserModel();
                     $model->load($_GET['user']);
                 } else {
                     header('Location: admin.php?error=unknown_edit_area');