Example #1
0
 /**
  * beforeFilter
  *
  * @return void
  * @access public
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     /* 認証設定 */
     $this->BcAuth->allow('index', 'mobile_index', 'smartphone_index', 'archives', 'mobile_archives', 'smartphone_archives', 'posts', 'mobile_posts', 'smartphone_posts', 'get_calendar', 'get_categories', 'get_posted_months', 'get_posted_years', 'get_recent_entries', 'get_authors');
     $this->BlogContent->recursive = -1;
     if ($this->contentId) {
         $this->blogContent = $this->BlogContent->read(null, $this->contentId);
     } else {
         $this->blogContent = $this->BlogContent->read(null, $this->params['pass'][0]);
         $this->contentId = $this->params['pass'][0];
     }
     $this->BlogPost->setupUpload($this->blogContent['BlogContent']['id']);
     $this->subMenuElements = array('default');
     $this->crumbs = array(array('name' => $this->blogContent['BlogContent']['title'], 'url' => '/' . $this->blogContent['BlogContent']['name'] . '/index'));
     // ページネーションのリンク対策
     // コンテンツ名を変更している際、以下の設定を行わないとプラグイン名がURLに付加されてしまう
     // Viewで $paginator->options = array('url' => $this->passedArgs) を行う事が前提
     if (!isset($this->request->params['admin'])) {
         $this->passedArgs['controller'] = $this->blogContent['BlogContent']['name'];
         $this->passedArgs['plugin'] = $this->blogContent['BlogContent']['name'];
         $this->passedArgs['action'] = $this->action;
     }
     // コメント送信用のトークンを出力する為にセキュリティコンポーネントを利用しているが、
     // 表示用のコントローラーなのでポストデータのチェックは必要ない
     if (Configure::read('debug') > 0) {
         $this->Security->validatePost = false;
         $this->Security->csrfCheck = false;
     } else {
         $this->Security->enabled = true;
         $this->Security->validatePost = false;
     }
 }
 /**
  * before_filter
  *
  * @return void
  * @access public
  */
 function beforeFilter()
 {
     parent::beforeFilter();
     if ($this->params['prefix'] == 'admin') {
         $this->subMenuElements = array('blog_common');
     }
 }
 /**
  * beforeFilter
  *
  * @return void
  * @access public
  */
 function beforeFilter()
 {
     parent::beforeFilter();
     $this->AuthEx->allow('add', 'captcha', 'smartphone_add', 'smartphone_captcha');
     $navis = array();
     if (!empty($this->params['pass'][1])) {
         $dbDatas = $this->BlogPost->read(null, $this->params['pass'][1]);
         if (!$dbDatas) {
             $this->notFound();
         }
         $this->blogPost['BlogPost'] = $dbDatas['BlogPost'];
         $this->blogContent['BlogContent'] = $dbDatas['BlogContent'];
         $navis[$this->blogContent['BlogContent']['title'] . '管理'] = '/admin/blog/blog_posts/index/' . $this->blogContent['BlogContent']['id'];
         $navis[$this->blogPost['BlogPost']['name']] = '/admin/blog/blog_posts/edit/' . $this->blogContent['BlogContent']['id'] . '/' . $this->blogPost['BlogPost']['id'];
     } elseif (!empty($this->params['pass'][0])) {
         $dbDatas = $this->BlogPost->BlogContent->read(null, $this->params['pass'][0]);
         $this->blogContent['BlogContent'] = $dbDatas['BlogContent'];
         $navis[$this->blogContent['BlogContent']['title'] . '管理'] = '/admin/blog/blog_posts/index/' . $this->blogContent['BlogContent']['id'];
     }
     $this->navis = am($this->navis, $navis);
     if (!empty($this->params['prefix']) && $this->params['prefix'] == 'admin') {
         $this->subMenuElements = array('blog_posts', 'blog_categories', 'blog_common');
     }
     $this->Security->enabled = true;
     $this->Security->requireAuth('add');
 }
 /**
  * beforeFilter
  *
  * @return void
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->BcAuth->allow('add', 'captcha', 'smartphone_add', 'smartphone_captcha', 'get_token');
     if (BcUtil::isAdminSystem()) {
         $this->subMenuElements = array('blog_posts');
         $this->request->params['Content'] = $this->BcContents->getContent($this->request->params['pass'][0])['Content'];
         $this->Security->enabled = true;
         $this->Security->requireAuth('add');
     }
     $crumbs = array();
     if (!empty($this->params['pass'][1])) {
         $dbDatas = $this->BlogPost->find('first', ['conditions' => ['BlogPost.id' => $this->params['pass'][1]]]);
         if (!$dbDatas) {
             $this->notFound();
         }
         $this->blogPost = array('BlogPost' => $dbDatas['BlogPost']);
         $this->blogContent = array('BlogContent' => $dbDatas['BlogContent']);
         if (BcUtil::isAdminSystem()) {
             $crumbs[] = array('name' => $this->request->params['Content']['title'] . '設定', 'url' => array('controller' => 'blog_posts', 'action' => 'index', $this->blogContent['BlogContent']['id']));
             $crumbs[] = array('name' => $this->blogPost['BlogPost']['name'], 'url' => array('controller' => 'blog_posts', 'action' => 'edit', $this->blogContent['BlogContent']['id'], $this->blogPost['BlogPost']['id']));
         }
     } elseif (!empty($this->params['pass'][0])) {
         if (!in_array($this->request->action, ['captcha', 'smartphone_captcha', 'get_token'])) {
             $dbDatas = $this->BlogPost->BlogContent->find('first', ['conditions' => ['BlogContent.id' => $this->params['pass'][0]]]);
             $this->blogContent = array('BlogContent' => $dbDatas['BlogContent']);
             if (BcUtil::isAdminSystem()) {
                 $crumbs[] = array('name' => $this->request->params['Content']['title'] . '設定', 'url' => array('controller' => 'blog_posts', 'action' => 'index', $this->blogContent['BlogContent']['id']));
             }
         }
     }
     $this->crumbs = array_merge($this->crumbs, $crumbs);
 }
 /**
  * beforeFilter
  *
  * @return void
  * @access public
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->BcAuth->allow('add', 'captcha', 'smartphone_add', 'smartphone_captcha', 'get_token');
     $crumbs = array();
     if (!empty($this->params['pass'][1])) {
         $dbDatas = $this->BlogPost->read(null, $this->params['pass'][1]);
         if (!$dbDatas) {
             $this->notFound();
         }
         $this->blogPost = array('BlogPost' => $dbDatas['BlogPost']);
         $this->blogContent = array('BlogContent' => $dbDatas['BlogContent']);
         $crumbs[] = array('name' => $this->blogContent['BlogContent']['title'] . '管理', 'url' => array('controller' => 'blog_posts', 'action' => 'index', $this->blogContent['BlogContent']['id']));
         $crumbs[] = array('name' => $this->blogPost['BlogPost']['name'], 'url' => array('controller' => 'blog_posts', 'action' => 'edit', $this->blogContent['BlogContent']['id'], $this->blogPost['BlogPost']['id']));
     } elseif (!empty($this->params['pass'][0])) {
         $dbDatas = $this->BlogPost->BlogContent->read(null, $this->params['pass'][0]);
         $this->blogContent = array('BlogContent' => $dbDatas['BlogContent']);
         $crumbs[] = array('name' => $this->blogContent['BlogContent']['title'] . '管理', 'url' => array('controller' => 'blog_posts', 'action' => 'index', $this->blogContent['BlogContent']['id']));
     }
     $this->crumbs = am($this->crumbs, $crumbs);
     if (!empty($this->params['prefix']) && $this->params['prefix'] == 'admin') {
         $this->subMenuElements = array('blog_posts', 'blog_categories');
     }
     if (empty($this->params['admin'])) {
         $this->Security->enabled = true;
         $this->Security->requireAuth('add');
     }
 }
 function beforeFilter()
 {
     parent::beforeFilter();
     $this->allow_blogger_edit = false;
     if (!empty($this->user['User']['id'])) {
         $this->allow_blogger_edit = $this->Acl->check(array('model' => 'User', 'foreign_key' => $this->user['User']['id']), 'blogger_edit');
     }
     $this->set('allow_blogger_edit', $this->allow_blogger_edit);
 }
 /**
  * beforeFilter
  *
  * @return void
  * @access public
  */
 function beforeFilter()
 {
     parent::beforeFilter();
     $this->BlogContent->recursive = -1;
     $this->blogContent = $this->BlogContent->read(null, $this->params['pass'][0]);
     $this->crumbs[] = array('name' => $this->blogContent['BlogContent']['title'] . '管理', 'url' => array('controller' => 'blog_posts', 'action' => 'index', $this->params['pass'][0]));
     if ($this->params['prefix'] == 'admin') {
         $this->subMenuElements = array('blog_posts', 'blog_categories', 'blog_common');
     }
     // バリデーション設定
     $this->BlogCategory->validationParams['blogContentId'] = $this->blogContent['BlogContent']['id'];
 }
 /**
  * beforeFilter
  *
  * @return void
  * @access public
  */
 function beforeFilter()
 {
     parent::beforeFilter();
     $this->BlogContent->recursive = -1;
     $this->blogContent = $this->BlogContent->read(null, $this->params['pass'][0]);
     $this->navis = am($this->navis, array($this->blogContent['BlogContent']['title'] . '管理' => '/admin/blog/blog_posts/index/' . $this->params['pass'][0]));
     if ($this->params['prefix'] == 'admin') {
         $this->subMenuElements = array('blog_posts', 'blog_categories', 'blog_common');
     }
     // バリデーション設定
     $this->BlogCategory->validationParams['blogContentId'] = $this->blogContent['BlogContent']['id'];
 }
