mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Bugtracker #4302 and general reorganisation of comment table for 0.8
This commit is contained in:
parent
8ac2be2e12
commit
e01a9ce04e
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/admin_log.php,v $
|
||||
| $Revision: 1.13 $
|
||||
| $Date: 2008-05-17 15:00:32 $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2008-05-24 12:45:26 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
| Preferences:
|
||||
@ -527,7 +527,7 @@ $col_fields = array('adminlog' => array('cf_datestring','dblog_type','dblog_ip',
|
||||
'rolllog' => array('cf_datestring','dblog_type','dblog_ip','dblog_user_id','dblog_user_name','dblog_eventcode','dblog_caller','dblog_title','dblog_remarks'),
|
||||
'downlog' => array('cf_datestring','dblog_ip','dblog_user_id','user_name','download_request_download_id','download_name'),
|
||||
'detailed' => array('cf_microtime','cf_microtimediff','source','dblog_type','dblog_ip','dblog_user_id','user_name','dblog_eventcode','dblog_title','dblog_remarks'),
|
||||
'comments' => array('cf_datestring', 'comment_id', 'comment_pid', 'comment_item_id', 'comment_subject', 'author_id', 'comment_author', 'comment_ip', 'comment_type', 'comment_comment', 'comment_blocked', 'comment_lock', 'del_check')
|
||||
'comments' => array('cf_datestring', 'comment_id', 'comment_pid', 'comment_item_id', 'comment_subject', 'comment_author_id', 'comment_author_name', 'comment_ip', 'comment_type', 'comment_comment', 'comment_blocked', 'comment_lock', 'del_check')
|
||||
);
|
||||
$col_widths = array('adminlog' => array(18,4,14,7,15,8,14,20), // Date - Pri - IP - UID - User - Code - Event - Info
|
||||
'auditlog' => array(18,14,7,15,8,14,24),
|
||||
@ -570,9 +570,7 @@ $base_query = array(
|
||||
UNION
|
||||
SELECT dblog_datestamp + (dblog_microtime/1000000) AS dblog_time, dblog_user_id, dblog_eventcode, dblog_title, dblog_remarks, dblog_type, dblog_ip, 'admin' AS source FROM `#admin_log`) AS cl
|
||||
LEFT JOIN `#user` AS u ON cl.dblog_user_id=u.user_id ",
|
||||
'comments' => "SELECT SQL_CALC_FOUND_ROWS *, comment_datestamp AS dblog_datestamp, SUBSTRING_INDEX(c.comment_author,'.',1) as author_id
|
||||
FROM `#comments` AS c"
|
||||
// LEFT JOIN `#user` AS u ON SUBSTRING_INDEX(c.comment_author,'.',1) = u.user_id"
|
||||
'comments' => "SELECT SQL_CALC_FOUND_ROWS *, comment_datestamp AS dblog_datestamp FROM `#comments` AS c"
|
||||
);
|
||||
|
||||
// The filters have to use the 'actual' db field names. So the following table sets the defaults and the exceptions which vary across the range of tables supported
|
||||
@ -580,7 +578,7 @@ $map_filters = array(
|
||||
'default' => array('datetimes' => '`dblog_datestamp`', 'ipfilter' => '`dblog_ip`', 'userfilter' => '`dblog_user_id`', 'eventfilter' => '`dblog_eventcode`'),
|
||||
'downlog' => array('datetimes' => '`download_request_datestamp`', 'ipfilter' => '`download_request_ip`', 'userfilter' => '`download_request_userid`'),
|
||||
'detailed' => array('datestart' => '`dblog_time`'),
|
||||
'comments' => array('datetimes' => '`comment_datestamp`', 'ipfilter' => '`comment_ip`', 'eventfilter' => 'comment_type', 'userfilter' => "SUBSTRING_INDEX(c.`comment_author`,'.',1)")
|
||||
'comments' => array('datetimes' => '`comment_datestamp`', 'ipfilter' => '`comment_ip`', 'eventfilter' => 'comment_type', 'userfilter' => '`comment_author_id`')
|
||||
);
|
||||
|
||||
|
||||
@ -905,9 +903,6 @@ function log_process($matches)
|
||||
// Look for pseudo-code for newlines, link insertion
|
||||
$val = preg_replace_callback("#\[!(\w+?)(=.+?){0,1}!]#",'log_process',$row['dblog_remarks']);
|
||||
break;
|
||||
case 'comment_author' :
|
||||
list(,$val) = explode('.',$row['comment_author'],2);
|
||||
break;
|
||||
case 'comment_ip' :
|
||||
$val = $row['comment_ip'];
|
||||
if (strlen($val) == 8)
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-01-20 22:21:14 $
|
||||
| $Author: secretr $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2008-05-24 12:45:27 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
header("location:../index.php");
|
||||
@ -121,7 +121,8 @@ CREATE TABLE comments (
|
||||
comment_pid int(10) unsigned NOT NULL default '0',
|
||||
comment_item_id int(10) unsigned NOT NULL default '0',
|
||||
comment_subject varchar(100) NOT NULL default '',
|
||||
comment_author varchar(100) NOT NULL default '',
|
||||
comment_author_id int(10) unsigned NOT NULL default '0',
|
||||
comment_author_name varchar(100) NOT NULL default '',
|
||||
comment_author_email varchar(200) NOT NULL default '',
|
||||
comment_datestamp int(10) unsigned NOT NULL default '0',
|
||||
comment_comment text NOT NULL,
|
||||
|
@ -11,12 +11,13 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
|
||||
| $Revision: 1.20 $
|
||||
| $Date: 2008-04-29 19:44:17 $
|
||||
| $Revision: 1.21 $
|
||||
| $Date: 2008-05-24 12:45:26 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
require_once("../class2.php");
|
||||
require_once(e_HANDLER.'db_table_admin_class.php');
|
||||
|
||||
@ -28,6 +29,8 @@ require_once(e_HANDLER.'db_table_admin_class.php');
|
||||
|
||||
// To do - how do we handle multi-language tables?
|
||||
|
||||
// If following line uncommented, enables a test routine
|
||||
//define('TEST_UPDATE',TRUE);
|
||||
$update_debug = FALSE; // TRUE gives extra messages in places
|
||||
//$update_debug = TRUE; // TRUE gives extra messages in places
|
||||
|
||||
@ -89,6 +92,10 @@ foreach ($dbupdateplugs as $path => $ver)
|
||||
|
||||
|
||||
// List of potential updates
|
||||
if (defined('TEST_UPDATE'))
|
||||
{
|
||||
$dbupdate["test_code"] = "Test update routine";
|
||||
}
|
||||
$dbupdate["core_prefs"] = LAN_UPDATE_13; // Prefs check
|
||||
$dbupdate["706_to_800"] = LAN_UPDATE_8." .706 ".LAN_UPDATE_9." .8";
|
||||
$dbupdate["70x_to_706"] = LAN_UPDATE_8." .70x ".LAN_UPDATE_9." .706";
|
||||
@ -175,6 +182,24 @@ function update_core_prefs($type='')
|
||||
}
|
||||
|
||||
|
||||
if (defined('TEST_UPDATE'))
|
||||
{
|
||||
//--------------------------------------------
|
||||
// Test routine - to activate, define TEST_UPDATE
|
||||
//--------------------------------------------
|
||||
function update_test_code($type='')
|
||||
{
|
||||
global $sql,$ns, $pref;
|
||||
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing whether an update is needed
|
||||
//--------------**************---------------
|
||||
// Add your test code in here
|
||||
//--------------**************---------------
|
||||
|
||||
|
||||
return $just_check;
|
||||
}
|
||||
} // End of test routine
|
||||
|
||||
//--------------------------------------------
|
||||
// Upgrade later versions of 0.7.x to 0.8
|
||||
//--------------------------------------------
|
||||
@ -211,7 +236,7 @@ function update_706_to_800($type='')
|
||||
$db_parser = new db_table_admin; // Class to read table defs and process them
|
||||
$do_save = FALSE; // Set TRUE to update prefs when update complete
|
||||
|
||||
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing if an update is needed
|
||||
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing whether an update is needed
|
||||
|
||||
|
||||
if (isset($pref['forum_user_customtitle']) && !isset($pref['signup_option_customtitle']))
|
||||
@ -307,6 +332,42 @@ function update_706_to_800($type='')
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Comments - split user field
|
||||
//---------------------------------------------------------
|
||||
if($sql->db_Field("comments","comment_author"))
|
||||
{
|
||||
if ($just_check) return update_needed('Comment table author field update');
|
||||
if ((!$sql->db_Field("comments","comment_author_id")) // Check to see whether new fields already added - maybe data copy failed part way through
|
||||
&& (!$sql->db_Select_gen("ALTER TABLE `#comments`
|
||||
ADD COLUMN comment_author_id int(10) unsigned NOT NULL default '0' AFTER `comment_author`,
|
||||
ADD COLUMN comment_author_name varchar(100) NOT NULL default '' AFTER `comment_author_id`")))
|
||||
{
|
||||
// Flag error
|
||||
echo "Error<br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$sql->db_Update("comments","comment_author_id=SUBSTRING_INDEX(`comment_author`,'.',1), comment_author_name=SUBSTRING(`comment_author` FROM POSITION('.' IN `comment_author`)+1)"))
|
||||
{
|
||||
// Flag error
|
||||
echo "Error<br />";
|
||||
}
|
||||
else
|
||||
{ // Delete superceded field - comment_author
|
||||
if (!$sql->db_Select_gen("ALTER TABLE `#comments` DROP COLUMN `comment_author`"))
|
||||
{
|
||||
// Flag error
|
||||
echo "Error<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Add index to download history
|
||||
//---------------------------------------------------------
|
||||
if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."download_requests"))
|
||||
{
|
||||
$found = FALSE;
|
||||
@ -380,9 +441,9 @@ function update_706_to_800($type='')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Tables defined in core_sql.php
|
||||
//---------------------------------
|
||||
|
||||
if (mysql_table_exists('dblog') && !mysql_table_exists('admin_log'))
|
||||
{
|
||||
if ($just_check) return update_needed('Rename dblog to admin_log');
|
||||
@ -472,7 +533,7 @@ function update_706_to_800($type='')
|
||||
{
|
||||
if (strtolower($field_info['Type']) != 'varchar(45)')
|
||||
{
|
||||
if ($just_check) return update_needed('Update field '.$f.' in table '.$t);
|
||||
if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t);
|
||||
mysql_query("ALTER TABLE `".MPREFIX.$t."` MODIFY `{$f}` VARCHAR(45) NOT NULL DEFAULT '';");
|
||||
catch_error();
|
||||
}
|
||||
|
@ -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.4 $
|
||||
| $Date: 2007-08-17 19:23:26 $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-05-24 12:45:34 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -33,16 +33,20 @@ SC_END
|
||||
|
||||
SC_BEGIN USERNAME
|
||||
global $USERNAME, $comrow;
|
||||
if (isset($comrow['user_id']) && $comrow['user_id']) {
|
||||
if (isset($comrow['user_id']) && $comrow['user_id'])
|
||||
{
|
||||
$USERNAME = "<a href='".e_BASE."user.php?id.".$comrow['user_id']."'>".$comrow['user_name']."</a>\n";
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
$comrow['user_id'] = 0;
|
||||
$USERNAME = preg_replace("/[0-9]+\./", '', $comrow['comment_author']);
|
||||
$USERNAME = preg_replace("/[0-9]+\./", '', $comrow['comment_author_name']);
|
||||
$USERNAME = str_replace("Anonymous", LAN_ANONYMOUS, $USERNAME);
|
||||
}
|
||||
return $USERNAME;
|
||||
SC_END
|
||||
|
||||
|
||||
SC_BEGIN TIMEDATE
|
||||
global $TIMEDATE, $comrow, $datestamp, $gen;
|
||||
$datestamp = $gen->convert_date($comrow['comment_datestamp'], "short");
|
||||
@ -122,8 +126,8 @@ SC_END
|
||||
|
||||
SC_BEGIN IPADDRESS
|
||||
global $IPADDRESS, $comrow;
|
||||
require_once(e_HANDLER."encrypt_handler.php");
|
||||
return (ADMIN ? "<a href='".e_BASE."userposts.php?0.comments.".$comrow['user_id']."'>".COMLAN_330." ".decode_ip($comrow['comment_ip'])."</a>" : "");
|
||||
//require_once(e_HANDLER."encrypt_handler.php");
|
||||
return (ADMIN ? "<a href='".e_BASE."userposts.php?0.comments.".$comrow['user_id']."'>".COMLAN_330." ".$comrow['comment_ip']."</a>" : "");
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LEVEL
|
||||
|
@ -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.9 $
|
||||
| $Date: 2008-04-14 19:07:02 $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2008-05-24 12:45:27 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -100,7 +100,15 @@ class comment {
|
||||
$id=intval($id);
|
||||
$sql -> db_Select("comments", "*", "comment_id='$id' ");
|
||||
$ecom = $sql -> db_Fetch();
|
||||
list($prid, $pname) = explode(".", $ecom['comment_author']);
|
||||
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'];
|
||||
}
|
||||
|
||||
if($prid != USERID || !USER)
|
||||
{
|
||||
@ -171,13 +179,15 @@ class comment {
|
||||
* @param unknown_type $addrating
|
||||
* @return unknown
|
||||
*/
|
||||
function render_comment($row, $table, $action, $id, $width, $subject, $addrating=FALSE) {
|
||||
function render_comment($row, $table, $action, $id, $width, $subject, $addrating=FALSE)
|
||||
{
|
||||
//addrating : boolean, to show rating system in rendered comment
|
||||
global $sql, $sc_style, $comment_shortcodes, $COMMENTSTYLE, $rater, $gen, $imode;
|
||||
global $pref, $comrow, $tp, $NEWIMAGE, $USERNAME, $RATING, $datestamp;
|
||||
global $thisaction, $thistable, $thisid;
|
||||
|
||||
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE){
|
||||
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -210,7 +220,8 @@ class comment {
|
||||
$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?".$comrow['comment_ip']."'>".COMLAN_4."</a>]";
|
||||
|
||||
if (!$COMMENTSTYLE) {
|
||||
if (!$COMMENTSTYLE)
|
||||
{
|
||||
global $THEMES_DIRECTORY;
|
||||
$COMMENTSTYLE = "";
|
||||
if (file_exists(THEME."comment_template.php")) {
|
||||
@ -219,7 +230,8 @@ class comment {
|
||||
require_once(e_BASE.$THEMES_DIRECTORY."templates/comment_template.php");
|
||||
}
|
||||
}
|
||||
if ($pref['nested_comments']) {
|
||||
if ($pref['nested_comments'])
|
||||
{
|
||||
$width2 = 100 - $width;
|
||||
$total_width = "95%";
|
||||
if($width)
|
||||
@ -273,8 +285,8 @@ class comment {
|
||||
$sub_query = "
|
||||
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
|
||||
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'])."'
|
||||
ORDER BY comment_datestamp
|
||||
";
|
||||
@ -308,11 +320,13 @@ class comment {
|
||||
* @param unknown_type $subject
|
||||
* @param unknown_type $rateindex
|
||||
*/
|
||||
function enter_comment($author_name, $comment, $table, $id, $pid, $subject, $rateindex=FALSE) {
|
||||
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 $sql, $sql2, $tp, $e107cache, $e_event, $e107, $pref, $rater;
|
||||
|
||||
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE){
|
||||
if(isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -341,22 +355,33 @@ class comment {
|
||||
|
||||
$comment = $tp->toDB($comment);
|
||||
$subject = $tp->toDB($subject);
|
||||
if (!$sql->db_Select("comments", "*", "comment_comment='".$comment."' AND comment_item_id='".intval($id)."' AND comment_type='".$tp -> toDB($type, true)."' ")) {
|
||||
if ($_POST['comment']) {
|
||||
if (USER == TRUE) {
|
||||
$nick = USERID.".".USERNAME;
|
||||
} else if($_POST['author_name'] == '') {
|
||||
$nick = "0.Anonymous";
|
||||
} else {
|
||||
if ($sql2->db_Select("user", "*", "user_name='".$tp -> toDB($_POST['author_name'])."' ")) {
|
||||
if ($sql2->db_Select("user", "*", "user_name='".$tp -> toDB($_POST['author_name'])."' AND user_ip='".$tp -> toDB($ip, true)."' ")) {
|
||||
$cuser_id = 0;
|
||||
$cuser_name = 'Anonymous'; // Preset as an anonymous comment
|
||||
if (!$sql->db_Select("comments", "*", "comment_comment='".$comment."' AND comment_item_id='".intval($id)."' AND comment_type='".$tp -> toDB($type, true)."' "))
|
||||
{
|
||||
if ($_POST['comment'])
|
||||
{
|
||||
if (USER == TRUE)
|
||||
{
|
||||
$cuser_id = USERID;
|
||||
$cuser_name = USERNAME;
|
||||
}
|
||||
elseif($_POST['author_name'] != '')
|
||||
{ // See if author name is registered user
|
||||
if ($sql2->db_Select("user", "*", "user_name='".$tp -> toDB($_POST['author_name'])."' "))
|
||||
{
|
||||
if ($sql2->db_Select("user", "*", "user_name='".$tp -> toDB($_POST['author_name'])."' AND user_ip='".$tp -> toDB($ip, true)."' "))
|
||||
{
|
||||
list($cuser_id, $cuser_name) = $sql2->db_Fetch();
|
||||
$nick = $cuser_id.".".$cuser_name;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
define("emessage", COMLAN_310);
|
||||
}
|
||||
} else {
|
||||
$nick = "0.".$tp->toDB($author_name);
|
||||
}
|
||||
else
|
||||
{ // User not on-line, so can't be entering comments
|
||||
$cuser_name = $tp->toDB($author_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,21 +393,43 @@ class comment {
|
||||
if($editpid)
|
||||
{
|
||||
$comment .= "\n[ ".COMLAN_319." [time=short]".time()."[/time] ]";
|
||||
$sql -> db_Update("comments", "comment_comment='$comment' WHERE comment_id='".intval($editpid)."' ");
|
||||
$sql -> db_Update("comments", "comment_comment='{$comment}' WHERE comment_id='".intval($editpid)."' ");
|
||||
$e107cache->clear("comment");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$sql->db_Insert("comments", "0, '".intval($pid)."', '".intval($id)."', '$subject', '$nick', '', '".$_t."', '$comment', '0', '$ip', '".$tp -> toDB($type, true)."', '0' "))
|
||||
$edata_li = array(
|
||||
// comment_id - auto-assigned
|
||||
'comment_pid' => intval($pid),
|
||||
"comment_item_id" => $id,
|
||||
"comment_subject" => $subject,
|
||||
'comment_author_id' => $cuser_id,
|
||||
'comment_author_name' => $cuser_name,
|
||||
// 'comment_author_email' => '', Field not saved ATM
|
||||
"comment_datestamp" => $_t,
|
||||
"comment_comment" => $comment,
|
||||
'comment_ip' => $ip,
|
||||
"comment_type" => $tp -> toDB($type, true)
|
||||
);
|
||||
// if (!$sql->db_Insert("comments", "0, '".intval($pid)."', '".intval($id)."', '$subject', '$nick', '', '".$_t."', '$comment', '0', '$ip', '".$tp -> toDB($type, true)."', '0' "))
|
||||
if (!$sql->db_Insert("comments", $edata_li))
|
||||
{
|
||||
echo "<b>".COMLAN_323."</b> ".COMLAN_11;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (USER == TRUE) {
|
||||
if (USER == TRUE)
|
||||
{
|
||||
$sql -> db_Update("user", "user_comments=user_comments+1, user_lastpost='".time()."' WHERE user_id='".USERID."' ");
|
||||
}
|
||||
$edata_li = array("comment_type" => $type, "comment_subject" => $subject, "comment_item_id" => $id, "comment_nick" => $nick, "comment_time" => $_t, "comment_comment" => $comment);
|
||||
// Next item for backward compatibility
|
||||
$edata_li["comment_nick"] = $cuser_id.'.'.$cuser_name;
|
||||
$edata_li["comment_time"] = $_t;
|
||||
unset($edata_li['comment_pid']);
|
||||
unset($edata_li['comment_author_email']);
|
||||
unset($edata_li['comment_ip']);
|
||||
|
||||
// $edata_li = array("comment_type" => $type, "comment_subject" => $subject, "comment_item_id" => $id, "comment_nick" => $nick, "comment_time" => $_t, "comment_comment" => $comment);
|
||||
$e_event->trigger("postcomment", $edata_li);
|
||||
$e107cache->clear("comment");
|
||||
if(!$type || $type == "news")
|
||||
@ -477,13 +524,13 @@ class comment {
|
||||
|
||||
$query = $pref['nested_comments'] ?
|
||||
"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
|
||||
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"
|
||||
:
|
||||
"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
|
||||
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";
|
||||
|
||||
$text = "";
|
||||
@ -565,7 +612,7 @@ class comment {
|
||||
$qry = "
|
||||
SELECT COUNT(*) AS count
|
||||
FROM #comments
|
||||
WHERE SUBSTRING_INDEX(comment_author,'.',1) = '{$id}'
|
||||
WHERE comment_author_id = '{$id}'
|
||||
";
|
||||
if($sql->db_Select_gen($qry))
|
||||
{
|
||||
@ -574,12 +621,13 @@ class comment {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_author_list($id, $comment_type)
|
||||
{
|
||||
global $sql;
|
||||
$authors = array();
|
||||
$qry = "
|
||||
SELECT DISTINCT(SUBSTRING_INDEX(comment_author,'.',1)) AS author
|
||||
SELECT DISTINCT(comment_author_id,) AS author
|
||||
FROM #comments
|
||||
WHERE comment_item_id='{$id}' AND comment_type='{$comment_type}'
|
||||
GROUP BY author
|
||||
@ -594,6 +642,8 @@ class comment {
|
||||
return $authors;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function delete_comments($table, $id)
|
||||
{
|
||||
global $sql, $tp;
|
||||
@ -616,10 +666,11 @@ class comment {
|
||||
//6) from file: render the returned data
|
||||
|
||||
//get all e_comment.php files and collect the variables
|
||||
function get_e_comment(){
|
||||
|
||||
function get_e_comment()
|
||||
{
|
||||
$data = getcachedvars('e_comment');
|
||||
if($data!==FALSE){
|
||||
if($data!==FALSE)
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -671,7 +722,8 @@ class comment {
|
||||
* @param array $cdreta : current data set
|
||||
*/
|
||||
|
||||
function getCommentData($amount='', $from='', $qry='', $cdvalid=FALSE, $cdreta=FALSE){
|
||||
function getCommentData($amount='', $from='', $qry='', $cdvalid=FALSE, $cdreta=FALSE)
|
||||
{
|
||||
global $pref, $menu_pref, $sql, $sql2, $tp;
|
||||
|
||||
$from1 = ($from ? $from : '0');
|
||||
@ -700,8 +752,8 @@ class comment {
|
||||
|
||||
$query = "
|
||||
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
|
||||
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)." ";
|
||||
|
||||
if ($comment_total = $sql->db_Select_gen($query))
|
||||
@ -714,11 +766,9 @@ class comment {
|
||||
//date
|
||||
$ret['comment_datestamp'] = $row['comment_datestamp'];
|
||||
|
||||
//author
|
||||
$comment_author_id = substr($row['comment_author'] , 0, strpos($row['comment_author'] , "."));
|
||||
$comment_author_name = substr($row['comment_author'] , (strpos($row['comment_author'] , ".")+1));
|
||||
$ret['comment_author_id'] = $comment_author_id;
|
||||
$ret['comment_author_name'] = $comment_author_name;
|
||||
//author - no ned to split now
|
||||
$comment_author_id = $ret['comment_author_id'];
|
||||
$comment_author_name = $ret['comment_author_name'];
|
||||
$ret['comment_author'] = (USERID ? "<a href='".e_BASE."user.php?id.".$comment_author_id."'>".$comment_author_name."</a>" : $comment_author_name);
|
||||
|
||||
//comment text
|
||||
|
Loading…
x
Reference in New Issue
Block a user