<?php
/**
 * Comment module
 * 
 * Allow user to perform ajax edit on actors name
 * 
 * @package linea21\modules\project
 * @author $Author$ - Simon Georget <simon@linea21.com>
 * @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.project.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'));

$arr = array();

securityCheck();
//////////// Check Droits utilisateur ////////////
if (!$l21auth->isSuperAdmin()) ReloadIndex('admin');
////////////

isset($_POST['id']) ? $arr['id'] = $_POST['id'] : die('no way !');
isset($_POST['name']) ? $arr['name'] = $_POST['name'] : die('no way !');


$oproject = new project;


if(strlen($arr['name']) < 2) {
  /* Outputting the error messages */
  echo '{"status":0,"errors":{"msg":"'. _t('comment', 'error_edit') .'"}}';

} else {
  /* we modify body comment */
    $r = $oproject->modify_actor_lite($arr['id'], $arr['name'], $GLOBALS['sql_object']);
	
	if(!$r) echo '{"status":0,"msg": "'. _t('msg', 'update_failed') .'"}';
	
	else echo '{"status":1,"msg": "'. _t('msg', 'update_successful') .'"}';
  die();
}

?>