OSDN Git Service

MARGE:masterブランチのマージ(マージできない分について、データベースハンドラーを書き換え)
[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(DB::getValue($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_commentform()\r
1133          * Parse skinvar commentform\r
1134          * \r
1135          * @param       string  $destinationurl URI for redirection\r
1136          * @return      void\r
1137          */\r
1138         public function parse_commentform($destinationurl = '')\r
1139         {\r
1140                 global $blog, $itemid, $member, $CONF, $manager, $DIR_LIBS, $errormessage;\r
1141                 \r
1142                 // warn when trying to provide a actionurl (used to be a parameter in Nucleus <2.0)\r
1143                 if ( stristr($destinationurl, 'action.php') )\r
1144                 {\r
1145                         $args = func_get_args();\r
1146                         $destinationurl = $args[1];\r
1147                         ActionLog::add(WARNING,_ACTIONURL_NOTLONGER_PARAMATER);\r
1148                 }\r
1149                 \r
1150                 $actionurl = $CONF['ActionURL'];\r
1151                 \r
1152                 // if item is closed, show message and do nothing\r
1153                 $item =& $manager->getItem($itemid,0,0);\r
1154                 if ( $item['closed'] || !$blog->commentsEnabled() )\r
1155                 {\r
1156                         $this->doForm('commentform-closed');\r
1157                         return;\r
1158                 }\r
1159                 \r
1160                 if ( !$blog->isPublic() && !$member->isLoggedIn() )\r
1161                 {\r
1162                         $this->doForm('commentform-closedtopublic');\r
1163                         return;\r
1164                 }\r
1165                 \r
1166                 if ( !$destinationurl )\r
1167                 {\r
1168                         // note: createLink returns an HTML encoded URL\r
1169                         $destinationurl = Link::create_link(\r
1170                                 'item',\r
1171                                 array(\r
1172                                         'itemid' => $itemid,\r
1173                                         'title' => $item['title'],\r
1174                                         'timestamp' => $item['timestamp'],\r
1175                                         'extra' => $this->linkparams\r
1176                                 )\r
1177                         );\r
1178                 }\r
1179                 else\r
1180                 {\r
1181                         // HTML encode URL\r
1182                         $destinationurl = Entity::hsc($destinationurl);\r
1183                 }\r
1184                 \r
1185                 // values to prefill\r
1186                 $user = cookieVar($CONF['CookiePrefix'] .'comment_user');\r
1187                 if ( !$user )\r
1188                 {\r
1189                         $user = postVar('user');\r
1190                 }\r
1191                 \r
1192                 $userid = cookieVar($CONF['CookiePrefix'] .'comment_userid');\r
1193                 if ( !$userid )\r
1194                 {\r
1195                         $userid = postVar('userid');\r
1196                 }\r
1197                 \r
1198                 $email = cookieVar($CONF['CookiePrefix'] .'comment_email');\r
1199                 if (!$email)\r
1200                 {\r
1201                         $email = postVar('email');\r
1202                 }\r
1203                 \r
1204                 $body = postVar('body');\r
1205                 \r
1206                 $this->formdata = array(\r
1207                         'destinationurl' => $destinationurl,    // url is already HTML encoded\r
1208                         'actionurl' => Entity::hsc($actionurl),\r
1209                         'itemid' => $itemid,\r
1210                         'user' => Entity::hsc($user),\r
1211                         'userid' => Entity::hsc($userid),\r
1212                         'email' => Entity::hsc($email),\r
1213                         'body' => Entity::hsc($body),\r
1214                         'membername' => $member->getDisplayName(),\r
1215                         'rememberchecked' => cookieVar($CONF['CookiePrefix'] .'comment_user')?'checked="checked"':''\r
1216                 );\r
1217                 \r
1218                 if ( !$member->isLoggedIn() )\r
1219                 {\r
1220                         $this->doForm('commentform-notloggedin');\r
1221                 }\r
1222                 else\r
1223                 {\r
1224                         $this->doForm('commentform-loggedin');\r
1225                 }\r
1226                 return;\r
1227         }\r
1228         \r
1229         /**\r
1230          * Actions::parse_comments()\r
1231          * Parse skinvar comments\r
1232          * include comments for one item\r
1233          * \r
1234          * @param       string  $template       name of template\r
1235          * @return      void\r
1236          */\r
1237         public function parse_comments($template)\r
1238         {\r
1239                 global $itemid, $manager, $blog, $highlight;\r
1240                 \r
1241                 $template =& $manager->getTemplate($template);\r
1242                 $item = Item::getitem($itemid, 0, 0);\r
1243                 \r
1244                 // create parser object & action handler\r
1245                 $handler = new ItemActions($blog);\r
1246                 $handler->setTemplate($template);\r
1247                 $handler->setCurrentItem($item);\r
1248                 \r
1249                 $parser = new Parser($handler);\r
1250                 \r
1251                 $comments = new Comments($itemid);\r
1252                 $comments->setItemActions($handler);\r
1253                 // shows ALL comments\r
1254                 $comments->showComments($template, -1, 1, $highlight);\r
1255                 return;\r
1256         }\r
1257         \r
1258         /**\r
1259          * Actions::parse_errordiv()\r
1260          * Parse errordiv\r
1261          * \r
1262          * @param       void\r
1263          * @return      void\r
1264          */\r
1265         public function parse_errordiv()\r
1266         {\r
1267                 global $errormessage;\r
1268                 if ( $errormessage )\r
1269                 {\r
1270                         echo '<div class="error">' . Entity::hsc($errormessage) . "</div>\n";\r
1271                 }\r
1272                 return;\r
1273         }\r
1274         \r
1275         /**\r
1276          * Actions::parse_errormessage()\r
1277          * Parse skinvar errormessage\r
1278          * \r
1279          * @param       void\r
1280          * @return      void\r
1281          */\r
1282         public function parse_errormessage()\r
1283         {\r
1284                 global $errormessage;\r
1285                 echo $errormessage;\r
1286                 return;\r
1287         }\r
1288         \r
1289         /**\r
1290          * Actions::parse_formdata()\r
1291          * Parse formdata\r
1292          * \r
1293          * @param       string  $what   key of format data\r
1294          * @return      void\r
1295          */\r
1296         public function parse_formdata($what)\r
1297         {\r
1298                 echo $this->formdata[$what];\r
1299                 return;\r
1300         }\r
1301         \r
1302         /**\r
1303          * Actions::parse_ifcat()\r
1304          * Parse ifcat\r
1305          * \r
1306          * @param       string  $text\r
1307          * @return      void\r
1308          */\r
1309         public function parse_ifcat($text = '')\r
1310         {\r
1311                 if ( $text == '' )\r
1312                 {\r
1313                         // new behaviour\r
1314                         $this->parse_if('category');\r
1315                 }\r
1316                 else\r
1317                 {\r
1318                         // old behaviour\r
1319                         global $catid, $blog;\r
1320                         if ( $blog->isValidCategory($catid) )\r
1321                         {\r
1322                                 echo $text;\r
1323                         }\r
1324                 }\r
1325                 return;\r
1326         }\r
1327         \r
1328         /**\r
1329          * Actions::parse_image()\r
1330          * Parse skinvar image\r
1331          * \r
1332          * @param       string  $what   name of tag\r
1333          * @return      void\r
1334          */\r
1335         public function parse_image($what = 'imgtag')\r
1336         {\r
1337                 global $CONF;\r
1338                 \r
1339                 $imagetext      = Entity::hsc(requestVar('imagetext'));\r
1340                 $imagepopup = requestVar('imagepopup');\r
1341                 $width          = intRequestVar('width');\r
1342                 $height         = intRequestVar('height');\r
1343                 $fullurl        = Entity::hsc($CONF['MediaURL'] . $imagepopup);\r
1344                 \r
1345                 switch ( $what )\r
1346                 {\r
1347                         case 'url':\r
1348                                 echo $fullurl;\r
1349                                 break;\r
1350                         case 'width':\r
1351                                 echo $width;\r
1352                                 break;\r
1353                         case 'height':\r
1354                                 echo $height;\r
1355                                 break;\r
1356                         case 'caption':\r
1357                         case 'text':\r
1358                                 echo $imagetext;\r
1359                                 break;\r
1360                         case 'imgtag':\r
1361                         default:\r
1362                                 echo "<img src=\"$fullurl\" width=\"$width\" height=\"$height\" alt=\"$imagetext\" title=\"$imagetext\" />";\r
1363                                 break;\r
1364                 }\r
1365                 return;\r
1366         }\r
1367         \r
1368         /**\r
1369          * Actions::parse_imagetext()\r
1370          * Parse skinvar imagetext\r
1371          * \r
1372          * @param       void\r
1373          * @return      void\r
1374          */\r
1375         public function parse_imagetext()\r
1376         {\r
1377                 $this->parse_image('imagetext');\r
1378                 return;\r
1379         }\r
1380 \r
1381         /**\r
1382          * Actions::parse_item()\r
1383          * Parse skinvar item\r
1384          * include one item (no comments)\r
1385          * \r
1386          * @param       void\r
1387          * @return      void\r
1388          */\r
1389         public function parse_item($template)\r
1390         {\r
1391                 global $blog, $itemid, $highlight;\r
1392                 \r
1393                 // need this to select default category\r
1394                 $this->setBlogCategory($blog, '');\r
1395                 $this->preBlogContent('item',$blog);\r
1396                 $r = $blog->showOneitem($itemid, $template, $highlight);\r
1397                 if ( $r == 0 )\r
1398                 {\r
1399                         echo _ERROR_NOSUCHITEM;\r
1400                 }\r
1401                 $this->postBlogContent('item',$blog);\r
1402                 return;\r
1403         }\r
1404 \r
1405         /**\r
1406          * Actions::parse_itemid()\r
1407          * Parse skinvar itemid\r
1408          * \r
1409          * @param       void\r
1410          * @return      void\r
1411          */\r
1412         public function parse_itemid()\r
1413         {\r
1414                 global $itemid;\r
1415                 echo $itemid;\r
1416                 return;\r
1417         }\r
1418         \r
1419         /**\r
1420          * Actions::parseitemlink()\r
1421          * Parse skinvar itemlink\r
1422          * \r
1423          * @param       void\r
1424          * @return      void\r
1425          */\r
1426         public function parse_itemlink($linktext = '')\r
1427         {\r
1428                 global $itemid;\r
1429                 $this->itemlink($itemid, $linktext);\r
1430                 return;\r
1431         }\r
1432         \r
1433         /**\r
1434          * Actions::parse_itemtitle()\r
1435          * Parse itemtitle\r
1436          * \r
1437          * @param       void\r
1438          * @return      void\r
1439          */\r
1440         public function parse_itemtitle($format = '')\r
1441         {\r
1442                 global $manager, $itemid;\r
1443                 $item =& $manager->getItem($itemid,0,0);\r
1444                 \r
1445                 switch ( $format )\r
1446                 {\r
1447                         case 'xml':\r
1448                                 echo Entity::hen($item['title']);\r
1449                                 break;\r
1450                         case 'raw':\r
1451                                 echo $item['title'];\r
1452                                 break;\r
1453                         case 'attribute':\r
1454                         default:\r
1455                                 echo Entity::hsc(strip_tags($item['title']));\r
1456                                 break;\r
1457                 }\r
1458                 return;\r
1459         }\r
1460         \r
1461         /**\r
1462          * Actions::parse_loginform()\r
1463          * Parse skinvar loginform\r
1464          * \r
1465          * @param       void\r
1466          * @return      void\r
1467          */\r
1468         public function parse_loginform()\r
1469         {\r
1470                 global $member, $CONF;\r
1471                 if ( !$member->isLoggedIn() )\r
1472                 {\r
1473                         $filename = 'loginform-notloggedin';\r
1474                         $this->formdata = array();\r
1475                 }\r
1476                 else\r
1477                 {\r
1478                         $filename = 'loginform-loggedin';\r
1479                         $this->formdata = array(\r
1480                                 'membername' => $member->getDisplayName(),\r
1481                         );\r
1482                 }\r
1483                 $this->doForm($filename);\r
1484                 return;\r
1485         }\r
1486         \r
1487         /**\r
1488          * Actions::parse_member()\r
1489          * Parse skinvar member\r
1490          * (includes a member info thingie)\r
1491          * \r
1492          * @param       string  $what   which memberdata is needed\r
1493          * @return      void\r
1494          */\r
1495         public function parse_member($what)\r
1496         {\r
1497                 global $memberinfo, $member, $CONF;\r
1498                 \r
1499                 // 1. only allow the member-details-page specific variables on member pages\r
1500                 if ( $this->skintype == 'member' )\r
1501                 {\r
1502                         switch( $what )\r
1503                         {\r
1504                                 case 'name':\r
1505                                         echo Entity::hsc($memberinfo->getDisplayName());\r
1506                                         break;\r
1507                                 case 'realname':\r
1508                                         echo Entity::hsc($memberinfo->getRealName());\r
1509                                         break;\r
1510                                 case 'notes':\r
1511                                         echo Entity::hsc($memberinfo->getNotes());\r
1512                                         break;\r
1513                                 case 'url':\r
1514                                         echo Entity::hsc($memberinfo->getURL());\r
1515                                         break;\r
1516                                 case 'email':\r
1517                                         echo Entity::hsc($memberinfo->getEmail());\r
1518                                         break;\r
1519                                 case 'id':\r
1520                                         echo Entity::hsc($memberinfo->getID());\r
1521                                         break;\r
1522                         }\r
1523                 }\r
1524                 \r
1525                 // 2. the next bunch of options is available everywhere, as long as the user is logged in\r
1526                 if ( $member->isLoggedIn() )\r
1527                 {\r
1528                         switch( $what )\r
1529                         {\r
1530                                 case 'yourname':\r
1531                                         echo $member->getDisplayName();\r
1532                                         break;\r
1533                                 case 'yourrealname':\r
1534                                         echo $member->getRealName();\r
1535                                         break;\r
1536                                 case 'yournotes':\r
1537                                         echo $member->getNotes();\r
1538                                         break;\r
1539                                 case 'yoururl':\r
1540                                         echo $member->getURL();\r
1541                                         break;\r
1542                                 case 'youremail':\r
1543                                         echo $member->getEmail();\r
1544                                         break;\r
1545                                 case 'yourid':\r
1546                                         echo $member->getID();\r
1547                                         break;\r
1548                                 case 'yourprofileurl':\r
1549                                         if ($CONF['URLMode'] == 'pathinfo')\r
1550                                                 echo Link::create_member_link($member->getID());\r
1551                                         else\r
1552                                                 echo $CONF['IndexURL'] . Link::create_member_link($member->getID());\r
1553                                         break;\r
1554                         }\r
1555                 }\r
1556                 return;\r
1557         }\r
1558         \r
1559         /**\r
1560          * Link::parse_membermailform()\r
1561          * Parse skinvar membermailform\r
1562          * \r
1563          * @param       integer $rows   the height for textarea\r
1564          * @param       integer $cols   the width for textarea\r
1565          * @param       string  $desturl        URI to redirect\r
1566          * @return      void\r
1567          */\r
1568         public function parse_membermailform($rows = 10, $cols = 40, $desturl = '')\r
1569         {\r
1570                 global $member, $CONF, $memberid;\r
1571                 \r
1572                 if ( $desturl == '' )\r
1573                 {\r
1574                         if ( $CONF['URLMode'] == 'pathinfo' )\r
1575                         {\r
1576                                 $desturl = Link::create_member_link($memberid);\r
1577                         }\r
1578                         else\r
1579                         {\r
1580                                 $desturl = $CONF['IndexURL'] . Link::create_member_link($memberid);\r
1581                         }\r
1582                 }\r
1583                 \r
1584                 $message = postVar('message');\r
1585                 $frommail = postVar('frommail');\r
1586                 \r
1587                 $this->formdata = array(\r
1588                         'url' => Entity::hsc($desturl),\r
1589                         'actionurl' => Entity::hsc($CONF['ActionURL']),\r
1590                         'memberid' => $memberid,\r
1591                         'rows' => $rows,\r
1592                         'cols' => $cols,\r
1593                         'message' => Entity::hsc($message),\r
1594                         'frommail' => Entity::hsc($frommail)\r
1595                 );\r
1596                 \r
1597                 if ( $member->isLoggedIn() )\r
1598                 {\r
1599                         $this->doForm('membermailform-loggedin');\r
1600                 }\r
1601                 else if ( $CONF['NonmemberMail'] )\r
1602                 {\r
1603                         $this->doForm('membermailform-notloggedin');\r
1604                 }\r
1605                 else\r
1606                 {\r
1607                         $this->doForm('membermailform-disallowed');\r
1608                 }\r
1609                 return;\r
1610         }\r
1611         \r
1612         /**\r
1613          * Actions::parse_nextarchive()\r
1614          * Parse skinvar nextarchive\r
1615          * \r
1616          * @param       void\r
1617          * @return      void\r
1618          */\r
1619         public function parse_nextarchive()\r
1620         {\r
1621                 global $archivenext;\r
1622                 echo $archivenext;\r
1623                 return;\r
1624         }\r
1625         \r
1626         /**\r
1627          * Parse skinvar nextitem\r
1628          * (include itemid of next item)\r
1629          * \r
1630          * @param       void\r
1631          * @return      void\r
1632          */\r
1633         public function parse_nextitem()\r
1634         {\r
1635                 global $itemidnext;\r
1636                 if ( isset($itemidnext) )\r
1637                 {\r
1638                         echo (int)$itemidnext;\r
1639                 }\r
1640                 return;\r
1641         }\r
1642         \r
1643         /**\r
1644          * Actions::parse_nextitemtitle()\r
1645          * Parse skinvar nextitemtitle\r
1646          * (include itemtitle of next item)\r
1647          * \r
1648          * @param       string  $format format of text\r
1649          * @return      void\r
1650          */\r
1651         public function parse_nextitemtitle($format = '')\r
1652         {\r
1653                 global $itemtitlenext;\r
1654                 \r
1655                 switch ( $format )\r
1656                 {\r
1657                         case 'xml':\r
1658                                 echo Entity::hen($itemtitlenext);\r
1659                                 break;\r
1660                         case 'raw':\r
1661                                 echo $itemtitlenext;\r
1662                                 break;\r
1663                         case 'attribute':\r
1664                         default:\r
1665                                 echo Entity::hsc($itemtitlenext);\r
1666                                 break;\r
1667                 }\r
1668                 return;\r
1669         }\r
1670         \r
1671         /**\r
1672          * Actions::parse_nextlink()\r
1673          * Parse skinvar nextlink\r
1674          * \r
1675          * @param       string  $linktext       text for content of anchor element\r
1676          * @param       integer $amount         the amount of items in a display\r
1677          * @param       integer $recount        increment from this value\r
1678          * @return      void\r
1679          */\r
1680         public function parse_nextlink($linktext = '', $amount = 10, $recount = '')\r
1681         {\r
1682                 global $itemidnext, $archivenext, $startpos;\r
1683                 if ( $this->skintype == 'item' )\r
1684                 {\r
1685                         $this->itemlink($itemidnext, $linktext);\r
1686                 }\r
1687                 else if ( $this->skintype == 'search' || $this->skintype == 'index' )\r
1688                 {\r
1689                         $this->searchlink($amount, $startpos, 'next', $linktext, $recount);\r
1690                 }\r
1691                 else\r
1692                 {\r
1693                         $this->archivelink($archivenext, $linktext);\r
1694                 }\r
1695                 return;\r
1696         }\r
1697 \r
1698         /**\r
1699          * Actions::parse_nucleusbutton()\r
1700          * Parse skinvar nucleusbutton\r
1701          * \r
1702          * @param       string  $imgurl URL  for image\r
1703          * @param       integer $imgwidth       width of image\r
1704          * @param       integer $imgheidht      height of image\r
1705          */\r
1706         public function parse_nucleusbutton($imgurl = '', $imgwidth = '85', $imgheight = '31')\r
1707         {\r
1708                 global $CONF;\r
1709                 if ( $imgurl == '' )\r
1710                 {\r
1711                         $imgurl = $CONF['AdminURL'] . 'nucleus.gif';\r
1712                 }\r
1713                 else if ( Parser::getProperty('IncludeMode') == 'skindir' )\r
1714                 {\r
1715                         // when skindit IncludeMode is used: start from skindir\r
1716                         $imgurl = $CONF['SkinsURL'] . Parser::getProperty('IncludePrefix') . $imgurl;\r
1717                 }\r
1718                 \r
1719                 $this->formdata = array(\r
1720                         'imgurl' => $imgurl,\r
1721                         'imgwidth' => $imgwidth,\r
1722                         'imgheight' => $imgheight,\r
1723                 );\r
1724                 $this->doForm('nucleusbutton');\r
1725                 return;\r
1726         }\r
1727         \r
1728         /**\r
1729          * Actions::parse_otherarchive()\r
1730          * Parse skinvar otherarchive\r
1731          * \r
1732          * @param       string  $blogname       name of weblog\r
1733          * @param       string  $template       name of template\r
1734          * @param       string  $category       name of category\r
1735          * @return      void\r
1736          */     \r
1737         public function parse_otherarchive($blogname, $template, $category = '')\r
1738         {\r
1739                 global $archive, $manager;\r
1740                 sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
1741                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1742                 $this->setBlogCategory($b, $category);\r
1743                 $this->preBlogContent('otherachive',$b);\r
1744                 $b->showArchive($template, $y, $m, $d);\r
1745                 $this->postBlogContent('otherachive',$b);\r
1746                 return;\r
1747         }\r
1748         \r
1749         /**\r
1750          * Actions::parse_otherarchivedaylist()\r
1751          * Parse skinvar otherarchivedaylist\r
1752          * \r
1753          * @param       string  $blogname       name of weblog\r
1754          * @param       string  $template       name of template\r
1755          * @param       string  $category       name of category\r
1756          * @param       integer $limit          the amount of items in a display\r
1757          * @return      void\r
1758          */\r
1759         public function parse_otherarchivedaylist($blogname, $template, $category = 'all', $limit = 0)\r
1760         {\r
1761                 global $manager;\r
1762                 if ( $category == 'all')\r
1763                 {\r
1764                         $category = '';\r
1765                 }\r
1766                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1767                 $this->setBlogCategory($b, $category);\r
1768                 $this->preBlogContent('otherarchivelist',$b);\r
1769                 $b->showArchiveList($template, 'day', $limit);\r
1770                 $this->postBlogContent('otherarchivelist',$b);\r
1771                 return;\r
1772         }\r
1773         \r
1774         /**\r
1775          * Actions::parse_otherarchivelist()\r
1776          * Parse skinvar otherarchivelist\r
1777          * \r
1778          * @param       string  $blogname       name of weblog\r
1779          * @param       string  $template       name of template\r
1780          * @param       string  $category       name of category\r
1781          * @param       integer $limit          the amount of items in a display\r
1782          * @return      void\r
1783          */\r
1784         public function parse_otherarchivelist($blogname, $template, $category = 'all', $limit = 0)\r
1785         {\r
1786                 global $manager;\r
1787                 if ( $category == 'all' )\r
1788                 {\r
1789                         $category = '';\r
1790                 }\r
1791                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1792                 $this->setBlogCategory($b, $category);\r
1793                 $this->preBlogContent('otherarchivelist',$b);\r
1794                 $b->showArchiveList($template, 'month', $limit);\r
1795                 $this->postBlogContent('otherarchivelist',$b);\r
1796                 return;\r
1797         }\r
1798         \r
1799         /**\r
1800          * Actions::parse_otherarchiveyearlist()\r
1801          * Parse skinvar otherarchiveyearlist\r
1802          * \r
1803          * @param       string  $blogname       name of weblog\r
1804          * @param       string  $template       name of template\r
1805          * @param       string  $category       name of category\r
1806          * @limit       integer $limit          the amount of items in a display\r
1807          */\r
1808         public function parse_otherarchiveyearlist($blogname, $template, $category = 'all', $limit = 0)\r
1809         {\r
1810                 global $manager;\r
1811                 if ( $category == 'all' )\r
1812                 {\r
1813                         $category = '';\r
1814                 }\r
1815                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1816                 $this->setBlogCategory($b, $category);\r
1817                 $this->preBlogContent('otherarchivelist',$b);\r
1818                 $b->showArchiveList($template, 'year', $limit);\r
1819                 $this->postBlogContent('otherarchivelist',$b);\r
1820                 return;\r
1821         }\r
1822         \r
1823         /**\r
1824          * Actions::parse_otherblog()\r
1825          * Parse skinvar otherblog\r
1826          * \r
1827          * @param       string  $blogname       name of weblog\r
1828          * @param       string  $template       name of template\r
1829          * @param       mixed   $amount         the amount of items, in case it includes the beginning\r
1830          * @param       string  $category       name of category\r
1831          * @return      void\r
1832          */\r
1833         public function parse_otherblog($blogname, $template, $amount = 10, $category = '')\r
1834         {\r
1835                 global $manager;\r
1836                 \r
1837                 list($limit, $offset) = sscanf($amount, '%d(%d)');\r
1838                 \r
1839                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1840                 $this->setBlogCategory($b, $category);\r
1841                 $this->preBlogContent('otherblog',$b);\r
1842                 $this->amountfound = $b->readLog($template, $limit, $offset);\r
1843                 $this->postBlogContent('otherblog',$b);\r
1844                 return;\r
1845         }\r
1846         \r
1847         /**\r
1848          * Actions::parse_othersearchresults()\r
1849          * Parse skinvar othersearchresults\r
1850          * \r
1851          * @param       string  $blogname       name of weblog\r
1852          * @param       string  $template       name of template\r
1853          * @param       integer $maxresults     the amount of results\r
1854          * @return      void\r
1855          */\r
1856         public function parse_othersearchresults($blogname, $template, $maxresults = 50)\r
1857         {\r
1858                 global $query, $amount, $manager, $startpos;\r
1859                 $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
1860                 // need this to select default category\r
1861                 $this->setBlogCategory($b, '');\r
1862                 $this->preBlogContent('othersearchresults',$b);\r
1863                 $b->search($query, $template, $amount, $maxresults, $startpos);\r
1864                 $this->postBlogContent('othersearchresults',$b);\r
1865                 return;\r
1866         }\r
1867         \r
1868         /**\r
1869          * Actions::parse_plugin()\r
1870          * Executes a plugin skinvar\r
1871          * extra parameters can be added\r
1872          * \r
1873          * @param       string  $pluginName     name of plugin (without the NP_)\r
1874          * @return      void\r
1875          */\r
1876         public function parse_plugin($pluginName)\r
1877         {\r
1878                 global $manager;\r
1879                 \r
1880                 $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
1881                 if ( !$plugin )\r
1882                 {\r
1883                         return;\r
1884                 }\r
1885                 \r
1886                 // get arguments\r
1887                 $params = func_get_args();\r
1888                 \r
1889                 // remove plugin name\r
1890                 array_shift($params);\r
1891                 \r
1892                 // add skin type on front\r
1893                 array_unshift($params, $this->skintype);\r
1894                 \r
1895                 call_user_func_array(array(&$plugin,'doSkinVar'), $params);\r
1896                 return;\r
1897         }\r
1898         \r
1899         /**\r
1900          * Actions::parse_prevarchive()\r
1901          * Parse skinvar prevarchive\r
1902          * \r
1903          * @param       void\r
1904          * @return      void\r
1905          */\r
1906         public function parse_prevarchive()\r
1907         {\r
1908                 global $archiveprev;\r
1909                 echo $archiveprev;\r
1910         }\r
1911         \r
1912         /**\r
1913          * Actions::parse_preview()\r
1914          * Parse skinvar preview\r
1915          * \r
1916          * @param       string  $template       name of tempalte\r
1917          * @return      void\r
1918          */\r
1919         public function parse_preview($template)\r
1920         {\r
1921                 global $blog, $CONF, $manager;\r
1922                 \r
1923                 $template =& $manager->getTemplate($template);\r
1924                 \r
1925                 $row['body'] = '<span id="prevbody"></span>';\r
1926                 $row['title'] = '<span id="prevtitle"></span>';\r
1927                 $row['more'] = '<span id="prevmore"></span>';\r
1928                 $row['itemlink'] = '';\r
1929                 $row['itemid'] = 0; $row['blogid'] = $blog->getID();\r
1930                 \r
1931                 echo Template::fill($template['ITEM_HEADER'],$row);\r
1932                 echo Template::fill($template['ITEM'],$row);\r
1933                 echo Template::fill($template['ITEM_FOOTER'],$row);\r
1934                 return;\r
1935         }\r
1936         \r
1937         /**\r
1938          * Actions::parse_previtem()\r
1939          * Parse skinvar previtem\r
1940          * (include itemid of prev item)\r
1941          * \r
1942          * @param       void\r
1943          * @return      void\r
1944          */\r
1945         public function parse_previtem()\r
1946         {\r
1947                 global $itemidprev;\r
1948                 if ( isset($itemidprev) )\r
1949                 {\r
1950                         echo (integer) $itemidprev;\r
1951                 }\r
1952                 return;\r
1953         }\r
1954         \r
1955         /**\r
1956          * Actions::parse_previtemtitle()\r
1957          * Parse skinvar previtemtitle\r
1958          * (include itemtitle of prev item)\r
1959          * \r
1960          * @param       String  $format string format\r
1961          * @return      String  formatted string\r
1962          */\r
1963         public function parse_previtemtitle($format = '')\r
1964         {\r
1965                 global $itemtitleprev;\r
1966                 \r
1967                 switch ( $format )\r
1968                 {\r
1969                         case 'xml':\r
1970                                 echo Entity::hen($itemtitleprev);\r
1971                                 break;\r
1972                         case 'raw':\r
1973                                 echo $itemtitleprev;\r
1974                                 break;\r
1975                         case 'attribute':\r
1976                         default:\r
1977                                 echo Entity::hsc($itemtitleprev);\r
1978                                 break;\r
1979                 }\r
1980                 return;\r
1981         }\r
1982         \r
1983         /**\r
1984          * Actions::parse_prevlink()\r
1985          * Parse skinvar prevlink\r
1986          * \r
1987          * @param       string  $linktext       text as a content of anchor element\r
1988          * @param       integer the amount of links\r
1989          * @return      void\r
1990          */\r
1991         public function parse_prevlink($linktext = '', $amount = 10)\r
1992         {\r
1993                 global $itemidprev, $archiveprev, $startpos;\r
1994                 \r
1995                 if ( $this->skintype == 'item' )\r
1996                 {\r
1997                         $this->itemlink($itemidprev, $linktext);\r
1998                 }\r
1999                 else if ( $this->skintype == 'search' || $this->skintype == 'index' )\r
2000                 {\r
2001                         $this->searchlink($amount, $startpos, 'prev', $linktext);\r
2002                 }\r
2003                 else\r
2004                 {\r
2005                         $this->archivelink($archiveprev, $linktext);\r
2006                 }\r
2007                 return;\r
2008         }\r
2009         \r
2010         /**\r
2011          * Actions::parse_query()\r
2012          * Parse skinvar query\r
2013          * (includes the search query)   \r
2014          * \r
2015          * @param       void\r
2016          * @return      void\r
2017          */\r
2018         public function parse_query()\r
2019         {\r
2020                 global $query;\r
2021                 echo Entity::hsc($query);\r
2022                 return;\r
2023         }\r
2024         \r
2025         /**\r
2026          * Actions::parse_referer()\r
2027          * Parse skinvar referer\r
2028          * \r
2029          * @param       void\r
2030          * @return      void\r
2031          */\r
2032         public function parse_referer()\r
2033         {\r
2034                 echo Entity::hsc(serverVar('HTTP_REFERER'));\r
2035                 return;\r
2036         }\r
2037         \r
2038         /**\r
2039          * Actions::parse_searchform()\r
2040          * Parse skinvar searchform\r
2041          * \r
2042          * @param       string  $blogname       name of weblog\r
2043          * @return      void\r
2044          */\r
2045         public function parse_searchform($blogname = '')\r
2046         {\r
2047                 global $CONF, $manager, $maxresults;\r
2048                 if ( $blogname )\r
2049                 {\r
2050                         $blog =& $manager->getBlog(getBlogIDFromName($blogname));\r
2051                 }\r
2052                 else\r
2053                 {\r
2054                         global $blog;\r
2055                 }\r
2056                 // use default blog when no blog is selected\r
2057                 $this->formdata = array(\r
2058                         'id'    => $blog?$blog->getID():$CONF['DefaultBlog'],\r
2059                         'query' => Entity::hsc(getVar('query')),\r
2060                 );\r
2061                 $this->doForm('searchform');\r
2062                 return;\r
2063         }\r
2064         \r
2065         /**\r
2066          * Actions::parse_searchresults()\r
2067          * Parse skinvar searchresults\r
2068          * \r
2069          * @param       string  $template       name of tempalte\r
2070          * @param       integer $maxresults     searched items in a display\r
2071          * @return      void;\r
2072          */\r
2073         public function parse_searchresults($template, $maxresults = 50 )\r
2074         {\r
2075                 global $blog, $query, $amount, $startpos;\r
2076                 \r
2077                 $this->setBlogCategory($blog, '');      // need this to select default category\r
2078                 $this->preBlogContent('searchresults',$blog);\r
2079                 $this->amountfound = $blog->search($query, $template, $amount, $maxresults, $startpos);\r
2080                 $this->postBlogContent('searchresults',$blog);\r
2081                 return;\r
2082         }\r
2083         \r
2084         /**\r
2085          * Actions::parse_self()\r
2086          * Parse skinvar self\r
2087          * \r
2088          * @param       void\r
2089          * @return      void\r
2090          */\r
2091         public function parse_self()\r
2092         {\r
2093                 global $CONF;\r
2094                 echo $CONF['Self'];\r
2095                 return;\r
2096         }\r
2097         \r
2098         /**\r
2099          * Actions::parse_sitevar()\r
2100          * Parse skinvar sitevar\r
2101          * (include a sitevar)\r
2102          * \r
2103          * @param       string  $which\r
2104          * @return      void\r
2105          */\r
2106         public function parse_sitevar($which)\r
2107         {\r
2108                 global $CONF;\r
2109                 switch ( $which )\r
2110                 {\r
2111                         case 'url':\r
2112                                 echo $CONF['IndexURL'];\r
2113                                 break;\r
2114                         case 'name':\r
2115                                 echo $CONF['SiteName'];\r
2116                                 break;\r
2117                         case 'admin':\r
2118                                 echo $CONF['AdminEmail'];\r
2119                                 break;\r
2120                         case 'adminurl':\r
2121                                 echo $CONF['AdminURL'];\r
2122                 }\r
2123                 return;\r
2124         }\r
2125         \r
2126         /**\r
2127          * Actions::parse_skinname()\r
2128          * Parse skinname\r
2129          * \r
2130          * @param       void\r
2131          * @return      void\r
2132          */\r
2133         public function parse_skinname()\r
2134         {\r
2135                 echo $this->skin->getName();\r
2136                 return;\r
2137         }\r
2138         \r
2139         /**\r
2140          * Actions::parse_skintype()\r
2141          * Parse skintype (experimental)\r
2142          * \r
2143          * @param       void\r
2144          * @return      void\r
2145          */\r
2146         public function parse_skintype()\r
2147         {\r
2148                 echo $this->skintype;\r
2149                 return;\r
2150         }\r
2151         \r
2152         /**\r
2153          * Actions::parse_ticket()\r
2154          * Parse ticket\r
2155          * \r
2156          * @param       void\r
2157          * @return      void\r
2158          */\r
2159         public function parse_ticket()\r
2160         {\r
2161                 global $manager;\r
2162                 $manager->addTicketHidden();\r
2163                 return;\r
2164         }\r
2165 \r
2166         /**\r
2167          * Actions::parse_todaylink()\r
2168          * Parse skinvar todaylink\r
2169          * A link to the today page (depending on selected blog, etc...)\r
2170          *\r
2171          * @param       string  $linktext       text for link\r
2172          * @return      void\r
2173          */\r
2174         public function parse_todaylink($linktext = '')\r
2175         {\r
2176                 global $blog, $CONF;\r
2177                 if ( $blog )\r
2178                 {\r
2179                         echo $this->link(Link::create_blogid_link($blog->getID(),$this->linkparams), $linktext);\r
2180                 }\r
2181                 else\r
2182                 {\r
2183                         echo $this->link($CONF['SiteUrl'], $linktext);\r
2184                 }\r
2185                 return;\r
2186         }\r
2187         \r
2188         /**\r
2189          * Parse vars\r
2190          * When commentform is not used, to include a hidden field with itemid   \r
2191          * \r
2192          * @param       void\r
2193          * @return      void\r
2194          */\r
2195         public function parse_vars()\r
2196         {\r
2197                 global $itemid;\r
2198                 echo '<input type="hidden" name="itemid" value="'.$itemid.'" />' . "\n";\r
2199                 return;\r
2200         }\r
2201 \r
2202         /**\r
2203          * Actions::parse_version()\r
2204          * Parse skinvar version\r
2205          * (include nucleus versionnumber)       \r
2206          * \r
2207          * @param       void\r
2208          * @return      void\r
2209          */\r
2210         public function parse_version()\r
2211         {\r
2212                 global $nucleus;\r
2213                 echo 'Nucleus CMS ' . $nucleus['version'];\r
2214                 return;\r
2215         }\r
2216         \r
2217         /**\r
2218          * Actions::parse_sticky()\r
2219          * Parse skinvar sticky\r
2220          * \r
2221          * @param       integer $itemnumber     id of item\r
2222          * @param       string  $template       name of template\r
2223          * @return      void\r
2224          */\r
2225         public function parse_sticky($itemnumber = 0, $template = '')\r
2226         {\r
2227                 global $manager;\r
2228                 \r
2229                 $itemnumber = intval($itemnumber);\r
2230                 $itemarray = array($itemnumber);\r
2231                 \r
2232                 $b =& $manager->getBlog(getBlogIDFromItemID($itemnumber));\r
2233                 $this->preBlogContent('sticky',$b);\r
2234                 $this->amountfound = $b->readLogFromList($itemarray, $template);\r
2235                 $this->postBlogContent('sticky',$b);\r
2236                 return;\r
2237         }\r
2238 }