OSDN Git Service

FIX: PHP5/MySQL5における文法違反コードの修正
[nucleus-jp/nucleus-jp-ancient.git] / nucleus / libs / BLOG.php
index a832f20..ae6a09d 100755 (executable)
@@ -161,8 +161,8 @@ class BLOG {
                $template =& $manager->getTemplate($templateName);
 
                // create parser object & action handler
-               $actions =& new ITEMACTIONS($this);
-               $parser =& new PARSER($actions->getDefinedActions(),$actions);
+               $actions = new ITEMACTIONS($this);
+               $parser = new PARSER($actions->getDefinedActions(),$actions);
                $actions->setTemplate($template);
                $actions->setHighlight($highlight);
                $actions->setLastVisit($lastVisit);
@@ -189,26 +189,50 @@ class BLOG {
                                        $timestamp = $item->timestamp;
                                        if ($old_date != 0) {
                                                $oldTS = strtotime($old_date);
-                                               $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));
+                                               $param = array(
+                                                       'blog'          => &$this,
+                                                       'timestamp'     =>  $oldTS
+                                               );
+                                               $manager->notify('PreDateFoot', $param);
                                                $tmp_footer = strftimejp(isset($template['DATE_FOOTER'])?$template['DATE_FOOTER']:'', $oldTS);
                                                $parser->parse($tmp_footer);
-                                               $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));
+                                               $param = array(
+                                                       'blog'          => &$this,
+                                                       'timestamp'     =>  $oldTS
+                                               );
+                                               $manager->notify('PostDateFoot', $param);
                                        }
-                                       $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));
+                                       $param = array(
+                                               'blog'          => &$this,
+                                               'timestamp'     =>  $timestamp
+                                       );
+                                       $manager->notify('PreDateHead', $param);
                                        // note, to use templatvars in the dateheader, the %-characters need to be doubled in
                                        // order to be preserved by strftime
                                        $tmp_header = strftimejp((isset($template['DATE_HEADER']) ? $template['DATE_HEADER'] : null), $timestamp);
                                        $parser->parse($tmp_header);
-                                       $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));
+                                       $param = array(
+                                               'blog'          => &$this,
+                                               'timestamp'     =>  $timestamp
+                                       );
+                                       $manager->notify('PostDateHead', $param);
                                }
                                $old_date = $new_date;
                        }
 
                        // parse item
                        $parser->parse($template['ITEM_HEADER']);
-                       $manager->notify('PreItem', array('blog' => &$this, 'item' => &$item));
+                       $param = array(
+                               'blog' => &$this,
+                               'item' => &$item
+                       );
+                       $manager->notify('PreItem', $param);
                        $parser->parse($template['ITEM']);
-                       $manager->notify('PostItem', array('blog' => &$this, 'item' => &$item));
+                       $param = array(
+                               'blog' => &$this,
+                               'item' => &$item
+                       );
+                       $manager->notify('PostItem', $param);
                        $parser->parse($template['ITEM_FOOTER']);
 
                }
@@ -217,9 +241,17 @@ class BLOG {
 
                // add another date footer if there was at least one item
                if (($numrows > 0) && $dateheads) {
-                       $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));
+                       $param = array(
+                               'blog'          => &$this,
+                               'timestamp'     =>  strtotime($old_date)
+                       );
+                       $manager->notify('PreDateFoot', $param);
                        $parser->parse($template['DATE_FOOTER']);
-                       $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));
+                       $param = array(
+                               'blog'          => &$this,
+                               'timestamp'     =>  strtotime($old_date)
+                       );
+                       $manager->notify('PostDateFoot', $param);
                }
 
                sql_free_result($items);        // free memory
@@ -265,7 +297,18 @@ class BLOG {
 
                $timestamp = date('Y-m-d H:i:s',$timestamp);
 
-               $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid));
+               $param = array(
+               'title'         => &$title,
+               'body'          => &$body,
+               'more'          => &$more,
+               'blog'          => &$this,
+               'authorid'      => &$authorid,
+               'timestamp'     => &$timestamp,
+               'closed'        => &$closed,
+               'draft'         => &$draft,
+               'catid'         => &$catid
+               );
+               $manager->notify('PreAddItem', $param);
 
                $ititle = sql_real_escape_string($title);
                $ibody = sql_real_escape_string($body);
