Файл: adultscript-2.0.3-pro/files/templates/defboot/extend/ajax/spam.plugin.php
Строк: 33
<?php
function ajax_plugin_spam()
{
$data = array('status' => 0, 'code' => '', 'msg' => '', 'debug' => '');
if (isset($_POST['type']) &&
isset($_POST['comment_id']) &&
isset($_POST['parent_id'])) {
if (VAuth::loggedin()) {
$user_id = (int) $_SESSION['user_id'];
$type = VF::factory('filter')->get('type');
$comment_id = (int) trim($_POST['comment_id']);
$parent_id = (int) trim($_POST['parent_id']);
$db = VF::factory('database');
$db->query("INSERT INTO #__spam
SET comment_id = ".$comment_id.",
parent_id = ".$parent_id.",
user_id = ".$user_id.",
type = '".$db->escape($type)."',
spam_date = '".date('Y-m-d h:i:s')."'");
if ($db->affected_rows()) {
$spam_id = (int) $db->get_last_insert_id('#__spam');
$db->query("UPDATE #__".$type."_comments
SET spam = ".$spam_id."
WHERE comment_id = ".$comment_id."
AND ".$type."_id = ".$parent_id."
LIMIT 1");
$data['msg'] = __('spam-success');
} else {
throw new VException('Application Error! Aborting...');
}
} else {
$data['msg'] = __('spam-login');
}
} else {
$data['msg'] = 'Invalid ajax request!';
}
return json_encode($data);
}