OSDN Git Service

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