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

Comment fixes. Problem remains with SEF Urls

This commit is contained in:
Cameron
2013-03-29 15:31:03 -07:00
parent 9dbb631c1c
commit 11589d6f9e
6 changed files with 35 additions and 19 deletions

View File

@@ -113,7 +113,7 @@ if(e_AJAX_REQUEST) // TODO improve security
$_SESSION['comment_author_name'] = $clean_authorname; $_SESSION['comment_author_name'] = $clean_authorname;
$row['comment_pid'] = $pid;
$row['comment_item_id'] = intval($_POST['itemid']); $row['comment_item_id'] = intval($_POST['itemid']);
$row['comment_type'] = e107::getComment()->getCommentType($tp->toDB($_POST['table'],true)); $row['comment_type'] = e107::getComment()->getCommentType($tp->toDB($_POST['table'],true));
$row['comment_subject'] = $tp->toDB($_POST['subject']); $row['comment_subject'] = $tp->toDB($_POST['subject']);
@@ -135,7 +135,7 @@ if(e_AJAX_REQUEST) // TODO improve security
{ {
$row['comment_id'] = $newid; $row['comment_id'] = $newid;
$width = ($pid) ? 5 : 0; $width = ($pid) ? 1 : 0;
$ret['html'] = "\n<!-- Appended -->\n"; $ret['html'] = "\n<!-- Appended -->\n";
$ret['html'] .= e107::getComment()->render_comment($row,'comments','comment',intval($_POST['itemid']),$width); $ret['html'] .= e107::getComment()->render_comment($row,'comments','comment',intval($_POST['itemid']),$width);

View File

@@ -75,9 +75,12 @@ class comment_shortcodes extends e_shortcode
function sc_timedate($parm='') function sc_timedate($parm='')
{ {
global $TIMEDATE, $datestamp, $gen; if($parm == 'relative')
$datestamp = $gen->convert_date($this->var['comment_datestamp'], "short"); {
return $datestamp; return e107::getDate()->computeLapse($this->var['comment_datestamp'],time(),false, false, 'short');
}
return e107::getDate()->convert_date($this->var['comment_datestamp'], "short");
} }
@@ -251,7 +254,7 @@ class comment_shortcodes extends e_shortcode
function sc_comment_input($parm='') function sc_comment_input($parm='')
{ {
$options = array( $options = array(
'class' => 'tbox input comment-input', 'class' => 'tbox input-xxlarge comment-input',
'placeholder' => "Leave a message..." // TODO Lan 'placeholder' => "Leave a message..." // TODO Lan
); );

View File

@@ -42,13 +42,13 @@ function user_avatar_shortcode($parm='')
if (vartrue($image)) if (vartrue($image))
{ {
$img = (strpos($image,"://")!==false) ? $image : $tp->thumbUrl(e_MEDIA."avatars/".$image,"aw=".$width."&ah=".$height); $img = (strpos($image,"://")!==false) ? $image : $tp->thumbUrl(e_MEDIA."avatars/".$image,"w=".$width."&h=".$height);
$text = "<img class='user-avatar e-tip' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' /> $text = "<img class='user-avatar e-tip' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' />
"; ";
} }
else else
{ {
$img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","aw=".$width."&ah=".$height); $img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height);
$text = "<img class='user-avatar' src='".$img."' alt='' />"; $text = "<img class='user-avatar' src='".$img."' alt='' />";
} }

View File

@@ -129,7 +129,7 @@ $COMMENT_TEMPLATE['ITEM'] = '
<div class="row-fluid"> <div class="row-fluid">
<div class="comment-box-username span1">{USERNAME}</div> <div class="comment-box-username span1">{USERNAME}</div>
<div class="comment-box-date span2">{TIMEDATE}</div> <div class="comment-box-date span2">{TIMEDATE=relative}</div>
<div class="comment-status span3">{COMMENT_STATUS}</div> <div class="comment-status span3">{COMMENT_STATUS}</div>
<div class="comment-moderate span6">{COMMENT_RATE} {REPLY} {COMMENTEDIT} {COMMENT_MODERATE}</div> <div class="comment-moderate span6">{COMMENT_RATE} {REPLY} {COMMENTEDIT} {COMMENT_MODERATE}</div>

View File

@@ -258,10 +258,12 @@ class comment
// ------------------------------------------------------------- // -------------------------------------------------------------
$indent = ($action == 'reply') ? "style='margin-left:40px'" : ""; $indent = ($action == 'reply') ? " class='offset1' " : "";
$formid = ($action == 'reply') ? "e-comment-form-reply" : "e-comment-form"; $formid = ($action == 'reply') ? "e-comment-form-reply" : "e-comment-form";
$text = "\n<div id='{$formid}' {$indent}>\n".e107::getMessage()->render('postcomment', true, false, false);//temporary here $text = "\n<div id='{$formid}' {$indent}>\n".e107::getMessage()->render('postcomment', true, false, false);//temporary here
// $text .= "Indent = ".$indent;
$text .= "<form id='{$formid}' method='post' action='".str_replace('http:', '', $_SERVER['REQUEST_URI'])."' >"; $text .= "<form id='{$formid}' method='post' action='".str_replace('http:', '', $_SERVER['REQUEST_URI'])."' >";
$data = array( $data = array(
@@ -408,12 +410,12 @@ class comment
if (vartrue($pref['nested_comments'])) if (vartrue($pref['nested_comments']))
{ {
$width2 = 100 - $width; // $width2 = 100 - $width;
$total_width = "95%"; // $total_width = "95%";
if ($width) if ($width)
{ {
$renderstyle = $COMMENT_TEMPLATE['ITEM_START']; $renderstyle = $COMMENT_TEMPLATE['ITEM_START'];
$renderstyle .= "<div style='margin-left:{$width}%'>".$COMMENT_TEMPLATE['ITEM']."</div>"; $renderstyle .= "<div class='offset".$width."' >".$COMMENT_TEMPLATE['ITEM']."</div>";
$renderstyle .= $COMMENT_TEMPLATE['ITEM_END']; $renderstyle .= $COMMENT_TEMPLATE['ITEM_END'];
} }
else else
@@ -487,9 +489,9 @@ class comment
ORDER BY comment_datestamp ORDER BY comment_datestamp
"; ";
$sql_nc = new db; /* a new db must be created here, for nested comment */ $sql_nc = new db; /* a new db must be created here, for nested comment */
if ($sub_total = $sql_nc->db_Select_gen($sub_query)) if ($sub_total = $sql_nc->gen($sub_query))
{ {
while ($row1 = $sql_nc->db_Fetch()) while ($row1 = $sql_nc->fetch())
{ {
if($this->isPending($row1)) if($this->isPending($row1))
@@ -501,7 +503,11 @@ class comment
if ($pref['nested_comments']) if ($pref['nested_comments'])
{ {
$width = min($width + 3, 80);
// $width = min($width + 1, 80);
$width = $width+1;
// $width = $width=+1;
// $text .= "WIDTH=".$width;
} }
$text .= $this->render_comment($row1, $table, $action, $id, $width, $subject, $addrating); $text .= $this->render_comment($row1, $table, $action, $id, $width, $subject, $addrating);
unset($width); unset($width);
@@ -978,6 +984,11 @@ class comment
//XXX Do NOT add to template - too important to allow for modification. //XXX Do NOT add to template - too important to allow for modification.
$text = "<ul id='comments-container'>\n".$text."\n</ul>"; $text = "<ul id='comments-container'>\n".$text."\n</ul>";
} }
else
{
$text = "<ul id='comments-container'><li><!-- --></li></ul>";
}
$search = array("{MODERATE}","{COMMENTS}","{COMMENTFORM}","{COMMENTNAV}"); $search = array("{MODERATE}","{COMMENTS}","{COMMENTFORM}","{COMMENTNAV}");
$replace = array($modcomment,$text,$comment,$pagination); $replace = array($modcomment,$text,$comment,$pagination);
$TEMPL = str_replace($search,$replace,$this->template['LAYOUT']); $TEMPL = str_replace($search,$replace,$this->template['LAYOUT']);

View File

@@ -59,7 +59,7 @@ $(document).ready(function()
if($('#comments-container').length){ if($('#comments-container').length){
// alert('true'); // alert('true');
}else{ }else{
$("#e-comment-form").parent().prepend("<div id='comments-container'></div>"); // $("#e-comment-form").parent().prepend("<div id='comments-container'></div>");
} }
if(pid != 0) if(pid != 0)
@@ -119,6 +119,8 @@ $(document).ready(function()
url: url + '?ajax_used=1&mode=reply', url: url + '?ajax_used=1&mode=reply',
data: { itemid: sp[3], table: table }, data: { itemid: sp[3], table: table },
success: function(data) { success: function(data) {
// alert(url);
var a = $.parseJSON(data); var a = $.parseJSON(data);
if(!a.error) if(!a.error)