Example #9
0
 /**
  * beforeFilter
  *
  * @return void
  * @access public
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     if (isset($this->request->params['pass'][0])) {
         $this->BlogContent->recursive = -1;
         $this->blogContent = $this->BlogContent->read(null, $this->request->params['pass'][0]);
         $this->crumbs[] = array('name' => $this->blogContent['BlogContent']['title'] . '管理', 'url' => array('controller' => 'blog_posts', 'action' => 'index', $this->request->params['pass'][0]));
         $this->BlogPost->setupUpload($this->blogContent['BlogContent']['id']);
         if ($this->request->params['prefix'] == 'admin') {
             $this->subMenuElements = array('blog_posts', 'blog_categories');
         }
         if (!empty($this->siteConfigs['editor']) && $this->siteConfigs['editor'] != 'none') {
             $this->helpers[] = $this->siteConfigs['editor'];
         }
     }
 }
 function beforeFilter()
 {
     parent::beforeFilter();
     $this->checked_blogger = false;
     if (!empty($this->user['User']['id'])) {
         $this->checked_blogger = $this->Acl->check(array('model' => 'User', 'foreign_key' => $this->user['User']['id']), 'blog_post');
     }
     $this->set('checked_blogger', $this->checked_blogger);
     $this->allow_blogger_edit = false;
     if (!empty($this->user['User']['id']) && BlogConfig::load('useBlogger')) {
         $this->allow_blogger_edit = $this->Acl->check(array('model' => 'User', 'foreign_key' => $this->user['User']['id']), 'blogger_edit');
     }
     //$this->allow_blogger_edit = true;
     $this->set('allow_blogger_edit', $this->allow_blogger_edit);
     if (!isset($this->params['admin']) || $this->params['admin'] == false) {
         //List of categories of blog
         $listCategories = $this->BlogFunctions->findListCount();
         $this->set(compact('listCategories'));
         //List of Archives
         $listArchives = $this->BlogFunctions->findArchivesCount(null, $this->lang);
         $this->set(compact('listArchives'));
     }
 }
Example #11
0
 /**
  * PostsController::beforeFilter()
  *
  * empty
  */
 function beforeFilter()
 {
     parent::beforeFilter();
 }