Файл: adultscript-2.0.3-pro/files/mobile/templates/default/extend/ajax/comment_user_delete.plugin.php
Строк: 32
<?php
defined('_VALID') or die('Restricted Access!');
function ajax_plugin_comment_user_delete()
{
$data = array('status' => 0, 'code' => '', 'msg' => '', 'debug' => '');
if (isset($_POST['comment_id'])) {
$user_id = (VAuth::loggedin()) ? (int) $_SESSION['user_id'] : 0;
if ($user_id) {
$comment_id = (int) trim($_POST['comment_id']);
VLanguage::load('profile.profile');
$db = VF::factory('database');
$db->query("SELECT user_id
FROM #__user_comments
WHERE comment_id = ".$comment_id."
LIMIT 1");
if ($db->affected_rows()) {
$owner_id = (int) $db->fetch_field('user_id');
if ($user_id == $owner_id OR VAuth::group('Moderator')) {
$db->query("DELETE FROM #__user_comments
WHERE comment_id = ".$comment_id."
LIMIT 1");
$data['msg'] = __('comment-delete-success');
$data['status'] = 1;
} else {
$data['msg'] = __('comment-delete-access');
}
} else {
$data['msg'] = __('comment-missing');
}
} else {
$data['msg'] = __('comment-login-delete');
}
} else {
$data['msg'] = 'Invalid ajax request!?';
}
return json_encode($data);
}