OSDN Git Service

FIX: PreUpdateItemイベントで渡される配列データのキー値にTab文字が含めれていたのを削除
[nucleus-jp/nucleus-jp-ancient.git] / nucleus / libs / ITEM.php
index c1ef7cf..047c740 100755 (executable)
@@ -2,21 +2,15 @@
 \r
 /*\r
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2011 The Nucleus Group\r
+ * Copyright (C) 2002-2012 The Nucleus Group\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
  * as published by the Free Software Foundation; either version 2\r
  * of the License, or (at your option) any later version.\r
  * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class representing an item\r
  *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2011 The Nucleus Group\r
- * @version $Id$\r
- * $NucleusJP: ITEM.php,v 1.7.2.3 2008/02/07 06:13:30 kimitake Exp $\r
+ * A class representing an item\r
  */\r
 class ITEM {\r
 \r
@@ -164,7 +158,17 @@ class ITEM {
                //Setting the itemOptions\r
                $aOptions = requestArray('plugoption');\r
                NucleusPlugin::_applyPluginOptions($aOptions, $itemid);\r
-               $manager->notify('PostPluginOptionsUpdate',array('context' => 'item', 'itemid' => $itemid, 'item' => array('title' => $i_title, 'body' => $i_body, 'more' => $i_more, 'closed' => $i_closed, 'catid' => $i_catid)));\r
+               $param = array(\r
+               'context'       => 'item',\r
+               'itemid'        => $itemid,\r
+               'item'          => array(\r
+                       'title'         => $i_title,\r
+                       'body'          => $i_body,\r
+                       'more'          => $i_more,\r
+                       'closed'        => $i_closed,\r
+                       'catid'         => $i_catid)\r
+               );\r
+               $manager->notify('PostPluginOptionsUpdate', $param);\r
 \r
                if ($i_draftid > 0) {\r
                        // delete permission is checked inside ITEM::delete()\r
@@ -208,7 +212,16 @@ class ITEM {
                }\r
 \r
                // call plugins\r
-               $manager->notify('PreUpdateItem',array('itemid' => $itemid, 'title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$blog, 'closed' => &$closed, 'catid' => &$catid));\r
+               $param = array(\r
+                       'itemid'        =>  $itemid,\r
+                       'title'         => &$title,\r
+                       'body'          => &$body,\r
+                       'more'          => &$more,\r
+                       'blog'          => &$blog,\r
+                       'closed'        => &$closed,\r
+                       'catid'         => &$catid\r
+               );\r
+               $manager->notify('PreUpdateItem', $param);\r
 \r
                // update item itsself\r
                $query =  'UPDATE '.sql_table('item')\r
@@ -264,7 +277,8 @@ class ITEM {
                // off we go!\r
                sql_query($query);\r
 \r
-               $manager->notify('PostUpdateItem',array('itemid' => $itemid));\r
+               $param = array('itemid' => $itemid);\r
+               $manager->notify('PostUpdateItem', $param);\r
 \r
                // when needed, move item and comments to new blog\r
                if ($moveNeeded)\r
@@ -273,7 +287,18 @@ class ITEM {
                //update the itemOptions\r
                $aOptions = requestArray('plugoption');\r
                NucleusPlugin::_applyPluginOptions($aOptions);\r
-               $manager->notify('PostPluginOptionsUpdate',array('context' => 'item', 'itemid' => $itemid, 'item' => array('title' => $title, 'body' => $body, 'more' => $more, 'closed' => $closed, 'catid' => $catid)));\r
+               $param = array(\r
+                       'context'       => 'item',\r
+                       'itemid'        => $itemid,\r
+                       'item'          => array(\r
+                               'title'         => $title,\r
+                               'body'          => $body,\r
+                               'more'          => $more,\r
+                               'closed'        => $closed,\r
+                               'catid'         => $catid\r
+                       )\r
+               );\r
+               $manager->notify('PostPluginOptionsUpdate', $param);\r
 \r
        }\r
 \r
@@ -290,14 +315,12 @@ class ITEM {
 \r
                $new_blogid = getBlogIDFromCatID($new_catid);\r
 \r
-               $manager->notify(\r
-                       'PreMoveItem',\r
-                       array(\r
-                               'itemid' => $itemid,\r
-                               'destblogid' => $new_blogid,\r
-                               'destcatid' => $new_catid\r
-                       )\r
+               $param = array(\r
+                       'itemid'                => $itemid,\r
+                       'destblogid'    => $new_blogid,\r
+                       'destcatid'             => $new_catid\r
                );\r
+               $manager->notify('PreMoveItem', $param);\r
 \r
 \r
                // update item table\r
@@ -308,14 +331,12 @@ class ITEM {
                $query = 'UPDATE '.sql_table('comment')." SET cblog=" . $new_blogid." WHERE citem=" . $itemid;\r
                sql_query($query);\r
 \r
-               $manager->notify(\r
-                       'PostMoveItem',\r
-                       array(\r
-                               'itemid' => $itemid,\r
-                               'destblogid' => $new_blogid,\r
-                               'destcatid' => $new_catid\r
-                       )\r
+               $param = array(\r
+                       'itemid'                => $itemid,\r
+                       'destblogid'    => $new_blogid,\r
+                       'destcatid'             => $new_catid\r
                );\r
+               $manager->notify('PostMoveItem', $param);\r
        }\r
 \r
        /**\r
@@ -332,8 +353,8 @@ class ITEM {
                        return 1;\r
                }\r
 \r
-\r
-               $manager->notify('PreDeleteItem', array('itemid' => $itemid));\r
+               $param = array('itemid' => $itemid);\r
+               $manager->notify('PreDeleteItem', $param);\r
 \r
                // delete item\r
                $query = 'DELETE FROM '.sql_table('item').' WHERE inumber=' . $itemid;\r
@@ -346,7 +367,8 @@ class ITEM {
                // delete all associated plugin options\r
                NucleusPlugin::_deleteOptionValues('item', $itemid);\r
 \r
-               $manager->notify('PostDeleteItem', array('itemid' => $itemid));\r
+               $param = array('itemid' => $itemid);\r
+               $manager->notify('PostDeleteItem', $param);\r
 \r
                return 0;\r
        }\r
@@ -448,12 +470,25 @@ class ITEM {
                        $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft);\r
                }\r
 \r
+               /*\r
                // No plugin support in AutoSaveDraft yet\r
                //Setting the itemOptions\r
-               //$aOptions = requestArray('plugoption');\r
-               //NucleusPlugin::_applyPluginOptions($aOptions, $itemid);\r
-               //$manager->notify('PostPluginOptionsUpdate',array('context' => 'item', 'itemid' => $itemid, 'item' => array('title' => $i_title, 'body' => $i_body, 'more' => $i_more, 'closed' => $i_closed, 'catid' => $i_catid)));\r
-\r
+               $aOptions = requestArray('plugoption');\r
+               NucleusPlugin::_applyPluginOptions($aOptions, $itemid);\r
+               $param = array(\r
+                       'context'       => 'item',\r
+                       'itemid'        => $itemid,\r
+                       'item'          => array(\r
+                               'title'         => $i_title,\r
+                               'body'          => $i_body,\r
+                               'more'          => $i_more,\r
+                               'closed'        => $i_closed,\r
+                               'catid'         => $i_catid\r
+                       )\r
+               );\r
+               $manager->notify('PostPluginOptionsUpdate', $param);\r
+               */\r
+               \r
                // success\r
                return array('status' => 'added', 'draftid' => $itemid);\r
        }\r