* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ include_once ('../config/define.php'); include_once ('../class/class.user.php'); include_once ('../languages/' . U_L . '/lang_common.' . CHARSET . '.php'); securityCheck(); $a = array( 'file', 'topic', 'post'); $wg_id = strip_tags($_POST['workgroup']); // we retrieve workgroup id $item = strip_tags($_POST['item']); // through 'post', 'topic', 'file' $value = strip_tags($_POST['notification']); // notif value false or true // we get user id $user_id = $GLOBALS['l21auth']->GetSessionElement('id'); $options = array(); $options['workgroup_id'] = $wg_id; $options['user_id'] = $user_id; $options['type'] = $item; $options['value'] = $value; // ////////// Check Droits utilisateur //////////// if (! $GLOBALS['l21auth']->isWorkgroupUser($wg_id, $GLOBALS['sql_object']) || ! in_array($item, $a)) return false; // ////////// include_once ('../class/class.user.php'); $user_object = new user(); $r = $user_object->changeOnebyOneWGNotification($options, $GLOBALS['sql_object']); // is numeric, everything is fine if (is_numeric($r)) { $status = 1; $o = _t('msg', 'update_successful'); } else { $status = 0; $o = _t('msg', 'update_failed'); } /* Return json values */ echo json_encode(array('status' => $status, 'msg' => $o )); exit(); ?>