mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
hybridAuth loop fix. Comment fixes for anonymous users.
This commit is contained in:
parent
4ae91639e4
commit
d52eec6673
@ -223,8 +223,11 @@ class comment_shortcodes extends e_shortcode
|
||||
if($this->mode == 'edit')
|
||||
{
|
||||
if (ANON == TRUE && USER == FALSE) // (anonymous comments - if allowed)
|
||||
{
|
||||
return "<input class='tbox comment author' type='text' placeholder=\"".COMLAN_16."\" name='author_name' size='61' value='{$_SESSION['comment_author_name']}' maxlength='100' />";
|
||||
{
|
||||
$disabled = ($_SESSION['comment_author_name']) ? "disabled='disabled'" : ""; // prevent anon users changing names on the same session.
|
||||
|
||||
return "<input {$disabled} class='tbox comment author' type='text' placeholder=\"".COMLAN_16."\" name='author_name' size='61' value='{$_SESSION['comment_author_name']}' maxlength='100' />";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,9 +44,18 @@ class comment
|
||||
private $template;
|
||||
|
||||
private $totalComments = 0;
|
||||
|
||||
private $moderator = false;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
||||
if(getperms('0')) // moderator perms.
|
||||
{
|
||||
$this->moderator = true;
|
||||
}
|
||||
|
||||
|
||||
global $COMMENTSTYLE;
|
||||
|
||||
if (!$COMMENTSTYLE)
|
||||
@ -302,6 +311,21 @@ class comment
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function isPending($row)
|
||||
{
|
||||
if($row['comment_blocked'] > 0 && ($row['comment_author_id'] != USERID || ($row['comment_author_id']==0 && $row['comment_author_name'] != $_SESSION['comment_author_name'])) && $this->moderator == false)
|
||||
{
|
||||
$this->totalComments = $this->totalComments - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
@ -445,7 +469,7 @@ class comment
|
||||
LEFT JOIN #rate AS r ON c.comment_id = r.rate_itemid AND r.rate_table = 'comments'
|
||||
|
||||
WHERE comment_item_id='".intval($thisid)."' AND comment_type='".$tp->toDB($type, true)."' AND comment_pid='".intval($comrow['comment_id'])."'
|
||||
AND (c.comment_blocked = 0 OR (c.comment_blocked > 0 AND c.comment_author_id = ".intval(USERID)."))
|
||||
|
||||
|
||||
ORDER BY comment_datestamp
|
||||
";
|
||||
@ -454,6 +478,14 @@ class comment
|
||||
{
|
||||
while ($row1 = $sql_nc->db_Fetch())
|
||||
{
|
||||
|
||||
if($this->isPending($row1))
|
||||
{
|
||||
$sub_total = $sub_total - 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ($pref['nested_comments'])
|
||||
{
|
||||
$width = min($width + 3, 80);
|
||||
@ -867,7 +899,6 @@ class comment
|
||||
LEFT JOIN #rate AS r ON c.comment_id = r.rate_itemid AND r.rate_table = 'comments'
|
||||
|
||||
WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp->toDB($type, true)."' AND c.comment_pid='0'
|
||||
AND (c.comment_blocked = 0 OR (c.comment_blocked > 0 AND c.comment_author_id = ".intval(USERID)."))
|
||||
ORDER BY c.comment_datestamp ".$sort;
|
||||
}
|
||||
else
|
||||
@ -881,19 +912,22 @@ class comment
|
||||
|
||||
|
||||
$query .= "WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp->toDB($type, true)."'
|
||||
AND (c.comment_blocked = 0 OR (c.comment_blocked > 0 AND c.comment_author_id = ".intval(USERID)."))
|
||||
|
||||
|
||||
ORDER BY c.comment_datestamp ".$sort;
|
||||
}
|
||||
|
||||
// AND (c.comment_blocked = 0 OR (c.comment_blocked > 0 AND c.comment_author_id = ".intval(USERID)."))
|
||||
|
||||
// TODO Preference for sort-order.
|
||||
|
||||
|
||||
$text = "";
|
||||
$comment = '';
|
||||
$modcomment = '';
|
||||
$lock = '';
|
||||
$text = "";
|
||||
$comment = '';
|
||||
$modcomment = '';
|
||||
$lock = '';
|
||||
$ret['comment'] = '';
|
||||
$moderator = getperms('0');
|
||||
|
||||
if ($this->totalComments = $sql->db_Select_gen($query))
|
||||
{
|
||||
@ -905,6 +939,13 @@ class comment
|
||||
//while ($row = $sql->db_Fetch())
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
|
||||
if($this->isPending($row,$moderator))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$lock = $row['comment_lock'];
|
||||
// $subject = $tp->toHTML($subject);
|
||||
if ($pref['nested_comments'])
|
||||
|
@ -86,6 +86,9 @@ $sc_style['COMMENT_RATE']['post'] = '</div>';
|
||||
$sc_style['USER_AVATAR']['pre'] = '<div class="comment-avatar center">';
|
||||
$sc_style['USER_AVATAR']['post'] = '</div>';
|
||||
|
||||
$sc_style['COMMENT_MODERATE']['pre'] = '<span class="comment-moderate">';
|
||||
$sc_style['COMMENT_MODERATE']['post'] = '</span>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -161,10 +161,12 @@ img.comment-avatar { max-width:128px; -webkit-box-shadow:#CCCCCC 0px 0px
|
||||
|
||||
a.comment-edit { }
|
||||
|
||||
.comment-edit { float:right; margin:0 5px 0 5px; }
|
||||
.comment-edit { float:right; margin-right:5px; }
|
||||
|
||||
.comment-reply { float:right ; margin-right:5px;}
|
||||
|
||||
.comment-moderate { float:right ; margin-right:5px;}
|
||||
|
||||
.comment-moderate { text-align:center }
|
||||
|
||||
.comment-rate { text-align:right; float:right; width:100px }
|
||||
|
Loading…
x
Reference in New Issue
Block a user