Ejemplo n.º 1
0
 /**
  * Load the post model to the permalink.
  * @return {ae_PostModel} The loaded post model.
  */
 public static function getPostModel()
 {
     if (!self::isPost()) {
         $msg = sprintf('[%s] Permalink does not represent a post.', get_class());
         throw new Exception($msg);
     }
     $model = new ae_PostModel();
     if (isset($_GET[PERMALINK_GET_POST]) && ae_Validate::id($_GET[PERMALINK_GET_POST])) {
         if (!$model->load($_GET[PERMALINK_GET_POST])) {
             return FALSE;
         }
     } else {
         $permalink = mb_substr(self::$url, 1);
         $permalink = preg_replace(';^' . PERMALINK_BASE_POST . ';i', '', $permalink);
         if (!$model->loadFromPermalink($permalink)) {
             return FALSE;
         }
     }
     return $model;
 }
Ejemplo n.º 2
0
         $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');
                     exit;
                 }
             }
         }
     }
 }