* 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 1784 2012-04-22 04:28:30Z 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::getDefinedActions()\r
+ * Actions::getAvailableSkinTypes()\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 getAvailableSkinTypes()\r
+ {\r
+ return self::$default_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
$defined_actions = array_merge(self::$default_actions, $extra_actions);\r
\r
- return array_merge($defined_actions, parent::getDefinedActions());\r
- }\r
- \r
- /**\r
- * Actions::getDefaultSkinTypes()\r
- * \r
- * @static\r
- * @param void\r
- * @return array list of friendly names for page actions\r
- */\r
- static public function getDefaultSkinTypes()\r
- {\r
- return self::$default_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::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
+ return array_merge($defined_actions, parent::getAvailableActions());\r
}\r
\r
/**\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
$handler = new ItemActions($blog);\r
- $parser = new Parser($handler->getDefinedActions(),$handler);\r
$handler->setTemplate($template);\r
- $handler->setParser($parser);\r
- $item = Item::getitem($itemid, 0, 0);\r
$handler->setCurrentItem($item);\r
\r
+ $parser = new Parser($handler);\r
+ \r
$comments = new Comments($itemid);\r
$comments->setItemActions($handler);\r
// shows ALL comments\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
* @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
-}
\ No newline at end of file
+}\r