OSDN Git Service

MARGE:masterブランチのマージ(マージできない分について、データベースハンドラーを書き換え)
[nucleus-jp/nucleus-next.git] / nucleus / libs / ITEMACTIONS.php
index 81afd2c..333dd81 100644 (file)
@@ -93,15 +93,15 @@ class ItemActions extends BaseActions
                'plugin',
                'query',
                'relevance',
-               'smartbody',
-               'syndicate_description',
-               'syndicate_title',
-               'time',
-               'title',
-       /* actions defined in BodyAction class */
+               'smartbody',\r
+               'syndicate_description',\r
+               'syndicate_title',\r
+               'time',\r
+               'title',\r
+       /* actions defined in BodyAction class */\r
                'image',\r
-               'media',
-               'popup',\r
+               'media',\r
+               'popup'\r
        );\r
        \r
        /**\r
@@ -112,6 +112,7 @@ class ItemActions extends BaseActions
        public function __construct(&$blog)\r
        {\r
                global $catid, $member;\r
+               \r
                // call constructor of superclass first\r
                parent::__construct();
                \r
@@ -162,7 +163,7 @@ class ItemActions extends BaseActions
        {\r
                global $currentitemid;\r
                $this->currentItem =& $item;\r
-               $currentitemid = $this->currentItem->itemid;\r
+               $currentitemid = $this->currentItem['itemid'];\r
                return;\r
        }\r
        \r
@@ -223,7 +224,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_body()\r
        {\r
-               $this->highlightAndParse($this->currentItem->body);\r
+               $this->highlightAndParse($this->currentItem['body']);\r
                return;\r
        }\r
        \r
@@ -236,7 +237,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_more()\r
        {\r
-               $this->highlightAndParse($this->currentItem->more);\r
+               $this->highlightAndParse($this->currentItem['more']);\r
                return;\r
        }\r
        \r
@@ -249,7 +250,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_itemid()\r
        {\r
-               echo $this->currentItem->itemid;\r
+               echo $this->currentItem['itemid'];\r
                return;\r
        }\r
        \r
@@ -262,7 +263,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_category()\r
        {\r
-               echo $this->currentItem->category;\r
+               echo $this->currentItem['category'];\r
                return;\r
        }\r
        \r
@@ -275,7 +276,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_categorylink()\r
        {\r
-               echo Link::create_link('category', array('catid' => $this->currentItem->catid, 'name' => $this->currentItem->category));\r
+               echo Link::create_link('category', array('catid' => $this->currentItem['catid'], 'name' => $this->currentItem['category']));\r
                return;\r
        }\r
        \r
@@ -288,7 +289,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_catid()\r
        {\r
-               echo $this->currentItem->catid;\r
+               echo $this->currentItem['catid'];\r
                return;\r
        }\r
        \r
@@ -301,7 +302,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_authorid()\r
        {\r
-               echo $this->currentItem->authorid;\r
+               echo $this->currentItem['authorid'];\r
                return;\r
        }\r
        \r
@@ -315,8 +316,8 @@ class ItemActions extends BaseActions
        public function parse_authorlink()\r
        {\r
                $data = array(\r
-                               'memberid' => $this->currentItem->authorid,\r
-                               'name' => $this->currentItem->author,\r
+                               'memberid' => $this->currentItem['authorid'],\r
+                               'name' => $this->currentItem['author'],\r
                                'extra' => $this->linkparams\r
                        );\r
                \r
@@ -347,9 +348,9 @@ class ItemActions extends BaseActions
        public function parse_itemlink()\r
        {\r
                $data = array(\r
-                       'itemid'        => $this->currentItem->itemid,\r
-                       'title'         => $this->currentItem->title,\r
-                       'timestamp'     => $this->currentItem->timestamp,\r
+                       'itemid'        => $this->currentItem['itemid'],\r
+                       'title'         => $this->currentItem['title'],\r
+                       'timestamp'     => $this->currentItem['timestamp'],\r
                        'extra'         => $this->linkparams\r
                );\r
                \r
@@ -379,7 +380,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_closed()\r
        {\r
-               echo $this->currentItem->closed;\r
+               echo $this->currentItem['closed'];\r
                return;\r
        }\r
        \r
@@ -392,7 +393,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_relevance()\r
        {\r
-               echo round($this->currentItem->score,2);\r
+               echo round($this->currentItem['score'], 2);\r
                return;\r
        }\r
        \r
@@ -409,10 +410,6 @@ class ItemActions extends BaseActions
                {\r
                        $itemtitle = $this->currentItem['title'];\r
                }\r
-               elseif ( is_object($this->currentItem) )\r
-               {\r
-                       $itemtitle = $this->currentItem->title;\r
-               }\r
                switch ( $format )\r
                {\r
                        case 'xml':\r
@@ -443,7 +440,7 @@ class ItemActions extends BaseActions
                global $manager;\r
                \r
                // get karma object\r
-               $karma =& $manager->getKarma($this->currentItem->itemid);\r
+               $karma =& $manager->getKarma($this->currentItem['itemid']);\r
                \r
                switch ( $type )\r
                {\r
@@ -484,20 +481,20 @@ class ItemActions extends BaseActions
                switch ( $which )\r
                {\r
                        case 'realname':\r
-                               echo $this->currentItem->authorname;\r
+                               echo $this->currentItem['authorname'];\r
                                break;\r
                        case 'id':\r
-                               echo $this->currentItem->authorid;\r
+                               echo $this->currentItem['authorid'];\r
                                break;\r
                        case 'email':\r
-                               echo $this->currentItem->authormail;\r
+                               echo $this->currentItem['authormail'];\r
                                break;\r
                        case 'url':\r
-                               echo $this->currentItem->authorurl;\r
+                               echo $this->currentItem['authorurl'];\r
                                break;\r
                        case 'name':\r
                        default:\r
-                               echo $this->currentItem->author;\r
+                               echo $this->currentItem['author'];\r
                }\r
                return;\r
        }\r
@@ -511,13 +508,13 @@ class ItemActions extends BaseActions
         */\r
        public function parse_smartbody()\r
        {\r
-               if ( !$this->currentItem->more )\r
+               if ( !$this->currentItem['more'] )\r
                {\r
-                       $this->highlightAndParse($this->currentItem->body);\r
+                       $this->highlightAndParse($this->currentItem['body']);\r
                }\r
                else\r
                {\r
-                       $this->highlightAndParse($this->currentItem->more);\r
+                       $this->highlightAndParse($this->currentItem['more']);\r
                }\r
                return;\r
        }\r
