OSDN Git Service

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