<?php
/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=usercom
Part=comments
File=usercom.comments
Hooks=comments.main
Tags=
Minlevel=0
Order=10
[END_SED_EXTPLUGIN]
==================== */
defined('SED_CODE') or die('Wrong URL.');

$m = sed_import('m', 'G', 'TXT');
$id = sed_import('id', 'G', 'INT');

if ($m=="details" && $id==$usr['id'] && !$usr['isadmin_com'])
{

	if ($ina=='delete')
	{
		sed_check_xg();
		$sql = sed_sql_query("SELECT * FROM $db_com WHERE com_id='$ind' LIMIT 1");

		if ($row = sed_sql_fetchassoc($sql))
		{
			if ($cfg['trash_comment'])
			{
				sed_trash_put('comment', $L['Comment']." #".$ind." (".$row['com_author'].")", $ind, $row);
			}

			$sql = sed_sql_query("DELETE FROM $db_com WHERE com_id='$ind'");

			if (substr($row['com_code'], 0, 1) == 'p')
			{
				$page_id = substr($row['com_code'], 1, 10);
				$sql = sed_sql_query("UPDATE $db_pages SET page_comcount=".sed_get_comcount($row['com_code'])." WHERE page_id=".$page_id);
			}

			sed_log("Deleted comment #".$ind." in '".$code."'",'adm');
		}

		
	}

}

?>
