1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-16 11:36:08 +02:00

Bugtracker #4651 - news comment counting

This commit is contained in:
e107steved
2009-05-08 21:50:19 +00:00
parent 790aba1069
commit c5b338c6fc
4 changed files with 134 additions and 42 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/modcomment.php,v $
| $Revision: 1.6 $
| $Date: 2009-04-16 20:50:38 $
| $Revision: 1.7 $
| $Date: 2009-05-08 21:50:19 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -50,19 +50,14 @@ if (isset($_POST['moderate']))
{
$sql->db_Update('comments', "comment_lock='0' WHERE `comment_item_id`=".$id." AND `comment_type`='".$tp -> toDB($type, true)."' ");
}
if (is_array($_POST['comment_blocked']))
{
while (list ($key, $cid) = each ($_POST['comment_blocked']))
{
$sql->db_Update('comments', "comment_blocked='1' WHERE `comment_id`=".$cid);
if (is_array($_POST['comment_blocked'])) {
while (list ($key, $cid) = each ($_POST['comment_blocked'])) {
$sql->db_Update("comments", "comment_blocked='1' WHERE comment_id='$cid' ");
}
}
if (is_array($_POST['comment_unblocked']))
{
while (list ($key, $cid) = each ($_POST['comment_unblocked']))
{
$sql->db_Update('comments', "comment_blocked='0' WHERE `comment_id`=".$cid);
if (is_array($_POST['comment_unblocked'])) {
while (list ($key, $cid) = each ($_POST['comment_unblocked'])) {
$sql->db_Update("comments", "comment_blocked='0' WHERE comment_id='$cid' ");
}
}
if (is_array($_POST['comment_delete']))
@@ -172,24 +167,32 @@ $ns->tablerender(MDCLAN_8, $text);
require_once("footer.php");
function delete_children($row, $cid) {
function delete_children($row, $cid)
{
global $sql, $sql2, $table;
$tmp = explode(".", $row['comment_author']);
$u_id = $tmp[0];
if ($u_id >= 1) {
$sql->db_Update("user", "user_comments=user_comments-1 WHERE user_id='$u_id'");
$u_id = intval($tmp[0]);
if ($u_id >= 1)
{
$sql->db_Update("user", "user_comments=user_comments-1 WHERE user_id=".$u_id);
}
if($table == "news"){
if (($table == "news") || ($table == '0'))
{
$sql->db_Update("news", "news_comment_total=news_comment_total-1 WHERE news_id='".$row['comment_item_id']."'");
}
if ($sql2->db_Select("comments", "*", "comment_pid='".$row['comment_id']."'")) {
while ($row2 = $sql2->db_Fetch()) {
if ($sql2->db_Select("comments", "*", "comment_pid='".$row['comment_id']."'"))
{
while ($row2 = $sql2->db_Fetch())
{
delete_children($row2, $row2['comment_id']);
}
}
$c_del[] = $cid;
while (list ($key, $cid) = each ($c_del)) {
while (list ($key, $cid) = each ($c_del))
{
$sql->db_Delete("comments", "comment_id='$cid'");
}
}