OSDN Git Service

ADD: 不足していたアクセス修飾子を追加
[nucleus-jp/nucleus-next.git] / nucleus / libs / ACTIONS.php
1 <?php\r
2 /**\r
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
4  * Copyright (C) 2002-2012 The Nucleus Group\r
5  *\r
6  * This program is free software; you can redistribute it and/or\r
7  * modify it under the terms of the GNU General Public License\r
8  * as published by the Free Software Foundation; either version 2\r
9  * of the License, or (at your option) any later version.\r
10  * (see nucleus/documentation/index.html#license for more info)\r
11  */\r
12 /**\r
13  * This class contains the functions that get called by using\r
14  * the special tags in the skins\r
15  *\r
16  * @license http://nucleuscms.org/license.txt GNU General Public License\r
17  * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
18  * @version $Id: ACTIONS.php 1784 2012-04-22 04:28:30Z sakamocchi $\r
19  */\r
20 \r
21 class Actions extends BaseActions\r
22 {\r
23         // part of the skin currently being parsed ('index', 'item', 'archive',\r
24         // 'archivelist', 'member', 'search', 'error', 'imagepopup')\r
25         private $skintype;\r
26         \r
27         // contains an assoc array with parameters that need to be included when\r
28         // generating links to items/archives/... (e.g. catid)\r
29         private $linkparams;\r
30         \r
31         // reference to the skin object for which a part is being parsed\r
32         private $skin;\r
33         \r
34         // used when including templated forms from the include/ dir. The $formdata var\r
35         // contains the values to fill out in there (assoc array name -> value)\r
36         private $formdata;\r
37         \r
38         // filled out with the number of displayed items after calling one of the\r
39         // (other)blog/(other)searchresults skinvars.\r
40         private $amountfound;\r
41         \r
42         /**\r
43          * Actions::$default_actions\r
44          * list of whole action names with which this class can deal\r
45          */\r
46         static private $default_actions = array(\r
47                 'addlink',\r
48                 'addpopupcode',\r
49                 'adminurl',\r
50                 'archivelink',\r
51                 'bloglist',\r
52                 'category',\r
53                 'charset',\r
54                 'loginform',\r
55                 'member',\r
56                 'nucleusbutton',\r
57                 'otherarchivedaylist',\r
58                 'otherarchivelist',\r
59                 'otherarchiveyearlist',\r
60                 'otherblog',\r
61                 'plugin',\r
62                 'referer',\r
63                 'searchform',\r
64                 'self',\r
65                 'sitevar',\r
66                 'skinname',\r
67                 'sticky',\r
68                 'todaylink',\r
69                 'version',\r
70                 // deprecated (Nucleus v2.0)\r
71                 /* TODO: remove this */\r
72                 'ifcat'\r
73         );\r
74         \r
75         /**\r
76          * Actions::$skin_type_friendly_names\r
77          * friendly name for wrapped page types\r
78          */\r
79         static public $default_skin_types = array(\r
80                 'index'                 => _SKIN_PART_MAIN,\r
81                 'item'                  => _SKIN_PART_ITEM,\r
82                 'archivelist'   => _SKIN_PART_ALIST,\r
83                 'archive'               => _SKIN_PART_ARCHIVE,\r
84                 'search'                => _SKIN_PART_SEARCH,\r
85                 'error'                 => _SKIN_PART_ERROR,\r
86                 'member'                => _SKIN_PART_MEMBER,\r
87                 'imagepopup'    => _SKIN_PART_POPUP\r
88         );\r
89         \r
90         /**\r
91          * Actions::getAvailableSkinTypes()\r
92          * \r
93          * @static\r
94          * @param       void\r
95          * @return      array   list of friendly names for page actions\r
96          */\r
97         static public function getAvailableSkinTypes()\r
98         {\r
99                 return self::$default_skin_types;\r
100         }\r
101         \r
102         /**\r
103          * Actions::__construct()\r
104          * Constructor for a new Actions object\r
105          * \r
106          * @param       string  $type\r
107          * @return      void\r
108          */\r
109         public function __construct($type)\r
110         {\r
111                 global $catid;\r
112                 \r
113                 // call constructor of superclass first\r
114                 parent::__construct();\r
115                 $this->skintype = $type;\r
116                 \r
117                 if ( $catid )\r
118                 {\r
119                         $this->linkparams = array('catid' => $catid);\r
120                 }\r
121                 return;\r
122         }\r
123         \r
124         /**\r
125          * Actions::getAvailableActions()\r
126          * \r
127          * @param       void\r
128          * @return      array   allowed actions for the page type\r
129          */\r
130         public function getAvailableActions()\r
131         {\r
132                 $extra_actions = array();\r
133                 \r
134                 switch ( $this->skintype )\r
135                 {\r
136                         case 'index':\r
137                                 $extra_actions = array(\r
138                                         'blog',\r
139                                         'blogsetting',\r
140                                         'preview',\r
141                                         'additemform',\r
142                                         'categorylist',\r
143                                         'archivelist',\r
144                                         'archivedaylist',\r
145                                         'archiveyearlist',\r
146                                         'nextlink',\r
147                                         'prevlink'\r
148                                 );\r
149                                 break;\r
150                         case 'archive':\r
151                                 $extra_actions = array(\r
152                                         'blog',\r
153                                         'archive',\r
154                                         'otherarchive',\r
155                                         'categorylist',\r
156                                         'archivelist',\r
157                                         'archivedaylist',\r
158                                         'archiveyearlist',\r
159                                         'blogsetting',\r
160                                         'archivedate',\r
161                                         'nextarchive',\r
162                                         'prevarchive',\r
163                                         'nextlink',\r
164                                         'prevlink',\r
165                                         'archivetype'\r
166                                 );\r
167                                 break;\r
168                         case 'archivelist':\r
169                                 $extra_actions = array(\r
170                                         'blog',\r
171                                         'archivelist',\r
172                                         'archivedaylist',\r
173                                         'archiveyearlist',\r
174                                         'categorylist',\r
175                                         'blogsetting'\r
176                                 );\r
177                                 break;\r
178                         case 'search':\r
179                                 $extra_actions = array(\r
180                                         'blog',\r
181                                         'archivelist',\r
182                                         'archivedaylist',\r
183                                         'archiveyearlist',\r
184                                         'categorylist',\r
185                                         'searchresults',\r
186                                         'othersearchresults',\r
187                                         'blogsetting',\r
188                                         'query',\r
189                                         'nextlink',\r
190                                         'prevlink'\r
191                                 );\r
192                                 break;\r
193                         case 'imagepopup':\r
194                                 $extra_actions = array(\r
195                                         'image',\r
196                                         // deprecated (Nucleus v2.0)\r
197                                         /* TODO: remove this */\r
198                                         'imagetext'\r
199                                 );\r
200                                 break;\r
201                         case 'member':\r
202                                 $extra_actions = array(\r
203                                         'membermailform',\r
204                                         'blogsetting',\r
205                                         'nucleusbutton',\r
206                                         'categorylist'\r
207                                 );\r
208                                 break;\r
209                         case 'item':\r
210                                 $extra_actions = array(\r
211                                         'blog',\r
212                                         'item',\r
213                                         'comments',\r
214                                         'commentform',\r
215                                         'vars',\r
216                                         'blogsetting',\r
217                                         'nextitem',\r
218                                         'previtem',\r
219                                         'nextlink',\r
220                                         'prevlink',\r
221                                         'nextitemtitle',\r
222                                         'previtemtitle',\r
223                                         'categorylist',\r
224                                         'archivelist',\r
225                                         'archivedaylist',\r
226                                         'archiveyearlist',\r
227                                         'itemtitle',\r
228                                         'itemid',\r
229                                         'itemlink'\r
230                                 );\r
231                                 break;\r
232                         case 'error':\r
233                                 $extra_actions = array(\r
234                                         'errormessage',\r
235                                         'categorylist'\r
236                                 );\r
237                                 break;\r
238                         default:\r
239                                         $extra_actions = array(\r
240                                                 'blog',\r
241                                                 'blogsetting',\r
242                                                 'preview',\r
243                                                 'additemform',\r
244                                                 'categorylist',\r
245                                                 'archivelist',\r
246                                                 'archivedaylist',\r
247                                                 'archiveyearlist',\r
248                                                 'nextlink',\r
249                                                 'prevlink',\r
250                                                 'membermailform',\r
251                                                 'nucleusbutton',\r
252                                                 'categorylist'\r
253                                         );\r
254                                 break;\r
255                 }\r
256                 \r
257                 $defined_actions = array_merge(self::$default_actions, $extra_actions);\r
258                 \r
259                 return array_merge($defined_actions, parent::getAvailableActions());\r
260         }\r
261         \r
262         /**\r
263          * Actions::setSkin()\r
264          * Set the skin\r
265          * @param       object  $skin   an instance of Skin class\r
266          * @return      void\r
267          */\r
268         public function setSkin(&$skin)\r
269         {\r
270                 $this->skin =& $skin;\r
271                 return;\r
272         }\r
273         \r
274         /**\r
275          * Actions::doForm()\r
276          * Forms get parsedincluded now, using an extra <formdata> skinvar\r
277          *\r
278          * @param       string  $filename\r
279          * @return      void\r
280          */\r
281         public function doForm($filename)\r
282         {\r
283                 global $DIR_NUCLEUS;\r
284                 array_push($this->parser->actions,'formdata', 'callback','errordiv','ticket');\r
285                 \r
286                 $oldIncludeMode = Parser::getProperty('IncludeMode');\r
287                 $oldIncludePrefix = Parser::getProperty('IncludePrefix');\r
288                 Parser::setProperty('IncludeMode','normal');\r
289                 Parser::setProperty('IncludePrefix','');\r
290                 \r
291                 $this->parse_parsedinclude($DIR_NUCLEUS . 'forms/' . $filename . '.template');\r
292                 Parser::setProperty('IncludeMode',$oldIncludeMode);\r
293                 Parser::setProperty('IncludePrefix',$oldIncludePrefix);\r
294                 \r
295                 array_pop($this->parser->actions);      // errordiv\r
296                 array_pop($this->parser->actions);      // callback\r
297                 array_pop($this->parser->actions);      // formdata\r
298                 array_pop($this->parser->actions);      // ticket\r
299                 return;\r
300         }\r
301 \r
302         /**\r
303          * Actions::checkCondition()\r
304          * Checks conditions for if statements\r
305          *\r
306          * @param       string  $field  type of <%if%>\r
307          * @param       string  $name   property of field\r
308          * @param       string  $value  value of property\r
309          * @return      boolean condition\r
310          */\r
311         protected function checkCondition($field, $name='', $value = '')\r
312         {\r
313                 global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;\r
314                 \r
315                 $condition = 0;\r
316                 switch ( $field )\r
317                 {\r
318                         case 'category':\r
319                                 $condition = ($blog && $this->ifCategory($name,$value));\r
320                                 break;\r
321                         case 'blogsetting':\r
322                                 $condition = ($blog && ($blog->getSetting($name) == $value));\r
323                                 break;\r
324                         case 'loggedin':\r
325                                 $condition = $member->isLoggedIn();\r
326                                 break;\r
327                         case 'onteam':\r
328                                 $condition = $member->isLoggedIn() && $this->ifOnTeam($name);\r
329                                 break;\r
330                         case 'admin':\r
331                                 $condition = $member->isLoggedIn() && $this->ifAdmin($name);\r
332                                 break;\r
333                         case 'nextitem':\r
334                                 $condition = ($itemidnext != '');\r
335                                 break;\r
336                         case 'previtem':\r
337                                 $condition = ($itemidprev != '');\r
338                                 break;\r
339                         case 'archiveprevexists':\r
340                                 $condition = ($archiveprevexists == true);\r
341                                 break;\r
342                         case 'archivenextexists':\r
343                                 $condition = ($archivenextexists == true);\r
344                                 break;\r
345                         case 'skintype':\r
346                                 $condition = (($name == $this->skintype) || ($name == requestVar('action')));\r
347                                 break;\r
348                         case 'hasplugin':\r
349                                 $condition = $this->ifHasPlugin($name, $value);\r
350                                 break;\r
351                         default:\r
352                                 $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);\r
353                                 break;\r
354                 }\r
355                 return $condition;\r
356         }\r
357         \r
358         /**\r
359          * Actions::_ifHasPlugin()\r
360          *      hasplugin,PlugName\r
361          *         -> checks if plugin exists\r
362          *      hasplugin,PlugName,OptionName\r
363          *         -> checks if the option OptionName from plugin PlugName is not set to 'no'\r
364          *      hasplugin,PlugName,OptionName=value\r
365          *         -> checks if the option OptionName from plugin PlugName is set to value\r
366          *\r
367          * @param       string  $name   name of plugin\r
368          * @param       string  $value  \r
369          * @return      \r
370          */\r
371         private function ifHasPlugin($name, $value)\r
372         {\r
373                 global $manager;\r
374                 $condition = false;\r
375                 // (pluginInstalled method won't write a message in the actionlog on failure)\r
376                 if ( $manager->pluginInstalled("NP_{$name}") )\r
377                 {\r
378                         $plugin =& $manager->getPlugin("NP_{$name}");\r
379                         if ( $plugin != NULL )\r
380                         {\r
381                                 if ( $value == "" )\r
382                                 {\r
383                                         $condition = true;\r
384                                 }\r
385                                 else\r
386                                 {\r
387                                         list($name2, $value2) = preg_split('#=#', $value, 2);\r
388                                         if ( $value2 == "" && $plugin->getOption($name2) != 'no' )\r
389                                         {\r
390                                                 $condition = true;\r
391                                         }\r
392                                         else if ( $plugin->getOption($name2) == $value2 )\r
393                                         {\r
394                                                 $condition = true;\r
395                                         }\r
396                                 }\r
397                         }\r
398                 }\r
399                 return $condition;\r
400         }\r
401         \r
402         /**\r
403          * Actions::ifPlugin()\r
404          * Checks if a plugin exists and call its doIf function\r
405          * \r
406          * @param       string  $name   name of plugin\r
407          * @param       string  $key    name of plugin option\r
408          * @param       string  $value  value of plugin option\r
409          * @return      void\r
410          */\r
411         private function ifPlugin($name, $key = '', $value = '')\r
412         {\r
413                 global $manager;\r
414                 \r
415                 $plugin =& $manager->getPlugin("NP_{$name}");\r
416                 if ( !$plugin )\r
417                 {\r
418                         return;\r
419                 }\r
420                 \r
421                 $params = func_get_args();\r
422                 array_shift($params);\r
423                 \r
424                 return call_user_func_array(array(&$plugin, 'doIf'), $params);\r
425         }\r
426         \r
427         /**\r
428          * Actions::ifCategory()\r
429          * Different checks for a category\r
430          * \r
431          * @param       string  $name   \r
432          * @param       string  $value  \r
433          * @return      boolean \r
434          */\r
435         private function ifCategory($name = '', $value='')\r
436         {\r
437                 global $blog, $catid;\r
438                 \r
439                 // when no parameter is defined, just check if a category is selected\r
440                 if ( ($name != 'catname' && $name != 'catid') || ($value == '') )\r
441                 {\r
442                         return $blog->isValidCategory($catid);\r
443                 }\r
444                 \r
445                 // check category name\r
446                 if ( $name == 'catname' )\r
447                 {\r
448                         $value = $blog->getCategoryIdFromName($value);\r
449                         if ( $value == $catid )\r
450                         {\r
451                                 return $blog->isValidCategory($catid);\r
452                         }\r
453                 }\r
454                 \r
455                 // check category id\r
456                 if ( ($name == 'catid') && ($value == $catid) )\r
457                 {\r
458                         return $blog->isValidCategory($catid);\r
459                 }\r
460                 return FALSE;\r
461         }\r
462         \r
463         /**\r
464          * Actions::ifOnTeam()\r
465          * Checks if a member is on the team of a blog and return his rights\r
466          * \r
467          * @param       string  $blogName       name of weblog\r
468          * @return      mixed\r
469          */\r
470         private function ifOnTeam($blogName = '')\r
471         {\r
472                 global $blog, $member, $manager;\r
473                 \r
474                 // when no blog found\r
475                 if ( ($blogName == '') && !is_object($blog) )\r
476                 {\r
477                         return 0;\r
478                 }\r
479                 \r
480                 // explicit blog selection\r
481                 if ( $blogName != '' )\r
482                 {\r
483                         $blogid = getBlogIDFromName($blogName);\r
484                 }\r
485                 \r
486                 if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
487                 {\r
488                         // use current blog\r
489                         $blogid = $blog->getID();\r
490                 }\r
491                 \r
492                 return $member->teamRights($blogid);\r
493         }\r
494 \r
495         /**\r
496          * Actions::ifAdmin()\r
497          * Checks if a member is admin of a blog\r
498          * \r
499          * @param       string  $blogName       name of weblog\r
500          * @return      mixed\r
501          */\r
502         private function ifAdmin($blogName = '')\r
503         {\r
504                 global $blog, $member, $manager;\r
505                 \r
506                 // when no blog found\r
507                 if ( ($blogName == '') && (!is_object($blog)) )\r
508                 {\r
509                         return 0;\r
510                 }\r
511                 \r
512                 // explicit blog selection\r
513                 if ( $blogName != '' )\r
514                 {\r
515                         $blogid = getBlogIDFromName($blogName);\r
516                 }\r
517                 \r
518                 if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
519                 {\r
520                         // use current blog\r
521                         $blogid = $blog->getID();\r
522                 }\r
523                 \r
524                 return $member->isBlogAdmin($blogid);\r
525         }\r
526         \r
527         /**\r
528          * Actions::link()\r
529          * returns either\r
530          *      - a raw link (html/xml encoded) when no linktext is provided\r
531          *      - a (x)html <a href... link when a text is present (text htmlencoded)\r
532          * \r
533          * @param       string  $url            URL for href attribute of anchor element\r
534          * @param       string  $linktext       content of anchor element\r
535          * @return      \r
536          */\r
537         private function link($url, $linktext = '')\r
538         {\r
539                 $u = Entity::hsc($url);\r
540                 // fix URLs that already had encoded ampersands\r
541                 $u = preg_replace("#&amp;amp;#", '&amp;', $u);\r
542                 if ( $linktext != '' )\r
543                 {\r
544                         $l = '<a href="' . $u .'">' . Entity::hsc($linktext) . '</a>';\r
545                 }\r
546                 else\r
547                 {\r
548                         $l = $u;\r
549                 }\r
550                 return $l;\r
551         }\r
552         \r
553         /**\r
554          * Actions::searchlink()\r
555          * Outputs a next/prev link\r
556          *\r
557          * @param $maxresults\r
558          *              The maximum amount of items shown per page (e.g. 10)\r
559          * @param $startpos\r
560          *              Current start position (requestVar('startpos'))\r
561          * @param $direction\r
562          *              either 'prev' or 'next'\r
563          * @param $linktext\r
564          *              When present, the output will be a full <a href...> link. When empty,\r
565          *              only a raw link will be outputted\r
566          */\r
567         private function searchlink($maxresults, $startpos, $direction, $linktext = '', $recount = '')\r
568         {\r
569                 global $CONF, $blog, $query, $amount;\r
570                 // TODO: Move request uri to linkparams. this is ugly. sorry for that.\r
571                 $startpos       = (integer) $startpos;\r
572                 $parsed         = parse_url(serverVar('REQUEST_URI'));\r
573                 $path           = $parsed['path'];\r
574                 $parsed         = $parsed['query'];\r
575                 $url            = '';\r
576                 \r
577                 if ( $direction == 'prev' )\r
578                 {\r
579                         if ( intval($startpos) - intval($maxresults) >= 0 )\r
580                         {\r
581                                 $startpos       = intval($startpos) - intval($maxresults);\r
582                                 \r
583                                 if ( $this->skintype == 'index' )\r
584                                 {\r
585                                         $url = $path;\r
586                                 }\r
587                                 else if ( $this->skintype == 'search' )\r
588                                 {\r
589                                         $url = $CONF['SearchURL'];\r
590                                 }\r
591                                 $url .= '?' . alterQueryStr($parsed,'startpos',$startpos);\r
592                         }\r
593                 }\r
594                 else if ( $direction == 'next' )\r
595                 {\r
596                         global $navigationItems;\r
597                         if ( !isset($navigationItems) )\r
598                         {\r
599                                 $navigationItems = 0;\r
600                         }\r
601                         \r
602                         if ( $recount )\r
603                         {\r
604                                 $iAmountOnPage = 0;\r
605                         }\r
606                         else \r
607                         {\r
608                                 $iAmountOnPage = $this->amountfound;\r
609                         }\r
610                         \r
611                         if ( intval($navigationItems) > 0 )\r
612                         {\r
613                                 $iAmountOnPage = intval($navigationItems) - intval($startpos);\r
614                         }\r
615                         elseif ( $iAmountOnPage == 0 )\r
616                         {\r
617                                 /*\r
618                                  * [%nextlink%] or [%prevlink%] probably called before [%blog%] or [%searchresults%]\r
619                                  * try a count query\r
620                                  */\r
621                                 if ( $this->skintype == 'index' )\r
622                                 {\r
623                                         $sqlquery = $blog->getSqlBlog('', 'count');\r
624                                         $url = $path;\r
625                                 }\r
626                                 else if ( $this->skintype == 'search' )\r
627                                 {\r
628                                         $unused_highlight = '';\r
629                                         $sqlquery = $blog->getSqlSearch($query, $amount, $unused_highlight, 'count');\r
630                                         $url = $CONF['SearchURL'];\r
631                                 }\r
632                                 if ( $sqlquery )\r
633                                 {\r
634                                         $iAmountOnPage = intval(quickQuery($sqlquery)) - intval($startpos);\r
635                                 }\r
636                         }\r
637                         \r
638                         $url = '';\r
639                         if ( intval($iAmountOnPage) >= intval($maxresults) )\r
640                         {\r
641                                 $startpos        = intval($startpos) + intval($maxresults);\r
642                                 $url            .= '?' . alterQueryStr($parsed, 'startpos', $startpos);\r
643                         }\r
644                 }\r
645                 \r
646                 if ( $url != '' )\r
647                 {\r
648                         echo $this->link($url, $linktext);\r
649                 }\r
650                 return;\r
651         }\r
652         \r
653         /**\r
654          * Actions::itemlink()\r
655          * Creates an item link and if no id is given a todaylink \r
656          * \r
657          * @param       integer $id     id for link\r
658          * @param       string  $linktext       text for link\r
659          * @return      void\r
660          */\r
661         private function itemlink($id, $linktext = '')\r
662         {\r
663                 global $CONF;\r
664                 if ( $id != 0 )\r
665                 {\r
666                         echo $this->link(Link::create_item_link($id, $this->linkparams), $linktext);\r
667                 }\r
668                 else\r
669                 {\r
670                         $this->parse_todaylink($linktext);\r
671                 }\r
672                 return;\r
673         }\r
674         \r
675         /**\r
676          * Actions::archivelink)\r
677          * Creates an archive link and if no id is given a todaylink \r
678          * \r
679          * @param       integer $id     id for link\r
680          * @param       string  $linktext       text for link\r
681          * @return      void\r
682          */\r
683         private function archivelink($id, $linktext = '')\r
684         {\r
685                 global $CONF, $blog;\r
686                 if ( $id != 0 )\r
687                 {\r
688                         echo $this->link(Link::create_archive_link($blog->getID(), $id, $this->linkparams), $linktext);\r
689                 }\r
690                 else\r
691                 {\r
692                         $this->parse_todaylink($linktext);\r
693                 }\r
694                 return;\r
695         }\r
696         \r
697         /**\r
698          * Actions:setBlogCategory()\r
699          * Helper function that sets the category that a blog will need to use\r
700          *\r
701          * @param       string  $blog           An object of the blog class, passed by reference (we want to make changes to it)\r
702          * @param       string  $catname        The name of the category to use\r
703          * @return      void\r
704          */\r
705         private function setBlogCategory(&$blog, $catname)\r
706         {\r
707                 global $catid;\r
708                 if ( $catname != '' )\r
709                 {\r
710                         $blog->setSelectedCategoryByName($catname);\r
711                 }\r
712                 else\r
713                 {\r
714                         $blog->setSelectedCategory($catid);\r
715                 }\r
716                 return;\r
717         }\r
718         \r
719         /**\r
720          * Actions::preBlogContent()\r
721          * Notifies the Manager that a PreBlogContent event occurs\r
722          * \r
723          * @param       string  $type   type of skin\r
724          * @param       object  $blog   an instance of Blog class\r
725          * @return      void\r
726          */\r
727         private function preBlogContent($type, &$blog)\r
728         {\r
729                 global $manager;\r
730                 $manager->notify('PreBlogContent',array('blog' => &$blog, 'type' => $type));\r
731                 return;\r
732         }\r
733 \r
734         /**\r
735          * Actions::postBlogContent()\r
736          * Notifies the Manager that a PostBlogContent event occurs\r
737          * \r
738          * @param       string  $type   type of skin\r
739          * @param       objecct $blog   an instance of Blog class\r
740          * @return      void\r
741          */\r
742         private function postBlogContent($type, &$blog)\r
743         {\r
744                 global $manager;\r
745                 $manager->notify('PostBlogContent', array('blog' => &$blog, 'type' => $type));\r
746                 return;\r
747         }\r
748         \r
749         /**\r
750          * Actions::parse_additemform()\r
751          * Parse skinvar additemform\r
752          * \r
753          * @param       void\r
754          * @return      void\r
755          */\r
756         public function parse_additemform()\r
757         {\r
758                 global $blog, $CONF;\r
759                 $this->formdata = array(\r
760                         'adminurl'      => Entity::hsc($CONF['AdminURL']),\r
761                         'catid'         => $blog->getDefaultCategory()\r
762                 );\r
763                 $blog->InsertJavaScriptInfo();\r
764                 $this->doForm('additemform');\r
765                 return;\r
766         }\r
767         \r
768         /**\r
769          * Actions::parse_addlink()\r
770          * Parse skinvar addlink\r
771          * A Link that allows to open a bookmarklet to add an item\r
772          */\r
773         public function parse_addlink()\r
774         {\r
775                 global $CONF, $member, $blog;\r
776                 if ( $member->isLoggedIn() && $member->isTeamMember($blog->blogid) )\r
777                 {\r
778                         echo $CONF['AdminURL'].'bookmarklet.php?blogid='.$blog->blogid;\r
779                 }\r
780                 return;\r
781         }\r
782         \r
783         /**\r
784          * Actions::parse_addpopupcode()\r
785          * Parse skinvar addpopupcode\r
786          * Code that opens a bookmarklet in an popup window\r
787          * \r
788          * @param       void\r
789          * @return      void\r
790          */\r
791         public function parse_addpopupcode()\r
792         {\r
793                 echo "if (event &amp;&amp; event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=500,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";\r
794                 return;\r
795         }\r
796         \r
797         /**\r
798          * Parse skinvar adminurl\r
799          * (shortcut for admin url)\r
800          * \r
801          * @param       void\r
802          * @return      void\r
803          */\r
804         public function parse_adminurl()\r
805         {\r
806                 $this->parse_sitevar('adminurl');\r
807                 return;\r
808         }\r
809         \r
810         /**\r
811          * Actions::parse_archive()\r
812          * Parse skinvar archive\r
813          * \r
814          * @param       string  $template       name of template\r
815          * @param       string  $category       name of category\r
816          * @return      \r
817          */\r
818         public function parse_archive($template, $category = '')\r
819         {\r
820                 global $blog, $archive;\r
821                 // can be used with either yyyy-mm or yyyy-mm-dd\r
822                 sscanf($archive,'%d-%d-%d', $y, $m, $d);\r
823                 $this->setBlogCategory($blog, $category);\r
824                 $this->preBlogContent('achive',$blog);\r
825                 $blog->showArchive($template, $y, $m, $d);\r
826                 $this->postBlogContent('achive',$blog);\r
827                 return;\r
828         }\r
829         \r
830         /**\r
831          * Actions::parse_archivedate()\r
832          * %archivedate(locale,date format)%\r
833          * \r
834          * @param       string  $locale\r
835          * @return      void\r
836          */\r
837         public function parse_archivedate($locale = '-def-')\r
838         {\r
839                 global $archive;\r
840                 \r
841                 /* \r
842                  * TODO: these lines are no meaning because there is no $template.\r
843                 if ( $locale == '-def-' )\r
844                 {\r
845                         setlocale(LC_TIME, $template['LOCALE']);\r
846                 }\r
847                 else\r
848                 {\r
849                         setlocale(LC_TIME, $locale);\r
850                 }\r
851                  */\r
852                 \r
853                 // get archive date\r
854                 sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
855                 \r
856                 // get format\r
857                 $args = func_get_args();\r
858                 // format can be spread over multiple parameters\r
859                 if ( sizeof($args) > 1 )\r
860                 {\r
861                         // take away locale\r
862                         array_shift($args);\r
863                         // implode\r
864                         $format=implode(',',$args);\r
865                 }\r
866                 elseif ( $d == 0 && $m !=0 )\r
867                 {\r
868                         $format = '%B %Y';\r
869                 }\r
870                 elseif ( $m == 0 )\r
871                 {\r
872                         $format = '%Y';\r
873                 }\r
874                 else\r
875                 {\r
876                         $format = '%d %B %Y';\r
877                 }\r
878                 echo i18n::formatted_datetime($format, mktime(0,0,0,$m?$m:1,$d?$d:1,$y));\r
879                 return;\r
880         }\r
881         \r
882         /**\r
883          * Actions::parse_archivedaylist()\r
884          * Parse skinvar archivedaylist\r
885          * \r
886          * @param       string  $template       name of template\r
887          * @param       string  $category       name of category\r
888          * @param       integer $limit          the number of items in a display\r
889          * @return      void\r
890          */\r
891         public function parse_archivedaylist($template, $category = 'all', $limit = 0)\r
892         {\r
893                 global $blog;\r
894                 if ( $category == 'all' )\r
895                 {\r
896                         $category = '';\r
897                 }\r
898                 $this->preBlogContent('archivelist',$blog);\r
899                 $this->setBlogCategory($blog, $category);\r
900                 $blog->showArchiveList($template, 'day', $limit);\r
901                 $this->postBlogContent('archivelist',$blog);\r
902                 return;\r
903         }\r
904         \r
905         /**\r
906          * Actions::parse_archivelink()\r
907          * A link to the archives for the current blog (or for default blog)\r
908          * \r
909          * @param       string  $linktext       text for link\r
910          * @return      void\r
911          */\r
912         public function parse_archivelink($linktext = '')\r
913         {\r
914                 global $blog, $CONF;\r
915                 if ( $blog )\r
916                 {\r
917                         echo $this->link(Link::create_archivelist_link($blog->getID(), $this->linkparams), $linktext);\r
918                 }\r
919                 else\r
920                 {\r
921                         echo $this->link(Link::create_archivelist_link(), $linktext);\r
922                 }\r
923                 return;\r
924         }\r
925         \r
926         /**\r
927          * Actions::parse_archivelist()\r
928          * \r
929          * @param       string  $template       name of template\r
930          * @param       string  $category       name of category\r
931          * @param       integer $limit          the number of items in a display\r
932          * @return      void\r
933          */\r
934         public function parse_archivelist($template, $category = 'all', $limit = 0)\r
935         {\r
936                 global $blog;\r
937                 if ( $category == 'all' )\r
938                 {\r
939                         $category = '';\r
940                 }\r
941                 $this->preBlogContent('archivelist',$blog);\r
942                 $this->setBlogCategory($blog, $category);\r
943                 $blog->showArchiveList($template, 'month', $limit);\r
944                 $this->postBlogContent('archivelist',$blog);\r
945                 return;\r
946         }\r
947         \r
948         /**\r
949          * Actions::parse_archiveyearlist()\r
950          * \r
951          * @param       string  $template       name of template\r
952          * @param       string  $category       name of category\r
953          * @param       integer $limit          the number of items in a display\r
954          */\r
955         public function parse_archiveyearlist($template, $category = 'all', $limit = 0)\r
956         {\r
957                 global $blog;\r
958                 if ( $category == 'all' )\r
959                 {\r
960                         $category = '';\r
961                 }\r
962                 $this->preBlogContent('archivelist',$blog);\r
963                 $this->setBlogCategory($blog, $category);\r
964                 $blog->showArchiveList($template, 'year', $limit);\r
965                 $this->postBlogContent('archivelist',$blog);\r
966                 return;\r
967         }\r
968         \r
969         /**\r
970          * Actions::parse_archivetype()\r
971          * Parse skinvar archivetype\r
972          * \r
973          * @param       void\r
974          * @return      void\r
975          */\r
976         public function parse_archivetype()\r
977         {\r
978                 global $archivetype;\r
979                 echo $archivetype;\r
980                 return;\r
981         }\r
982         \r
983         /**\r
984          * Actions::parse_blog()\r
985          * Parse skinvar blog\r
986          * \r
987          * @param       string  $template       name of template\r
988          * @param       mixed   $amount         the number of items in a display, in case it includes the beginning\r
989          * @param       string  $category       name of category\r
990          * @return      void\r
991          */\r
992         public function parse_blog($template, $amount = 10, $category = '')\r
993         {\r
994                 global $blog, $startpos;\r
995                 \r
996                 list($limit, $offset) = sscanf($amount, '%d(%d)');\r
997                 $this->setBlogCategory($blog, $category);\r
998                 $this->preBlogContent('blog',$blog);\r
999                 $this->amountfound = $blog->readLog($template, $limit, $offset, $startpos);\r
1000                 $this->postBlogContent('blog',$blog);\r
1001                 return;\r
1002         }\r
1003         \r
1004         /**\r
1005          * Actions::parse_bloglist()\r
1006          * Parse skinvar bloglist\r
1007          * Shows a list of all blogs\r
1008          * \r
1009          * @param       string  $template       name of template\r
1010          * @param       string  $bnametype      whether 'name' or 'shortname' is used for the link text\r
1011          * @param       string  $orderby        order criteria\r
1012          * @param       string  $direction      order ascending or descending             \r
1013          * @return      void\r
1014          */\r
1015         public function parse_bloglist($template, $bnametype = '', $orderby='number', $direction='asc')\r
1016         {\r
1017                 Blog::showBlogList($template, $bnametype, $orderby, $direction);\r
1018                 return;\r
1019         }\r
1020         \r
1021         /**\r
1022          * Actions::parse_blogsetting()\r
1023          * Parse skinvar blogsetting\r
1024          * \r
1025          * @param       string  $which  key of weblog settings\r
1026          * @return      void\r
1027          */\r
1028         public function parse_blogsetting($which)\r
1029         {\r
1030                 global $blog;\r
1031                 switch( $which )\r
1032                 {\r
1033                         case 'id':\r
1034                                 echo Entity::hsc($blog->getID());\r
1035                                 break;\r
1036                         case 'url':\r
1037                                 echo Entity::hsc($blog->getURL());\r
1038                                 break;\r
1039                         case 'name':\r
1040                                 echo Entity::hsc($blog->getName());\r
1041                                 break;\r
1042                         case 'desc':\r
1043                                 echo Entity::hsc($blog->getDescription());\r
1044                                 break;\r
1045                         case 'short':\r
1046                                 echo Entity::hsc($blog->getShortName());\r
1047                                 break;\r
1048                 }\r
1049                 return;\r
1050         }\r
1051         \r
1052         /**\r
1053          * Actions::parse_callback()\r
1054          * Parse callback\r
1055          * \r
1056          * @param       string  $eventName      name of event\r
1057          * @param       string  $type   type of skin\r
1058          * @return      void\r
1059          */\r
1060         public function parse_callback($eventName, $type)\r
1061         {\r
1062                 global $manager;\r
1063                 $manager->notify($eventName, array('type' => $type));\r
1064                 return;\r
1065         }\r
1066         \r
1067         /**\r
1068          * Actions::parse_category()\r
1069          * Parse skinvar category\r
1070          * \r
1071          * @param       string  $type   key of category settings\r
1072          * @return      void\r
1073          */\r
1074         public function parse_category($type = 'name')\r
1075         {\r
1076                 global $catid, $blog;\r
1077                 if ( !$blog->isValidCategory($catid) )\r
1078                 {\r
1079                         return;\r
1080                 }\r
1081                 \r
1082                 switch ( $type )\r
1083                 {\r
1084                         case 'name':\r
1085                                 echo $blog->getCategoryName($catid);\r
1086                                 break;\r
1087                         case 'desc':\r
1088                                 echo $blog->getCategoryDesc($catid);\r
1089                                 break;\r
1090                         case 'id':\r
1091                                 echo $catid;\r
1092                                 break;\r
1093                 }\r
1094                 return;\r
1095         }\r
1096         \r
1097         /**\r
1098          * Actions::parse_categorylist()\r
1099          * Parse categorylist\r
1100          * \r
1101          * @param       string  $template       name of template\r
1102          * @param       string  $blogname       name of weblog\r
1103          * @return      void\r
1104          */\r
1105         public function parse_categorylist($template, $blogname = '')\r
1106         {\r
1107                 global $blog, $manager;\r
1108                 \r
1109                 // when no blog found\r
1110                 if ( ($blogname == '') && (!is_object($blog)) )\r
1111                 {\r
1112                         return 0;\r
1113                 }\r
1114                         \r
1115                 if ( $blogname == '' )\r
1116                 {\r
1117                         $this->preBlogContent('categorylist',$blog);\r
1118                         $blog->showCategoryList($template);\r
1119                         $this->postBlogContent('categorylist',$blog);\r
1120                 }\r
1121                 else\r
1122                 {\r
1123                         $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1124                         $this->preBlogContent('categorylist',$b);\r
1125                         $b->showCategoryList($template);\r
1126                         $this->postBlogContent('categorylist',$b);\r
1127                 }\r
1128                 return;\r
1129         }\r
1130         \r
1131         /**\r
1132          * Actions::parse_charset()\r
1133          * Parse skinvar charset\r
1134          * \r
1135          * @param       void\r
1136          * @return      void\r
1137          */\r
1138         public function parse_charset()\r
1139         {\r
1140                 echo i18n::get_current_charset();\r
1141                 return;\r
1142         }\r
1143         \r
1144         /**\r
1145          * Actions::parse_commentform()\r
1146          * Parse skinvar commentform\r
1147          * \r
1148          * @param       string  $destinationurl URI for redirection\r
1149          * @return      void\r
1150          */\r
1151         public function parse_commentform($destinationurl = '')\r
1152         {\r
1153                 global $blog, $itemid, $member, $CONF, $manager, $DIR_LIBS, $errormessage;\r
1154                 \r
1155                 // warn when trying to provide a actionurl (used to be a parameter in Nucleus <2.0)\r
1156                 if ( stristr($destinationurl, 'action.php') )\r
1157                 {\r
1158                         $args = func_get_args();\r
1159                         $destinationurl = $args[1];\r
1160                         ActionLog::add(WARNING,_ACTIONURL_NOTLONGER_PARAMATER);\r
1161                 }\r
1162                 \r
1163                 $actionurl = $CONF['ActionURL'];\r
1164                 \r
1165                 // if item is closed, show message and do nothing\r
1166                 $item =& $manager->getItem($itemid,0,0);\r
1167                 if ( $item['closed'] || !$blog->commentsEnabled() )\r
1168                 {\r
1169                         $this->doForm('commentform-closed');\r
1170                         return;\r
1171                 }\r
1172                 \r
1173                 if ( !$blog->isPublic() && !$member->isLoggedIn() )\r
1174                 {\r
1175                         $this->doForm('commentform-closedtopublic');\r
1176                         return;\r
1177                 }\r
1178                 \r
1179                 if ( !$destinationurl )\r
1180                 {\r
1181                         // note: createLink returns an HTML encoded URL\r
1182                         $destinationurl = Link::create_link(\r
1183                                 'item',\r
1184                                 array(\r
1185                                         'itemid' => $itemid,\r
1186                                         'title' => $item['title'],\r
1187                                         'timestamp' => $item['timestamp'],\r
1188                                         'extra' => $this->linkparams\r
1189                                 )\r
1190                         );\r
1191                 }\r
1192                 else\r
1193                 {\r
1194                         // HTML encode URL\r
1195                         $destinationurl = Entity::hsc($destinationurl);\r
1196                 }\r
1197                 \r
1198                 // values to prefill\r
1199                 $user = cookieVar($CONF['CookiePrefix'] .'comment_user');\r
1200                 if ( !$user )\r
1201                 {\r
1202                         $user = postVar('user');\r
1203                 }\r
1204                 \r
1205                 $userid = cookieVar($CONF['CookiePrefix'] .'comment_userid');\r
1206                 if ( !$userid )\r
1207                 {\r
1208                         $userid = postVar('userid');\r
1209                 }\r
1210                 \r
1211                 $email = cookieVar($CONF['CookiePrefix'] .'comment_email');\r
1212                 if (!$email)\r
1213                 {\r
1214                         $email = postVar('email');\r
1215                 }\r
1216                 \r
1217                 $body = postVar('body');\r
1218                 \r
1219                 $this->formdata = array(\r
1220                         'destinationurl' => $destinationurl,    // url is already HTML encoded\r
1221                         'actionurl' => Entity::hsc($actionurl),\r
1222                         'itemid' => $itemid,\r
1223                         'user' => Entity::hsc($user),\r
1224                         'userid' => Entity::hsc($userid),\r
1225                         'email' => Entity::hsc($email),\r
1226                         'body' => Entity::hsc($body),\r
1227                         'membername' => $member->getDisplayName(),\r
1228                         'rememberchecked' => cookieVar($CONF['CookiePrefix'] .'comment_user')?'checked="checked"':''\r
1229                 );\r
1230                 \r
1231                 if ( !$member->isLoggedIn() )\r
1232                 {\r
1233                         $this->doForm('commentform-notloggedin');\r
1234                 }\r
1235                 else\r
1236                 {\r
1237                         $this->doForm('commentform-loggedin');\r
1238                 }\r
1239                 return;\r
1240         }\r
1241         \r
1242         /**\r
1243          * Actions::parse_comments()\r
1244          * Parse skinvar comments\r
1245          * include comments for one item\r
1246          * \r
1247          * @param       string  $template       name of template\r
1248          * @return      void\r
1249          */\r
1250         public function parse_comments($template)\r
1251         {\r
1252                 global $itemid, $manager, $blog, $highlight;\r
1253                 \r
1254                 $template =& $manager->getTemplate($template);\r
1255                 $item = Item::getitem($itemid, 0, 0);\r
1256                 \r
1257                 // create parser object & action handler\r
1258                 $handler = new ItemActions($blog);\r
1259                 $handler->setTemplate($template);\r
1260                 $handler->setCurrentItem($item);\r
1261                 \r
1262                 $parser = new Parser($handler);\r
1263                 \r
1264                 $comments = new Comments($itemid);\r
1265                 $comments->setItemActions($handler);\r
1266                 // shows ALL comments\r
1267                 $comments->showComments($template, -1, 1, $highlight);\r
1268                 return;\r
1269         }\r
1270         \r
1271         /**\r
1272          * Actions::parse_errordiv()\r
1273          * Parse errordiv\r
1274          * \r
1275          * @param       void\r
1276          * @return      void\r
1277          */\r
1278         public function parse_errordiv()\r
1279         {\r
1280                 global $errormessage;\r
1281                 if ( $errormessage )\r
1282                 {\r
1283                         echo '<div class="error">' . Entity::hsc($errormessage) . "</div>\n";\r
1284                 }\r
1285                 return;\r
1286         }\r
1287         \r
1288         /**\r
1289          * Actions::parse_errormessage()\r
1290          * Parse skinvar errormessage\r
1291          * \r
1292          * @param       void\r
1293          * @return      void\r
1294          */\r
1295         public function parse_errormessage()\r
1296         {\r
1297                 global $errormessage;\r
1298                 echo $errormessage;\r
1299                 return;\r
1300         }\r
1301         \r
1302         /**\r
1303          * Actions::parse_formdata()\r
1304          * Parse formdata\r
1305          * \r
1306          * @param       string  $what   key of format data\r
1307          * @return      void\r
1308          */\r
1309         public function parse_formdata($what)\r
1310         {\r
1311                 echo $this->formdata[$what];\r
1312                 return;\r
1313         }\r
1314         \r
1315         /**\r
1316          * Actions::parse_ifcat()\r
1317          * Parse ifcat\r
1318          * \r
1319          * @param       string  $text\r
1320          * @return      void\r
1321          */\r
1322         public function parse_ifcat($text = '')\r
1323         {\r
1324                 if ( $text == '' )\r
1325                 {\r
1326                         // new behaviour\r
1327                         $this->parse_if('category');\r
1328                 }\r
1329                 else\r
1330                 {\r
1331                         // old behaviour\r
1332                         global $catid, $blog;\r
1333                         if ( $blog->isValidCategory($catid) )\r
1334                         {\r
1335                                 echo $text;\r
1336                         }\r
1337                 }\r
1338                 return;\r
1339         }\r
1340         \r
1341         /**\r
1342          * Actions::parse_image()\r
1343          * Parse skinvar image\r
1344          * \r
1345          * @param       string  $what   name of tag\r
1346          * @return      void\r
1347          */\r
1348         public function parse_image($what = 'imgtag')\r
1349         {\r
1350                 global $CONF;\r
1351                 \r
1352                 $imagetext      = Entity::hsc(requestVar('imagetext'));\r
1353                 $imagepopup = requestVar('imagepopup');\r
1354                 $width          = intRequestVar('width');\r
1355                 $height         = intRequestVar('height');\r
1356                 $fullurl        = Entity::hsc($CONF['MediaURL'] . $imagepopup);\r
1357                 \r
1358                 switch ( $what )\r
1359                 {\r
1360                         case 'url':\r
1361                                 echo $fullurl;\r
1362                                 break;\r
1363                         case 'width':\r
1364                                 echo $width;\r
1365                                 break;\r
1366                         case 'height':\r
1367                                 echo $height;\r
1368                                 break;\r
1369                         case 'caption':\r
1370                         case 'text':\r
1371                                 echo $imagetext;\r
1372                                 break;\r
1373                         case 'imgtag':\r
1374                         default:\r
1375                                 echo "<img src=\"$fullurl\" width=\"$width\" height=\"$height\" alt=\"$imagetext\" title=\"$imagetext\" />";\r
1376                                 break;\r
1377                 }\r
1378                 return;\r
1379         }\r
1380         \r
1381         /**\r
1382          * Actions::parse_imagetext()\r
1383          * Parse skinvar imagetext\r
1384          * \r
1385          * @param       void\r
1386          * @return      void\r
1387          */\r
1388         public function parse_imagetext()\r
1389         {\r
1390                 $this->parse_image('imagetext');\r
1391                 return;\r
1392         }\r
1393 \r
1394         /**\r
1395          * Actions::parse_item()\r
1396          * Parse skinvar item\r
1397          * include one item (no comments)\r
1398          * \r
1399          * @param       void\r
1400          * @return      void\r
1401          */\r
1402         public function parse_item($template)\r
1403         {\r
1404                 global $blog, $itemid, $highlight;\r
1405                 \r
1406                 // need this to select default category\r
1407                 $this->setBlogCategory($blog, '');\r
1408                 $this->preBlogContent('item',$blog);\r
1409                 $r = $blog->showOneitem($itemid, $template, $highlight);\r
1410                 if ( $r == 0 )\r
1411                 {\r
1412                         echo _ERROR_NOSUCHITEM;\r
1413                 }\r
1414                 $this->postBlogContent('item',$blog);\r
1415                 return;\r
1416         }\r
1417 \r
1418         /**\r
1419          * Actions::parse_itemid()\r
1420          * Parse skinvar itemid\r
1421          * \r
1422          * @param       void\r
1423          * @return      void\r
1424          */\r
1425         public function parse_itemid()\r
1426         {\r
1427                 global $itemid;\r
1428                 echo $itemid;\r
1429                 return;\r
1430         }\r
1431         \r
1432         /**\r
1433          * Actions::parseitemlink()\r
1434          * Parse skinvar itemlink\r
1435          * \r
1436          * @param       void\r
1437          * @return      void\r
1438          */\r
1439         public function parse_itemlink($linktext = '')\r
1440         {\r
1441                 global $itemid;\r
1442                 $this->itemlink($itemid, $linktext);\r
1443                 return;\r
1444         }\r
1445         \r
1446         /**\r
1447          * Actions::parse_itemtitle()\r
1448          * Parse itemtitle\r
1449          * \r
1450          * @param       void\r
1451          * @return      void\r
1452          */\r
1453         public function parse_itemtitle($format = '')\r
1454         {\r
1455                 global $manager, $itemid;\r
1456                 $item =& $manager->getItem($itemid,0,0);\r
1457                 \r
1458                 switch ( $format )\r
1459                 {\r
1460                         case 'xml':\r
1461                                 echo Entity::hen($item['title']);\r
1462                                 break;\r
1463                         case 'raw':\r
1464                                 echo $item['title'];\r
1465                                 break;\r
1466                         case 'attribute':\r
1467                         default:\r
1468                                 echo Entity::hsc(strip_tags($item['title']));\r
1469                                 break;\r
1470                 }\r
1471                 return;\r
1472         }\r
1473         \r
1474         /**\r
1475          * Actions::parse_loginform()\r
1476          * Parse skinvar loginform\r
1477          * \r
1478          * @param       void\r
1479          * @return      void\r
1480          */\r
1481         public function parse_loginform()\r
1482         {\r
1483                 global $member, $CONF;\r
1484                 if ( !$member->isLoggedIn() )\r
1485                 {\r
1486                         $filename = 'loginform-notloggedin';\r
1487                         $this->formdata = array();\r
1488                 }\r
1489                 else\r
1490                 {\r
1491                         $filename = 'loginform-loggedin';\r
1492                         $this->formdata = array(\r
1493                                 'membername' => $member->getDisplayName(),\r
1494                         );\r
1495                 }\r
1496                 $this->doForm($filename);\r
1497                 return;\r
1498         }\r
1499         \r
1500         /**\r
1501          * Actions::parse_member()\r
1502          * Parse skinvar member\r
1503          * (includes a member info thingie)\r
1504          * \r
1505          * @param       string  $what   which memberdata is needed\r
1506          * @return      void\r
1507          */\r
1508         public function parse_member($what)\r
1509         {\r
1510                 global $memberinfo, $member, $CONF;\r
1511                 \r
1512                 // 1. only allow the member-details-page specific variables on member pages\r
1513                 if ( $this->skintype == 'member' )\r
1514                 {\r
1515                         switch( $what )\r
1516                         {\r
1517                                 case 'name':\r
1518                                         echo Entity::hsc($memberinfo->getDisplayName());\r
1519                                         break;\r
1520                                 case 'realname':\r
1521                                         echo Entity::hsc($memberinfo->getRealName());\r
1522                                         break;\r
1523                                 case 'notes':\r
1524                                         echo Entity::hsc($memberinfo->getNotes());\r
1525                                         break;\r
1526                                 case 'url':\r
1527                                         echo Entity::hsc($memberinfo->getURL());\r
1528                                         break;\r
1529                                 case 'email':\r
1530                                         echo Entity::hsc($memberinfo->getEmail());\r
1531                                         break;\r
1532                                 case 'id':\r
1533                                         echo Entity::hsc($memberinfo->getID());\r
1534                                         break;\r
1535                         }\r
1536                 }\r
1537                 \r
1538                 // 2. the next bunch of options is available everywhere, as long as the user is logged in\r
1539                 if ( $member->isLoggedIn() )\r
1540                 {\r
1541                         switch( $what )\r
1542                         {\r
1543                                 case 'yourname':\r
1544                                         echo $member->getDisplayName();\r
1545                                         break;\r
1546                                 case 'yourrealname':\r
1547                                         echo $member->getRealName();\r
1548                                         break;\r
1549                                 case 'yournotes':\r
1550                                         echo $member->getNotes();\r
1551                                         break;\r
1552                                 case 'yoururl':\r
1553                                         echo $member->getURL();\r
1554                                         break;\r
1555                                 case 'youremail':\r
1556                                         echo $member->getEmail();\r
1557                                         break;\r
1558                                 case 'yourid':\r
1559                                         echo $member->getID();\r
1560                                         break;\r
1561                                 case 'yourprofileurl':\r
1562                                         if ($CONF['URLMode'] == 'pathinfo')\r
1563                                                 echo Link::create_member_link($member->getID());\r
1564                                         else\r
1565                                                 echo $CONF['IndexURL'] . Link::create_member_link($member->getID());\r
1566                                         break;\r
1567                         }\r
1568                 }\r
1569                 return;\r
1570         }\r
1571         \r
1572         /**\r
1573          * Link::parse_membermailform()\r
1574          * Parse skinvar membermailform\r
1575          * \r
1576          * @param       integer $rows   the height for textarea\r
1577          * @param       integer $cols   the width for textarea\r
1578          * @param       string  $desturl        URI to redirect\r
1579          * @return      void\r
1580          */\r
1581         public function parse_membermailform($rows = 10, $cols = 40, $desturl = '')\r
1582         {\r
1583                 global $member, $CONF, $memberid;\r
1584                 \r
1585                 if ( $desturl == '' )\r
1586                 {\r
1587                         if ( $CONF['URLMode'] == 'pathinfo' )\r
1588                         {\r
1589                                 $desturl = Link::create_member_link($memberid);\r
1590                         }\r
1591                         else\r
1592                         {\r
1593                                 $desturl = $CONF['IndexURL'] . Link::create_member_link($memberid);\r
1594                         }\r
1595                 }\r
1596                 \r
1597                 $message = postVar('message');\r
1598                 $frommail = postVar('frommail');\r
1599                 \r
1600                 $this->formdata = array(\r
1601                         'url' => Entity::hsc($desturl),\r
1602                         'actionurl' => Entity::hsc($CONF['ActionURL']),\r
1603                         'memberid' => $memberid,\r
1604                         'rows' => $rows,\r
1605                         'cols' => $cols,\r
1606                         'message' => Entity::hsc($message),\r
1607                         'frommail' => Entity::hsc($frommail)\r
1608                 );\r
1609                 \r
1610                 if ( $member->isLoggedIn() )\r
1611                 {\r
1612                         $this->doForm('membermailform-loggedin');\r
1613                 }\r
1614                 else if ( $CONF['NonmemberMail'] )\r
1615                 {\r
1616                         $this->doForm('membermailform-notloggedin');\r
1617                 }\r
1618                 else\r
1619                 {\r
1620                         $this->doForm('membermailform-disallowed');\r
1621                 }\r
1622                 return;\r
1623         }\r
1624         \r
1625         /**\r
1626          * Actions::parse_nextarchive()\r
1627          * Parse skinvar nextarchive\r
1628          * \r
1629          * @param       void\r
1630          * @return      void\r
1631          */\r
1632         public function parse_nextarchive()\r
1633         {\r
1634                 global $archivenext;\r
1635                 echo $archivenext;\r
1636                 return;\r
1637         }\r
1638         \r
1639         /**\r
1640          * Parse skinvar nextitem\r
1641          * (include itemid of next item)\r
1642          * \r
1643          * @param       void\r
1644          * @return      void\r
1645          */\r
1646         public function parse_nextitem()\r
1647         {\r
1648                 global $itemidnext;\r
1649                 if ( isset($itemidnext) )\r
1650                 {\r
1651                         echo (int)$itemidnext;\r
1652                 }\r
1653                 return;\r
1654         }\r
1655         \r
1656         /**\r
1657          * Actions::parse_nextitemtitle()\r
1658          * Parse skinvar nextitemtitle\r
1659          * (include itemtitle of next item)\r
1660          * \r
1661          * @param       string  $format format of text\r
1662          * @return      void\r
1663          */\r
1664         public function parse_nextitemtitle($format = '')\r
1665         {\r
1666                 global $itemtitlenext;\r
1667                 \r
1668                 switch ( $format )\r
1669                 {\r
1670                         case 'xml':\r
1671                                 echo Entity::hen($itemtitlenext);\r
1672                                 break;\r
1673                         case 'raw':\r
1674                                 echo $itemtitlenext;\r
1675                                 break;\r
1676                         case 'attribute':\r
1677                         default:\r
1678                                 echo Entity::hsc($itemtitlenext);\r
1679                                 break;\r
1680                 }\r
1681                 return;\r
1682         }\r
1683         \r
1684         /**\r
1685          * Actions::parse_nextlink()\r
1686          * Parse skinvar nextlink\r
1687          * \r
1688          * @param       string  $linktext       text for content of anchor element\r
1689          * @param       integer $amount         the amount of items in a display\r
1690          * @param       integer $recount        increment from this value\r
1691          * @return      void\r
1692          */\r
1693         public function parse_nextlink($linktext = '', $amount = 10, $recount = '')\r
1694         {\r
1695                 global $itemidnext, $archivenext, $startpos;\r
1696                 if ( $this->skintype == 'item' )\r
1697                 {\r
1698                         $this->itemlink($itemidnext, $linktext);\r
1699                 }\r
1700                 else if ( $this->skintype == 'search' || $this->skintype == 'index' )\r
1701                 {\r
1702                         $this->searchlink($amount, $startpos, 'next', $linktext, $recount);\r
1703                 }\r
1704                 else\r
1705                 {\r
1706                         $this->archivelink($archivenext, $linktext);\r
1707                 }\r
1708                 return;\r
1709         }\r
1710 \r
1711         /**\r
1712          * Actions::parse_nucleusbutton()\r
1713          * Parse skinvar nucleusbutton\r
1714          * \r
1715          * @param       string  $imgurl URL  for image\r
1716          * @param       integer $imgwidth       width of image\r
1717          * @param       integer $imgheidht      height of image\r
1718          */\r
1719         public function parse_nucleusbutton($imgurl = '', $imgwidth = '85', $imgheight = '31')\r
1720         {\r
1721                 global $CONF;\r
1722                 if ( $imgurl == '' )\r
1723                 {\r
1724                         $imgurl = $CONF['AdminURL'] . 'nucleus.gif';\r
1725                 }\r
1726                 else if ( Parser::getProperty('IncludeMode') == 'skindir' )\r
1727                 {\r
1728                         // when skindit IncludeMode is used: start from skindir\r
1729                         $imgurl = $CONF['SkinsURL'] . Parser::getProperty('IncludePrefix') . $imgurl;\r
1730                 }\r
1731                 \r
1732                 $this->formdata = array(\r
1733                         'imgurl' => $imgurl,\r
1734                         'imgwidth' => $imgwidth,\r
1735                         'imgheight' => $imgheight,\r
1736                 );\r
1737                 $this->doForm('nucleusbutton');\r
1738                 return;\r
1739         }\r
1740         \r
1741         /**\r
1742          * Actions::parse_otherarchive()\r
1743          * Parse skinvar otherarchive\r
1744          * \r
1745          * @param       string  $blogname       name of weblog\r
1746          * @param       string  $template       name of template\r
1747          * @param       string  $category       name of category\r
1748          * @return      void\r
1749          */     \r
1750         public function parse_otherarchive($blogname, $template, $category = '')\r
1751         {\r
1752                 global $archive, $manager;\r
1753                 sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
1754                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1755                 $this->setBlogCategory($b, $category);\r
1756                 $this->preBlogContent('otherachive',$b);\r
1757                 $b->showArchive($template, $y, $m, $d);\r
1758                 $this->postBlogContent('otherachive',$b);\r
1759                 return;\r
1760         }\r
1761         \r
1762         /**\r
1763          * Actions::parse_otherarchivedaylist()\r
1764          * Parse skinvar otherarchivedaylist\r
1765          * \r
1766          * @param       string  $blogname       name of weblog\r
1767          * @param       string  $template       name of template\r
1768          * @param       string  $category       name of category\r
1769          * @param       integer $limit          the amount of items in a display\r
1770          * @return      void\r
1771          */\r
1772         public function parse_otherarchivedaylist($blogname, $template, $category = 'all', $limit = 0)\r
1773         {\r
1774                 global $manager;\r
1775                 if ( $category == 'all')\r
1776                 {\r
1777                         $category = '';\r
1778                 }\r
1779                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1780                 $this->setBlogCategory($b, $category);\r
1781                 $this->preBlogContent('otherarchivelist',$b);\r
1782                 $b->showArchiveList($template, 'day', $limit);\r
1783                 $this->postBlogContent('otherarchivelist',$b);\r
1784                 return;\r
1785         }\r
1786         \r
1787         /**\r
1788          * Actions::parse_otherarchivelist()\r
1789          * Parse skinvar otherarchivelist\r
1790          * \r
1791          * @param       string  $blogname       name of weblog\r
1792          * @param       string  $template       name of template\r
1793          * @param       string  $category       name of category\r
1794          * @param       integer $limit          the amount of items in a display\r
1795          * @return      void\r
1796          */\r
1797         public function parse_otherarchivelist($blogname, $template, $category = 'all', $limit = 0)\r
1798         {\r
1799                 global $manager;\r
1800                 if ( $category == 'all' )\r
1801                 {\r
1802                         $category = '';\r
1803                 }\r
1804                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1805                 $this->setBlogCategory($b, $category);\r
1806                 $this->preBlogContent('otherarchivelist',$b);\r
1807                 $b->showArchiveList($template, 'month', $limit);\r
1808                 $this->postBlogContent('otherarchivelist',$b);\r
1809                 return;\r
1810         }\r
1811         \r
1812         /**\r
1813          * Actions::parse_otherarchiveyearlist()\r
1814          * Parse skinvar otherarchiveyearlist\r
1815          * \r
1816          * @param       string  $blogname       name of weblog\r
1817          * @param       string  $template       name of template\r
1818          * @param       string  $category       name of category\r
1819          * @limit       integer $limit          the amount of items in a display\r
1820          */\r
1821         public function parse_otherarchiveyearlist($blogname, $template, $category = 'all', $limit = 0)\r
1822         {\r
1823                 global $manager;\r
1824                 if ( $category == 'all' )\r
1825                 {\r
1826                         $category = '';\r
1827                 }\r
1828                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1829                 $this->setBlogCategory($b, $category);\r
1830                 $this->preBlogContent('otherarchivelist',$b);\r
1831                 $b->showArchiveList($template, 'year', $limit);\r
1832                 $this->postBlogContent('otherarchivelist',$b);\r
1833                 return;\r
1834         }\r
1835         \r
1836         /**\r
1837          * Actions::parse_otherblog()\r
1838          * Parse skinvar otherblog\r
1839          * \r
1840          * @param       string  $blogname       name of weblog\r
1841          * @param       string  $template       name of template\r
1842          * @param       mixed   $amount         the amount of items, in case it includes the beginning\r
1843          * @param       string  $category       name of category\r
1844          * @return      void\r
1845          */\r
1846         public function parse_otherblog($blogname, $template, $amount = 10, $category = '')\r
1847         {\r
1848                 global $manager;\r
1849                 \r
1850                 list($limit, $offset) = sscanf($amount, '%d(%d)');\r
1851                 \r
1852                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1853                 $this->setBlogCategory($b, $category);\r
1854                 $this->preBlogContent('otherblog',$b);\r
1855                 $this->amountfound = $b->readLog($template, $limit, $offset);\r
1856                 $this->postBlogContent('otherblog',$b);\r
1857                 return;\r
1858         }\r
1859         \r
1860         /**\r
1861          * Actions::parse_othersearchresults()\r
1862          * Parse skinvar othersearchresults\r
1863          * \r
1864          * @param       string  $blogname       name of weblog\r
1865          * @param       string  $template       name of template\r
1866          * @param       integer $maxresults     the amount of results\r
1867          * @return      void\r
1868          */\r
1869         public function parse_othersearchresults($blogname, $template, $maxresults = 50)\r
1870         {\r
1871                 global $query, $amount, $manager, $startpos;\r
1872                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1873                 // need this to select default category\r
1874                 $this->setBlogCategory($b, '');\r
1875                 $this->preBlogContent('othersearchresults',$b);\r
1876                 $b->search($query, $template, $amount, $maxresults, $startpos);\r
1877                 $this->postBlogContent('othersearchresults',$b);\r
1878                 return;\r
1879         }\r
1880         \r
1881         /**\r
1882          * Actions::parse_plugin()\r
1883          * Executes a plugin skinvar\r
1884          * extra parameters can be added\r
1885          * \r
1886          * @param       string  $pluginName     name of plugin (without the NP_)\r
1887          * @return      void\r
1888          */\r
1889         public function parse_plugin($pluginName)\r
1890         {\r
1891                 global $manager;\r
1892                 \r
1893                 $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
1894                 if ( !$plugin )\r
1895                 {\r
1896                         return;\r
1897                 }\r
1898                 \r
1899                 // get arguments\r
1900                 $params = func_get_args();\r
1901                 \r
1902                 // remove plugin name\r
1903                 array_shift($params);\r
1904                 \r
1905                 // add skin type on front\r
1906                 array_unshift($params, $this->skintype);\r
1907                 \r
1908                 call_user_func_array(array(&$plugin,'doSkinVar'), $params);\r
1909                 return;\r
1910         }\r
1911         \r
1912         /**\r
1913          * Actions::parse_prevarchive()\r
1914          * Parse skinvar prevarchive\r
1915          * \r
1916          * @param       void\r
1917          * @return      void\r
1918          */\r
1919         public function parse_prevarchive()\r
1920         {\r
1921                 global $archiveprev;\r
1922                 echo $archiveprev;\r
1923         }\r
1924         \r
1925         /**\r
1926          * Actions::parse_preview()\r
1927          * Parse skinvar preview\r
1928          * \r
1929          * @param       string  $template       name of tempalte\r
1930          * @return      void\r
1931          */\r
1932         public function parse_preview($template)\r
1933         {\r
1934                 global $blog, $CONF, $manager;\r
1935                 \r
1936                 $template =& $manager->getTemplate($template);\r
1937                 \r
1938                 $row['body'] = '<span id="prevbody"></span>';\r
1939                 $row['title'] = '<span id="prevtitle"></span>';\r
1940                 $row['more'] = '<span id="prevmore"></span>';\r
1941                 $row['itemlink'] = '';\r
1942                 $row['itemid'] = 0; $row['blogid'] = $blog->getID();\r
1943                 \r
1944                 echo Template::fill($template['ITEM_HEADER'],$row);\r
1945                 echo Template::fill($template['ITEM'],$row);\r
1946                 echo Template::fill($template['ITEM_FOOTER'],$row);\r
1947                 return;\r
1948         }\r
1949         \r
1950         /**\r
1951          * Actions::parse_previtem()\r
1952          * Parse skinvar previtem\r
1953          * (include itemid of prev item)\r
1954          * \r
1955          * @param       void\r
1956          * @return      void\r
1957          */\r
1958         public function parse_previtem()\r
1959         {\r
1960                 global $itemidprev;\r
1961                 if ( isset($itemidprev) )\r
1962                 {\r
1963                         echo (integer) $itemidprev;\r
1964                 }\r
1965                 return;\r
1966         }\r
1967         \r
1968         /**\r
1969          * Actions::parse_previtemtitle()\r
1970          * Parse skinvar previtemtitle\r
1971          * (include itemtitle of prev item)\r
1972          * \r
1973          * @param       String  $format string format\r
1974          * @return      String  formatted string\r
1975          */\r
1976         public function parse_previtemtitle($format = '')\r
1977         {\r
1978                 global $itemtitleprev;\r
1979                 \r
1980                 switch ( $format )\r
1981                 {\r
1982                         case 'xml':\r
1983                                 echo Entity::hen($itemtitleprev);\r
1984                                 break;\r
1985                         case 'raw':\r
1986                                 echo $itemtitleprev;\r
1987                                 break;\r
1988                         case 'attribute':\r
1989                         default:\r
1990                                 echo Entity::hsc($itemtitleprev);\r
1991                                 break;\r
1992                 }\r
1993                 return;\r
1994         }\r
1995         \r
1996         /**\r
1997          * Actions::parse_prevlink()\r
1998          * Parse skinvar prevlink\r
1999          * \r
2000          * @param       string  $linktext       text as a content of anchor element\r
2001          * @param       integer the amount of links\r
2002          * @return      void\r
2003          */\r
2004         public function parse_prevlink($linktext = '', $amount = 10)\r
2005         {\r
2006                 global $itemidprev, $archiveprev, $startpos;\r
2007                 \r
2008                 if ( $this->skintype == 'item' )\r
2009                 {\r
2010                         $this->itemlink($itemidprev, $linktext);\r
2011                 }\r
2012                 else if ( $this->skintype == 'search' || $this->skintype == 'index' )\r
2013                 {\r
2014                         $this->searchlink($amount, $startpos, 'prev', $linktext);\r
2015                 }\r
2016                 else\r
2017                 {\r
2018                         $this->archivelink($archiveprev, $linktext);\r
2019                 }\r
2020                 return;\r
2021         }\r
2022         \r
2023         /**\r
2024          * Actions::parse_query()\r
2025          * Parse skinvar query\r
2026          * (includes the search query)   \r
2027          * \r
2028          * @param       void\r
2029          * @return      void\r
2030          */\r
2031         public function parse_query()\r
2032         {\r
2033                 global $query;\r
2034                 echo Entity::hsc($query);\r
2035                 return;\r
2036         }\r
2037         \r
2038         /**\r
2039          * Actions::parse_referer()\r
2040          * Parse skinvar referer\r
2041          * \r
2042          * @param       void\r
2043          * @return      void\r
2044          */\r
2045         public function parse_referer()\r
2046         {\r
2047                 echo Entity::hsc(serverVar('HTTP_REFERER'));\r
2048                 return;\r
2049         }\r
2050         \r
2051         /**\r
2052          * Actions::parse_searchform()\r
2053          * Parse skinvar searchform\r
2054          * \r
2055          * @param       string  $blogname       name of weblog\r
2056          * @return      void\r
2057          */\r
2058         public function parse_searchform($blogname = '')\r
2059         {\r
2060                 global $CONF, $manager, $maxresults;\r
2061                 if ( $blogname )\r
2062                 {\r
2063                         $blog =& $manager->getBlog(getBlogIDFromName($blogname));\r
2064                 }\r
2065                 else\r
2066                 {\r
2067                         global $blog;\r
2068                 }\r
2069                 // use default blog when no blog is selected\r
2070                 $this->formdata = array(\r
2071                         'id'    => $blog?$blog->getID():$CONF['DefaultBlog'],\r
2072                         'query' => Entity::hsc(getVar('query')),\r
2073                 );\r
2074                 $this->doForm('searchform');\r
2075                 return;\r
2076         }\r
2077         \r
2078         /**\r
2079          * Actions::parse_searchresults()\r
2080          * Parse skinvar searchresults\r
2081          * \r
2082          * @param       string  $template       name of tempalte\r
2083          * @param       integer $maxresults     searched items in a display\r
2084          * @return      void;\r
2085          */\r
2086         public function parse_searchresults($template, $maxresults = 50 )\r
2087         {\r
2088                 global $blog, $query, $amount, $startpos;\r
2089                 \r
2090                 $this->setBlogCategory($blog, '');      // need this to select default category\r
2091                 $this->preBlogContent('searchresults',$blog);\r
2092                 $this->amountfound = $blog->search($query, $template, $amount, $maxresults, $startpos);\r
2093                 $this->postBlogContent('searchresults',$blog);\r
2094                 return;\r
2095         }\r
2096         \r
2097         /**\r
2098          * Actions::parse_self()\r
2099          * Parse skinvar self\r
2100          * \r
2101          * @param       void\r
2102          * @return      void\r
2103          */\r
2104         public function parse_self()\r
2105         {\r
2106                 global $CONF;\r
2107                 echo $CONF['Self'];\r
2108                 return;\r
2109         }\r
2110         \r
2111         /**\r
2112          * Actions::parse_sitevar()\r
2113          * Parse skinvar sitevar\r
2114          * (include a sitevar)\r
2115          * \r
2116          * @param       string  $which\r
2117          * @return      void\r
2118          */\r
2119         public function parse_sitevar($which)\r
2120         {\r
2121                 global $CONF;\r
2122                 switch ( $which )\r
2123                 {\r
2124                         case 'url':\r
2125                                 echo $CONF['IndexURL'];\r
2126                                 break;\r
2127                         case 'name':\r
2128                                 echo $CONF['SiteName'];\r
2129                                 break;\r
2130                         case 'admin':\r
2131                                 echo $CONF['AdminEmail'];\r
2132                                 break;\r
2133                         case 'adminurl':\r
2134                                 echo $CONF['AdminURL'];\r
2135                 }\r
2136                 return;\r
2137         }\r
2138         \r
2139         /**\r
2140          * Actions::parse_skinname()\r
2141          * Parse skinname\r
2142          * \r
2143          * @param       void\r
2144          * @return      void\r
2145          */\r
2146         public function parse_skinname()\r
2147         {\r
2148                 echo $this->skin->getName();\r
2149                 return;\r
2150         }\r
2151         \r
2152         /**\r
2153          * Actions::parse_skintype()\r
2154          * Parse skintype (experimental)\r
2155          * \r
2156          * @param       void\r
2157          * @return      void\r
2158          */\r
2159         public function parse_skintype()\r
2160         {\r
2161                 echo $this->skintype;\r
2162                 return;\r
2163         }\r
2164         \r
2165         /**\r
2166          * Actions::parse_ticket()\r
2167          * Parse ticket\r
2168          * \r
2169          * @param       void\r
2170          * @return      void\r
2171          */\r
2172         public function parse_ticket()\r
2173         {\r
2174                 global $manager;\r
2175                 $manager->addTicketHidden();\r
2176                 return;\r
2177         }\r
2178 \r
2179         /**\r
2180          * Actions::parse_todaylink()\r
2181          * Parse skinvar todaylink\r
2182          * A link to the today page (depending on selected blog, etc...)\r
2183          *\r
2184          * @param       string  $linktext       text for link\r
2185          * @return      void\r
2186          */\r
2187         public function parse_todaylink($linktext = '')\r
2188         {\r
2189                 global $blog, $CONF;\r
2190                 if ( $blog )\r
2191                 {\r
2192                         echo $this->link(Link::create_blogid_link($blog->getID(),$this->linkparams), $linktext);\r
2193                 }\r
2194                 else\r
2195                 {\r
2196                         echo $this->link($CONF['SiteUrl'], $linktext);\r
2197                 }\r
2198                 return;\r
2199         }\r
2200         \r
2201         /**\r
2202          * Parse vars\r
2203          * When commentform is not used, to include a hidden field with itemid   \r
2204          * \r
2205          * @param       void\r
2206          * @return      void\r
2207          */\r
2208         public function parse_vars()\r
2209         {\r
2210                 global $itemid;\r
2211                 echo '<input type="hidden" name="itemid" value="'.$itemid.'" />' . "\n";\r
2212                 return;\r
2213         }\r
2214 \r
2215         /**\r
2216          * Actions::parse_version()\r
2217          * Parse skinvar version\r
2218          * (include nucleus versionnumber)       \r
2219          * \r
2220          * @param       void\r
2221          * @return      void\r
2222          */\r
2223         public function parse_version()\r
2224         {\r
2225                 global $nucleus;\r
2226                 echo 'Nucleus CMS ' . $nucleus['version'];\r
2227                 return;\r
2228         }\r
2229         \r
2230         /**\r
2231          * Actions::parse_sticky()\r
2232          * Parse skinvar sticky\r
2233          * \r
2234          * @param       integer $itemnumber     id of item\r
2235          * @param       string  $template       name of template\r
2236          * @return      void\r
2237          */\r
2238         public function parse_sticky($itemnumber = 0, $template = '')\r
2239         {\r
2240                 global $manager;\r
2241                 \r
2242                 $itemnumber = intval($itemnumber);\r
2243                 $itemarray = array($itemnumber);\r
2244                 \r
2245                 $b =& $manager->getBlog(getBlogIDFromItemID($itemnumber));\r
2246                 $this->preBlogContent('sticky',$b);\r
2247                 $this->amountfound = $b->readLogFromList($itemarray, $template);\r
2248                 $this->postBlogContent('sticky',$b);\r
2249                 return;\r
2250         }\r
2251 }