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

Bugtracker #4990, EONE-14:bug - couldn't edit comments on user info page

This commit is contained in:
e107steved
2010-08-23 07:28:46 +00:00
parent 8f12e9ada3
commit 049cf5344b
5 changed files with 248 additions and 225 deletions

View File

@@ -1,20 +1,15 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Copyright (C) 2008-2009 e107 Inc
| http://e107.org
|
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/comment.php,v $
| $Revision$
| $Date$
| $Author$
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2008-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Comment handling generic interface
*
* $URL$
* $Id$
*/
@@ -44,7 +39,7 @@ $cobj = new comment;
$temp_query = explode(".", e_QUERY);
$action = $temp_query[0]; // Usually says 'comment' - may say 'reply'
$table = $temp_query[1]; // Table containing item associated with comment(s)
$id = intval(varset($temp_query[2], "")); // ID of item associated with comments (e.g. news ID)
$id = intval(varset($temp_query[2], 0)); // ID of item associated with comments (e.g. news ID)
// For reply with nested comments, its the ID of the 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
@@ -61,21 +56,27 @@ if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit']))
exit;
}
if($table == "poll")
switch ($table)
{
case 'poll' :
if (!$sql->db_Select("polls", "poll_title", "`poll_id` = '{$id}' AND `poll_comment` = 1"))
{
header("location: ".e_BASE."index.php");
exit;
}
}
elseif($table == "news")
{
break;
case 'news' :
if (!$sql->db_Select("news", "news_allow_comments", "`news_id` = '{$id}' AND `news_allow_comments` = 0"))
{
header("location: ".e_BASE."index.php");
exit;
}
case 'user' :
if (!$sql->db_Select('user', 'user_name', '`user_id` ='.$id))
{
header("location: ".e_BASE."index.php");
exit;
}
}
$pid = intval(varset($_POST['pid'], 0)); // ID of the specific comment being edited (nested comments - replies)
@@ -135,13 +136,33 @@ if (isset($_POST['replysubmit']))
if ($redirectFlag)
{ // Need to go back to original page
// Check for core tables first
switch ($table)
{
case "news" :
header('Location: '.e107::getUrl()->create('core:news', 'main', 'action=extend&id='.$redirectFlag));
exit;
case "poll" :
echo "<script type='text/javascript'>document.location.href='".e_HTTP."comment.php?comment.{$table}.{$redirectFlag}'</script>\n";
exit;
case "download" :
echo "<script type='text/javascript'>document.location.href='".e_HTTP."download.php?view.{$redirectFlag}'</script>\n";
exit;
case "page" :
echo "<script type='text/javascript'>document.location.href='".e_HTTP."page.php?{$redirectFlag}'</script>\n";
exit;
case 'user' :
echo "<script type='text/javascript'>document.location.href='".e_HTTP."user.php?id.{$redirectFlag}'</script>\n";
exit;
}
// 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']);
$reply_location = str_replace('{NID}', $redirectFlag, $e_comment[$table]['reply_location']);
}
if ($plugin_redir)
@@ -149,28 +170,8 @@ if ($redirectFlag)
echo "<script type='text/javascript'>document.location.href='{$reply_location}'</script>\n";
exit;
}
else
{
switch ($table)
{
case "news" :
header('Location: '.e107::getUrl()->create('core:news', 'main', 'action=extend&id='.$redirectFlag));
exit;
case "poll" :
echo "<script type='text/javascript'>document.location.href='".e_HTTP."comment.php?comment.{$table}.{$redirectFlag}'</script>\n";
exit;
break;
case "download" :
echo "<script type='text/javascript'>document.location.href='".e_HTTP."download.php?view.{$redirectFlag}'</script>\n";
exit;
break;
case "page" :
echo "<script type='text/javascript'>document.location.href='".e_HTTP."page.php?{$redirectFlag}'</script>\n";
exit;
break;
}
}
// No redirect found if we get here.
}
$comment_ob_start = FALSE;
@@ -232,6 +233,19 @@ if ($action == "reply")
exit;
}
break;
case 'user' :
if ($sql->db_Select('user','user_name',"user_id={$nid} "))
{
$row = $sql->db_Fetch();
$subject = $row['user_name'];
$title = COMLAN_12;
}
else
{
header("location:".e_BASE."index.php");
exit;
}
break;
}
}
define('e_PAGETITLE', COMLAN_102.$subject.($title ? ' / '.$title : '')." / ".COMLAN_99);
@@ -330,7 +344,21 @@ elseif ($action == 'comment')
exit;
}
break;
case 'user' :
if ($sql->db_Select('user','user_name',"user_id={$id} "))
{
$row = $sql->db_Fetch();
$subject = $row['user_name'];
//$title = 'Edit comment about user';
$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'])

View File

@@ -8,10 +8,8 @@
*
* User information - shortcodes
*
* $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/user_shortcodes.php,v $
* $Revision$
* $Date$
* $Author$
* $URL$
* $Id$
*
*/
if (!defined('e107_INIT')) { exit; }
@@ -471,9 +469,9 @@ if($pref['profile_comments'])
$cobj = new comment;
$qry = "
SELECT c.*, u.*, ue.* FROM #comments AS c
LEFT JOIN #user AS u ON c.comment_author = u.user_id
LEFT JOIN #user_extended AS ue ON c.comment_author = ue.user_extended_id
WHERE c.comment_item_id='".intval($user['user_id'])."'
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($user['user_id'])."
AND c.comment_type='profile'
AND c.comment_pid='0'
ORDER BY c.comment_datestamp
@@ -502,7 +500,7 @@ if($pref['profile_comments'])
{
$ret .= "<a href='".e_BASE.e_ADMIN."modcomment.php?profile.{$user['user_id']}'>".COMLAN_314."</a><br /><br />";
}
$ret .= $cobj->form_comment("comment", "profile", $user['user_id'], "", "", TRUE);
$ret .= $cobj->form_comment("comment", "profile", $user['user_id'], $user['user_name'], "", TRUE);
return $ret;
}
SC_END

