OSDN Git Service

Admin判定の変更
authorCake <cake_67@users.sourceforge.jp>
Tue, 8 Mar 2011 05:39:40 +0000 (14:39 +0900)
committerCake <cake_67@users.sourceforge.jp>
Tue, 8 Mar 2011 05:39:40 +0000 (14:39 +0900)
app/plugins/links/controllers/links_controller.php
app/plugins/links/models/link.php

index 968824b..8a37b42 100644 (file)
@@ -94,16 +94,16 @@ class LinksController extends AppController {
 
        function add() {
                if (!empty($this->data)) {
-                       $this->_add(false);
+                       $this->_add();
                }
        }
 
        function edit($id = null) {
-               $this->_edit($id, false);
+               $this->_edit($id);
        }
 
        function delete($id = null) {
-               $this->_delete($id, false);
+               $this->_delete($id);
        }
 
        function visit($id = null) {
@@ -122,28 +122,28 @@ class LinksController extends AppController {
        }
 
        function admin_index() {
-               $this->_index(true);
+               $this->_index();
        }
 
        function admin_listview() {
-               $this->_listview(true);
+               $this->_listview();
        }
 
        function admin_add() {
                if (!empty($this->data)) {
-                       $this->_add(true);
+                       $this->_add();
                }
        }
 
        function admin_edit($id = null) {
-               $this->_edit($id, true);
+               $this->_edit($id);
        }
 
        function admin_delete($id = null) {
-               $this->_delete($id, true);
+               $this->_delete($id);
        }
 
-       function _index($isAdmin = false) {
+       function _index() {
                $this->Link->beforeFind('');
                // WhatsNew
                $member = $this->Link->find('all', array('options' => array(
@@ -171,7 +171,7 @@ class LinksController extends AppController {
                ));
        }
 
-       function _listview($isAdmin = false) {
+       function _listview() {
                $this->paginate = $this->Link->options();
                $links = $this->paginate();
 
@@ -182,11 +182,11 @@ class LinksController extends AppController {
                $this->set('title_for_layout', " - ". __('Links', true));
        }
 
-       function _add($isAdmin = false) {
+       function _add() {
                // デモモードチェック
                $this->_check_demo();
 
-               if ($isAdmin) {
+               if ($this->isAdmin) {
                        $fieldList = $this->Link->fields['admin_add'];
                } else {
                        $fieldList = $this->Link->fields['add'];
@@ -216,7 +216,7 @@ class LinksController extends AppController {
                $this->set('title_for_layout', " - ". __('ADD Link', true));
        }
 
-       function _edit($id = null, $isAdmin = false) {
+       function _edit($id = null) {
                // デモモードチェック
                $this->_check_demo();
 
@@ -227,7 +227,7 @@ class LinksController extends AppController {
                $link = $this->_getLink4id($id);
 
                // 権限チェック
-               if (!$isAdmin) {
+               if (!$this->isAdmin) {
                        if ($link['Link']['user_id'] != $this->user_id) {
                                $this->Session->setFlash(__('No Permission', true));
                                $this->redirect(array('action' => 'listview'));
@@ -239,7 +239,7 @@ class LinksController extends AppController {
                }
 
                if (!empty($this->data)) {
-                       if ($isAdmin) {
+                       if ($this->isAdmin) {
                                $fieldList = $this->Link->fields['admin_edit'];
                        } else {
                                $fieldList = $this->Link->fields['edit'];
@@ -272,7 +272,7 @@ class LinksController extends AppController {
                $this->set('title_for_layout', " - ". __('Edit Link', true). " - ". $link['Link']['title']. "(". $link['Link']['url']. ")");
        }
 
-       function _delete($id = null, $isAdmin = false) {
+       function _delete($id = null) {
                // デモモードチェック
                $this->_check_demo();
 
@@ -283,7 +283,7 @@ class LinksController extends AppController {
                $link = $this->_getLink4id($id);
 
                // 権限チェック
-               if (!$isAdmin) {
+               if (!$this->isAdmin) {
                        if ($link['Link']['user_id'] != $this->user_id) {
                                $this->Session->setFlash(__('No Permission', true));
                                $this->redirect(array('action' => 'listview'));
index df07233..fd5e8c8 100644 (file)
@@ -259,7 +259,7 @@ class Link extends AppModel {
                }
 
                $params = Router::getParams();
-               if ($params->admin) {
+               if (isset($params->admin)) {
                        if (!in_array($data["type"], array_keys($this->type))) {
                                return false;
                        }