*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2009 The Nucleus Group
+<<<<<<< HEAD
* @version $Id: ITEMACTIONS.php 1757 2012-04-15 09:02:32Z sakamocchi $
+=======
+ * @version $Id: ITEMACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
+>>>>>>> skinnable-master
*/
class ItemActions extends BaseActions
{
* ItemActions::$blog
* reference to the blog currently being displayed
*/
- private $blog;
+ public $blog;
/**
* ItemActions::$template
* defined actions in this class
*/
static private $defined_actions = array(
+ 'author',
+ 'authorid',
+ 'authorlink',
'blogid',
- 'title',
+ 'blogurl',
'body',
- 'more',
- 'smartbody',
- 'itemid',
- 'morelink',
'category',
'categorylink',
- 'author',
- 'authorid',
- 'authorlink',
'catid',
- 'karma',
- 'date',
- 'time',
- 'query',
- 'itemlink',
- 'blogurl',
'closed',
- 'syndicate_title',
- 'syndicate_description',
- 'karmaposlink',
- 'karmaneglink',
- 'new',
- 'image',
- 'popup',
- 'media',
+ 'comments',
+ 'date',
'daylink',
- 'query',
- 'include',
- 'phpinclude',
- 'parsedinclude',
- 'skinfile',
- 'set',
- 'plugin',
'edit',
'editlink',
'editpopupcode',
- 'comments',
+ 'itemid',
+ 'itemlink',
+ 'karma',
+ 'karmaneglink',
+ 'karmaposlink',
+ 'more',
+ 'morelink',
+ 'new',
+ 'plugin',
+ 'query',
'relevance',
- 'if',
- 'else',
- 'endif',
- 'elseif',
- 'ifnot',
- 'elseifnot'
- );
+ 'smartbody',
+ 'syndicate_description',
+ 'syndicate_title',
+ 'time',
+ 'title',
+ /* actions defined in BodyAction class */
+ 'image',
+ 'media',
+<<<<<<< HEAD
+ 'popup',
+=======
+ 'popup'
+>>>>>>> skinnable-master
+ );
/**
* ItemActions::__construct
*/
public function __construct(&$blog)
{
+ global $catid, $member;
+
// call constructor of superclass first
parent::__construct();
- global $catid, $member;
// extra parameters for created links
if ( $catid )
{
}
/**
- * ItemActions::getDefinedActions()
+ * ItemActions::getAvailableActions()
* Returns an array with the actions that are defined
* in the ItemActions class
*
* @param void
* @return void
*/
- public function getDefinedActions()
+ public function getAvailableActions()
{
- return self::$defined_actions;
+ return array_merge(self::$defined_actions, parent::getAvailableActions());
}
/**
}
/**
- * ItemActions::setParser()
- *
- * @param object &$parser instance of Parser class
- * @return void
- */
- public function setParser(&$parser)
- {
- $this->parser =& $parser;
- return;
- }
-
- /**
* ItemActions::setCurrentItem()
*
* @param object $item instance of Item class
{
global $currentitemid;
$this->currentItem =& $item;
- $currentitemid = $this->currentItem->itemid;
+ $currentitemid = $this->currentItem['itemid'];
return;
}
*/
public function parse_body()
{
- $this->highlightAndParse($this->currentItem->body);
+ $this->highlightAndParse($this->currentItem['body']);
return;
}
*/
public function parse_more()
{
- $this->highlightAndParse($this->currentItem->more);
+ $this->highlightAndParse($this->currentItem['more']);
return;
}
*/
public function parse_itemid()
{
- echo $this->currentItem->itemid;
+ echo $this->currentItem['itemid'];
return;
}
*/
public function parse_category()
{
- echo $this->currentItem->category;
+ echo $this->currentItem['category'];
return;
}
*/
public function parse_categorylink()
{
- echo Link::create_link('category', array('catid' => $this->currentItem->catid, 'name' => $this->currentItem->category));
+ echo Link::create_link('category', array('catid' => $this->currentItem['catid'], 'name' => $this->currentItem['category']));
return;
}
*/
public function parse_catid()
{
- echo $this->currentItem->catid;
+ echo $this->currentItem['catid'];
return;
}
*/
public function parse_authorid()
{
- echo $this->currentItem->authorid;
+ echo $this->currentItem['authorid'];
return;
}
public function parse_authorlink()
{
$data = array(
- 'memberid' => $this->currentItem->authorid,
- 'name' => $this->currentItem->author,
+ 'memberid' => $this->currentItem['authorid'],
+ 'name' => $this->currentItem['author'],
'extra' => $this->linkparams
);
public function parse_itemlink()
{
$data = array(
- 'itemid' => $this->currentItem->itemid,
- 'title' => $this->currentItem->title,
- 'timestamp' => $this->currentItem->timestamp,
+ 'itemid' => $this->currentItem['itemid'],
+ 'title' => $this->currentItem['title'],
+ 'timestamp' => $this->currentItem['timestamp'],
'extra' => $this->linkparams
);
*/
public function parse_closed()
{
- echo $this->currentItem->closed;
+ echo $this->currentItem['closed'];
return;
}
*/
public function parse_relevance()
{
- echo round($this->currentItem->score,2);
+ echo round($this->currentItem['score'], 2);
return;
}
{
$itemtitle = $this->currentItem['title'];
}
- elseif ( is_object($this->currentItem) )
- {
- $itemtitle = $this->currentItem->title;
- }
switch ( $format )
{
case 'xml':
global $manager;
// get karma object
- $karma =& $manager->getKarma($this->currentItem->itemid);
+ $karma =& $manager->getKarma($this->currentItem['itemid']);
switch ( $type )
{
switch ( $which )
{
case 'realname':
- echo $this->currentItem->authorname;
+ echo $this->currentItem['authorname'];
break;
case 'id':
- echo $this->currentItem->authorid;
+ echo $this->currentItem['authorid'];
break;
case 'email':
- echo $this->currentItem->authormail;
+ echo $this->currentItem['authormail'];
break;
case 'url':
- echo $this->currentItem->authorurl;
+ echo $this->currentItem['authorurl'];
break;
case 'name':
default:
- echo $this->currentItem->author;
+ echo $this->currentItem['author'];
}
return;
}
*/
public function parse_smartbody()
{
- if ( !$this->currentItem->more )
+ if ( !$this->currentItem['more'] )
{
- $this->highlightAndParse($this->currentItem->body);
+ $this->highlightAndParse($this->currentItem['body']);
}
else
{
- $this->highlightAndParse($this->currentItem->more);
+ $this->highlightAndParse($this->currentItem['more']);
}
return;
}
*/
public function parse_morelink()
{
- if ( $this->currentItem->more )
+ if ( $this->currentItem['more'] )
{
$this->parser->parse($this->template['MORELINK']);
}
$offset = $this->blog->getTimeOffset() * 3600;
}
- echo i18n::formatted_datetime($format, $this->currentItem->timestamp, $offset);
+ echo i18n::formatted_datetime($format, $this->currentItem['timestamp'], $offset);
return;
}
{
$format = $this->template['FORMAT_TIME'];
}
- echo i18n::formatted_datetime($format, $this->currentItem->timestamp);
+ echo i18n::formatted_datetime($format, $this->currentItem['timestamp']);
return;
}
* @return string syndicated title
*/
public function parse_syndicate_title($maxLength = 100) {
- $syndicated = strip_tags($this->currentItem->title);
+ $syndicated = strip_tags($this->currentItem['title']);
echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));
}
*/
public function parse_syndicate_description($maxLength = 250, $addHighlight = 0)
{
- $syndicated = strip_tags($this->currentItem->body);
+ $syndicated = strip_tags($this->currentItem['body']);
if ( $addHighlight )
{
$tmp_highlight = Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));
public function parse_karmaposlink($text = '')
{
global $CONF;
- $link = $CONF['ActionURL'] . '?action=votepositive&itemid=' . $this->currentItem->itemid;
+ $link = $CONF['ActionURL'] . '?action=votepositive&itemid=' . $this->currentItem['itemid'];
if ( !$text )
{
echo '<a href="'.$link.'">' . $text . '</a>';
public function parse_karmaneglink($text = '')
{
global $CONF;
- $link = $CONF['ActionURL'] . '?action=votenegative&itemid='.$this->currentItem->itemid;
+ $link = $CONF['ActionURL'] . '?action=votenegative&itemid='.$this->currentItem['itemid'];
if ( !$text )
{
*/
public function parse_new()
{
- if ( ($this->lastVisit != 0) && ($this->currentItem->timestamp > $this->lastVisit) )
+ if ( ($this->lastVisit != 0) && ($this->currentItem['timestamp'] > $this->lastVisit) )
{
echo $this->template['NEW'];
}
*/
public function parse_daylink()
{
- echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem->timestamp), $this->linkparams);
+ echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem['timestamp']), $this->linkparams);
return;
}
// add comments
if ( $this->showComments && $this->blog->commentsEnabled() )
{
- $comments = new Comments($this->currentItem->itemid);
+ $comments = new Comments($this->currentItem['itemid']);
$comments->setItemActions($this);
- $comments->showComments($this->template, $maxToShow, $this->currentItem->closed ? 0 : 1, $this->strHighlight);
+ $comments->showComments($this->template, $maxToShow, $this->currentItem['closed'] ? 0 : 1, $this->strHighlight);
}
return;
}
array_shift($params);
// add item reference (array_unshift didn't work)
+<<<<<<< HEAD
$params = array_merge(array(&$this->currentItem),$params);
call_user_func_array(array(&$plugin,'doTemplateVar'), $params);
+=======
+ $target = array(&$this->currentItem);
+ $params = array_merge($target,$params);
+
+ call_user_func_array(array($plugin,'doTemplateVar'), $params);
+>>>>>>> skinnable-master
return;
}
public function parse_edit()
{
global $member, $CONF;
- if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem->authorid)) )
+ if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem['authorid'])) )
{
$this->parser->parse($this->template['EDITLINK']);
}
public function parse_editlink()
{
global $CONF;
- echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&itemid=' . $this->currentItem->itemid;
+ echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&itemid=' . $this->currentItem['itemid'];
return;
}
*/
public function highlightAndParse(&$data)
{
- $actions = new BodyActions($this->blog);
- $parser = new Parser($actions->getDefinedActions(), $actions);
- $actions->setTemplate($this->template);
- $actions->setHighlight($this->strHighlight);
- $actions->setCurrentItem($this->currentItem);
- $parser->parse($actions->highlight($data));
+ $handler = new BodyActions($this->blog);
+ $handler->setTemplate($this->template);
+ $handler->setHighlight($this->strHighlight);
+ $handler->setCurrentItem($this->currentItem);
+
+ $parser = new Parser($handler);
+<<<<<<< HEAD
+ $parser->parse($handler->highlight($data));
+=======
+ $highlight = $handler->highlight($data);
+ $parser->parse($highlight);
+>>>>>>> skinnable-master
return;
}
* @param string $value value of property
* @return boolean
*/
- private function checkCondition($field, $name='', $value = '')
+ protected function checkCondition($field, $name='', $value = '')
{
global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
$condition = ($blog && ($blog->getSetting($name) == $value));
break;
case 'itemblogsetting':
- $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));
+<<<<<<< HEAD
+ $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
$condition = ($b && ($b->getSetting($name) == $value));
+=======
+ $item =& $manager->getItem($this->currentItem['itemid'], 1, 1);
+ $t_blog =& $manager->getBlog($item['blogid']);
+ $condition = ($t_blog && ($t_blog->getSetting($name) == $value));
+>>>>>>> skinnable-master
break;
case 'loggedin':
$condition = $member->isLoggedIn();
{
global $member, $manager;
- $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));
+<<<<<<< HEAD
+ $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
+=======
+>>>>>>> skinnable-master
// when no parameter is defined, just check if author is current visitor
if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )
{
- return (boolean) ((integer) $member->getID() > 0 && (integer) $member->getID() == (integer) $this->currentItem->authorid);
+ return (boolean) ((integer) $member->getID() > 0 && (integer) $member->getID() == (integer) $this->currentItem['authorid']);
}
// check author name
if ( $key == 'name' )
{
$value = strtolower($value);
- if ( $value == strtolower($this->currentItem->author) )
+ if ( $value == strtolower($this->currentItem['author']) )
{
return TRUE;
}
// check if author is admin
if ( ($key == 'isadmin') )
{
- $aid = intval($this->currentItem->authorid);
+<<<<<<< HEAD
+ $aid = intval($this->currentItem['authorid']);
$blogid = intval($b->getID());
$amember =& $manager->getMember($aid);
if ( $amember->isAdmin() )
return TRUE;
}
return (boolean) $amember->isBlogAdmin($blogid);
+=======
+ $i_author =& $manager->getMember($this->currentItem['authorid']);
+ if ( $i_author->isAdmin() )
+ {
+ return TRUE;
+ }
+ return (boolean) $i_author->isBlogAdmin($this->currentItem['blogid']);
+>>>>>>> skinnable-master
}
return FALSE;
{
global $catid, $manager;
- $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));
+<<<<<<< HEAD
+ $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
+=======
+ $blog =& $manager->getBlog($this->currentItem['blogid']);
+>>>>>>> skinnable-master
// when no parameter is defined, just check if a category is selected
if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
{
+<<<<<<< HEAD
return (boolean) $b->isValidCategory($catid);
+=======
+ return (boolean) $blog->isValidCategory($catid);
+>>>>>>> skinnable-master
}
- $icatid = $this->currentItem->catid;
+ $icatid = $this->currentItem['catid'];
// check category name
if ( $key == 'catname' )
{
+<<<<<<< HEAD
$value = $b->getCategoryIdFromName($value);
if ( $value == $icatid )
{
return (boolean) $b->isValidCategory($icatid);
+=======
+ $value = $blog->getCategoryIdFromName($value);
+ if ( $value == $icatid )
+ {
+ return (boolean) $blog->isValidCategory($icatid);
+>>>>>>> skinnable-master
}
}
// check category id
if ( ($key == 'catid') && ($value == $icatid) )
{
+<<<<<<< HEAD
return (boolean) $b->isValidCategory($icatid);
+=======
+ return (boolean) $blog->isValidCategory($icatid);
+>>>>>>> skinnable-master
}
return FALSE;
}
$params = func_get_args();
array_shift($params);
+<<<<<<< HEAD
return (boolean) call_user_func_array(array(&$plugin, 'doIf'), $params);
+=======
+ return (boolean) call_user_func_array(array($plugin, 'doIf'), $params);
+>>>>>>> skinnable-master
}
-}
\ No newline at end of file
+}