mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
Issue #2162 - possible fix.
This commit is contained in:
@@ -858,13 +858,16 @@ class comment
|
|||||||
unset($edata_li['comment_ip']);*/
|
unset($edata_li['comment_ip']);*/
|
||||||
|
|
||||||
e107::getEvent()->trigger("postcomment", $edata_li);
|
e107::getEvent()->trigger("postcomment", $edata_li);
|
||||||
|
e107::getEvent()->trigger('user_comment_posted', $edata_li);
|
||||||
e107::getCache()->clear("comment");
|
e107::getCache()->clear("comment");
|
||||||
|
|
||||||
|
// Moved to e107_plugins/news/e_event.php
|
||||||
|
/*
|
||||||
|
|
||||||
if ((empty($table) || $table == "news") && !$this->moderateComment($pref['comments_moderate']))
|
if ((empty($table) || $table == "news") && !$this->moderateComment($pref['comments_moderate']))
|
||||||
{
|
{
|
||||||
$sql->update("news", "news_comment_total=news_comment_total+1 WHERE news_id=".intval($id));
|
$sql->update("news", "news_comment_total=news_comment_total+1 WHERE news_id=".intval($id));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//if rateindex is posted, enter the rating from this user
|
//if rateindex is posted, enter the rating from this user
|
||||||
// if ($rateindex)
|
// if ($rateindex)
|
||||||
@@ -1521,7 +1524,7 @@ class comment
|
|||||||
{
|
{
|
||||||
$ret['comment_type'] = COMLAN_TYPE_8;
|
$ret['comment_type'] = COMLAN_TYPE_8;
|
||||||
$ret['comment_title'] = $comment_author_name;
|
$ret['comment_title'] = $comment_author_name;
|
||||||
$ret['comment_url'] = e107::getUrl()->create('user/pofile/view', array('id' => $row['user_id'], 'name' => $row['user_name']));//e_HTTP."user.php?id.".$row['comment_item_id'];
|
$ret['comment_url'] = e107::getUrl()->create('user/profile/view', array('id' => $row['user_id'], 'name' => $row['user_name']));//e_HTTP."user.php?id.".$row['comment_item_id'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'page': // Custom Page
|
case 'page': // Custom Page
|
||||||
|
61
e107_plugins/news/e_event.php
Normal file
61
e107_plugins/news/e_event.php
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
* XXX HIGHLY EXPERIMENTAL AND SUBJECT TO CHANGE WITHOUT NOTICE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
|
||||||
|
class news_event // plugin-folder + '_event'
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure functions/methods to run when specific e107 events are triggered.
|
||||||
|
* For a list of events, please visit: http://e107.org/developer-manual/classes-and-methods#events
|
||||||
|
* Developers can trigger their own events using: e107::getEvent()->trigger('plugin_event',$array);
|
||||||
|
* Where 'plugin' is the folder of their plugin and 'event' is a unique name of the event.
|
||||||
|
* $array is data which is sent to the triggered function. eg. myfunction($array) in the example below.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function config()
|
||||||
|
{
|
||||||
|
|
||||||
|
$event = array();
|
||||||
|
|
||||||
|
$event[] = array(
|
||||||
|
'name' => "user_comment_posted", // when this is triggered... (see http://e107.org/developer-manual/classes-and-methods#events)
|
||||||
|
'function' => "incrementComment", // ..run this function (see below).
|
||||||
|
);
|
||||||
|
|
||||||
|
return $event;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function incrementComment($data) // the method to run.
|
||||||
|
{
|
||||||
|
if($data['comment_type'] !== 'news' && !empty($data['comment_type']))
|
||||||
|
{
|
||||||
|
file_put_contents(e_LOG."news.event.log", print_r($data,true));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($data['comment_item_id']))
|
||||||
|
{
|
||||||
|
e107::getDb()->update("news", "news_comment_total=news_comment_total+1 WHERE news_id=".intval($data['comment_item_id']));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} //end class
|
||||||
|
|
Reference in New Issue
Block a user