noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
export.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
22/*!\file
23 * \brief manage all the export to CSV or PDF
24 * act can be
25 *
26 */
27define ('ALLOWED',1);
28require_once '../include/constant.php';
29require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
30MaintenanceMode("block.html");
31
33require_once NOALYSS_INCLUDE.'/class/database.class.php';
34require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
35require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
36
37//
38// for loading javascripts or style-sheet, it is needed to know the user
39// global preference, but the user is not yet connected
40// to a folder. So the Database is the repository
41if ( defined("noalyss_user") || defined("phpcompta_user")) {
42 $g_user=new Noalyss_user(new Database());
44}
45// load message for javascript
46if (isset ($_REQUEST['loadjs']) && $_REQUEST['loadjs']=='message')
47{
48 header('Content-Type: text/javascript');
49 include_once NOALYSS_INCLUDE."/lib/message_javascript.php";
50 return;
51}
52// Connect the user to the current folder and export file
54$g_user=new Noalyss_user($cn);
55$gDossier=dossier::id();
57mb_internal_encoding("UTF-8");
58$g_user->Check();
59/**
60 * check if 2FA is completed
61 */
62if ( ! $g_user->is_double_identified()) {
63 exit();
64}
65$action=$g_user->check_dossier($gDossier);
66
68$action=$hi->get("act");
69
70if ( $action=='X' || $g_user->check_print($action)==0 )
71 {
72 echo alert(_('Accès interdit'));
73 redirect("do.php?".dossier::get());
74 exit();
75 }
76// get file and execute it
77
78 $prfile=$cn->get_value("select me_file from menu_ref where me_code=$1",array($action));
79
80if ( LOGINPUT)
81{
82 $file_loginput=fopen($_ENV['TMP'].'/export-'.$prfile.'-'.$_SERVER['REQUEST_TIME'].'.php','a+');
83 fwrite ($file_loginput,"<?php \n");
84 fwrite ($file_loginput,'//@description: export '.$prfile."\n");
85 fwrite($file_loginput, '$_GET='.var_export($_GET,true));
86 fwrite($file_loginput,";\n");
87 fwrite($file_loginput, '$_POST='.var_export($_POST,true));
88 fwrite($file_loginput,";\n");
89 fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
90 fwrite($file_loginput,"\n");
91 fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
92 fwrite($file_loginput,"\n");
93 fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
94 fwrite($file_loginput,"\n");
95 fwrite($file_loginput,' require_once NOALYSS_INCLUDE."/export/'.$prfile.'";');
96 fwrite($file_loginput,"\n");
97 fclose($file_loginput);
98}
99
100 if ( $prfile == "" || !file_exists(NOALYSS_INCLUDE."/export/$prfile")) {
102 die (_('Export impossible'));
103 }
104 require_once NOALYSS_INCLUDE."/export/$prfile";
105 ?>
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.
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']
contains the class for connecting to Noalyss
static connect()
manage the http input (get , post, request) and extract from an array
Class to manage the company parameter (address, name...)
$_POST['ac']
Definition do.php:323
$hi
Definition export.php:67
if( $action=='X'|| $g_user->check_print($action)==0) $prfile
Definition export.php:78
for($e=0; $e< count($afiche); $e++) exit
print
Type of printing.
redirect( $p_string, $p_time=0)
redirect with javascript