diff --git a/e107_core/shortcodes/batch/comment_shortcodes.php b/e107_core/shortcodes/batch/comment_shortcodes.php index da4a08c10..e2735f250 100644 --- a/e107_core/shortcodes/batch/comment_shortcodes.php +++ b/e107_core/shortcodes/batch/comment_shortcodes.php @@ -223,8 +223,11 @@ class comment_shortcodes extends e_shortcode if($this->mode == 'edit') { if (ANON == TRUE && USER == FALSE) // (anonymous comments - if allowed) - { - return ""; + { + $disabled = ($_SESSION['comment_author_name']) ? "disabled='disabled'" : ""; // prevent anon users changing names on the same session. + + return ""; + } } } diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index ddf09ebe7..3e1b94632 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -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']) diff --git a/e107_themes/templates/comment_template.php b/e107_themes/templates/comment_template.php index b60dba874..92cbaedc3 100644 --- a/e107_themes/templates/comment_template.php +++ b/e107_themes/templates/comment_template.php @@ -86,6 +86,9 @@ $sc_style['COMMENT_RATE']['post'] = ''; $sc_style['USER_AVATAR']['pre'] = '
'; $sc_style['USER_AVATAR']['post'] = '
'; +$sc_style['COMMENT_MODERATE']['pre'] = ''; +$sc_style['COMMENT_MODERATE']['post'] = ''; + diff --git a/e107_web/css/e107.css b/e107_web/css/e107.css index 7c8b11b20..a7311688d 100644 --- a/e107_web/css/e107.css +++ b/e107_web/css/e107.css @@ -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 } diff --git a/index.php b/index.php index 8c6b7d040..d3288906c 100644 --- a/index.php +++ b/index.php @@ -62,7 +62,7 @@ // -------------- 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)) {