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('../lib/functions_auth.php');
include_once('../config/define.php');
include_once('../lib/lib_common.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(themePath('../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'];
////////////////////////////////////////
include_once('../class/system/class.'. SQL. '.php');
$GLOBALS['sql_object'] = new $sql_entity;
$GLOBALS['sql_object'] -> DBInitialise();
$GLOBALS['sql_object'] -> DBConnexion();
//////////// Check Droits utilisateur ////////////
if ($arr['module'] == 'files') {
if(!isset ($_COOKIE['linea21']['login'])) die('<p class="error">'. _t('divers', 'noauth'). '</p>');
if($wgid != 'shared' && !isWorkgroupUser($wgid)) die('<p class="error">'. _t('divers', 'noauth'). '</p>');
isset ($_COOKIE['linea21']['login']) ? $arr['user_id'] = $_COOKIE['linea21']['id'] : $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';
$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: */
|