* This class contains the functions that get called by using\r
* the special tags in the skins\r
*\r
- * The allowed tags for a type of skinpart are defined by the\r
- * Skin::getAllowedActionsForType($type) method\r
- *\r
* @license http://nucleuscms.org/license.txt GNU General Public License\r
* @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: ACTIONS.php 1757 2012-04-15 09:02:32Z sakamocchi $\r
+ * @version $Id: ACTIONS.php 1863 2012-05-19 10:50:27Z sakamocchi $
*/\r
\r
class Actions extends BaseActions\r
// generating links to items/archives/... (e.g. catid)\r
private $linkparams;\r
\r
- // reference to the skin object for which a part is being parsed\r
- private $skin;\r
- \r
// used when including templated forms from the include/ dir. The $formdata var\r
// contains the values to fill out in there (assoc array name -> value)\r
private $formdata;\r
'archivelink',\r
'bloglist',\r
'category',\r
- 'charset',\r
'loginform',\r
'member',\r
'nucleusbutton',\r
);\r
\r
/**\r
- * Actions::$skin_type_friendly_names\r
+ * Actions::$normal_skin_types\r
* friendly name for wrapped page types\r
*/\r
- static public $skin_type_friendly_names = array(\r
+ static public $normal_skin_types = array(\r
'index' => _SKIN_PART_MAIN,\r
'item' => _SKIN_PART_ITEM,\r
'archivelist' => _SKIN_PART_ALIST,\r
);\r
\r
/**\r
- * Actions::getDefinedActions()\r
+ * Actions::getNormalSkinTypes()\r
* \r
* @static\r
- * @param string $type page type\r
+ * @param void\r
+ * @return array list of friendly names for page actions\r
+ */\r
+ static public function getNormalSkinTypes()\r
+ {\r
+ return self::$normal_skin_types;\r
+ }\r
+ \r
+ /**\r
+ * Actions::__construct()\r
+ * Constructor for a new Actions object\r
+ * \r
+ * @param string $type\r
+ * @return void\r
+ */\r
+ public function __construct($type)\r
+ {\r
+ global $catid;\r
+ \r
+ // call constructor of superclass first\r
+ parent::__construct();\r
+ $this->skintype = $type;\r
+ \r
+ if ( $catid )\r
+ {\r
+ $this->linkparams = array('catid' => $catid);\r
+ }\r
+ return;\r
+ }\r
+ \r
+ /**\r
+ * Actions::getAvailableActions()\r
+ * \r
+ * @param void\r
* @return array allowed actions for the page type\r
*/\r
- static public function getDefinedActions($type='')\r
+ public function getAvailableActions()\r
{\r
$extra_actions = array();\r
\r
- switch ( $type )\r
+ switch ( $this->skintype )\r
{\r
case 'index':\r
$extra_actions = array(\r
);\r
break;\r
}\r
-
- $defined_actions = array_merge(self::$default_actions, $extra_actions);
-
- return array_merge($defined_actions, parent::getDefinedActions());
- }\r
- \r
- /**\r
- * Actions::getSkinTypeFriendlyNames()\r
- * \r
- * @static\r
- * @param void\r
- * @return array list of friendly names for page actions\r
- */\r
- static public function getSkinTypeFriendlyNames()\r
- {\r
- return self::$skin_type_friendly_names;\r
- }\r
- \r
- /**\r
- * Actions::__construct()\r
- * Constructor for a new Actions object\r
- * \r
- * @param string $type\r
- * @return void\r
- */\r
- public function __construct($type)\r
- {\r
- global $catid;\r
\r
- // call constructor of superclass first\r
- parent::__construct();
-
- $this->skintype = $type;\r
+ $defined_actions = array_merge(self::$default_actions, $extra_actions);\r
\r
- if ( $catid )\r
- {\r
- $this->linkparams = array('catid' => $catid);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::setSkin()\r
- * Set the skin\r
- * @param object $skin an instance of Skin class\r
- * @return void\r
- */\r
- public function setSkin(&$skin)\r
- {\r
- $this->skin =& $skin;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::setParser()\r
- * Set the parser\r
- * \r
- * @param object $parser an instance of Parser class\r
- * @return void\r
- */\r
- public function setParser(&$parser)\r
- {\r
- $this->parser =& $parser;\r
- return;\r
+ return array_merge($defined_actions, parent::getAvailableActions());\r
}\r
\r
/**\r
public function doForm($filename)\r
{\r
global $DIR_NUCLEUS;\r
- array_push($this->parser->actions,'formdata','text','callback','errordiv','ticket');\r
+ array_push($this->parser->actions,'formdata', 'callback','errordiv','ticket');\r
\r
$oldIncludeMode = Parser::getProperty('IncludeMode');\r
$oldIncludePrefix = Parser::getProperty('IncludePrefix');\r
\r
array_pop($this->parser->actions); // errordiv\r
array_pop($this->parser->actions); // callback\r
- array_pop($this->parser->actions); // text\r
array_pop($this->parser->actions); // formdata\r
array_pop($this->parser->actions); // ticket\r
return;\r
}\r
\r
// check category name\r
- if ( $name == 'catname' )\r
+ else if ( $name == 'catname' )
{\r
$value = $blog->getCategoryIdFromName($value);\r
if ( $value == $catid )\r
}\r
\r
// check category id\r
- if ( ($name == 'catid') && ($value == $catid) )\r
+ else if ( ($name == 'catid') && ($value == $catid) )
{\r
return $blog->isValidCategory($catid);\r
}\r
// TODO: Move request uri to linkparams. this is ugly. sorry for that.\r
$startpos = (integer) $startpos;\r
$parsed = parse_url(serverVar('REQUEST_URI'));\r
- $path = $parsed['path'];\r
- $parsed = $parsed['query'];\r
+ $path = ( in_array('path', $parsed) ) ? $parsed['path'] : '';\r
+ $parsed = ( in_array('query', $parsed) ) ? $parsed['query'] : '';\r
$url = '';\r
\r
if ( $direction == 'prev' )\r
{\r
$url = $CONF['SearchURL'];\r
}\r
- $url .= '?' . alterQueryStr($parsed,'startpos',$startpos);\r
+ $url .= '?' . alterQueryStr($parsed, 'startpos', $startpos);\r
}\r
}\r
else if ( $direction == 'next' )\r
}\r
if ( $sqlquery )\r
{\r
- $iAmountOnPage = intval(quickQuery($sqlquery)) - intval($startpos);\r
+ $iAmountOnPage = intval(DB::getValue($sqlquery)) - intval($startpos);\r
}\r
}\r
\r
}\r
\r
/**\r
- * Actions::parse_charset()\r
- * Parse skinvar charset\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_charset()\r
- {\r
- echo i18n::get_current_charset();\r
- return;\r
- }\r
- \r
- /**\r
* Actions::parse_commentform()\r
* Parse skinvar commentform\r
* \r
*/\r
public function parse_comments($template)\r
{\r
- global $itemid, $manager, $blog, $highlight;\r
+ global $manager, $blog, $highlight, $itemid;\r
+ \r
$template =& $manager->getTemplate($template);\r
+ $item =& $manager->getitem($itemid, 0, 0);\r
\r
// create parser object & action handler\r
- $actions = new ItemActions($blog);\r
- $parser = new Parser($actions->getDefinedActions(),$actions);\r
- $actions->setTemplate($template);\r
- $actions->setParser($parser);\r
- $item = Item::getitem($itemid, 0, 0);\r
- $actions->setCurrentItem($item);\r
+ $handler = new ItemActions($blog);\r
+ $handler->setTemplate($template);\r
+ $handler->setCurrentItem($item);\r
+ \r
+ $parser = new Parser($handler);\r
\r
$comments = new Comments($itemid);\r
- $comments->setItemActions($actions);\r
+ $comments->setItemActions($handler);\r
// shows ALL comments\r
$comments->showComments($template, -1, 1, $highlight);\r
return;\r
public function parse_itemtitle($format = '')\r
{\r
global $manager, $itemid;\r
- $item =& $manager->getItem($itemid,0,0);\r
+ $item =& $manager->getItem($itemid, 1, 1);\r
\r
switch ( $format )\r
{\r
*/\r
public function parse_skinname()\r
{\r
- echo $this->skin->getName();\r
+ echo $this->parser->skin->getName();\r
return;\r
}\r
\r
}\r
\r
/**\r
- * Actions::parse_text()\r
- * Parse text\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_text($which)\r
- {\r
- // constant($which) only available from 4.0.4 :(\r
- if ( defined($which) )\r
- {\r
- eval("echo $which;");\r
- }\r
- return;\r
- }\r
- \r
- /**\r
* Actions::parse_ticket()\r
* Parse ticket\r
* \r
* @param string $template name of template\r
* @return void\r
*/\r
- public function parse_sticky($itemnumber = 0, $template = '')\r
+ public function parse_sticky($itemid = 0, $template = '')\r
{\r
global $manager;\r
\r
- $itemnumber = intval($itemnumber);\r
- $itemarray = array($itemnumber);\r
+ $itemid = (integer) $itemid;\r
+ $itemarray = array($itemid);\r
+ \r
+ $item =& $manager->getItem($post['itemid'], 1, 1);\r
+ $blog =& $manager->getBlog($item['blogid']);\r
\r
- $b =& $manager->getBlog(getBlogIDFromItemID($itemnumber));\r
- $this->preBlogContent('sticky',$b);\r
- $this->amountfound = $b->readLogFromList($itemarray, $template);\r
- $this->postBlogContent('sticky',$b);\r
+ $this->preBlogContent('sticky', $blog);\r
+ $this->amountfound = $blog->readLogFromList($itemarray, $template);\r
+ $this->postBlogContent('sticky', $blog);\r
return;\r
}\r
}\r