noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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
35$cn=Dossier::connect();
37$g_user=new Noalyss_user($cn);
38$g_user->check(true);
39IDate::set_firstDate($g_user->get_first_week_day());
40ITva_Popup::set_vat_code($g_user->get_vat_code_preference());
41
43/* if a code has been asked */
44if (isset($_REQUEST['plugin_code']) )
45{
46 if ( LOGINPUT)
47 {
48 $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+');
49 fwrite ($file_loginput,"<?php \n");
50 fwrite ($file_loginput,'//@description:'.$_REQUEST['plugin_code']."\n");
51 fwrite($file_loginput, '$_GET='.var_export($_GET,true));
52 fwrite($file_loginput,";\n");
53 fwrite($file_loginput, '$_POST='.var_export($_POST,true));
54 fwrite($file_loginput,";\n");
55 fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
56 fwrite($file_loginput,"\n");
57 fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
58 fwrite($file_loginput,"\n");
59 fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
60 fwrite($file_loginput,"\n");
61 fwrite($file_loginput,"include '".basename(__FILE__)."';\n");
62 fclose($file_loginput);
63 }
64
65 $ext=new Extension($cn);
66
67 if ( $ext->search($_REQUEST['plugin_code']) != -1)
68 {
69 /* security */
70 if ( !isset ($_SESSION[SESSION_KEY.'g_user']) || $ext->can_request($_SESSION[SESSION_KEY.'g_user']) == 0 )
71 {
72 exit();
73 }
74 /* call the ajax script */
75 require_once(NOALYSS_PLUGIN.DIRECTORY_SEPARATOR.dirname(trim($ext->getp('me_file'))).DIRECTORY_SEPARATOR.'ajax.php');
76 }
77 else
78 {
79 alert(j(_("Cette extension n'existe pas ")));
80 exit();
81 }
82
83}
84?>
MaintenanceMode($p_file)
When you want to prevent users to connect, create a file in noalyss/ (NOALYSS_BASE) with the message ...
set_language()
set the lang thanks the _SESSION['g_lang'] var.
j($p_string)
escape correctly php string to javascript
Definition ac_common.php:96
alert($p_msg, $buffer=false)
alert in javascript
global $g_parameter
global $g_user
if no group available , then stop
$_REQUEST['ac']
_("actif, passif,charge,...")
$_GET['qcode']
manage the extension, it involves the table extension
static set_firstDate($firstDate)
static set_vat_code(int $vat_code)
show the Numeric ID or the code
Class to manage the company parameter (address, name...)
$_POST['ac']
Definition do.php:312
for($e=0; $e< count($afiche); $e++) exit