View File

@@ -1,21 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Copyright (C) 2008-2009 e107 Inc (e107.org)
| http://e107.org
|
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/comment_class.php,v $
| $Revision$
| $Date$
| $Author$
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2002-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Comment handler class
*
* $URL$
* $Id$
*/
if (!defined('e107_INIT'))
{
exit;
@@ -24,8 +20,12 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");
global $comment_shortcodes;
require_once (e_CORE."shortcodes/batch/comment_shortcodes.php");
/**
* Enter description here...
*
* @package e107
* @subpackage e107_handlers
* @version $Id$;
*
* This class handles all comment-related functions.
*/
@@ -53,8 +53,6 @@ class comment
* @param unknown_type $rating
* @return unknown
*/
function form_comment($action, $table, $id, $subject, $content_type, $return = FALSE, $rating = FALSE, $tablerender = TRUE)
{
//rating : boolean, to show rating system in comment

View File

@@ -22,6 +22,7 @@ define("COMLAN_8", "Comment");
define("COMLAN_9", "Submit comment");
define("COMLAN_10", "Administrator");
define("COMLAN_11", "Was unable to enter your comment into the database - please retype leaving out any non-standard characters.");
define('COMLAN_12', 'User');
define("COMLAN_16", "Username: ");
define("COMLAN_99", "Comments");
define("COMLAN_100", "News");
@@ -63,6 +64,6 @@ define("COMLAN_TYPE_5", "docs");
define("COMLAN_TYPE_6", "bugtrack");
define("COMLAN_TYPE_7", "ideas");
define("COMLAN_TYPE_8", "userprofile");
define("COMLAN_TYPE_PAGE", "Content"); // Reall custom page, but use a 'non-technical' description
define("COMLAN_TYPE_PAGE", "Content"); // Really custom page, but use a 'non-technical' description
?>

View File

@@ -2,16 +2,14 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* User information
*
* $Source: /cvs_backup/e107_0.8/user.php,v $
* $Revision$
* $Date$
* $Author$
* $URL$
* $Id$
*
*/
//HCL define('PAGE_NAME', 'Members');
@@ -126,16 +124,16 @@ if (isset($id))
exit;
}
if (isset($_POST['commentsubmit']) && $pref['profile_comments'])
{
require_once(e_HANDLER."comment_class.php");
$cobj = new comment;
$cobj->enter_comment($_POST['author_name'], $_POST['comment'], 'profile', $id, $pid, $_POST['subject']);
}
if($pref['profile_comments'])
{
include_once(e_HANDLER."comment_class.php");
require_once(e_HANDLER."comment_class.php");
$comment_edit_query = 'comment.user.'.$id;
}
if (isset($_POST['commentsubmit']) && $pref['profile_comments'])
{
$cobj = new comment;
$cobj->enter_comment($_POST['author_name'], $_POST['comment'], 'profile', $id, $pid, $_POST['subject']);
}
if($text = renderuser($id))