OSDN Git Service

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