function setParser(&$parser) {
$this->parser =& $parser;
}
-
+
function setCommentsObj(&$commentsObj) {
$this->commentsObj =& $commentsObj;
}
-
+
function setTemplate($template) {
$this->template =& $template;
}
-
+
function setCurrentComment(&$comment) {
+
global $manager;
+
// begin if: member comment
if ($comment['memberid'] != 0)
{
$mem =& $manager->getMember($comment['memberid']);
$comment['user'] = $mem->getDisplayName();
-
+
// begin if: member URL exists, set it as the userid
- if ($mem->getURL())
+ if ($mem->getURL() )
{
$comment['userid'] = $mem->getURL();
}
{
$comment['userid'] = $mem->getEmail();
} // end if
-
+
$comment['userlinkraw'] = createLink(
'member',
array(
'name' => $mem->getDisplayName(),
'extra' => $this->commentsObj->itemActions->linkparams
)
- );
+ );
+
}
// else: non-member comment
else
{
+
// create smart links
+
// begin if: comment userid is not empty
if (!empty($comment['userid']) )
{
+
// begin if: comment userid has either "http://" or "https://" at the beginning
if ( (strpos($comment['userid'], 'http://') === 0) || (strpos($comment['userid'], 'https://') === 0) )
{
{
$comment['userlinkraw'] = 'http://' . $comment['userid'];
} // end if
+
}
// else if: comment email is valid
else if (isValidMailAddress($comment['email']) )
{
$comment['userlinkraw'] = 'mailto:' . $comment['userid'];
} // end if
+
} // end if
+
$this->currentComment =& $comment;
global $currentcommentid, $currentcommentarray;
$currentcommentid = $comment['commentid'];
function parse_date($format = '') {
echo formatDate($format, $this->currentComment['timestamp'], $this->template['FORMAT_DATE'], $this->commentsObj->itemActions->blog);
}
-
+
/**
* Parse templatevar email
*/
/**
* Parse templatevar user
+ * @param string $mode
*/
- function parse_user($mode='') {
+ function parse_user($mode = '')\r
+ {
global $manager;
- if ($mode == 'realname' && $this->currentComment['memberid'] > 0) {
+\r
+ if ( $mode == 'realname' && $this->currentComment['memberid'] > 0 )\r
+ {
$member =& $manager->getMember($this->currentComment['memberid']);
echo $member->getRealName();
- } else {
- echo htmlspecialchars($this->currentComment['user'],ENT_QUOTES);
+ }\r
+ else\r
+ {
+ echo htmlspecialchars($this->currentComment['user'], ENT_QUOTES);
}
}
function parse_userlinkraw() {
echo $this->currentComment['userlinkraw'];
}
-
+
/**
* Parse templatevar userwebsite
*/
if (!(strpos($this->currentComment['userlinkraw'], 'http://') === false))
echo $this->currentComment['userlinkraw'];
}
-
+
/**
* Parse templatevar userwebsitelink
*/
echo $this->currentComment['user'];
}
}
-
+
// function to enable if-else-elseif-elseifnot-ifnot-endif to comment template fields
-
+
/**
* Checks conditions for if statements
*
break;
case 'archivenextexists':
$condition = ($archivenextexists == true);
- break;
+ break;
case 'skintype':
$condition = ($name == $this->skintype);
break; */
break;
}
return $condition;
- }
-
+ }
+
/**
* Different checks for a category
*/
return false;
}
-
-
+
+
/**
* Different checks for an author
*/
function _ifAuthor($name = '', $value='') {
global $member, $manager;
-
+
if ($this->currentComment['memberid'] == 0) return false;
-
+
$mem =& $manager->getMember($this->currentComment['memberid']);
$b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
$citem =& $manager->getItem($this->currentComment['itemid'],1,1);
// check comment author name
if ($name == 'name') {
$value = trim(strtolower($value));
- if ($value == '')
+ if ($value == '')
return false;
if ($value == strtolower($mem->getDisplayName()))
return true;
}
// check if comment author is admin
- if ($name == 'isadmin') {
- $blogid = intval($b->getID());
+ if ($name == 'isadmin') {
+ $blogid = intval($b->getID());
if ($mem->isAdmin())
return true;
-
+
return $mem->isBlogAdmin($blogid);
}
-
+
// check if comment author is item author
- if ($name == 'isauthor') {
+ if ($name == 'isauthor') {
return (intval($citem['authorid']) == intval($this->currentComment['memberid']));
}
-
+
// check if comment author is on team
if ($name == 'isonteam') {
return $mem->teamRights(intval($b->getID()));
return false;
}
-
+
/**
* Different checks for a category
*/
function _ifItemCategory($name = '', $value='') {
global $catid, $manager;
-
+
$b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
$citem =& $manager->getItem($this->currentComment['itemid'],1,1);
$icatid = $citem['catid'];
// when no parameter is defined, just check if a category is selected
if (($name != 'catname' && $name != 'catid') || ($value == ''))
return $b->isValidCategory($icatid);
-
+
// check category name
if ($name == 'catname') {
$value = $b->getCategoryIdFromName($value);
return false;
}
-
+
/**
* Checks if a member is on the team of a blog and return his rights
*/
function _ifOnTeam($blogName = '') {
global $blog, $member, $manager;
-
+
$b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
-
+
// when no blog found
if (($blogName == '') && (!is_object($b)))
return 0;
global $blog, $member, $manager;
$b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
-
+
// when no blog found
if (($blogName == '') && (!is_object($b)))
return 0;
return $member->isBlogAdmin($blogid);
}
-
+
/**
* hasplugin,PlugName
* -> checks if plugin exists
return call_user_func_array(array(&$plugin, 'doIf'), $params);
}
+
}
?>
\ No newline at end of file