Nucleus CMSの新リリースを準備するためのリポジトリ。現在はNucleus CMS 4.0にマージするためのコードをコミットしている。
Revision | 7ea26abd7e41c2644f42ce936f6557d58755cb3a (tree) |
---|---|
Time | 2012-06-28 01:00:43 |
Author | reine <reine@user...> |
Commiter | reine |
FIX:$manager->notify()の第二引数に変数を渡すように修正。
スクリプトに含まれるすべての$manager->notify()の第二引数を変数に変更した
プラグインメソッドは、引数を参照で受け取るようにする必要がある。
@@ -296,8 +296,9 @@ class Action | ||
296 | 296 | $newmem = new Member(); |
297 | 297 | $newmem->readFromName($name); |
298 | 298 | $newmem->sendActivationLink('register'); |
299 | - | |
300 | - $manager->notify('PostRegister', array('member' => &$newmem) ); | |
299 | + | |
300 | + $data = array('member' => $newmem); | |
301 | + $manager->notify('PostRegister', $data); | |
301 | 302 | |
302 | 303 | if ( postVar('desturl') ) |
303 | 304 | { |
@@ -64,7 +64,8 @@ class ActionLog | ||
64 | 64 | |
65 | 65 | $query = sprintf('DELETE FROM %s', sql_table('actionlog')); |
66 | 66 | |
67 | - $manager->notify('ActionLogCleared',array()); | |
67 | + $data = array(); | |
68 | + $manager->notify('ActionLogCleared', $data); | |
68 | 69 | |
69 | 70 | return DB::execute($query) !== FALSE; |
70 | 71 | } |
@@ -706,10 +706,11 @@ class Actions extends BaseActions | ||
706 | 706 | * @param object $blog an instance of Blog class |
707 | 707 | * @return void |
708 | 708 | */ |
709 | - private function preBlogContent($type, &$blog) | |
709 | + private function preBlogContent($type, $blog) | |
710 | 710 | { |
711 | 711 | global $manager; |
712 | - $manager->notify('PreBlogContent',array('blog' => &$blog, 'type' => $type)); | |
712 | + $data = array('blog' => $blog, 'type' => $type); | |
713 | + $manager->notify('PreBlogContent', $data); | |
713 | 714 | return; |
714 | 715 | } |
715 | 716 |
@@ -721,10 +722,11 @@ class Actions extends BaseActions | ||
721 | 722 | * @param objecct $blog an instance of Blog class |
722 | 723 | * @return void |
723 | 724 | */ |
724 | - private function postBlogContent($type, &$blog) | |
725 | + private function postBlogContent($type, $blog) | |
725 | 726 | { |
726 | 727 | global $manager; |
727 | - $manager->notify('PostBlogContent', array('blog' => &$blog, 'type' => $type)); | |
728 | + $data = array('blog' => $blog, 'type' => $type); | |
729 | + $manager->notify('PostBlogContent', $data); | |
728 | 730 | return; |
729 | 731 | } |
730 | 732 |
@@ -974,11 +976,11 @@ class Actions extends BaseActions | ||
974 | 976 | public function parse_blog($template, $amount = 10, $category = '') |
975 | 977 | { |
976 | 978 | global $blog, $startpos; |
977 | - | |
978 | 979 | list($limit, $offset) = sscanf($amount, '%d(%d)'); |
979 | 980 | $this->setBlogCategory($blog, $category); |
980 | 981 | $this->preBlogContent('blog',$blog); |
981 | 982 | $this->amountfound = $blog->readLog($template, $limit, $offset, $startpos); |
983 | + $this->parse_benchmark(); | |
982 | 984 | $this->postBlogContent('blog',$blog); |
983 | 985 | return; |
984 | 986 | } |
@@ -1042,7 +1044,8 @@ class Actions extends BaseActions | ||
1042 | 1044 | public function parse_callback($eventName, $type) |
1043 | 1045 | { |
1044 | 1046 | global $manager; |
1045 | - $manager->notify($eventName, array('type' => $type)); | |
1047 | + $data = array('type' => $type); | |
1048 | + $manager->notify($eventName, $data); | |
1046 | 1049 | return; |
1047 | 1050 | } |
1048 | 1051 |
@@ -813,7 +813,8 @@ class Admin | ||
813 | 813 | |
814 | 814 | $item =& $manager->getItem($itemid, 1, 1); |
815 | 815 | $blog =& $manager->getBlog($item['blogid']); |
816 | - $manager->notify('PrepareItemForEdit', array('blog'=> &$blog, 'item' => &$item)); | |
816 | + $data = array('blog'=> $blog, 'item' => $item); | |
817 | + $manager->notify('PrepareItemForEdit', $data); | |
817 | 818 | |
818 | 819 | if ( $blog->convertBreaks() ) |
819 | 820 | { |
@@ -1202,8 +1203,9 @@ class Admin | ||
1202 | 1203 | |
1203 | 1204 | $member->canAlterComment($commentid) or self::disallow(); |
1204 | 1205 | |
1205 | - $comment = COMMENT::getComment($commentid); | |
1206 | - $manager->notify('PrepareCommentForEdit', array('comment' => &$comment)); | |
1206 | + $comment = Comment::getComment($commentid); | |
1207 | + $data = array('comment' => &$comment); | |
1208 | + $manager->notify('PrepareCommentForEdit', $data); | |
1207 | 1209 | |
1208 | 1210 | self::$contents = $comment; |
1209 | 1211 | self::$skin->parse('commentedit'); |
@@ -5250,8 +5252,9 @@ class Admin | ||
5250 | 5252 | { |
5251 | 5253 | $event_identifier = 'AdminSkin'; |
5252 | 5254 | } |
5253 | - | |
5254 | - $manager->notify("PreDelete{$event_identifier}", array('skinid' => $skinid)); | |
5255 | + | |
5256 | + $data = array('skinid' => $skinid); | |
5257 | + $manager->notify("PreDelete{$event_identifier}", $data); | |
5255 | 5258 | |
5256 | 5259 | // 1. delete description |
5257 | 5260 | $query = "DELETE FROM %s WHERE sdnumber=%d;"; |
@@ -5263,7 +5266,7 @@ class Admin | ||
5263 | 5266 | $query = sprintf($query, sql_table('skin'), (integer) $skinid); |
5264 | 5267 | DB::execute($query); |
5265 | 5268 | |
5266 | - $manager->notify("PostDelete{$event_identifier}", array('skinid' => $skinid)); | |
5269 | + $manager->notify("PostDelete{$event_identifier}", $data); | |
5267 | 5270 | |
5268 | 5271 | return; |
5269 | 5272 | } |
@@ -2611,11 +2611,13 @@ class AdminActions extends BaseActions | ||
2611 | 2611 | $pluginfields = array(); |
2612 | 2612 | if ( !in_array($this->skintype, Admin::$adminskin_actions) ) |
2613 | 2613 | { |
2614 | - $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields)); | |
2614 | + $data = array('fields' => &$pluginfields); | |
2615 | + $manager->notify('TemplateExtraFields', $data); | |
2615 | 2616 | } |
2616 | 2617 | else |
2617 | 2618 | { |
2618 | - $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields)); | |
2619 | + $data = array('fields' => &$pluginfields); | |
2620 | + $manager->notify('AdminTemplateExtraFields', $data); | |
2619 | 2621 | } |
2620 | 2622 | |
2621 | 2623 | foreach ( $pluginfields as $ptkey => $ptvalue ) |
@@ -3673,12 +3675,14 @@ class AdminActions extends BaseActions | ||
3673 | 3675 | case 'member': |
3674 | 3676 | $id = intRequestVar('memberid'); |
3675 | 3677 | $mem =& $manager->getMember($id); |
3676 | - $manager->notify('MemberSettingsFormExtras', array('member' => &$mem)); | |
3678 | + $data = array('member' => &$mem); | |
3679 | + $manager->notify('MemberSettingsFormExtras', $data); | |
3677 | 3680 | break; |
3678 | 3681 | case 'blog': |
3679 | 3682 | $id = intRequestVar('blogid'); |
3680 | 3683 | $blg =& $manager->getBlog($id); |
3681 | - $manager->notify('BlogSettingsFormExtras', array('member' => &$blg)); | |
3684 | + $data = array('member' => &$blg); | |
3685 | + $manager->notify('BlogSettingsFormExtras', $data); | |
3682 | 3686 | break; |
3683 | 3687 | case 'createaccount': |
3684 | 3688 | $data = array( |
@@ -3691,7 +3695,8 @@ class AdminActions extends BaseActions | ||
3691 | 3695 | $manager->notify('RegistrationFormExtraFields', $data); |
3692 | 3696 | break; |
3693 | 3697 | default: |
3694 | - $manager->notify('GeneralSettingsFormExtras', array()); | |
3698 | + $data = array(); | |
3699 | + $manager->notify('GeneralSettingsFormExtras', $data); | |
3695 | 3700 | break; |
3696 | 3701 | } |
3697 | 3702 | return; |
@@ -3929,7 +3934,8 @@ class AdminActions extends BaseActions | ||
3929 | 3934 | $templates = & $manager->getTemplate($template_name); |
3930 | 3935 | } |
3931 | 3936 | $pluginExtras = array(); |
3932 | - $manager->notify('QuickMenu', array('options' => &$pluginExtras)); | |
3937 | + $data = array('options' => &$pluginExtras); | |
3938 | + $manager->notify('QuickMenu', $data); | |
3933 | 3939 | |
3934 | 3940 | $template = array(); |
3935 | 3941 | if ( count($pluginExtras) > 0 ) |
@@ -5214,8 +5220,9 @@ class AdminActions extends BaseActions | ||
5214 | 5220 | public function parse_pagefoot() |
5215 | 5221 | { |
5216 | 5222 | global $action, $member, $manager, $blogid; |
5217 | - | |
5218 | - $manager->notify('AdminPrePageFoot', array('action' => Admin::$action)); | |
5223 | + | |
5224 | + $data = array('action' => Admin::$action); | |
5225 | + $manager->notify('AdminPrePageFoot', $data); | |
5219 | 5226 | |
5220 | 5227 | $content = $this->parser->skin->getContentFromDB('pagefoot'); |
5221 | 5228 | if ( !$content ) |
@@ -55,28 +55,19 @@ class Ban | ||
55 | 55 | public function addBan($blogid, $iprange, $reason) |
56 | 56 | { |
57 | 57 | global $manager; |
58 | - | |
59 | - $manager->notify( | |
60 | - 'PreAddBan', | |
61 | - array( | |
58 | + | |
59 | + $data = array( | |
62 | 60 | 'blogid' => $blogid, |
63 | 61 | 'iprange' => &$iprange, |
64 | 62 | 'reason' => &$reason |
65 | - ) | |
66 | - ); | |
63 | + ); | |
64 | + $manager->notify('PreAddBan', $data); | |
67 | 65 | |
68 | 66 | $query = 'INSERT INTO %s (blogid, iprange, reason) VALUES (%d, %s, %s)'; |
69 | 67 | $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange), DB::quoteValue($reason)); |
70 | 68 | $res = DB::execute($query); |
71 | 69 | |
72 | - $manager->notify( | |
73 | - 'PostAddBan', | |
74 | - array( | |
75 | - 'blogid' => $blogid, | |
76 | - 'iprange' => $iprange, | |
77 | - 'reason' => $reason | |
78 | - ) | |
79 | - ); | |
70 | + $manager->notify('PostAddBan', $data); | |
80 | 71 | |
81 | 72 | return $res !== FALSE ? 1 : 0; |
82 | 73 | } |
@@ -88,26 +79,18 @@ class Ban | ||
88 | 79 | public function removeBan($blogid, $iprange) |
89 | 80 | { |
90 | 81 | global $manager; |
91 | - | |
92 | - $manager->notify( | |
93 | - 'PreDeleteBan', | |
94 | - array( | |
82 | + | |
83 | + $data = array( | |
95 | 84 | 'blogid' => $blogid, |
96 | 85 | 'range' => $iprange |
97 | - ) | |
98 | - ); | |
86 | + ); | |
87 | + $manager->notify('PreDeleteBan', $data); | |
99 | 88 | |
100 | 89 | $query = 'DELETE FROM %s WHERE blogid=%d and iprange=%s'; |
101 | 90 | $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange)); |
102 | 91 | $res = DB::execute($query); |
103 | 92 | |
104 | - $manager->notify( | |
105 | - 'PostDeleteBan', | |
106 | - array( | |
107 | - 'blogid' => $blogid, | |
108 | - 'range' => $iprange | |
109 | - ) | |
110 | - ); | |
93 | + $manager->notify('PostDeleteBan', $data); | |
111 | 94 | |
112 | 95 | return $res !== FALSE ? 1 : 0; |
113 | 96 | } |
@@ -184,6 +184,7 @@ class Blog | ||
184 | 184 | private function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1) |
185 | 185 | { |
186 | 186 | global $CONF, $manager, $currentTemplateName; |
187 | + global $StartTime; | |
187 | 188 | |
188 | 189 | $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit'); |
189 | 190 | if ( $lastVisit != 0 ) |
@@ -228,7 +229,8 @@ class Blog | ||
228 | 229 | if ( $old_date != 0 ) |
229 | 230 | { |
230 | 231 | $oldTS = strtotime($old_date); |
231 | - $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS)); | |
232 | + $data = array('blog' => $this, 'timestamp' => $oldTS); | |
233 | + $manager->notify('PreDateFoot', $data); | |
232 | 234 | |
233 | 235 | if ( !in_array('DATE_FOOTER', $template) || empty($template['DATE_FOOTER']) ) |
234 | 236 | { |
@@ -239,10 +241,11 @@ class Blog | ||
239 | 241 | $tmp_footer = i18n::formatted_datetime($template['DATE_FOOTER'], $oldTS); |
240 | 242 | } |
241 | 243 | $parser->parse($tmp_footer); |
242 | - $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS)); | |
244 | + $manager->notify('PostDateFoot', $data); | |
243 | 245 | } |
244 | 246 | |
245 | - $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp)); | |
247 | + $data = array('blog' => $this, 'timestamp' => $timestamp); | |
248 | + $manager->notify('PreDateHead', $data); | |
246 | 249 | |
247 | 250 | // note, to use templatvars in the dateheader, the %-characters need to be doubled in |
248 | 251 | // order to be preserved by strftime |
@@ -255,16 +258,17 @@ class Blog | ||
255 | 258 | $tmp_header = i18n::formatted_datetime($template['DATE_HEADER'], $timestamp); |
256 | 259 | } |
257 | 260 | $parser->parse($tmp_header); |
258 | - $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp)); | |
261 | + $manager->notify('PostDateHead', $data); | |
259 | 262 | } |
260 | 263 | $old_date = $new_date; |
261 | 264 | } |
262 | 265 | |
263 | 266 | // parse item |
264 | 267 | $parser->parse($template['ITEM_HEADER']); |
265 | - $manager->notify('PreItem', array('blog' => &$this, 'item' => &$item)); | |
268 | + $data = array('blog' => $this, 'item' => &$item); | |
269 | + $manager->notify('PreItem', $data); | |
266 | 270 | $parser->parse($template['ITEM']); |
267 | - $manager->notify('PostItem', array('blog' => &$this, 'item' => &$item)); | |
271 | + $manager->notify('PostItem', $data); | |
268 | 272 | $parser->parse($template['ITEM_FOOTER']); |
269 | 273 | } |
270 | 274 |
@@ -273,9 +277,10 @@ class Blog | ||
273 | 277 | // add another date footer if there was at least one item |
274 | 278 | if ( ($numrows > 0) && $dateheads ) |
275 | 279 | { |
276 | - $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date))); | |
280 | + $data = array('blog' => $this, 'timestamp' => strtotime($old_date)); | |
281 | + $manager->notify('PreDateFoot', $data); | |
277 | 282 | $parser->parse($template['DATE_FOOTER']); |
278 | - $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date))); | |
283 | + $manager->notify('PostDateFoot', $data); | |
279 | 284 | } |
280 | 285 | |
281 | 286 | $items->closeCursor(); |
@@ -353,8 +358,9 @@ class Blog | ||
353 | 358 | } |
354 | 359 | |
355 | 360 | $timestamp = date('Y-m-d H:i:s',$timestamp); |
356 | - | |
357 | - $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid)); | |
361 | + | |
362 | + $data = array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => $this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid); | |
363 | + $manager->notify('PreAddItem', $data); | |
358 | 364 | |
359 | 365 | $ititle = DB::quoteValue($title); |
360 | 366 | $ibody = DB::quoteValue($body); |
@@ -365,8 +371,9 @@ class Blog | ||
365 | 371 | $query = sprintf($query, sql_table('item'), $ititle, $ibody, $imore, $blogid, $authorid, $timestamp, $closed, $draft, $catid, $posted); |
366 | 372 | DB::execute($query); |
367 | 373 | $itemid = DB::getInsertId(); |
368 | - | |
369 | - $manager->notify('PostAddItem',array('itemid' => $itemid)); | |
374 | + | |
375 | + $data = array('itemid' => $itemid); | |
376 | + $manager->notify('PostAddItem', $data); | |
370 | 377 | |
371 | 378 | if ( !$draft ) |
372 | 379 | { |
@@ -681,7 +688,7 @@ class Blog | ||
681 | 688 | } |
682 | 689 | |
683 | 690 | $template =& $manager->getTemplate($template); |
684 | - $data['blogid'] = $this->blogid; | |
691 | + $listitem['blogid'] = $this->blogid; | |
685 | 692 | |
686 | 693 | if ( !array_key_exists('ARCHIVELIST_HEADER', $template) || !$template['ARCHIVELIST_HEADER'] ) |
687 | 694 | { |
@@ -692,7 +699,7 @@ class Blog | ||
692 | 699 | $tplt = $template['ARCHIVELIST_HEADER']; |
693 | 700 | } |
694 | 701 | |
695 | - echo Template::fill($tplt, $data); | |
702 | + echo Template::fill($tplt, $listitem); | |
696 | 703 | |
697 | 704 | $query = 'SELECT itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) AS Day' |
698 | 705 | . ' FROM '.sql_table('item') |
@@ -732,34 +739,35 @@ class Blog | ||
732 | 739 | { |
733 | 740 | $archivedate = date('Y-m-d',$current['itime']); |
734 | 741 | $archive['day'] = date('d',$current['itime']); |
735 | - $data['day'] = date('d',$current['itime']); | |
736 | - $data['month'] = date('m',$current['itime']); | |
737 | - $archive['month'] = $data['month']; | |
742 | + $listitem['day'] = date('d',$current['itime']); | |
743 | + $listitem['month'] = date('m',$current['itime']); | |
744 | + $archive['month'] = $listitem['month']; | |
738 | 745 | } |
739 | 746 | elseif ( $mode == 'year' ) |
740 | 747 | { |
741 | 748 | $archivedate = date('Y',$current['itime']); |
742 | - $data['day'] = ''; | |
743 | - $data['month'] = ''; | |
749 | + $listitem['day'] = ''; | |
750 | + $listitem['month'] = ''; | |
744 | 751 | $archive['day'] = ''; |
745 | 752 | $archive['month'] = ''; |
746 | 753 | } |
747 | 754 | else |
748 | 755 | { |
749 | 756 | $archivedate = date('Y-m',$current['itime']); |
750 | - $data['month'] = date('m',$current['itime']); | |
751 | - $archive['month'] = $data['month']; | |
752 | - $data['day'] = ''; | |
757 | + $listitem['month'] = date('m',$current['itime']); | |
758 | + $archive['month'] = $listitem['month']; | |
759 | + $listitem['day'] = ''; | |
753 | 760 | $archive['day'] = ''; |
754 | 761 | } |
755 | 762 | |
756 | - $data['year'] = date('Y',$current['itime']); | |
757 | - $archive['year'] = $data['year']; | |
758 | - $data['archivelink'] = Link::create_archive_link($this->blogid,$archivedate,$linkparams); | |
759 | - | |
760 | - $manager->notify('PreArchiveListItem', array('listitem' => &$data)); | |
763 | + $listitem['year'] = date('Y',$current['itime']); | |
764 | + $archive['year'] = $listitem['year']; | |
765 | + $listitem['archivelink'] = Link::create_archive_link($this->blogid,$archivedate,$linkparams); | |
766 | + | |
767 | + $data = array('listitem' => &$listitem); | |
768 | + $manager->notify('PreArchiveListItem', $data); | |
761 | 769 | |
762 | - $temp = Template::fill($template['ARCHIVELIST_LISTITEM'],$data); | |
770 | + $temp = Template::fill($template['ARCHIVELIST_LISTITEM'],$listitem); | |
763 | 771 | echo i18n::formatted_datetime($temp, $current['itime']); |
764 | 772 | return; |
765 | 773 | } |
@@ -775,7 +783,7 @@ class Blog | ||
775 | 783 | $tplt = $template['ARCHIVELIST_FOOTER']; |
776 | 784 | } |
777 | 785 | |
778 | - echo Template::fill($tplt, $data); | |
786 | + echo Template::fill($tplt, $listitem); | |
779 | 787 | return; |
780 | 788 | } |
781 | 789 |
@@ -846,29 +854,29 @@ class Blog | ||
846 | 854 | $query = sprintf($query, sql_table('category'), (integer) $this->blogid); |
847 | 855 | $res = DB::getResult($query); |
848 | 856 | |
849 | - foreach ( $res as $data ) | |
857 | + foreach ( $res as $row ) | |
850 | 858 | { |
851 | 859 | $args = array( |
852 | - 'catid' => $data['catid'], | |
853 | - 'name' => $data['catname'], | |
860 | + 'catid' => $row['catid'], | |
861 | + 'name' => $row['catname'], | |
854 | 862 | 'extra' => $linkparams |
855 | 863 | ); |
856 | 864 | |
857 | - $data['blogid'] = $this->blogid; | |
858 | - $data['blogurl'] = $blogurl; | |
859 | - $data['catlink'] = Link::create_link('category', $args); | |
860 | - $data['self'] = $CONF['Self']; | |
865 | + $row['blogid'] = $this->blogid; | |
866 | + $row['blogurl'] = $blogurl; | |
867 | + $row['catlink'] = Link::create_link('category', $args); | |
868 | + $row['self'] = $CONF['Self']; | |
861 | 869 | |
862 | 870 | // this gives catiscurrent = no when no category is selected. |
863 | - $data['catiscurrent'] = 'no'; | |
864 | - $data['currentcat'] = 'no'; | |
871 | + $row['catiscurrent'] = 'no'; | |
872 | + $row['currentcat'] = 'no'; | |
865 | 873 | |
866 | 874 | if ( $this->selectedcatid ) |
867 | 875 | { |
868 | - if ( $this->selectedcatid == $data['catid'] ) | |
876 | + if ( $this->selectedcatid == $row['catid'] ) | |
869 | 877 | { |
870 | - $data['catiscurrent'] = 'yes'; | |
871 | - $data['currentcat'] = 'yes'; | |
878 | + $row['catiscurrent'] = 'yes'; | |
879 | + $row['currentcat'] = 'yes'; | |
872 | 880 | } |
873 | 881 | } |
874 | 882 | else |
@@ -879,23 +887,24 @@ class Blog | ||
879 | 887 | $iobj =& $manager->getItem($itemid, 0, 0); |
880 | 888 | $cid = $iobj['catid']; |
881 | 889 | |
882 | - if ( $cid == $data['catid'] ) | |
890 | + if ( $cid == $row['catid'] ) | |
883 | 891 | { |
884 | - $data['catiscurrent'] = 'yes'; | |
885 | - $data['currentcat'] = 'yes'; | |
892 | + $row['catiscurrent'] = 'yes'; | |
893 | + $row['currentcat'] = 'yes'; | |
886 | 894 | } |
887 | 895 | } |
888 | 896 | } |
889 | - | |
890 | - $manager->notify('PreCategoryListItem', array('listitem' => &$data)); | |
897 | + | |
898 | + $data = array('listitem' => &$row); | |
899 | + $manager->notify('PreCategoryListItem', $data); | |
891 | 900 | |
892 | 901 | if ( !array_key_exists('CATLIST_LISTITEM', $template) || empty($template['CATLIST_LISTITEM'])) |
893 | 902 | { |
894 | - echo Template::fill(NULL, $data); | |
903 | + echo Template::fill(NULL, $row); | |
895 | 904 | } |
896 | 905 | else |
897 | 906 | { |
898 | - echo Template::fill($template['CATLIST_LISTITEM'], $data); | |
907 | + echo Template::fill($template['CATLIST_LISTITEM'], $row); | |
899 | 908 | } |
900 | 909 | } |
901 | 910 |
@@ -987,24 +996,25 @@ class Blog | ||
987 | 996 | $query = 'SELECT bnumber, bname, bshortname, bdesc, burl FROM '.sql_table('blog').' ORDER BY '.$orderby.' '.$direction; |
988 | 997 | $res = DB::getResult($query); |
989 | 998 | |
990 | - foreach ( $res as $data ) | |
999 | + foreach ( $res as $row ) | |
991 | 1000 | { |
992 | 1001 | $list = array(); |
993 | - $list['bloglink'] = Link::create_blogid_link($data['bnumber']); | |
994 | - $list['blogdesc'] = $data['bdesc']; | |
995 | - $list['blogurl'] = $data['burl']; | |
1002 | + $list['bloglink'] = Link::create_blogid_link($row['bnumber']); | |
1003 | + $list['blogdesc'] = $row['bdesc']; | |
1004 | + $list['blogurl'] = $row['burl']; | |
996 | 1005 | |
997 | 1006 | if ( $bnametype == 'shortname' ) |
998 | 1007 | { |
999 | - $list['blogname'] = $data['bshortname']; | |
1008 | + $list['blogname'] = $row['bshortname']; | |
1000 | 1009 | } |
1001 | 1010 | else |
1002 | 1011 | { |
1003 | 1012 | /* all other cases */ |
1004 | - $list['blogname'] = $data['bname']; | |
1013 | + $list['blogname'] = $row['bname']; | |
1005 | 1014 | } |
1006 | - | |
1007 | - $manager->notify('PreBlogListItem',array('listitem' => &$list)); | |
1015 | + | |
1016 | + $data = array('listitem' => &$list); | |
1017 | + $manager->notify('PreBlogListItem', $data); | |
1008 | 1018 | |
1009 | 1019 | echo Template::fill($template['BLOGLIST_LISTITEM'], $list); |
1010 | 1020 | } |
@@ -1139,8 +1149,8 @@ class Blog | ||
1139 | 1149 | public function getCategoryDesc($catid) |
1140 | 1150 | { |
1141 | 1151 | $query = 'SELECT cdesc FROM %s WHERE cblog=%d and catid=%d;'; |
1142 | - $query = sprintf($querym, sql_table('category'), (integer) $this->blogid, (integer) $catid); | |
1143 | - $res = DB::getValue(); | |
1152 | + $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid); | |
1153 | + $res = DB::getValue($query); | |
1144 | 1154 | return $res; |
1145 | 1155 | } |
1146 | 1156 |
@@ -1767,7 +1777,8 @@ class Blog | ||
1767 | 1777 | // This $pinged is allow a plugin to tell other hook to the event that a ping is sent already |
1768 | 1778 | // Note that the plugins's calling order is subject to thri order in the plugin list |
1769 | 1779 | $pinged = FALSE; |
1770 | - $manager->notify('JustPosted', array('blogid' => $this->blogid, 'pinged' => &$pinged)); | |
1780 | + $data = array('blogid' => $this->blogid, 'pinged' => &$pinged); | |
1781 | + $manager->notify('JustPosted', $data); | |
1771 | 1782 | |
1772 | 1783 | // clear all expired future posts |
1773 | 1784 | $query = "UPDATE %s SET iposted='1' WHERE iblog=%d AND itime < NOW();"; |
@@ -120,10 +120,11 @@ class Comments | ||
120 | 120 | $comment['timestamp'] = strtotime($comment['ctime']); |
121 | 121 | $handler->setCurrentComment($comment); |
122 | 122 | $handler->setHighlight($highlight); |
123 | - | |
124 | - $manager->notify('PreComment', array('comment' => &$comment)); | |
123 | + | |
124 | + $data = array('comment' => &$comment); | |
125 | + $manager->notify('PreComment', $data); | |
125 | 126 | $parser->parse($template['COMMENTS_BODY']); |
126 | - $manager->notify('PostComment', array('comment' => &$comment)); | |
127 | + $manager->notify('PostComment', $data); | |
127 | 128 | } |
128 | 129 | |
129 | 130 | $parser->parse($template['COMMENTS_FOOTER']); |
@@ -273,8 +274,9 @@ class Comments | ||
273 | 274 | $spamcheck['email'] = $comment['email']; |
274 | 275 | $spamcheck['url'] = $comment['userid']; |
275 | 276 | } |
276 | - | |
277 | - $manager->notify('SpamCheck', array('spamcheck' => &$spamcheck) ); | |
277 | + | |
278 | + $data = array('spamcheck' => &$spamcheck); | |
279 | + $manager->notify('SpamCheck', $data); | |
278 | 280 | |
279 | 281 | if ( !$continue && isset($spamcheck['result']) && $spamcheck['result'] == TRUE ) |
280 | 282 | { |
@@ -336,8 +338,9 @@ class Comments | ||
336 | 338 | } |
337 | 339 | |
338 | 340 | $comment = Comment::prepare($comment); |
339 | - | |
340 | - $manager->notify('PreAddComment', array('comment' => &$comment, 'spamcheck' => &$spamcheck) ); | |
341 | + | |
342 | + $data = array('comment' => &$comment, 'spamcheck' => &$spamcheck); | |
343 | + $manager->notify('PreAddComment', $data); | |
341 | 344 | |
342 | 345 | $name = DB::quoteValue($comment['user']); |
343 | 346 | $url = DB::quoteValue($comment['userid']); |
@@ -372,7 +375,8 @@ class Comments | ||
372 | 375 | |
373 | 376 | // post add comment |
374 | 377 | $commentid = DB::getInsertId(); |
375 | - $manager->notify('PostAddComment', array('comment' => &$comment, 'commentid' => &$commentid, 'spamcheck' => &$spamcheck) ); | |
378 | + $data = array('comment' => &$comment, 'commentid' => &$commentid, 'spamcheck' => &$spamcheck); | |
379 | + $manager->notify('PostAddComment', $data); | |
376 | 380 | |
377 | 381 | // succeeded ! |
378 | 382 | return TRUE; |
@@ -435,7 +439,8 @@ class Comments | ||
435 | 439 | // let plugins do verification (any plugin which thinks the comment is invalid |
436 | 440 | // can change 'error' to something other than '1') |
437 | 441 | $result = 1; |
438 | - $manager->notify('ValidateForm', array('type' => 'comment', 'comment' => &$comment, 'error' => &$result, 'spamcheck' => &$spamcheck) ); | |
442 | + $data = array('type' => 'comment', 'comment' => &$comment, 'error' => &$result, 'spamcheck' => &$spamcheck); | |
443 | + $manager->notify('ValidateForm', $data); | |
439 | 444 | |
440 | 445 | return $result; |
441 | 446 | } |
@@ -373,8 +373,9 @@ class Item | ||
373 | 373 | |
374 | 374 | // off we go! |
375 | 375 | DB::execute($query); |
376 | - | |
377 | - $manager->notify('PostUpdateItem', array('itemid' => $itemid)); | |
376 | + | |
377 | + $data = array('itemid' => $itemid); | |
378 | + $manager->notify('PostUpdateItem', $data); | |
378 | 379 | |
379 | 380 | // when needed, move item and comments to new blog |
380 | 381 | if ( $moveNeeded ) |
@@ -461,8 +462,9 @@ class Item | ||
461 | 462 | { |
462 | 463 | return 1; |
463 | 464 | } |
464 | - | |
465 | - $manager->notify('PreDeleteItem', array('itemid' => $itemid)); | |
465 | + | |
466 | + $data = array('itemid' => $itemid); | |
467 | + $manager->notify('PreDeleteItem', $data); | |
466 | 468 | |
467 | 469 | // delete item |
468 | 470 | $query = "DELETE FROM %s WHERE inumber=%d;"; |
@@ -477,7 +479,7 @@ class Item | ||
477 | 479 | // delete all associated plugin options |
478 | 480 | NucleusPlugin::delete_option_values('item', $itemid); |
479 | 481 | |
480 | - $manager->notify('PostDeleteItem', array('itemid' => $itemid)); | |
482 | + $manager->notify('PostDeleteItem', $data); | |
481 | 483 | |
482 | 484 | return 0; |
483 | 485 | } |
@@ -116,15 +116,13 @@ class Link | ||
116 | 116 | |
117 | 117 | if ($usePathInfo) |
118 | 118 | { |
119 | - $manager->notify( | |
120 | - 'GenerateURL', | |
121 | - array( | |
119 | + $data = array( | |
122 | 120 | 'type' => $type, |
123 | 121 | 'params' => $params, |
124 | 122 | 'completed' => &$created, |
125 | 123 | 'url' => &$url |
126 | - ) | |
127 | - ); | |
124 | + ); | |
125 | + $manager->notify('GenerateURL', $data); | |
128 | 126 | } |
129 | 127 | |
130 | 128 | // if a plugin created the URL, return it |
@@ -542,7 +542,7 @@ class Manager | ||
542 | 542 | * but it can also be an array containing multiple values |
543 | 543 | * @return void |
544 | 544 | */ |
545 | - public function notify($eventName, $data) | |
545 | + public function notify($eventName, &$data) | |
546 | 546 | { |
547 | 547 | // load subscription list if needed |
548 | 548 | if ( !is_array($this->subscriptions) ) |
@@ -571,7 +571,7 @@ class Manager | ||
571 | 571 | && !empty($this->plugins[$listener]) |
572 | 572 | && method_exists($this->plugins[$listener], 'event_' . $eventName) ) |
573 | 573 | { |
574 | - call_user_func(array(&$this->plugins[$listener], 'event_' . $eventName), array(&$data)); | |
574 | + call_user_func(array(&$this->plugins[$listener], 'event_' . $eventName), $data); | |
575 | 575 | } |
576 | 576 | } |
577 | 577 | } |
@@ -206,7 +206,8 @@ class Media | ||
206 | 206 | } |
207 | 207 | |
208 | 208 | // trigger PreMediaUpload event |
209 | - $manager->notify('PreMediaUpload',array('collection' => &$collection, 'uploadfile' => $uploadfile, 'filename' => &$filename)); | |
209 | + $data = array('collection' => &$collection, 'uploadfile' => $uploadfile, 'filename' => &$filename); | |
210 | + $manager->notify('PreMediaUpload', $data); | |
210 | 211 | |
211 | 212 | // don't allow uploads to unknown or forbidden collections |
212 | 213 | $exceptReadOnly = TRUE; |
@@ -268,8 +269,9 @@ class Media | ||
268 | 269 | $oldumask = umask(0000); |
269 | 270 | @chmod($mediadir . $filename, 0644); |
270 | 271 | umask($oldumask); |
271 | - | |
272 | - $manager->notify('PostMediaUpload',array('collection' => $collection, 'mediadir' => $mediadir, 'filename' => $filename)); | |
272 | + | |
273 | + $data = array('collection' => $collection, 'mediadir' => $mediadir, 'filename' => $filename); | |
274 | + $manager->notify('PostMediaUpload', $data); | |
273 | 275 | |
274 | 276 | return ''; |
275 | 277 | } |
@@ -201,7 +201,8 @@ class Member | ||
201 | 201 | |
202 | 202 | $success = 0; |
203 | 203 | $allowlocal = 1; |
204 | - $manager->notify('CustomLogin', array('login' => &$login, 'password'=>&$password, 'success'=>&$success, 'allowlocal'=>&$allowlocal)); | |
204 | + $data = array('login' => &$login, 'password'=>&$password, 'success'=>&$success, 'allowlocal'=>&$allowlocal); | |
205 | + $manager->notify('CustomLogin', $data); | |
205 | 206 | |
206 | 207 | $this->loggedin = 0; |
207 | 208 | if ( $success ) |
@@ -225,7 +226,8 @@ class Member | ||
225 | 226 | { |
226 | 227 | $errormessage = 'Login failed for ' . $login; |
227 | 228 | } |
228 | - $manager->notify('LoginFailed', array('username' => $login) ); | |
229 | + $data = array('username' => $login); | |
230 | + $manager->notify('LoginFailed', $data); | |
229 | 231 | ActionLog::add(INFO, $errormessage); |
230 | 232 | } |
231 | 233 | /* login success */ |
@@ -248,7 +250,8 @@ class Member | ||
248 | 250 | } |
249 | 251 | |
250 | 252 | $errormessage = ''; |
251 | - $manager->notify('LoginSuccess', array('member' => &$member, 'username' => $login) ); | |
253 | + $data = array('member' => $this, 'username' => $login); | |
254 | + $manager->notify('LoginSuccess', $data); | |
252 | 255 | ActionLog::add(INFO, "Login successful for $login (sharedpc=$shared)"); |
253 | 256 | } |
254 | 257 |
@@ -324,7 +327,8 @@ class Member | ||
324 | 327 | /* remove cookies on logout */ |
325 | 328 | setcookie("{$CONF['CookiePrefix']}user", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']); |
326 | 329 | setcookie("{$CONF['CookiePrefix']}loginkey", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']); |
327 | - $manager->notify('Logout', array('username' => cookieVar("{$CONF['CookiePrefix']}user") ) ); | |
330 | + $data = array('username' => cookieVar("{$CONF['CookiePrefix']}user") ); | |
331 | + $manager->notify('Logout', $data); | |
328 | 332 | } |
329 | 333 | |
330 | 334 | $this->loggedin = 0; |
@@ -320,7 +320,7 @@ class Skin | ||
320 | 320 | global $currentSkinName, $manager, $CONF, $DIR_NUCLEUS; |
321 | 321 | |
322 | 322 | $data = array( |
323 | - 'skin' => &$this, | |
323 | + 'skin' => $this, | |
324 | 324 | 'type' => $type |
325 | 325 | ); |
326 | 326 | $manager->notify("Init{$this->event_identifier}Parse", $data); |
@@ -142,26 +142,22 @@ class Template | ||
142 | 142 | static public function createNew($name, $desc) |
143 | 143 | { |
144 | 144 | global $manager; |
145 | - | |
146 | - $manager->notify( | |
147 | - 'PreAddTemplate', | |
148 | - array( | |
145 | + | |
146 | + $data = array( | |
149 | 147 | 'name' => &$name, |
150 | 148 | 'description' => &$desc |
151 | - ) | |
152 | - ); | |
149 | + ); | |
150 | + $manager->notify('PreAddTemplate', $data); | |
153 | 151 | |
154 | 152 | DB::execute('INSERT INTO '.sql_table('template_desc').' (tdname, tddesc) VALUES (' . DB::quoteValue($name) . ',' . DB::quoteValue($desc) . ')'); |
155 | 153 | $newId = DB::getInsertId(); |
156 | - | |
157 | - $manager->notify( | |
158 | - 'PostAddTemplate', | |
159 | - array( | |
154 | + | |
155 | + $data = array( | |
160 | 156 | 'templateid' => $newId, |
161 | 157 | 'name' => $name, |
162 | 158 | 'description' => $desc |
163 | - ) | |
164 | - ); | |
159 | + ); | |
160 | + $manager->notify('PostAddTemplate', $data); | |
165 | 161 | |
166 | 162 | return $newId; |
167 | 163 | } |
@@ -176,12 +172,8 @@ class Template | ||
176 | 172 | static public function read($name) |
177 | 173 | { |
178 | 174 | global $manager; |
179 | - $manager->notify( | |
180 | - 'PreTemplateRead', | |
181 | - array( | |
182 | - 'template' => &$name | |
183 | - ) | |
184 | - ); | |
175 | + $data = array('template' => &$name); | |
176 | + $manager->notify('PreTemplateRead', $data); | |
185 | 177 | |
186 | 178 | $query = "SELECT tpartname, tcontent FROM %s, %s WHERE tdesc=tdnumber and tdname=%s"; |
187 | 179 | $query = sprintf($query, sql_table('template_desc'), sql_table('template'), DB::quoteValue($name)); |
@@ -344,7 +344,8 @@ i18n::set_current_locale($locale); | ||
344 | 344 | |
345 | 345 | |
346 | 346 | /* login completed */ |
347 | -$manager->notify('PostAuthentication', array('loggedIn' => $member->isLoggedIn() ) ); | |
347 | +$data = array('loggedIn' => $member->isLoggedIn()); | |
348 | +$manager->notify('PostAuthentication', $data); | |
348 | 349 | |
349 | 350 | /* next action */ |
350 | 351 | if ( $member->isLoggedIn() && $nextaction ) |
@@ -135,7 +135,7 @@ class NP_Medium extends NucleusPlugin | ||
135 | 135 | return; |
136 | 136 | } |
137 | 137 | |
138 | - public function event_AdminPrePageHead($data) | |
138 | + public function event_AdminPrePageHead(&$data) | |
139 | 139 | { |
140 | 140 | global $CONF; |
141 | 141 |
@@ -111,7 +111,7 @@ class NP_Ping extends NucleusPlugin | ||
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | - public function event_JustPosted($data) | |
114 | + public function event_JustPosted(&$data) | |
115 | 115 | { |
116 | 116 | global $DIR_PLUGINS, $DIR_NUCLEUS; |
117 | 117 |
@@ -138,13 +138,13 @@ class NP_Ping extends NucleusPlugin | ||
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - public function event_PostAddItem($data) | |
141 | + public function event_PostAddItem(&$data) | |
142 | 142 | { |
143 | 143 | $this->_sendPingCheck($data['itemid']); |
144 | 144 | return ; |
145 | 145 | } |
146 | 146 | |
147 | - public function event_PostUpdateItem($data) | |
147 | + public function event_PostUpdateItem(&$data) | |
148 | 148 | { |
149 | 149 | $this->_sendPingCheck($data['itemid']); |
150 | 150 | return; |
@@ -123,7 +123,7 @@ class NP_SecurityEnforcer extends NucleusPlugin | ||
123 | 123 | return; |
124 | 124 | } |
125 | 125 | |
126 | - public function event_QuickMenu($data) | |
126 | + public function event_QuickMenu(&$data) | |
127 | 127 | { |
128 | 128 | // only show when option enabled |
129 | 129 | global $member; |
@@ -143,7 +143,7 @@ class NP_SecurityEnforcer extends NucleusPlugin | ||
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
146 | - public function event_PrePasswordSet($data) | |
146 | + public function event_PrePasswordSet(&$data) | |
147 | 147 | { |
148 | 148 | //password, errormessage, valid |
149 | 149 | if ( $this->enable_security == 'no' ) |
@@ -172,7 +172,7 @@ class NP_SecurityEnforcer extends NucleusPlugin | ||
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
175 | - public function event_PostRegister($data) | |
175 | + public function event_PostRegister(&$data) | |
176 | 176 | { |
177 | 177 | if ( $this->enable_security != 'yes' ) |
178 | 178 | { |
@@ -192,7 +192,7 @@ class NP_SecurityEnforcer extends NucleusPlugin | ||
192 | 192 | return; |
193 | 193 | } |
194 | 194 | |
195 | - public function event_CustomLogin($data) | |
195 | + public function event_CustomLogin(&$data) | |
196 | 196 | { |
197 | 197 | if ( $this->enable_security != 'yes' || $this->max_failed_login <= 0 ) |
198 | 198 | { |
@@ -226,7 +226,7 @@ class NP_SecurityEnforcer extends NucleusPlugin | ||
226 | 226 | return; |
227 | 227 | } |
228 | 228 | |
229 | - public function event_LoginSuccess($data) | |
229 | + public function event_LoginSuccess(&$data) | |
230 | 230 | { |
231 | 231 | //member(obj),username |
232 | 232 | if ( $this->enable_security != 'yes' || $this->max_failed_login <= 0 ) |
@@ -241,7 +241,7 @@ class NP_SecurityEnforcer extends NucleusPlugin | ||
241 | 241 | return; |
242 | 242 | } |
243 | 243 | |
244 | - public function event_LoginFailed($data) | |
244 | + public function event_LoginFailed(&$data) | |
245 | 245 | { |
246 | 246 | //username |
247 | 247 | if ( $this->enable_security != 'yes' || $this->max_failed_login <= 0 ) |
@@ -104,7 +104,7 @@ class NP_SkinFiles extends NucleusPlugin { | ||
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | - public function event_QuickMenu($data) | |
107 | + public function event_QuickMenu(&$data) | |
108 | 108 | { |
109 | 109 | global $member; |
110 | 110 |