linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file _ajax_admin.php

Documentation is available at _ajax_admin.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage comment
  5.  * @author Simon Georget <simon@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. include_once('../config/define.php');
  12. include_once('../class/class.comment.php');
  13. include_once('../languages/' U_L '/lang_comment.' CHARSET '.php');
  14. include_once(override('../comment/display.php'));
  15.  
  16. //////////// Check Droits utilisateur ////////////
  17. if (!$l21auth->isSuperAdmin()) ReloadIndex('admin');
  18. ////////////
  19.  
  20. $a parse_url($_SERVER['HTTP_REFERER']PHP_URL_QUERY);
  21. parse_str($a$output);
  22. $page $output['rub'];
  23.  
  24. $id $_GET['id'];
  25. $todo $_GET['todo'];
  26.  
  27. $comm new comment;
  28.  
  29. if($todo == 'disapprove'{
  30.   $r $comm->disapprove($id$GLOBALS['sql_object']);
  31.   $msg _t('comment''disapproved');
  32. }
  33. if($todo == 'approve'{
  34.   $isnew $comm->isnew($id$GLOBALS['sql_object']);
  35.   if($isnew === true{
  36.     $comment $comm->get(array('given_id' => $id'status' => array('P''D''E'))$GLOBALS['sql_object']);
  37.     $arr array();
  38.     $arr['module'$comment[0]['comment_module'];
  39.     $arr['module_id'$comment[0]['comment_module_id'];
  40.     $arr['user_id'$comment[0]['comment_user_id'];
  41.     $arr['name'$comment[0]['comment_name'];
  42.     $arr['email'$comment[0]['comment_email'];
  43.     $arr['body'$comment[0]['comment_body'];
  44.   }
  45.   $r $comm->approve($id$GLOBALS['sql_object']);
  46.   $msg _t('comment''approved');
  47. }
  48. if($todo == 'del'{
  49.   $r $comm->delete($id$GLOBALS['sql_object']);
  50.   $msg '';
  51. }
  52. if($r == true{
  53.   // new validated comments notified to users, if needed
  54.  
  55.   if(isset($arr&& $arr['module'!= 'contribute'{
  56.     notifyusers($arr,$id$commtrue);
  57.   }
  58.   echo '{"status":1,"el": "#com-'.$id.'", "action": "'.$todo.'", "page": "'.$page.'", "msg": "'.$msg.'"}';
  59. else {
  60.   echo '{"status":0,"el": "#com-'.$id.'", "action": "'.$todo.'", "page": "'.$page.'", "msg": "'.$msg.'"}';
  61. }
  62.  
  63. ?>

Documentation generated on Thu, 20 Mar 2014 16:49:45 +0100 by phpDocumentor 1.4.1