File: /var/www/ilya/data/www/afish-ka.ru/admin/modules/actions/comments.inc
<?
//- Настройки модуля -----------------------------------------------------------
permission("mcp"); // tcp-техники; acp-админы; mcp-модеры; cp-рядовые участники
$skin_pname = "Отзывы посетителей на событие";
$temp_html="";
//------------------------------------------------------------------------------
if(isset($_GET['delete'])) {
$result = query("SELECT * FROM `opinions` WHERE `id`='".$_GET['delete']."'");
if(mysql_num_rows($result)==1) {
$data = mysql_fetch_array($result);
cache_delete(array("opinions_actions"),$data['aid'].".html");
query("DELETE FROM `opinions` WHERE `id`='".$_GET['delete']."'");
header("Location: ./?m=".$_GET['m']."&task=comments&id=".$data['aid']);
}
else {
header("Location: ./?m=".$_GET['m']."&task=list");
}
}
$result = query("SELECT * FROM `actions` WHERE `id`=".$_GET['id'].";");
if(mysql_num_rows($result)!=1)
header("Location: ./?m=".$_GET['m']."&task=list");
else {
$action = mysql_fetch_array($result);
$skin_pname = "Отзывы посетителей на событие «<a href=\"./?m=".$_GET['m']."&task=edit&id=".$_GET['id']."\">".$action['title']."</a>»";
$result = query("SELECT * FROM `opinions` WHERE `aid`='".$_GET['id']."'");
if(mysql_num_rows($result)==0)
$temp_html = "<p>Отзывов на событие «".$action['title']."» нет</p>";
else {
$list_opinions = "";
while($data=mysql_fetch_array($result)) {
$id = $data['id'];
$author = $data['author'];
$datetime = $data['datetime'];
$text = $data['text'];
$list_opinions .= preg_replace("/{%(\w+)%}/ee", "$\\1",skin_html("actions_comment.htm",0));
}
}
}
$temp_html .= $list_opinions;
skin_html_design($temp_html);
?>