* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ $noplugin = true; // flag for ../config/define.php file include_once('../config/define.php'); include_once('../admin/mysql.inc.php'); include_once('../class/class.comment.php'); include_once('../languages/' . U_L . '/lang_comment.' . CHARSET . '.php'); include_once('../languages/' . U_L . '/lang_common.' . CHARSET . '.php'); include_once(override('../comment/display.php')); securityCheck(); //////////// Check Droits utilisateur //////////// if (!$l21auth->isSuperAdmin()) ReloadIndex('admin'); //////////// $a = parse_url(get_referer(true), PHP_URL_QUERY); parse_str($a ?? '', $output); isset($output['rub']) ? $page = strip_tags($output['rub']) : $page = ''; $id = $_GET['id']; $todo = $_GET['todo']; $comm = new comment; if($todo == 'disapprove') { $r = $comm->disapprove($id, $GLOBALS['sql_object']); $msg = _t('comment', 'disapproved'); } if($todo == 'approve') { $isnew = $comm->isnew($id, $GLOBALS['sql_object']); if($isnew === true) { $comment = $comm->get(array('given_id' => $id, 'status' => array('P', 'D', 'E')), $GLOBALS['sql_object']); $arr = array(); $arr['module'] = $comment[0]['comment_module']; $arr['module_id'] = $comment[0]['comment_module_id']; $arr['user_id'] = $comment[0]['comment_user_id']; $arr['name'] = $comment[0]['comment_name']; $arr['email'] = $comment[0]['comment_email']; $arr['title'] = $comment[0]['comment_title']; $arr['body'] = $comment[0]['comment_body']; } $r = $comm->approve($id, $GLOBALS['sql_object']); $msg = _t('comment', 'approved'); } if($todo == 'del') { $r = $comm->delete($id, $GLOBALS['sql_object']); $msg = ''; } if($r == true) { // new validated comments notified to users, if needed if(isset($arr) && $arr['module'] != 'contribute') { notifyusers($arr,$id, $comm, true); } echo '{"status":1,"el": "#com-'.$id.'", "action": "'.$todo.'", "page": "'.$page.'", "msg": "'.$msg.'"}'; } else { echo '{"status":0,"el": "#com-'.$id.'", "action": "'.$todo.'", "page": "'.$page.'", "msg": "'.$msg.'"}'; } ?>