noalyss Version-10
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);
39/**
40 * check if 2FA is completed
41 */
42if ( ! $g_user->is_double_identified()) {
43 exit();
44}
45IDate::set_firstDate($g_user->get_first_week_day());
46ITva_Popup::set_vat_code($g_user->get_vat_code_preference());
47
49/* if a code has been asked */
50if (isset($_REQUEST['plugin_code']) )
51{
52 if ( LOGINPUT)
53 {
54 $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+');
55 fwrite ($file_loginput,"<?php \n");
56 fwrite ($file_loginput,'//@description:'.$_REQUEST['plugin_code']."\n");
57 fwrite($file_loginput, '$_GET='.var_export($_GET,true));
58 fwrite($file_loginput,";\n");
59 fwrite($file_loginput, '$_POST='.var_export($_POST,true));
60 fwrite($file_loginput,";\n");
61 fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
62 fwrite($file_loginput,"\n");
63 fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
64 fwrite($file_loginput,"\n");
65 fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
66 fwrite($file_loginput,"\n");
67 fwrite($file_loginput,"include '".basename(__FILE__)."';\n");
68 fclose($file_loginput);
69 }
70
71 $ext=new Extension($cn);
72
73 if ( $ext->search($_REQUEST['plugin_code']) != -1)
74 {
75 /* security */
76 if ( !isset ($_SESSION[SESSION_KEY.'g_user']) || $ext->can_request($_SESSION[SESSION_KEY.'g_user']) == 0 )
77 {
78 exit();
79 }
80 /* call the ajax script */
81 require_once(NOALYSS_PLUGIN.DIRECTORY_SEPARATOR.dirname(trim($ext->getp('me_file'))).DIRECTORY_SEPARATOR.'ajax.php');
82 }
83 else
84 {
85 alert(j(_("Cette extension n'existe pas ")));
86 exit();
87 }
88
89}
90?>
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:323
for($e=0; $e< count($afiche); $e++) exit