Файл: adultscript-2.0.3-pro/files/admin/templates/default/extend/ajax/comment_edit.plugin.php
Строк: 30
<?php
defined('_VALID') or die('Restricted Access!');
function ajax_plugin_comment_edit()
{
$data = array('status' => 0, 'code' => '', 'msg' => '', 'debug' => '');
if (isset($_POST['id']) && isset($_POST['value'])) {
$filter = &VF::factory('filter');
$id = $filter->get('id');
$comment = $filter->get('value');
$parts = explode('_', $id);
if (isset($parts['0']) && isset($parts['1'])) {
$type = $parts['0'];
$types = array('video' => 1, 'model' => 1, 'photo' => 1, 'user' => 1);
if (!isset($types[$type])) {
return 'Invalid type!';
}
$comment_id = (int) $parts['1'];
$db = VF::factory('database');
$db->query("SELECT comment_id
FROM #__".$type."_comments
WHERE comment_id = ".$comment_id."
LIMIT 1");
if ($db->affected_rows()) {
$db->query("UPDATE #__".$type."_comments
SET comment = '".$db->escape($comment)."'
WHERE comment_id = ".$comment_id."
LIMIT 1");
return nl2br($comment);
} else {
$data['msg'] = 'Invalid comment id! Are you sure this comment exists!';
}
} else {
$data['msg'] = 'Invalid comment id format!';
}
} else {
$data['msg'] = 'Invalid ajax request!';
}
return $data['msg'];
}
?>