1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +02:00

More comments clean-up. Approve all comments has been added as an option.

This commit is contained in:
CaMer0n
2012-06-15 12:50:18 +00:00
parent 8da6fd2ed2
commit afa2adcd2b
7 changed files with 378 additions and 198 deletions

View File

@@ -82,16 +82,17 @@ class comments_admin_ui extends e_admin_ui
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'comment_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE),
'comment_item_id' => array('title'=> "item id", 'type' => 'number', 'width' => '5%'),
'comment_type' => array('title'=> "Type", 'type' => 'method', 'width' => '10%', 'filter'=>TRUE),
'comment_item_id' => array('title'=> "item id", 'type' => 'number', 'width' => '5%'),
'comment_subject' => array('title'=> "subject", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name
'comment_comment' => array('title'=> "comment", 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
'comment_author_id' => array('title'=> "author", 'type' => 'user', 'data' => 'int', 'width' => 'auto', 'writeParms' => 'nameField=comment_author_name'), // User id
'comment_author_name' => array('title'=> "authorName", 'type' => 'user', 'width' => 'auto', 'readParms'=>'idField=comment_author_id&link=1', 'noedit' => true, 'forceSave' => true), // User name
'u.user_name' => array('title'=> "System user", 'type' => 'user', 'width' => 'auto', 'readParms'=>'idField=comment_author_id&link=1', 'noedit' => true), // User name
'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date
'comment_blocked' => array('title'=> "blocked", 'type' => 'boolean', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'comment_datestamp' => array('title'=> LAN_DATESTAMP, 'type' => 'datestamp', 'width' => 'auto'), // User date
'comment_blocked' => array('title'=> "Status", 'type' => 'method', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'comment_ip' => array('title'=> "IP", 'type' => 'ip', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)
'comment_type' => array('title'=> "Type", 'type' => 'method', 'width' => '10%', 'filter'=>TRUE),
'comment_lock' => array('title'=> "Lock", 'type' => 'boolean', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'),
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
);
@@ -144,6 +145,27 @@ class comments_admin_form_ui extends e_admin_form_ui
return $types;
}
}
function comment_blocked($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
{
if($mode == 'read')
{
$blocked = array("","blocked","pending");
return $blocked[$curVal];
}
if($mode == 'filter' || $mode == 'batch') // Custom Filter List for release_type
{
$blocked = array("approved","blocked","pending");
return $blocked;
}
}
}
new comments_admin();

View File

@@ -1312,6 +1312,13 @@ $text .= "
</td>
</tr>
<tr>
<td class='label'>Moderate Comments: </td>
<td class='control'>
".$frm->radio_switch('comments_moderate', $pref['comments_moderate'], LAN_YES, LAN_NO)."
</td>
</tr>
</tbody>
</table>

View File

@@ -2,7 +2,7 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
@@ -15,28 +15,49 @@
*/
if (!defined('e107_INIT')) { exit; }
//include_once(e_HANDLER.'shortcode_handler.php');
//$comment_shortcodes = e107::getScParser()->parse_scbatch(__FILE__);
class comment_shortcodes extends e_shortcode
{
var $var;
function sc_subject($parm)
function sc_subject_input($parm)
{
$tp = e107::getParser();
$pref = e107::getPref();
global $SUBJECT, $comrow, $pref, $NEWIMAGE, $tp;
if (isset($pref['nested_comments']) && $pref['nested_comments']) {
$SUBJECT = $NEWIMAGE." ".(empty($this->var['comment_subject']) ? $subject : $tp->toHTML($this->var['comment_subject'], TRUE));
} else {
$SUBJECT = '';
if(vartrue($pref['nested_comments']))
{
return "<input class='tbox comment subject-input' type='text' placeholder='".COMLAN_324." name='subject' size='61' value='".$tp->toForm($this->var['subject'])."' maxlength='100' />";
}
return $SUBJECT;
return;
}
function sc_username($parm)
function sc_subject($parm)
{
$tp = e107::getParser();
$pref = e107::getPref();
global $SUBJECT, $NEWIMAGE;
if (vartrue($pref['nested_comments']))
{
$SUBJECT = $NEWIMAGE." ".(empty($this->var['comment_subject']) ? $subject : $tp->toHTML($this->var['comment_subject'], TRUE));
}
else
{
$SUBJECT = '';
}
return $SUBJECT;
}
function sc_username($parm)
{
global $USERNAME;
if (isset($this->var['user_id']) && $this->var['user_id'])
{
@@ -52,19 +73,24 @@ class comment_shortcodes extends e_shortcode
}
function sc_TIMEDATE($parm)
function sc_timedate($parm)
{
global $TIMEDATE, $datestamp, $gen;
$datestamp = $gen->convert_date($this->var['comment_datestamp'], "short");
return $datestamp;
}
function sc_reply($parm)
{
global $REPLY, $action, $pref, $table, $id, $thisaction, $thistable, $thisid;
global $REPLY, $action, $table, $id, $thisaction, $thistable, $thisid;
$pref = e107::getPref();
$REPLY = '';
if($this->var['comment_lock'] != "1"){
if ($thisaction == "comment" && $pref['nested_comments']) {
if($this->var['comment_lock'] != "1" && $this->var['comment_blocked'] < 1)
{
if ($thisaction == "comment" && $pref['nested_comments'])
{
$REPLY = "<a href='".SITEURL."comment.php?reply.".$thistable.".".$this->var['comment_id'].".".$thisid."'>".COMLAN_326."</a>";
}
}
@@ -105,9 +131,7 @@ class comment_shortcodes extends e_shortcode
function sc_avatar($parm)
{
// --------- Legacy Code below for those who still want to use it.
global $AVATAR;
@@ -125,12 +149,14 @@ class comment_shortcodes extends e_shortcode
return $this->var['user_image'];
}
function sc_comments($parm)
{
global $COMMENTS;
return (isset($this->var['user_id']) && $this->var['user_id'] ? COMLAN_99.": ".$this->var['user_comments'] : COMLAN_194)."<br />";
}
function sc_joined($parm)
{
global $JOINED, $gen;
@@ -142,28 +168,134 @@ class comment_shortcodes extends e_shortcode
return $JOINED;
}
function sc_comment_itemid($parm) // for ajax item id.
{
return 'comment-'.intval($this->var['comment_id']);
}
function sc_comment_moderate($parm)
{
if(!getperms('0') && !getperms("B"))
{
return;
}
$url = e_PAGE."?".e_QUERY;
$unblock = "[<a href='".e_ADMIN_ABS."comment.php?unblock-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_1."</a>] ";
$block = "[<a href='".e_ADMIN_ABS."comment.php?block-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_2."</a>] ";
$delete = "[<a href='".e_ADMIN_ABS."comment.php?delete-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_3."</a>] ";
$userinfo = "[<a href='".e_ADMIN_ABS."userinfo.php?".e107::getIPHandler()->ipDecode($comrow['comment_ip'])."'>".COMLAN_4."</a>]";
return $unblock.$block.$delete.$userinfo;
}
function sc_comment_button($parm)
{
if($this->mode == 'edit')
{
return "<input class='button' type='submit' name='".$this->var['action']."submit' value='".(isset($this->var['eaction']) && $this->var['eaction'] == "edit" ? COMLAN_320 : COMLAN_9)."' />";
}
}
function sc_author_input($parm)
{
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='{$_POST['author_name']}' maxlength='100' />";
}
}
}
function sc_rate_input($parm)
{
return $this->var['rate'];
}
function sc_comment_input($parm)
{
$options = array(
'class' => 'tbox input comment-input',
'placeholder' => "Leave a message..." // TODO Lan
);
if($parm == 'bbcode')
{
return e107::getForm()->bbarea('comment',$this->var['comval'],'comment','comment-'.$this->var['itemid'],'large',$options);
}
else
{
return e107::getForm()->textarea('comment',$this->var['comval'], 5, 80,$options);
}
}
function sc_user_avatar($parm)
{
$this->var['user_id'] = USERID;
$this->var['user_image'] = USERIMAGE;
return $this->sc_comment_avatar($parm);
}
function sc_comment($parm)
{
global $COMMENT, $pref;
// global $COMMENT, $pref;
$tp = e107::getParser();
return (isset($this->var['comment_blocked']) && $this->var['comment_blocked'] ? COMLAN_0 : $tp->toHTML($this->var['comment_comment'], TRUE, FALSE, $this->var['user_id']));
if($this->var['comment_blocked'] == 1)
{
return COMLAN_0;
}
return $tp->toHTML($this->var['comment_comment'], TRUE, FALSE, $this->var['user_id']);
}
function sc_comment_status($parm)
{
switch ($this->var['comment_blocked'])
{
case 2:
return "Pending Approval"; // TODO LAN
break;
case 1:
return COMLAN_0;
break;
default:
break;
}
}
function sc_commentedit($parm)
{
global $COMMENTEDIT, $pref, $comment_edit_query;
if ($pref['allowCommentEdit'] && USER && $this->var['user_id'] == USERID && $this->var['comment_lock'] != "1")
global $COMMENTEDIT, $comment_edit_query;
$pref = e107::getPref();
if ($pref['allowCommentEdit'] && USER && $this->var['user_id'] == USERID && ($this->var['comment_lock'] < 1))
{
$adop_icon = (file_exists(THEME."images/commentedit.png") ? THEME_ABS."images/commentedit.png" : e_IMAGE_ABS."admin_images/edit_16.png");
$adop_icon = (file_exists(THEME."images/commentedit.png") ? "<img src='".THEME_ABS."images/commentedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' class='icon' />" : "Edit");
//Searching for '.' is BAD!!! It breaks mod rewritten requests. Why is this needed at all?
if (strstr(e_QUERY, "&"))
{
return "<a href='".e_SELF."?".e_QUERY."&amp;comment=edit&amp;comment_id=".$this->var['comment_id']."'><img src='".$adop_icon."' alt='".COMLAN_318."' title='".COMLAN_318."' class='icon' /></a>";
return "<a class='comment-edit' href='".e_SELF."?".e_QUERY."&amp;comment=edit&amp;comment_id=".$this->var['comment_id']."'>{$adop_icon}</a>";
}
else
{
// return "<a href='".e_SELF."?".$comment_edit_query.".edit.".$this->var['comment_id']."'><img src='".e_IMAGE."generic/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
return "<a href='".SITEURL."comment.php?".$comment_edit_query.".edit.".$this->var['comment_id']."#e-comment-form'><img src='".$adop_icon."' alt='".COMLAN_318."' title='".COMLAN_318."' class='icon' /></a>";
return "<a class='comment-edit' href='".SITEURL."comment.php?".$comment_edit_query.".edit.".$this->var['comment_id']."#e-comment-form'>".$adop_icon."</a>";
}
}
else
@@ -172,12 +304,14 @@ class comment_shortcodes extends e_shortcode
}
}
function sc_rating($parm)
{
global $RATING;
return $RATING;
}
function sc_ipaddress($parm)
{
global $IPADDRESS, $e107;
@@ -185,6 +319,7 @@ class comment_shortcodes extends e_shortcode
return (ADMIN ? "<a href='".SITEURL."userposts.php?0.comments.".$this->var['user_id']."'>".COMLAN_330." ".e107::getIPHandler()->ipDecode($this->var['comment_ip'])."</a>" : "");
}
function sc_level($parm)
{
global $LEVEL, $pref;
@@ -193,6 +328,7 @@ class comment_shortcodes extends e_shortcode
return ($this->var['user_admin'] ? $ldata[0] : $ldata[1]);
}
function sc_location($parm)
{
global $LOCATION;
@@ -200,6 +336,7 @@ class comment_shortcodes extends e_shortcode
return (isset($this->var['user_location']) && $this->var['user_location'] ? COMLAN_313.": ".$tp->toHTML($this->var['user_location'], TRUE) : '');
}
function sc_signature($parm)
{
global $SIGNATURE;

View File

@@ -25,6 +25,7 @@
<core name="comments_disabled">0</core>
<core name="comments_emoticons">0</core>
<core name="comments_icon">0</core>
<core name="comments_moderate">0</core>
<core name="compress_output">0</core>
<core name="contact_emailcopy">0</core>
<core name="cookie_name">e107cookie</core>

View File

@@ -51,12 +51,60 @@ class comment
{
require_once(e107::coreTemplatePath('comment'));
}
else // BC
elseif(!$COMMENT_TEMPLATE) // BC template.
{
global $sc_style;
/*
$COMMENTSTYLE = "
<table class='fborder' style='".USER_WIDTH."'>
<tr>
<td colspan='2' class='forumheader'>
{SUBJECT} {USERNAME} {TIMEDATE} {REPLY} {COMMENTEDIT}
</td>
</tr>
<tr>
<td style='width:30%; vertical-align:top;'>
{AVATAR}<span class='smalltext'>{COMMENTS}{JOINED}</span>
</td>
<td style='width:70%; vertical-align:top;'>
{COMMENT}
{RATING}
{IPADDRESS}
{LEVEL}
{LOCATION}
{SIGNATURE}
</td>
</tr>
</table>
<br />";
*/
$COMMENT_TEMPLATE['ITEM_START'] = "";
$COMMENT_TEMPLATE['ITEM'] = $COMMENTSTYLE;
$COMMENT_TEMPLATE['ITEM_END'] = "";
$COMMENT_TEMPLATE['LAYOUT'] = "{COMMENTS}{COMMENTFORM}{MODERATE}";
$COMMENT_TEMPLATE['FORM'] = "<table style='width:100%'>
{SUBJECT_INPUT}
{AUTHOR_INPUT}
{RATE_INPUT}
{COMMENT_INPUT}
{COMMENT_BUTTON}
</table>";
$sc_style['SUBJECT_INPUT']['pre'] = "<tr><td style='width:20%'>".COMLAN_324."</td><td style='width:80%'>";
$sc_style['SUBJECT_INPUT']['post'] = "</td></tr>";
$sc_style['AUTHOR_INPUT']['pre'] = "<tr><td style='width:20%; vertical-align:top;'>".COMLAN_16."</td><td style='width:80%'>";
$sc_style['AUTHOR_INPUT']['post'] = "</td></tr>";
$sc_style['RATE_INPUT']['pre'] = "<tr><td style='width:20%; vertical-align:top;'>".COMLAN_327.":</td><td style='width:80%;'>";
$sc_style['RATE_INPUT']['post'] = "</td></tr>";
$sc_style['COMMENT_INPUT']['pre'] = "<tr><td style='width:20%; vertical-align:top;'>".COMLAN_8.":</td><td id='commentform' style='width:80%;'>";
$sc_style['COMMENT_INPUT']['post'] = "</td></tr>";
$sc_style['COMMENT_BUTTON']['pre'] = "<tr style='vertical-align:top'><td colspan='2' id='commentformbutton' style='width:80%;'>";
$sc_style['COMMENT_BUTTON']['post'] = "</td></tr>";
}
$this->template = $COMMENT_TEMPLATE;
@@ -78,8 +126,12 @@ class comment
function form_comment($action, $table, $id, $subject, $content_type, $return = FALSE, $rating = FALSE, $tablerender = TRUE)
{
//rating : boolean, to show rating system in comment
global $pref, $sql, $tp;
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE)
$pref = e107::getPref();
$sql = e107::getDb();
$tp = e107::getParser();
if(vartrue($pref['comments_disabled']))
{
return;
}
@@ -98,24 +150,7 @@ class comment
//FIXME - e_REQUEST_URI?
//e_SELF."?".e_QUERY
$text = "\n<div id='e-comment-form' style='text-align:center'>\n".e107::getMessage()->render('postcomment', true, false, false);//temporary here
$text .= "<form method='post' action='".str_replace('http:', '', $_SERVER['REQUEST_URI'])."' id='dataform' >\n
<table style='width:100%'>";
if ($pref['nested_comments'])
{
$text .= "<tr>\n<td style='width:20%'>".COMLAN_324."</td>\n<td style='width:80%'>\n
<input class='tbox comment subject' type='text' name='subject' size='61' value='".$tp->toForm($subject)."' maxlength='100' />\n</td>\n</tr>";
$text2 = "";
}
else
{
$text2 = "<input type='hidden' name='subject' value='".$tp->toForm($subject)."' />\n";
}
if (isset($_GET['comment']) && $_GET['comment'] == 'edit')
if (vartrue($_GET['comment']) == 'edit')
{
$eaction = 'edit';
$id = $_GET['comment_id'];
@@ -177,40 +212,45 @@ class comment
$rater = new rater;
}
$rate = $rater->composerating($table, $itemid, $enter = TRUE, USERID, TRUE);
$rate = "<tr><td style='width:20%; vertical-align:top;'>".COMLAN_327.":</td>\n<td style='width:80%;'>".$rate."</td></tr>\n";
} //end rating area
if (ANON == TRUE && USER == FALSE) // Box for author name (anonymous comments - if allowed)
{
$text .= "<tr>\n<td style='width:20%; vertical-align:top;'>".COMLAN_16."</td>\n<td style='width:80%'>\n<input class='tbox comment author' type='text' name='author_name' size='61' value='{$author_name}' maxlength='100' />\n</td>\n</tr>";
}
$text .= $rate."<tr> \n
<td style='width:20%; vertical-align:top;'>".COMLAN_8.":</td>\n<td id='commentform' style='width:80%;'>\n";
// -------------------------------------------------------------
$text = "\n<div id='e-comment-form'>\n".e107::getMessage()->render('postcomment', true, false, false);//temporary here
$text .= "<form method='post' action='".str_replace('http:', '', $_SERVER['REQUEST_URI'])."' id='dataform' >";
$data = array(
'action' => $action,
'subject' => $subject,
'table' => $table,
'comval' => strip_tags(trim($comval)),
'itemid' => $itemid,
'eaction' => $eaction,
'rate' => $rate
);
$text .= e107::getForm()->bbarea('comment',trim($comval),'comment','comment-'.$itemid,'large',array('autofocus'=>1));
e107::getScBatch('comment')->setParserVars($data);
$text .= "</td></tr>
<tr style='vertical-align:top'>
<td style='width:20%'>".$text2."</td>\n";
e107::getScBatch('comment')->setMode('edit');
$text .= $tp->parseTemplate($this->template['FORM'], TRUE, e107::getScBatch('comment'));
$text .= "<div>"; // All Hidden Elements.
$text .= (isset($action) && $action == "reply" ? "<input type='hidden' name='pid' value='{$id}' />" : '');
$text .=(isset($eaction) && $eaction == "edit" ? "<input type='hidden' name='editpid' value='{$id}' />" : "");
$text .=(isset($content_type) && $content_type ? "<input type='hidden' name='content_type' value='{$content_type}' />" : '');
$text .= (!$pref['nested_comments']) ? "<input type='hidden' name='subject' value='".$tp->toForm($subject)."' />\n" : "";
$text .= "
<td id='commentformbutton' style='width:80%;'>
".(isset($action) && $action == "reply" ? "<input type='hidden' name='pid' value='{$id}' />" : '').(isset($eaction) && $eaction == "edit" ? "<input type='hidden' name='editpid' value='{$id}' />" : "").(isset($content_type) && $content_type ? "<input type='hidden' name='content_type' value='{$content_type}' />" : '')."<input class='button' type='submit' name='".$action."submit' value='".(isset($eaction) && $eaction == "edit" ? COMLAN_320 : COMLAN_9)."' />\n
</td>\n</tr>\n
</table>
<div>
<input type='hidden' name='e-token' value='".e_TOKEN."' />\n
</div>
</form>
</div>";
//TODO Add Template
if ($tablerender)
{
$text = $ns->tablerender($caption, $text, '', TRUE);
@@ -258,13 +298,13 @@ class comment
global $thisaction,$thistable,$thisid,$e107;
if (isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE)
if (vartrue($pref['comments_disabled']))
{
return;
}
$comrow = $row;
e107::getScBatch('comment')->setParserVars($row);
$thistable = $table;
$thisid = $id;
@@ -292,21 +332,14 @@ class comment
define("IMAGE_new_comments", (file_exists(THEME."images/new_comments.png") ? "<img src='".THEME_ABS."images/new_comments.png' alt='' /> " : "<img src='".e_IMAGE_ABS."generic/new_comments.png' alt='' /> "));
}
$ns = new e107table;
// $ns = new e107table;
if (!$gen || !is_object($gen))
{
$gen = new convert;
}
$url = e_PAGE."?".e_QUERY;
$unblock = "[<a href='".e_ADMIN_ABS."comment.php?unblock-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_1."</a>] ";
$block = "[<a href='".e_ADMIN_ABS."comment.php?block-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_2."</a>] ";
$delete = "[<a href='".e_ADMIN_ABS."comment.php?delete-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_3."</a>] ";
$userinfo = "[<a href='".e_ADMIN_ABS."userinfo.php?".e107::getIPHandler()->ipDecode($comrow['comment_ip'])."'>".COMLAN_4."</a>]";
}
e107::getScBatch('comment')->setParserVars($row);
$COMMENT_TEMPLATE = $this->template;
if ($pref['nested_comments'])
@@ -314,24 +347,10 @@ class comment
$width2 = 100 - $width;
$total_width = "95%";
if ($width)
{
{
$renderstyle = $COMMENT_TEMPLATE['ITEM_START'];
$renderstyle .= "<div style='margin-left:{$width}%'>".$COMMENT_TEMPLATE['ITEM']."</div>";
$renderstyle .= $COMMENT_TEMPLATE['ITEM_END'];
/*
$renderstyle = "
<table style='width:".$total_width."' border='0'>
<tr>
<td style='width:".$width."%' ></td>
<td style='width:".$width2."%'>".$COMMENTSTYLE."
</td>
</tr>
</table>";
* */
$renderstyle .= $COMMENT_TEMPLATE['ITEM_END'];
}
else
{
@@ -399,6 +418,8 @@ class comment
LEFT JOIN #user AS u ON c.comment_author_id = u.user_id
LEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_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
";
$sql_nc = new db; /* a new db must be created here, for nested comment */
@@ -438,12 +459,13 @@ class comment
function enter_comment($author_name, $comment, $table, $id, $pid, $subject, $rateindex = FALSE)
{
//rateindex : the posted value from the rateselect box (without the urljump) (see function rateselect())
global $e_event,$e107,$pref,$rater;
global $e_event,$e107,$rater;
$sql = e107::getDb();
$sql2 = e107::getDb('sql2');
$tp = e107::getParser();
$e107cache = e107::getCache();
$pref = e107::getPref();
if ($this->getCommentPermissions() != 'rw') return;
@@ -530,7 +552,7 @@ class comment
'comment_author_email' => $tp->toDB($cuser_mail),
'comment_datestamp' => $_t,
'comment_comment' => $comment,
'comment_blocked' => 0, //Not blocked by default
'comment_blocked' => (vartrue($pref['comments_moderate']) ? 2 : 0),
'comment_ip' => $ip,
'comment_type' => $tp->toDB($type, true),
'comment_lock' => 0 //Not locked by default
@@ -760,12 +782,17 @@ class comment
"SELECT c.*, u.*, ue.* FROM #comments AS c
LEFT JOIN #user AS u ON c.comment_author_id = u.user_id
LEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_id
WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp->toDB($type, true)."' AND c.comment_pid='0' ORDER BY c.comment_datestamp"
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"
:
"SELECT c.*, u.*, ue.* FROM #comments AS c
LEFT JOIN #user AS u ON c.comment_author_id = u.user_id
LEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_id
WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp->toDB($type, true)."' ORDER BY c.comment_datestamp";
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";
$text = "";
$comment = '';
@@ -801,7 +828,10 @@ class comment
if (ADMIN && getperms("B"))
{
$modcomment = "<div style='text-align:right'><a href='".e_ADMIN_ABS."modcomment.php?$table.$id'>".COMLAN_314."</a></div><br />";
$modcomment = "<div class='comment-moderate'>";
// $modcomment .= "<a href='".e_ADMIN_ABS."modcomment.php?$table.$id'>".COMLAN_314."</a>";
$modcomment .= "<a href='".e_ADMIN_ABS."comment.php?searchquery={$id}&filter_options=comment_type__".$this->getCommentType($table)."'>".COMLAN_314."</a>";
$modcomment .= "</div>";
}
}

View File

@@ -17,7 +17,7 @@
if (!defined('e107_INIT')) { exit; }
if (!defined("USER_WIDTH")){ define("USER_WIDTH", "width:100%"); }
global $sc_style, $comment_shortcodes;
global $sc_style;
global $pref, $comrow, $row2, $tp, $NEWIMAGE, $USERNAME, $RATING;
$sc_style['SUBJECT']['pre'] = "<b>";
@@ -29,11 +29,8 @@ $sc_style['USERNAME']['post'] = "</b>";
$sc_style['TIMEDATE']['pre'] = "";
$sc_style['TIMEDATE']['post'] = "";
$sc_style['REPLY']['pre'] = "";
$sc_style['REPLY']['post'] = "";
$sc_style['AVATAR']['pre'] = "<div class='spacer'>";
$sc_style['AVATAR']['post'] = "</div>";
$sc_style['AVATAR']['pre'] = "";
$sc_style['AVATAR']['post'] = "";
$sc_style['COMMENTS']['pre'] = "";
$sc_style['COMMENTS']['post'] = "<br />";
@@ -59,115 +56,91 @@ $sc_style['LOCATION']['post'] = "<br />";
$sc_style['SIGNATURE']['pre'] = "";
$sc_style['SIGNATURE']['post'] = "<br />";
/*
$COMMENTSTYLE = "
<table class='fborder' style='".USER_WIDTH."'>
<tr>
<td colspan='2' class='forumheader'>
{SUBJECT} {USERNAME} {TIMEDATE} {REPLY} {COMMENTEDIT}
</td>
</tr>
<tr>
<td style='width:30%; vertical-align:top;'>
{AVATAR}<span class='smalltext'>{COMMENTS}{JOINED}</span>
</td>
<td style='width:70%; vertical-align:top;'>
{COMMENT}
{RATING}
{IPADDRESS}
{LEVEL}
{LOCATION}
{SIGNATURE}
</td>
</tr>
</table>
<br />";
*/
// from e107.org
$sc_style['REPLY']['pre'] = "<span class='comment-reply'>";
$sc_style['REPLY']['post'] = "</span>";
$sc_style['COMMENTEDIT']['pre'] = '<div class="clear_b H10"><!-- --></div><div class="comments-box-reply smalltext f-right">';
$sc_style['COMMENTEDIT']['post'] = '</div>';
$sc_style['COMMENTEDIT']['pre'] = '<span class="comment-edit">';
$sc_style['COMMENTEDIT']['post'] = '</span>';
$sc_style['COMMENT_AVATAR']['pre'] = '<div class="center">';
$sc_style['COMMENT_AVATAR']['post'] = '</div>';
$sc_style['SUBJECT_INPUT']['pre'] = ""; //COMLAN_324
$sc_style['SUBJECT_INPUT']['post'] = "";
$sc_style['AUTHOR_INPUT']['pre'] = ""; // COMLAN_16
$sc_style['AUTHOR_INPUT']['post'] = "";
$sc_style['RATE_INPUT']['pre'] = "".COMLAN_327."";
$sc_style['RATE_INPUT']['post'] = "";
$sc_style['COMMENT_INPUT']['pre'] = "";// COMLAN_8
$sc_style['COMMENT_INPUT']['post'] = "";
$sc_style['COMMENT_BUTTON']['pre'] = "<div id='commentformbutton'>";
$sc_style['COMMENT_BUTTON']['post'] = "</div>";
$sc_style['USER_AVATAR']['pre'] = '<div class="center">';
$sc_style['USER_AVATAR']['post'] = '</div>';
$COMMENT_TEMPLATE['FORM'] = "
<div class='comment-box comment-box-form clearfix'>
<div class='comment-box-left'>
{USER_AVATAR}
</div>
<div class='comment-box-right' style='text-align:left'>
<div class='P10'>
{SUBJECT_INPUT}
{AUTHOR_INPUT}
{RATE_INPUT}
{COMMENT_INPUT}
{COMMENT_BUTTON}
</div>
</div>
</div>
<div class='clear_b'><!-- --></div>";
$COMMENT_TEMPLATE['ITEM'] = '
<div class="comments-box-left">
<div class="comment-box-left">
{COMMENT_AVATAR}
</div>
<div class="comments-box-right">
<div class="comment-box-right">
<div class="P10">
<span class="comments-box-username">{USERNAME}</span>
<span class="comments-box-date">{TIMEDATE}</span>
<span class="comments-reply">{REPLY}</span>
<span class="comment-box-username">{USERNAME}</span>
<span class="comment-box-date">{TIMEDATE}</span>
<span class="comment-status">{COMMENT_STATUS}</span>
<div class="comments-user-badge-bar">
{SUPPORT}
{REPLY}
{COMMENTEDIT}
</div>
<div class="clear_b H5"><!-- --></div>
{COMMENT}
{COMMENTEDIT}
{COMMENT_MOD//ERATE}
</div>
</div>';
$COMMENT_TEMPLATE['ITEM_START'] = '<div class="comments-box clearfix">';
$COMMENT_TEMPLATE['ITEM_START'] = '<div id="{COMMENT_ITEMID}" class="comment-box clearfix">';
$COMMENT_TEMPLATE['ITEM_END'] = '</div><div class="clear_b"><!-- --></div>';
$COMMENT_TEMPLATE['LAYOUT'] = '{COMMENTFORM}{COMMENTS}{MODERATE}';
$COMMENT_TEMPLATE['FORM'] = ""; //TODO
/*
$COMMENTSTYLE = '
<div class="comments-box clearfix">
<div class="comments-box-left">
{COMMENT_AVATAR}
</div>
<div class="comments-box-right">
<div class="P10">
<span class="comments-box-username">{USERNAME}</span>
<span class="comments-box-date">{TIMEDATE}</span>
<span class="comments-reply">{REPLY}</span>
<div class="comments-user-badge-bar">
{SUPPORT}
</div>
<div class="clear_b H5"><!-- --></div>
{COMMENT}
{COMMENTEDIT}
</div>
</div>
';
*/
?>

View File

@@ -133,26 +133,36 @@ div.bbcode { margin: 15px 0px; clear: both; } /* layout control via bbcodes */
/* default comments layout */
.comments-box { padding-bottom:10px; margin-bottom:10px; border-top:1px solid #C0C0C0; }
.comment-box { padding-bottom:10px; margin-bottom:10px; border-top:1px solid #C0C0C0; }
.comments-box-left { float:left; text-align:center; width:10%; min-width:100px }
.comment-box-left { float:left; text-align:center; width:10%; min-width:100px }
.comments-box-userinfo { padding:20px 5px 10px 5px; }
.comment-box-userinfo { padding:20px 5px 10px 5px; }
.comments-box-username { padding-left:0px; font-size:1.2em; padding-right: 10px }
.comment-box-username { padding-left:0px; font-size:1.2em; padding-right: 10px }
.comments-avatar { padding:10px 10px 0px 10px; }
img.comment-avatar { max-width:128px; -webkit-box-shadow:#CCCCCC 0px 0px 10px; -moz-box-shadow:#CCCCCC 0px 0px 10px; box-shadow:#CCCCCC 0px 0px 10px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; }
.comments-box-right { width:85%; min-height: 70px; float:left; }
.comment-box-right { width:85%; min-height: 70px; float:left; }
.comments-box-arrow { width:11px; height:26px; float:left; position:relative; top:5px; left:-18px; }
.comment-box-arrow { width:11px; height:26px; float:left; position:relative; top:5px; left:-18px; }
.comments-box-date { }
.comment-box-date { }
.comments-user-badge-bar { float:right; margin-left:20px; }
.comments-box-reply { position:relative; bottom:0px; right:-10px; padding:2px 5px; font-size:0.85em; background-color:#EBFAFF; border:1px solid #C6F1FF; border-bottom:0px none; border-right:0px none; -webkit-border-top-left-radius: 5px; -moz-border-radius-topleft: 5px; border-top-left-radius: 5px; }
.comment-replyxxx { position:relative; bottom:0px; right:-10px; padding:2px 5px; font-size:0.85em; background-color:#EBFAFF; border:1px solid #C6F1FF; border-bottom:0px none; border-right:0px none; -webkit-border-top-left-radius: 5px; -moz-border-radius-topleft: 5px; border-top-left-radius: 5px; }
.comment-input { width:100% }
.comment-status { float:right; font-style: italic }
a.comment-edit { }
.comment-edit { float:right; margin-right:5px; }
.comment-reply { float:right ; margin-right:5px;}
.comment-moderate { text-align:center }