1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

hybridAuth loop fix. Comment fixes for anonymous users.

This commit is contained in:
CaMer0n
2012-06-18 13:00:47 +00:00
parent 4ae91639e4
commit d52eec6673
5 changed files with 60 additions and 11 deletions

View File

@@ -223,8 +223,11 @@ class comment_shortcodes extends e_shortcode
if($this->mode == 'edit') if($this->mode == 'edit')
{ {
if (ANON == TRUE && USER == FALSE) // (anonymous comments - if allowed) 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' />";
} }
} }
} }

View File

@@ -44,9 +44,18 @@ class comment
private $template; private $template;
private $totalComments = 0; private $totalComments = 0;
private $moderator = false;
function __construct() function __construct()
{ {
if(getperms('0')) // moderator perms.
{
$this->moderator = true;
}
global $COMMENTSTYLE; global $COMMENTSTYLE;
if (!$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... * 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' 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'])."' 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 ORDER BY comment_datestamp
"; ";
@@ -454,6 +478,14 @@ class comment
{ {
while ($row1 = $sql_nc->db_Fetch()) while ($row1 = $sql_nc->db_Fetch())
{ {
if($this->isPending($row1))
{
$sub_total = $sub_total - 1;
continue;
}
if ($pref['nested_comments']) if ($pref['nested_comments'])
{ {
$width = min($width + 3, 80); $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' 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' 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; ORDER BY c.comment_datestamp ".$sort;
} }
else else
@@ -881,19 +912,22 @@ class comment
$query .= "WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp->toDB($type, true)."' $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; 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. // TODO Preference for sort-order.
$text = ""; $text = "";
$comment = ''; $comment = '';
$modcomment = ''; $modcomment = '';
$lock = ''; $lock = '';
$ret['comment'] = ''; $ret['comment'] = '';
$moderator = getperms('0');
if ($this->totalComments = $sql->db_Select_gen($query)) if ($this->totalComments = $sql->db_Select_gen($query))
{ {
@@ -905,6 +939,13 @@ class comment
//while ($row = $sql->db_Fetch()) //while ($row = $sql->db_Fetch())
foreach ($rows as $row) foreach ($rows as $row)
{ {
if($this->isPending($row,$moderator))
{
continue;
}
$lock = $row['comment_lock']; $lock = $row['comment_lock'];
// $subject = $tp->toHTML($subject); // $subject = $tp->toHTML($subject);
if ($pref['nested_comments']) if ($pref['nested_comments'])

View File

@@ -86,6 +86,9 @@ $sc_style['COMMENT_RATE']['post'] = '</div>';
$sc_style['USER_AVATAR']['pre'] = '<div class="comment-avatar center">'; $sc_style['USER_AVATAR']['pre'] = '<div class="comment-avatar center">';
$sc_style['USER_AVATAR']['post'] = '</div>'; $sc_style['USER_AVATAR']['post'] = '</div>';
$sc_style['COMMENT_MODERATE']['pre'] = '<span class="comment-moderate">';
$sc_style['COMMENT_MODERATE']['post'] = '</span>';

View File

@@ -161,10 +161,12 @@ img.comment-avatar { max-width:128px; -webkit-box-shadow:#CCCCCC 0px 0px
a.comment-edit { } 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-reply { float:right ; margin-right:5px;}
.comment-moderate { float:right ; margin-right:5px;}
.comment-moderate { text-align:center } .comment-moderate { text-align:center }
.comment-rate { text-align:right; float:right; width:100px } .comment-rate { text-align:right; float:right; width:100px }

View File

@@ -62,7 +62,7 @@
// -------------- Experimental ----------------- // -------------- Experimental -----------------
unset($_SESSION['E:SOCIAL']); // unset($_SESSION['E:SOCIAL']);
if(vartrue($_GET['provider']) && !isset($_SESSION['E:SOCIAL']) && e107::getPref('social_login_active', false) && (e_ADMIN_AREA !== true)) if(vartrue($_GET['provider']) && !isset($_SESSION['E:SOCIAL']) && e107::getPref('social_login_active', false) && (e_ADMIN_AREA !== true))
{ {