@@ -276,7 +319,8 @@ class BLOG {
                sql_query($query);
                $itemid = sql_insert_id();
 
-               $manager->notify('PostAddItem',array('itemid' => $itemid));
+               $param = array('itemid' => $itemid);
+               $manager->notify('PostAddItem', $param);
 
                if (!$draft)
                        $this->updateUpdateFile();
@@ -315,7 +359,7 @@ class BLOG {
 
                $frommail = $member->getNotifyFromMailAddress();
 
-               $notify =& new NOTIFICATION($this->getNotifyAddress());
+               $notify = new NOTIFICATION($this->getNotifyAddress());
                $notify->notify($mailto_title, $mailto_msg , $frommail);
 
 
@@ -356,28 +400,24 @@ class BLOG {
                                $catName = $catName . $i;
                        }
 
-                       $manager->notify(
-                               'PreAddCategory',
-                               array(
-                                       'blog' => &$this,
-                                       'name' => &$catName,
-                                       'description' => $catDescription
-                               )
+                       $param = array(
+                               'blog'                  => &$this,
+                               'name'                  => &$catName,
+                               'description'   =>  $catDescription
                        );
+                       $manager->notify('PreAddCategory', $param);
 
                        $query = 'INSERT INTO '.sql_table('category').' (cblog, cname, cdesc) VALUES (' . $this->getID() . ", '" . sql_real_escape_string($catName) . "', '" . sql_real_escape_string($catDescription) . "')";
                        sql_query($query);
                        $catid = sql_insert_id();
 
-                       $manager->notify(
-                               'PostAddCategory',
-                               array(
-                                       'blog' => &$this,
-                                       'name' => $catName,
-                                       'description' => $catDescription,
-                                       'catid' => $catid
-                               )
+                       $param = array(
+                               'blog'                  => &$this,
+                               'name'                  =>  $catName,
+                               'description'   =>  $catDescription,
+                               'catid'                 =>  $catid
                        );
+                       $manager->notify('PostAddCategory', $param);
 
                        return $catid;
                } else {
@@ -456,7 +496,7 @@ class BLOG {
         */
        function getSqlSearch($query, $amountMonths = 0, &$highlight, $mode = '')
        {
-               $searchclass =& new SEARCH($query);
+               $searchclass = new SEARCH($query);
 
                $highlight      = $searchclass->inclusive;
 
@@ -619,12 +659,8 @@ class BLOG {
                        $archive['year'] = $data['year'];
                        $data['archivelink'] = createArchiveLink($this->getID(),$archivedate,$linkparams);
 
-                       $manager->notify(
-                               'PreArchiveListItem',
-                               array(
-                                       'listitem' => &$data
-                               )
-                       );
+                       $param = array('listitem' => &$data);
+                       $manager->notify('PreArchiveListItem', $param);
 
                        $temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data);
                        echo strftimejp($temp,$current->itime);
@@ -732,12 +768,8 @@ class BLOG {
                                }
                        }
 
-                       $manager->notify(
-                               'PreCategoryListItem',
-                               array(
-                                       'listitem' => &$data
-                               )
-                       );
+                       $param = array('listitem' => &$data);
+                       $manager->notify('PreCategoryListItem', $param);
 
                        echo TEMPLATE::fill((isset($template['CATLIST_LISTITEM']) ? $template['CATLIST_LISTITEM'] : null), $data);
                        //$temp = TEMPLATE::fill((isset($template['CATLIST_LISTITEM']) ? $template['CATLIST_LISTITEM'] : null), $data);
@@ -823,12 +855,8 @@ class BLOG {
                                $list['blogname'] = $data['bname'];
                        }
 
-                       $manager->notify(
-                               'PreBlogListItem',
-                               array(
-                                       'listitem' => &$list
-                               )
-                       );
+                       $param = array('listitem' => &$list);
+                       $manager->notify('PreBlogListItem', $param);
 
                        echo TEMPLATE::fill((isset($template['BLOGLIST_LISTITEM']) ? $template['BLOGLIST_LISTITEM'] : null), $list);
 
@@ -1132,29 +1160,25 @@ class BLOG {
                if ($tmem->isTeamMember($this->getID()))
                        return 0;
 
-               $manager->notify(
-                       'PreAddTeamMember',
-                       array(
-                               'blog' => &$this,
-                               'member' => &$tmem,
-                               'admin' => &$admin
-                       )
+               $param = array(
+                       'blog'          => &$this,
+                       'member'        => &$tmem,
+                       'admin'         => &$admin
                );
+               $manager->notify('PreAddTeamMember', $param);
 
                // add to team
                $query = 'INSERT INTO '.sql_table('team').' (TMEMBER, TBLOG, TADMIN) '
                           . 'VALUES (' . $memberid .', '.$this->getID().', "'.$admin.'")';
                sql_query($query);
 
-               $manager->notify(
-                       'PostAddTeamMember',
-                       array(
-                               'blog' => &$this,
-                               'member' => &$tmem,
-                               'admin' => $admin
-                       )
-
+               
+               $param = array(
+                       'blog'          => &$this,
+                       'member'        => &$tmem,
+                       'admin'         => $admin
                );
+               $manager->notify('PostAddTeamMember', $param);
 
                $logMsg = sprintf(_TEAM_ADD_NEWTEAMMEMBER, $tmem->getDisplayName(), $memberid, $this->getName());
                ACTIONLOG::add(INFO, $logMsg);
@@ -1204,12 +1228,11 @@ class BLOG {
                                // This $pinged is allow a plugin to tell other hook to the event that a ping is sent already
                                // Note that the plugins's calling order is subject to thri order in the plugin list
                                $pinged = false;
-                               $manager->notify(
-                                               'JustPosted',
-                                               array('blogid' => $blogid,
-                                               'pinged' => &$pinged
-                                               )
+                               $param = array(
+                                       'blogid' =>  $blogid,
+                                       'pinged' => &$pinged
                                );
+                               $manager->notify('JustPosted', $param);
 
                                // clear all expired future posts
                                sql_query("UPDATE " . sql_table('item') . " SET iposted='1' WHERE iblog=" . $blogid . " AND itime<NOW()");