Source for file _ajax_submit.php
Documentation is available at _ajax_submit.php
* @package linea21.modules
* @author Simon Georget <simon@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
include_once('../config/define.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'));
$arr['module'] = $o['module'] = $_POST['module'];
if(isset ($_POST['file_id'])) {
$arr['module_id'] = $o['module_id'] = $_POST['file_id'];
$arr['module_id'] = $o['module_id'] = $_POST['id'];
//////////// Check Droits utilisateur ////////////
if ($arr['module'] == 'files') {
if(!isset ($_SESSION['authenticated'])) die('<p class="error">'. _t('divers', 'noauth'). '</p>');
if($wgid != 'shared' && !$l21auth->isWorkgroupUser($wgid, $sql_object)) die('<p class="error">'. _t('divers', 'noauth'). '</p>');
isset ($_SESSION['userlogin']) ? $arr['user_id'] = base64_decode($_SESSION['userid']) : $arr['user_id'] = '';
isset ($_POST['cname']) ? $arr['name'] = $_POST['cname'] : $arr['name'] = '';
isset ($_POST['cemail']) ? $arr['email'] = $_POST['cemail'] : $arr['email'] = '';
isset ($_POST['curl']) ? $arr['url'] = $_POST['curl'] : $arr['url'] = '';
isset ($_POST['cbody']) ? $arr['body'] = $_POST['cbody'] : $arr['body'] = '';
isset ($_POST['cnotification']) ? $arr['notification'] = 'Y' : $arr['notification'] = 'N';
// prevent spam if user not authenticated
if(!isset ($_SESSION['authenticated']) && $_SESSION['securityaction']!= md5($_POST['securitycode'])) {
$passed = _t('security','message');
if(!isset ($passed)) $passed = $comm->checkDataIntegrity($arr);
/* Outputting the error messages */
echo '{"status":0,"errors":{"msg":'. json_encode($passed). '}}';
/* we add the new comment */
$r = $comm->add($arr, $GLOBALS['sql_object']);
// we send an email to default user for moderation if needed
// we notify users if needed
// no notification on 'contribute' module
if($arr['module'] != 'contribute') {
$o['status'] = array('P', 'D');
/* Outputting the markup of the just-inserted comment: */
|