noalyss Version-9
ajax.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS under GPL
4 *
5 */
6/**
7 * @file
8 * @brief this file is used for the ajax from the extension, it will the ajax.php file from the plugin directory
9 * all the variable are in $_REQUEST
10 * The code (of the plugin) is required
11 * Required variable in $_REQUEST
12 * - gDossier
13 * - plugin_code
14 */
15if ( ! defined ('ALLOWED') ) define ('ALLOWED',1);
16require_once '../include/constant.php';
17require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
18require_once NOALYSS_INCLUDE.'/class/database.class.php';
19require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
20require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
21require_once NOALYSS_INCLUDE.'/class/extension.class.php';
22if ( !isset ($_REQUEST['gDossier'])) exit();
23MaintenanceMode("block.html");
24require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
25mb_internal_encoding("UTF-8");
26/**
27 * if not connected, session is expired then exit with a message NOCONX
28 */
29if ( ! isset($_SESSION[SESSION_KEY."g_user"])) {
30 echo "NOCONX";
31 die();
32}
33
37$g_user=new Noalyss_user($cn);
38$g_user->check(true);
39IDate::set_firstDate($g_user->get_first_week_day());
41/* if a code has been asked */
42if (isset($_REQUEST['plugin_code']) )
43{
44 if ( LOGINPUT)
45 {
46 $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+');
47 fwrite ($file_loginput,"<?php \n");
48 fwrite ($file_loginput,'//@description:'.$_REQUEST['plugin_code']."\n");
49 fwrite($file_loginput, '$_GET='.var_export($_GET,true));
50 fwrite($file_loginput,";\n");
51 fwrite($file_loginput, '$_POST='.var_export($_POST,true));
52 fwrite($file_loginput,";\n");
53 fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
54 fwrite($file_loginput,"\n");
55 fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
56 fwrite($file_loginput,"\n");
57 fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
58 fwrite($file_loginput,"\n");
59 fwrite($file_loginput,"include '".basename(__FILE__)."';\n");
60 fclose($file_loginput);
61 }
62
63 $ext=new Extension($cn);
64
65 if ( $ext->search($_REQUEST['plugin_code']) != -1)
66 {
67 /* security */
68 if ( !isset ($_SESSION[SESSION_KEY.'g_user']) || $ext->can_request($_SESSION[SESSION_KEY.'g_user']) == 0 )
69 {
70 exit();
71 }
72 /* call the ajax script */
73 require_once(NOALYSS_PLUGIN.DIRECTORY_SEPARATOR.dirname(trim($ext->getp('me_file'))).DIRECTORY_SEPARATOR.'ajax.php');
74 }
75 else
76 {
77 alert(j(_("Cette extension n'existe pas ")));
78 exit();
79 }
80
81}
82?>
MaintenanceMode($p_file)
When you want to prevent users to connect, create a file in noalyss/ (NOALYSS_BASE) with the message ...
Definition: ac_common.php:1663
set_language()
set the lang thanks the _SESSION['g_lang'] var.
Definition: ac_common.php:754
j($p_string)
escape correctly php string to javascript
Definition: ac_common.php:96
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
if(! isset($_SESSION[SESSION_KEY."g_user"])) global $cn
Definition: ajax.php:34
if(! isset($_SESSION[SESSION_KEY."g_user"])) global $g_user
if not connected, session is expired then exit with a message NOCONX
Definition: ajax.php:29
if(! isset($_SESSION[SESSION_KEY."g_user"])) global $g_parameter
Definition: ajax.php:34
$_REQUEST['ac']
$_GET['qcode']
static connect()
manage the extension, it involves the table extension
static set_firstDate($firstDate)
Class to manage the company parameter (address, name...)
$_POST['ac']
Definition: do.php:310
for($e=0; $e< count($afiche); $e++) exit