@@ -528,7 +525,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_morelink()\r
        {\r
-               if ( $this->currentItem->more )\r
+               if ( $this->currentItem['more'] )\r
                {\r
                        $this->parser->parse($this->template['MORELINK']);\r
                }\r
@@ -565,7 +562,7 @@ class ItemActions extends BaseActions
                        $offset = $this->blog->getTimeOffset() * 3600;\r
                }\r
                \r
-               echo i18n::formatted_datetime($format, $this->currentItem->timestamp, $offset);\r
+               echo i18n::formatted_datetime($format, $this->currentItem['timestamp'], $offset);\r
                return;\r
        }\r
        \r
@@ -592,7 +589,7 @@ class ItemActions extends BaseActions
                {\r
                        $format = $this->template['FORMAT_TIME'];\r
                }\r
-               echo i18n::formatted_datetime($format, $this->currentItem->timestamp);\r
+               echo i18n::formatted_datetime($format, $this->currentItem['timestamp']);\r
                return;\r
        }\r
        \r
@@ -604,7 +601,7 @@ class ItemActions extends BaseActions
         * @return      string  syndicated      title\r
         */\r
        public function parse_syndicate_title($maxLength = 100) {\r
-               $syndicated = strip_tags($this->currentItem->title);\r
+               $syndicated = strip_tags($this->currentItem['title']);\r
                echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
        }\r
        \r
