Ejemplo n.º 1
0
 /**
  * Load the category model to the permalink.
  * @return {ae_CategoryModel} The loaded category model.
  */
 public static function getCategoryModel()
 {
     if (!self::isCategory()) {
         $msg = sprintf('[%s] Permalink does not represent a category.', get_class());
         throw new Exception($msg);
     }
     $model = new ae_CategoryModel();
     if (isset($_GET[PERMALINK_GET_CATEGORY]) && ae_Validate::id($_GET[PERMALINK_GET_CATEGORY])) {
         if (!$model->load($_GET[PERMALINK_GET_CATEGORY])) {
             return FALSE;
         }
     } else {
         $permalink = mb_substr(self::$urlNoOffset, 1);
         $permalink = preg_replace(';^' . PERMALINK_BASE_CATEGORY . ';i', '', $permalink);
         if (!$model->loadFromPermalink($permalink, TRUE)) {
             return FALSE;
         }
     }
     return $model;
 }
Ejemplo n.º 2
0
<?php

if (isset($_GET['category']) && ae_Validate::id($_GET['category'])) {
    $editArea = 'Category';
    $areaId = 'category';
    $model = new ae_CategoryModel();
    $model->load($_GET['category']);
} else {
    if (isset($_GET['cofilter']) && ae_Validate::id($_GET['cofilter'])) {
        $editArea = 'Comment filter';
        $areaId = 'cofilter';
        $model = new ae_CommentfilterModel();
        $model->load($_GET['cofilter']);
    } else {
        if (isset($_GET['comment']) && ae_Validate::id($_GET['comment'])) {
            $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']);