1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Bugtracker #4364 - support comment edit for downloads, content. Also bugtracker #4381 don't display blocked comments

This commit is contained in:
e107steved 2008-05-25 08:26:11 +00:00
parent 62401cd74d
commit 33f96bb871
6 changed files with 377 additions and 334 deletions

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/comment.php,v $
| $Revision: 1.4 $
| $Date: 2007-12-08 14:49:44 $
| $Revision: 1.5 $
| $Date: 2008-05-25 08:26:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -36,40 +36,38 @@ $id = intval(varset($temp_query[2], "")); // ID of item associated with comment
$nid = intval(varset($temp_query[3], "")); // Action - e.g. 'edit'. Or news ID for reply with nested comments
$xid = intval(varset($temp_query[4], "")); // ID of target comment
global $comment_edit_query;
//$comment_edit_query = '';
//if ($temp_query[3] == 'edit') $comment_edit_query = $temp_query[0].".".$temp_query[1].".".$temp_query[2];
$comment_edit_query = $temp_query[0].".".$temp_query[1].".".$temp_query[2];
unset($temp_query);
$redirectFlag = 0;
if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit']))
{
{ // New comment, or edited comment, being posted.
if(!ANON && !USER)
{
header("location: ".e_BASE."index.php");
exit;
header("location: ".e_BASE."index.php");
exit;
}
if($table == "poll")
{
if (!$sql->db_Select("polls", "poll_title", "`poll_id` = '{$id}' AND `poll_comment` = 1"))
{
header("location: ".e_BASE."index.php");
exit;
}
} else if($table == "news")
if (!$sql->db_Select("polls", "poll_title", "`poll_id` = '{$id}' AND `poll_comment` = 1"))
{
header("location: ".e_BASE."index.php");
exit;
}
}
elseif($table == "news")
{
if (!$sql->db_Select("news", "news_allow_comments", "`news_id` = '{$id}' AND `news_allow_comments` = 0"))
{
header("location: ".e_BASE."index.php");
exit;
}
if (!$sql->db_Select("news", "news_allow_comments", "`news_id` = '{$id}' AND `news_allow_comments` = 0"))
{
header("location: ".e_BASE."index.php");
exit;
}
}
// $pid = (isset($_POST['pid']) ? $_POST['pid'] : 0);
// $pid = intval($pid);
$pid = intval(varset($_POST['pid'], 0));
$pid = intval(varset($_POST['pid'], 0)); // ID of the specific comment being edited (nested comments - replies)
$editpid = intval(varset($_POST['editpid'], 0)); // ID of the specific comment being edited
$editpid = intval(varset($_POST['editpid'], 0)); // ID of the specific comment being edited (in-line comments)
$clean_authorname = $_POST['author_name'];
$clean_comment = $_POST['comment'];
@ -87,74 +85,78 @@ if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit']))
if($editpid)
{
$redir = preg_replace("#\.edit.*#si", "", e_QUERY);
$redirectFlag = $id;
/* $redir = preg_replace("#\.edit.*#si", "", e_QUERY);
header("Location: ".e_SELF."?{$redir}");
exit;
exit; */
}
}
if (isset($_POST['replysubmit']))
{
{ // Reply to nested comment being posted
if ($table == "news" && !$sql->db_Select("news", "news_allow_comments", "news_id='{$nid}' "))
{
header("location:".e_BASE."index.php");
exit;
header("location:".e_BASE."index.php");
exit;
}
else
{
$row = $sql->db_Fetch();
if (!$row['news_id']) {
$pid = (isset($_POST['pid']) ? $_POST['pid'] : 0);
$pid = intval($pid);
$row = $sql->db_Fetch();
if (!$row['news_id'])
{
$pid = (isset($_POST['pid']) ? $_POST['pid'] : 0);
$pid = intval($pid);
$clean_authorname = $_POST['author_name'];
$clean_comment = $_POST['comment'];
$clean_subject = $_POST['subject'];
$clean_authorname = $_POST['author_name'];
$clean_comment = $_POST['comment'];
$clean_subject = $_POST['subject'];
$cobj->enter_comment($clean_authorname, $clean_comment, $table, $nid, $pid, $clean_subject);
$e107cache->clear("comment.php?{$table}.{$id}");
}
//plugin e_comment.php files
$plugin_redir = false;
$e_comment = $cobj->get_e_comment();
if ($table == $e_comment[$table]['eplug_comment_ids']){
$plugin_redir = TRUE;
$reply_location = str_replace("{NID}", $nid, $e_comment[$table]['reply_location']);
}
if ($plugin_redir)
{
echo "<script type='text/javascript'>document.location.href='{$reply_location}'</script>\n";
exit;
} elseif ($table == "news" || $table == "poll")
{
echo "<script type='text/javascript'>document.location.href='".e_BASE."comment.php?comment.{$table}.{$nid}'</script>\n";
exit;
} elseif($table == "bugtrack")
{
echo "<script type='text/javascript'>document.location.href='".e_PLUGIN."bugtracker/bugtracker.php?show.{$nid}'</script>\n";
exit;
} elseif($table == "faq")
{
echo "<script type='text/javascript'>document.location.href='".e_PLUGIN."faq/faq.php?cat.{$xid}.{$nid}'</script>\n";
exit;
} elseif ($table == "content")
{
echo "<script type='text/javascript'>document.location.href='".e_BASE."content.php?{$_POST['content_type']}.{$nid}'</script>\n";
exit;
} elseif ($table == "download")
{
echo "<script type='text/javascript'>document.location.href='".e_BASE."download.php?view.{$nid}'</script>\n";
exit;
} elseif ($table == "page")
{
echo "<script type='text/javascript'>document.location.href='".e_BASE."page.php?{$nid}'</script>\n";
exit;
}
$cobj->enter_comment($clean_authorname, $clean_comment, $table, $nid, $pid, $clean_subject);
$e107cache->clear("comment.php?{$table}.{$id}");
}
$redirectFlag = $nid;
}
}
if ($redirectFlag)
{ // Need to go back to original page
// Check plugin e_comment.php files
$plugin_redir = false;
$e_comment = $cobj->get_e_comment();
if ($table == $e_comment[$table]['eplug_comment_ids'])
{
$plugin_redir = TRUE;
$reply_location = str_replace("{NID}", $redirectFlag, $e_comment[$table]['reply_location']);
}
if ($plugin_redir)
{
echo "<script type='text/javascript'>document.location.href='{$reply_location}'</script>\n";
exit;
}
else
{
switch ($table)
{
case "news" :
case "poll" :
echo "<script type='text/javascript'>document.location.href='".e_BASE."comment.php?comment.{$table}.{$redirectFlag}'</script>\n";
exit;
break;
case "download" :
echo "<script type='text/javascript'>document.location.href='".e_BASE."download.php?view.{$redirectFlag}'</script>\n";
exit;
break;
case "page" :
echo "<script type='text/javascript'>document.location.href='".e_BASE."page.php?{$redirectFlag}'</script>\n";
exit;
break;
}
}
}
$comment_ob_start = FALSE;
if ($action == "reply")
{
@ -174,83 +176,70 @@ if ($action == "reply")
if ($subject == "")
{
if ($table == "news")
switch ($table)
{
if (!$sql->db_Select("news", "news_title", "news_id='{$nid}' "))
{
header("location: ".e_BASE."index.php");
exit;
}
else
{
list($news['news_title']) = $sql->db_Fetch();
$subject = $news['news_title'];
$title = COMLAN_100;
}
}
elseif ($table == "poll")
{
if (!$sql->db_Select("polls", "poll_title", "poll_id='{$nid}' ")) {
header("location:".e_BASE."index.php");
exit;
} else {
list($poll['poll_title']) = $sql->db_Fetch();
$subject = $poll['poll_title'];
$title = COMLAN_101;
}
}
elseif ($table == "content")
{
$sql->db_Select("content", "content_heading", "content_id='{$nid}'");
$subject = $content['content_heading'];
}
elseif ($table == "bugtracker")
{
$sql->db_Select("bugtrack", "bugtrack_summary", "bugtrack_id='{$nid}'");
$subject = $content['content_heading'];
case "news" :
if (!$sql->db_Select("news", "news_title", "news_id='{$nid}' "))
{
header("location: ".e_BASE."index.php");
exit;
}
else
{
list($news['news_title']) = $sql->db_Fetch();
$subject = $news['news_title'];
$title = COMLAN_100;
}
case "poll" :
if (!$sql->db_Select("polls", "poll_title", "poll_id='{$nid}' "))
{
header("location:".e_BASE."index.php");
exit;
}
else
{
list($poll['poll_title']) = $sql->db_Fetch();
$subject = $poll['poll_title'];
$title = COMLAN_101;
}
break;
case 'download' :
if ($sql->db_Select('download','download_name',"download_id={$nid} "))
{
$row = $sql->db_Fetch();
$subject = $row['download_name'];
$title = COMLAN_106;
}
else
{
header("location:".e_BASE."index.php");
exit;
}
break;
}
}
if ($table == "content")
{
$sql->db_Select("content", "content_type", "content_id='{$nid}'");
list($content['content_type']) = $sql->db_Fetch();
if ($content['content_type'] == "0") {
$content_type = "article";
$title = COMLAN_103;
} elseif ($content['content_type'] == "3") {
$content_type = "review";
$title = COMLAN_104;
} elseif ($content['content_type'] == "1") {
$content_type = "content";
$title = COMLAN_105;
}
}
define('e_PAGETITLE', $title." / ".COMLAN_99." / ".COMLAN_102.$subject."");
require_once(HEADERF);
}
else
{
{ // Default code if not reply
// Check cache
if ($cache = $e107cache->retrieve("comment.php?{$table}.{$id}"))
{
require_once(HEADERF);
echo $cache;
require_once(FOOTERF);
exit;
require_once(HEADERF);
echo $cache;
require_once(FOOTERF);
exit;
}
else
{
if ($table == "news")
{
/*
changes by jalist 19/01/05:
updated db query removed one call
*/
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'])
{
$query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
switch ($table)
{
case "news" :
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'])
{
$query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
LEFT JOIN #user AS u ON n.news_author = u.user_id
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
LEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id
@ -258,76 +247,116 @@ else
AND n.news_id={$id}
AND n.news_allow_comments=0
GROUP by n.news_id";
}
else
{
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
}
else
{
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
LEFT JOIN #user AS u ON n.news_author = u.user_id
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
AND n.news_id={$id}
AND n.news_allow_comments=0";
}
}
if (!$sql->db_Select_gen($query))
if (!$sql->db_Select_gen($query))
{
header("location:".e_BASE."index.php");
exit;
}
else
{
$news = $sql->db_Fetch();
$subject = $tp->toForm($news['news_title']);
define("e_PAGETITLE", COMLAN_100." / ".COMLAN_99." / {$subject}");
require_once(HEADERF);
ob_start();
$comment_ob_start = TRUE;
$ix = new news;
$ix->render_newsitem($news, "extend"); // extend so that news-title-only news text is displayed in full when viewing comments.
$field = $news['news_id'];
}
break;
case "poll" :
if (!$sql->db_Select("polls", "*", "poll_id='{$id}'"))
{
header("location:".e_BASE."index.php");
exit;
}
else
{
$row = $sql->db_Fetch();
$comments_poll = $row['poll_comment'];
$subject = $row['poll_title'];
define("e_PAGETITLE", COMLAN_101." / ".COMLAN_99." / ".$subject."");
require_once(HEADERF);
require(e_PLUGIN."poll/poll_menu.php");
$field = $row['poll_id'];
if(!$comments_poll)
{
header("location:".e_BASE."index.php");
exit;
}
else
{
$news = $sql->db_Fetch();
$subject = $tp->toForm($news['news_title']);
define("e_PAGETITLE", COMLAN_100." / ".COMLAN_99." / {$subject}");
require_once(HEADERF);
ob_start();
$comment_ob_start = TRUE;
$ix = new news;
$ix->render_newsitem($news, "extend"); // extend so that news-title-only news text is displayed in full when viewing comments.
$field = $news['news_id'];
$comtype = 0;
require_once(FOOTERF);
exit;
}
}
else if($table == "poll")
{
if (!$sql->db_Select("polls", "*", "poll_id='{$id}'"))
require_once(HEADERF);
}
break;
case 'download' :
if ($sql->db_Select('download','download_name',"download_id={$id} "))
{
$row = $sql->db_Fetch();
$subject = $row['download_name'];
$title = COMLAN_106;
$field = $id;
require_once(HEADERF);
}
else
{
header("location:".e_BASE."index.php");
exit;
}
break;
default : // Hope its a plugin table
$e_comment = $cobj->get_e_comment();
if ($table == $e_comment[$table]['eplug_comment_ids'])
{
if ($sql->db_Select($table,$e_comment[$table]['db_title'],$e_comment[$table]['db_id']."={$id} "))
{
header("location:".e_BASE."index.php");
exit;
}
else
{
$row = $sql->db_Fetch();
$comments_poll = $row['poll_comment'];
$subject = $row['poll_title'];
define("e_PAGETITLE", COMLAN_101." / ".COMLAN_99." / ".$subject."");
require_once(HEADERF);
require(e_PLUGIN."poll/poll_menu.php");
$field = $row['poll_id'];
$comtype = 4;
if(!$comments_poll)
{
require_once(FOOTERF);
exit;
}
$row = $sql->db_Fetch();
$subject = $row[$e_comment[$table]['db_title']];
$title = $e_comment[$table]['plugin_name'];
$field = $id;
require_once(HEADERF);
}
}
require_once(HEADERF);
else
{
header("location:".e_BASE."index.php");
exit;
}
}
else
{ // Error - emit some debug code
require_once(HEADERF);
echo "Comment error: {$table} Field: {$e_comment['db_id']} ID {$id} Title: {$e_comment['db_title']}<br />";
echo "<pre>";
var_dump($e_comment);
echo "</pre>";
}
}
}
}
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news")
{
echo "<span class='smalltext'><b>".$pref['trackbackString']."</b> ".$e107->http_path.e_PLUGIN."trackback/trackback.php?pid={$id}</span>";
echo "<span class='smalltext'><b>".$pref['trackbackString']."</b> ".$e107->http_path.e_PLUGIN."trackback/trackback.php?pid={$id}</span>";
}
$field = ($field ? $field : ($id ? $id : ""));
$field = ($field ? $field : ($id ? $id : "")); // ID of associated source item
$width = (isset($width) && $width ? $width : "");
$cobj->compose_comment($table, $action, $field, $width, $subject, $rate=FALSE);
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news"){
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news")
{
if($sql->db_Select("trackback", "*", "trackback_pid={$id}"))
{
$tbArray = $sql -> db_getList();

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/download.php,v $
| $Revision: 1.18 $
| $Date: 2007-11-21 22:52:45 $
| $Revision: 1.19 $
| $Date: 2008-05-25 08:26:11 $
| $Author: e107steved $
|
+----------------------------------------------------------------------------+
@ -399,6 +399,8 @@ if ($action == "view")
$dl = $sql -> db_Fetch();
$comment_edit_query = 'comment.download.'.$id;
$load_template = 'download_template';
if (!isset($DOWNLOAD_VIEW_TABLE)) eval($template_load_core);
if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:0px");}

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/comment_shortcodes.php,v $
| $Revision: 1.5 $
| $Date: 2008-05-24 12:45:34 $
| $Revision: 1.6 $
| $Date: 2008-05-25 08:26:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -110,7 +110,8 @@ if ($pref['allowCommentEdit'] && USER && $comrow['user_id'] == USERID && $comrow
}
else
{
return "<a href='".e_SELF."?".$comment_edit_query.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."packs/".$imode."/generic/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
// return "<a href='".e_SELF."?".$comment_edit_query.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."packs/".$imode."/generic/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
return "<a href='".e_BASE."comment.php?".$comment_edit_query.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."packs/".$imode."/generic/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
}
}
else

View File

@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/comment_class.php,v $
| $Revision: 1.11 $
| $Date: 2008-05-24 15:14:36 $
| $Revision: 1.12 $
| $Date: 2008-05-25 08:26:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -32,7 +32,7 @@ require_once(e_FILE."shortcode/batch/comment_shortcodes.php");
class comment {
/**
* Enter description here...
* Display the comment editing form
*
* @param unknown_type $action
* @param unknown_type $table
@ -47,123 +47,126 @@ class comment {
{
//rating : boolean, to show rating system in comment
global $pref, $sql, $tp;
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE){
return;
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE)
{
return;
}
require_once(e_HANDLER."ren_help.php");
if (ANON == TRUE || USER == TRUE)
{
$itemid = $id;
$ns = new e107table;
if ($action == "reply" && substr($subject, 0, 4) != "Re: ")
$itemid = $id;
$ns = new e107table;
if ($action == "reply" && substr($subject, 0, 4) != "Re: ")
{
$subject = COMLAN_325.' '.$subject;
}
$text = "\n<div style='text-align:center'><form method='post' action='".e_SELF."?".e_QUERY."' 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')
{
$eaction = 'edit';
$id = $_GET['comment_id'];
}
elseif (strstr(e_QUERY, "edit"))
{
$eaction = "edit";
$tmp = explode(".", e_QUERY);
$count = 0;
foreach($tmp as $t)
{
$subject = COMLAN_325.' '.$subject;
if($t == "edit")
{
$id = $tmp[($count+1)];
break;
}
$count++;
}
}
$text = "\n<div style='text-align:center'><form method='post' action='".e_SELF."?".e_QUERY."' 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 = "";
if(isset($eaction) && $eaction == "edit")
{ // Get existing comment
$id=intval($id);
$sql -> db_Select("comments", "*", "comment_id='{$id}' ");
$ecom = $sql -> db_Fetch();
if (isset($ecom['comment_author']))
{ // Old comment DB format
list($prid, $pname) = explode(".", $ecom['comment_author'],2);
}
else
{
$text2 = "<input type='hidden' name='subject' value='".$tp -> toForm($subject)."' />\n";
$prid = $ecom['comment_author_id'];
$pname = $ecom['comment_author_name'];
}
if (isset($_GET['comment']) && $_GET['comment'] == 'edit')
{
$eaction = 'edit';
$id = $_GET['comment_id'];
}
else if (strstr(e_QUERY, "edit"))
{
$eaction = "edit";
$tmp = explode(".", e_QUERY);
$count = 0;
foreach($tmp as $t)
{
if($t == "edit")
{
$id = $tmp[($count+1)];
break;
}
$count++;
}
if($prid != USERID || !USER)
{ // Editing not allowed
echo "<div style='text-align: center;'>".COMLAN_329."</div>";
require_once(FOOTERF);
exit;
}
if(isset($eaction) && $eaction == "edit")
{
$id=intval($id);
$sql -> db_Select("comments", "*", "comment_id='$id' ");
$ecom = $sql -> db_Fetch();
if (isset($ecom['comment_author']))
{ // Old comment DB format
list($prid, $pname) = explode(".", $ecom['comment_author'],2);
}
else
{
$prid = $ecom['comment_author_id'];
$pname = $ecom['comment_author_name'];
}
$caption = COMLAN_318;
$comval = $tp -> toForm($ecom['comment_comment']);
$comval = preg_replace("#\[ ".COMLAN_319.".*\]#si", "", $comval);
}
else
{ // New comment - blank form
$caption = COMLAN_9;
$comval = "";
}
if($prid != USERID || !USER)
{
echo "<div style='text-align: center;'>".COMLAN_329."</div>";
require_once(FOOTERF);
exit;
}
//add the rating select box/result ?
$rate = "";
if($rating == TRUE && !(ANON == TRUE && USER == FALSE) )
{
global $rater;
require_once(e_HANDLER."rate_class.php");
if(!is_object($rater)){ $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
$caption = COMLAN_318;
$comval = $tp -> toFORM($ecom['comment_comment']);
$comval = preg_replace("#\[ ".COMLAN_319.".*\]#si", "", $comval);
}
else
{
$caption = COMLAN_9;
$comval = "";
}
//add the rating select box/result ?
$rate = "";
if($rating == TRUE && !(ANON == TRUE && USER == FALSE) )
{
global $rater;
require_once(e_HANDLER."rate_class.php");
if(!is_object($rater)){ $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)
{
$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
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<textarea class='tbox comment' id='comment' name='comment' cols='62' rows='7' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>$comval</textarea>\n<br />
".display_help('helpb',"comment")."</td></tr>\n<tr style='vertical-align:top'> \n<td style='width:20%'>".$text2."</td>\n<td id='commentformbutton' style='width:80%;'>\n". (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>\n</form></div>";
".display_help('helpb',"comment")."</td></tr>\n<tr style='vertical-align:top'> \n<td style='width:20%'>".$text2."</td>\n
<td id='commentformbutton' style='width:80%;'>\n
". (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>\n</form></div>";
if($tablerender)
{
$text = $ns->tablerender($caption, $text, '', TRUE);
}
if($tablerender)
{
$text = $ns->tablerender($caption, $text, '', TRUE);
}
if($return)
{
return $text;
}
else
{
echo $text;
}
if($return)
{
return $text;
}
else
{
echo $text;
}
}
else
{
echo "<br /><div style='text-align:center'><b>".COMLAN_6." <a href='".e_SIGNUP."'>".COMLAN_321."</a> ".COMLAN_322."</b></div>";
{ // Comment entry not allowed - point to signup link
echo "<br /><div style='text-align:center'><b>".COMLAN_6." <a href='".e_SIGNUP."'>".COMLAN_321."</a> ".COMLAN_322."</b></div>";
}
}
@ -502,20 +505,22 @@ class comment {
/**
* Enter description here...
*
* @param unknown_type $table
* @param unknown_type $action
* @param unknown_type $id
* @param unknown_type $width
* @param unknown_type $table - the source table for the associated item
* @param unknown_type $action - usually 'comment' or 'reply'
* @param unknown_type $id - ID of item associated with comments (e.g. news ID)
* @param unknown_type $width - appears to not be used
* @param unknown_type $subject
* @param unknown_type $rate
*/
function compose_comment($table, $action, $id, $width, $subject, $rate=FALSE, $return=FALSE, $tablerender=TRUE){
function compose_comment($table, $action, $id, $width, $subject, $rate=FALSE, $return=FALSE, $tablerender=TRUE)
{
//compose comment : single call function will render the existing comments and show the form_comment
//rate : boolean, to show/hide rating system in comment, default FALSE
global $pref, $sql, $ns, $e107cache, $tp, $totcc;
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE){
return;
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE)
{
return;
}
$count_comments = $this -> count_comments($table, $id, $pid=FALSE);
@ -541,44 +546,44 @@ class comment {
if ($comment_total = $sql->db_Select_gen($query))
{
$width = 0;
while ($row = $sql->db_Fetch())
$width = 0;
while ($row = $sql->db_Fetch())
{
$lock = $row['comment_lock'];
// $subject = $tp->toHTML($subject);
if ($pref['nested_comments'])
{
$lock = $row['comment_lock'];
// $subject = $tp->toHTML($subject);
if ($pref['nested_comments'])
{
$text .= $this->render_comment($row, $table , $action, $id, $width, $tp->toHTML($subject), $rate);
}
else
{
$text .= $this->render_comment($row, $table , $action, $id, $width, $tp->toHTML($subject), $rate);
}
$text .= $this->render_comment($row, $table , $action, $id, $width, $tp->toHTML($subject), $rate);
}
else
{
$text .= $this->render_comment($row, $table , $action, $id, $width, $tp->toHTML($subject), $rate);
}
}
if ($tablerender)
{
$text = $ns->tablerender(COMLAN_99, $text, '', TRUE);
}
if ($tablerender)
{
$text = $ns->tablerender(COMLAN_99, $text, '', TRUE);
}
if (!$return)
{
echo $text;
}
else
{
$ret['comment'] = $text;
}
if (!$return)
{
echo $text;
}
else
{
$ret['comment'] = $text;
}
if (ADMIN && getperms("B"))
{
$modcomment = "<div style='text-align:right'><a href='".e_ADMIN_ABS."modcomment.php?$table.$id'>".COMLAN_314."</a></div><br />";
}
if (ADMIN && getperms("B"))
{
$modcomment = "<div style='text-align:right'><a href='".e_ADMIN_ABS."modcomment.php?$table.$id'>".COMLAN_314."</a></div><br />";
}
}
if ($lock != "1")
{
$comment = $this->form_comment($action, $table, $id, $subject, "", TRUE, $rate, $tablerender);
$comment = $this->form_comment($action, $table, $id, $subject, "", TRUE, $rate, $tablerender);
}
else
{
@ -597,6 +602,9 @@ class comment {
return (!$return) ? "" : $ret;
}
function recalc_user_comments($id)
{
global $sql;
@ -678,7 +686,7 @@ class comment {
$fl = new e_file;
$omit = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$','.bak$');
$files = $fl->get_files(e_PLUGIN, $fmask = 'e_comment.php', $omit, $recurse_level = 1, $current_level = 0);
$files = $fl->get_files(e_PLUGIN, 'e_comment.php', $omit, 1, 0);
foreach($files as $file){
unset($e_comment, $key);
@ -754,7 +762,7 @@ 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_id!='' ".$qry1." ORDER BY c.comment_datestamp DESC LIMIT ".intval($from1).",".intval($amount1)." ";
WHERE c.comment_id!='' AND c.comment_blocked = 0 ".$qry1." ORDER BY c.comment_datestamp DESC LIMIT ".intval($from1).",".intval($amount1)." ";
if ($comment_total = $sql->db_Select_gen($query))
{

View File

@ -4,8 +4,8 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_comment.php,v $
| $Revision: 1.4 $
| $Date: 2007-12-25 12:43:05 $
| $Revision: 1.5 $
| $Date: 2008-05-25 08:26:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -30,6 +30,7 @@ define("COMLAN_102", "Replying to: ");
define("COMLAN_103", "Article");
define("COMLAN_104", "Review");
define("COMLAN_105", "Content");
define("COMLAN_106", "Download");
define("COMLAN_145", "Registered: ");
define("COMLAN_194", "Guest");
define("COMLAN_195", "Registered member");

View File

@ -12,9 +12,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/content.php,v $
| $Revision: 1.18 $
| $Date: 2008-02-20 21:42:25 $
| $Author: lisa_ $
| $Revision: 1.19 $
| $Date: 2008-05-25 08:26:11 $
| $Author: e107steved $
+---------------------------------------------------------------+
*/
@ -1062,9 +1062,11 @@ function show_content_item(){
global $pref, $content_pref, $custom, $plugindir, $plugintable, $array, $content_shortcodes, $datequery, $order, $nextprevquery, $from, $number, $row, $qs, $gen, $sql, $aa, $tp, $rs, $cobj, $e107, $e107cache, $eArrayStorage, $ns, $rater, $ep, $row, $authordetails, $mainparent;
global $CONTENT_CONTENT_TABLE_TEXT, $CONTENT_CONTENT_TABLE_PAGENAMES, $CONTENT_CONTENT_TABLE_SUMMARY, $CONTENT_CONTENT_TABLE_CUSTOM_TAGS, $CONTENT_CONTENT_TABLE_PARENT, $CONTENT_CONTENT_TABLE_INFO_PRE, $CONTENT_CONTENT_TABLE_INFO_POST, $CM_AUTHOR, $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA, $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA;
global $CONTENT_CONTENT_TABLE_PREV_PAGE, $CONTENT_CONTENT_TABLE_NEXT_PAGE;
global $comment_edit_query;
$mainparent = $aa -> getMainParent(intval($qs[1]));
$content_pref = $aa -> getContentPref($mainparent, true);
$comment_edit_query = 'comment.pcontent.'.$qs[1];
show_content_search_menu("item", $mainparent); //show navigator/search/order menu
$array = $aa -> getCategoryTree("", $mainparent, TRUE);