@@ -618,7 +615,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_syndicate_description($maxLength = 250, $addHighlight = 0)\r
        {\r
-               $syndicated = strip_tags($this->currentItem->body);\r
+               $syndicated = strip_tags($this->currentItem['body']);\r
                if ( $addHighlight )\r
                {\r
                        $tmp_highlight = Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
@@ -641,7 +638,7 @@ class ItemActions extends BaseActions
        public function parse_karmaposlink($text = '')\r
        {\r
                global $CONF;\r
-               $link = $CONF['ActionURL'] . '?action=votepositive&itemid=' . $this->currentItem->itemid;\r
+               $link = $CONF['ActionURL'] . '?action=votepositive&itemid=' . $this->currentItem['itemid'];\r
                if ( !$text )\r
                {\r
                        echo '<a href="'.$link.'">' . $text . '</a>';\r
@@ -664,7 +661,7 @@ class ItemActions extends BaseActions
        public function parse_karmaneglink($text = '')\r
        {\r
                global $CONF;\r
-               $link = $CONF['ActionURL'] . '?action=votenegative&amp;itemid='.$this->currentItem->itemid;\r
+               $link = $CONF['ActionURL'] . '?action=votenegative&amp;itemid='.$this->currentItem['itemid'];\r
                \r
                if ( !$text )\r
                {\r
@@ -687,7 +684,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_new()\r
        {\r
-               if ( ($this->lastVisit != 0) && ($this->currentItem->timestamp > $this->lastVisit) )\r
+               if ( ($this->lastVisit != 0) && ($this->currentItem['timestamp'] > $this->lastVisit) )\r
                {\r
                        echo $this->template['NEW'];\r
                }\r
@@ -703,7 +700,7 @@ class ItemActions extends BaseActions
         */\r
        public function parse_daylink()\r
        {\r
-               echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem->timestamp), $this->linkparams);\r
+               echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem['timestamp']), $this->linkparams);\r
                return;\r
        }\r
        \r
@@ -724,9 +721,9 @@ class ItemActions extends BaseActions
                // add comments\r
                if ( $this->showComments && $this->blog->commentsEnabled() )\r
                {\r
-                       $comments = new Comments($this->currentItem->itemid);\r
+                       $comments = new Comments($this->currentItem['itemid']);\r
                        $comments->setItemActions($this);\r
-                       $comments->showComments($this->template, $maxToShow, $this->currentItem->closed ? 0 : 1, $this->strHighlight);\r
+                       $comments->showComments($this->template, $maxToShow, $this->currentItem['closed'] ? 0 : 1, $this->strHighlight);\r
                }\r
                return;\r
        }\r
@@ -772,7 +769,7 @@ class ItemActions extends BaseActions
        public function parse_edit()\r
        {\r
                global $member, $CONF;\r
-               if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem->authorid)) )\r
+               if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem['authorid'])) )\r
                {\r
                        $this->parser->parse($this->template['EDITLINK']);\r
                }\r
@@ -786,7 +783,7 @@ class ItemActions extends BaseActions
        public function parse_editlink()\r
        {\r
                global $CONF;\r
-               echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&amp;itemid=' . $this->currentItem->itemid;\r
+               echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&amp;itemid=' . $this->currentItem['itemid'];\r
                return;\r
        }\r
        \r
@@ -850,7 +847,7 @@ class ItemActions extends BaseActions
                                $condition = ($blog && ($blog->getSetting($name) == $value));\r
                                break;\r
                        case 'itemblogsetting':\r
-                               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));\r
+                               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));\r
                                $condition = ($b && ($b->getSetting($name) == $value));\r
                                break;\r
                        case 'loggedin':\r
@@ -923,19 +920,19 @@ class ItemActions extends BaseActions
        {\r
                global $member, $manager;\r
                \r
-               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));\r
+               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));\r
                \r
                // when no parameter is defined, just check if author is current visitor\r
                if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )\r
                {\r
-                       return (boolean) ((integer) $member->getID() > 0 && (integer) $member->getID() == (integer) $this->currentItem->authorid);\r
+                       return (boolean) ((integer) $member->getID() > 0 && (integer) $member->getID() == (integer) $this->currentItem['authorid']);\r
                }\r
                \r
                // check author name\r
                if ( $key == 'name' )\r
                {\r
                        $value = strtolower($value);\r
-                       if ( $value == strtolower($this->currentItem->author) )\r
+                       if ( $value == strtolower($this->currentItem['author']) )\r
                        {\r
                                return TRUE;\r
                        }\r
@@ -944,7 +941,7 @@ class ItemActions extends BaseActions
                // check if author is admin\r
                if ( ($key == 'isadmin') )\r
                {\r
-                       $aid = intval($this->currentItem->authorid);\r
+                       $aid = intval($this->currentItem['authorid']);\r
                        $blogid = intval($b->getID());                  \r
                        $amember =& $manager->getMember($aid);\r
                        if ( $amember->isAdmin() )\r
@@ -969,7 +966,7 @@ class ItemActions extends BaseActions
        {\r
                global $catid, $manager;\r
                \r
-               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));\r
+               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));\r
                \r
                // when no parameter is defined, just check if a category is selected\r
                if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
@@ -977,7 +974,7 @@ class ItemActions extends BaseActions
                        return (boolean) $b->isValidCategory($catid);\r
                }\r
                \r
-               $icatid = $this->currentItem->catid;\r
+               $icatid = $this->currentItem['catid'];\r
                \r
                // check category name\r
                if ( $key == 'catname' )\r
@@ -1128,4 +1125,4 @@ class ItemActions extends BaseActions
                \r
                return (boolean) call_user_func_array(array(&$plugin, 'doIf'), $params);\r
        }\r
-}
+}
\ No newline at end of file