Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / inc / includes.php @ b67d8923

Historique | Voir | Annoter | Télécharger (5,48 ko)

1
<?php
2
/*
3
 * @version $Id: includes.php 7763 2009-01-06 18:44:50Z moyo $
4
 -------------------------------------------------------------------------
5
 GLPI - Gestionnaire Libre de Parc Informatique
6
 Copyright (C) 2003-2009 by the INDEPNET Development Team.
7

8
 http://indepnet.net/   http://glpi-project.org
9
 -------------------------------------------------------------------------
10

11
 LICENSE
12

13
 This file is part of GLPI.
14

15
 GLPI is free software; you can redistribute it and/or modify
16
 it under the terms of the GNU General Public License as published by
17
 the Free Software Foundation; either version 2 of the License, or
18
 (at your option) any later version.
19

20
 GLPI is distributed in the hope that it will be useful,
21
 but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 GNU General Public License for more details.
24

25
 You should have received a copy of the GNU General Public License
26
 along with GLPI; if not, write to the Free Software
27
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
 --------------------------------------------------------------------------
29
 */
30

    
31
// ----------------------------------------------------------------------
32
// Original Author of file:
33
// Purpose of file:
34
// ----------------------------------------------------------------------
35

    
36
if (!defined('GLPI_ROOT')){
37
        die("Sorry. You can't access directly to this file");
38
        }
39
// Notice problem  for date function :
40
if (function_exists('date_default_timezone_set')){
41
        $tz=ini_get('date.timezone');
42
        if (!empty($tz)){
43
                date_default_timezone_set($tz);
44
        } else {
45
                date_default_timezone_set(@date_default_timezone_get());
46
        }
47
}
48
include_once (GLPI_ROOT . "/inc/timer.class.php");
49

    
50
// Init Timer to compute time of display
51
$TIMER_DEBUG=new Script_Timer;
52
$TIMER_DEBUG->Start_Timer();
53

    
54
include_once (GLPI_ROOT . "/inc/dbmysql.class.php");
55
include_once (GLPI_ROOT . "/inc/commondbtm.class.php");
56
include_once (GLPI_ROOT . "/inc/commonitem.class.php");
57
include_once (GLPI_ROOT . "/inc/common.function.php");
58
include_once (GLPI_ROOT . "/inc/db.function.php");
59
include_once (GLPI_ROOT . "/inc/auth.function.php");
60
include_once (GLPI_ROOT . "/inc/display.function.php");
61
include_once (GLPI_ROOT . "/inc/ajax.function.php");
62
include_once (GLPI_ROOT . "/inc/dropdown.function.php");
63
include_once (GLPI_ROOT . "/inc/config.class.php");
64
include_once (GLPI_ROOT . "/config/config.php");
65
include_once (GLPI_ROOT . "/inc/plugin.function.php");
66

    
67
// Load Language file
68
loadLanguage();
69

    
70
if ($CFG_GLPI["debug"]){
71
        if ($CFG_GLPI["debug_profile"]){                
72
                $SQL_TOTAL_REQUEST=0;
73
        }
74
        if ($CFG_GLPI["debug_sql"]){                
75
                $DEBUG_SQL["queries"]=array();
76
                $DEBUG_SQL["errors"]=array();
77
                $DEBUG_SQL["times"]=array();
78
        }
79
}
80

    
81

    
82

    
83
if (!isset($AJAX_INCLUDE)){
84
        include_once (GLPI_ROOT . "/inc/auth.class.php");
85
        include_once (GLPI_ROOT . "/inc/connection.class.php");
86
        include_once (GLPI_ROOT . "/inc/connection.function.php");
87
        include_once (GLPI_ROOT . "/inc/mailing.class.php");
88
        include_once (GLPI_ROOT . "/inc/mailing.function.php");
89
        include_once (GLPI_ROOT . "/inc/export.function.php");
90
        include_once (GLPI_ROOT . "/inc/log.function.php");
91
        include_once (GLPI_ROOT . "/inc/bookmark.function.php");
92
        include_once (GLPI_ROOT . "/inc/alert.class.php");
93
}
94

    
95
// Security system
96
if (isset($_POST)){
97
        if (!get_magic_quotes_gpc()){
98
                $_POST = array_map('addslashes_deep', $_POST);
99
        }
100
        $_POST = array_map('clean_cross_side_scripting_deep', $_POST);
101
}
102
if (isset($_GET)){
103
        if (!get_magic_quotes_gpc()){
104
                $_GET = array_map('addslashes_deep', $_GET);
105
        }
106
        $_GET = array_map('clean_cross_side_scripting_deep', $_GET);
107
}
108

    
109

    
110

    
111
// Mark if Header is loaded or not :
112
$HEADER_LOADED=false;
113
$FOOTER_LOADED=false;
114
if (isset($AJAX_INCLUDE)){
115
        $HEADER_LOADED=true;
116
}
117

    
118
if (isset($NEEDED_ITEMS)&&is_array($NEEDED_ITEMS)){
119
        foreach ($NEEDED_ITEMS as $item){
120
                if (file_exists(GLPI_ROOT . "/inc/$item.class.php")){
121
                        include_once (GLPI_ROOT . "/inc/$item.class.php");
122
                }
123
                if (file_exists(GLPI_ROOT . "/inc/$item.function.php")){
124
                        include_once (GLPI_ROOT . "/inc/$item.function.php");
125
                }
126
        }
127
}
128

    
129
/* On startup, register all plugins configured for use. */
130
if (!isset($AJAX_INCLUDE)&&!isset($PLUGINS_INCLUDED)){
131
        // PLugin already included
132
        $PLUGINS_INCLUDED=1;
133

    
134
        if (!isset($_SESSION["glpi_plugins"])) {
135
                initPlugins();
136
        }
137

    
138
        if (isset($_SESSION["glpi_plugins"]) && is_array($_SESSION["glpi_plugins"])) {
139
                //doHook("config");
140

    
141
                if (count($_SESSION["glpi_plugins"])){
142
                        foreach ($_SESSION["glpi_plugins"] as $name) {
143

    
144
                                if (isset($_SESSION["glpilanguage"])&&file_exists(GLPI_ROOT . "/plugins/$name/locales/".$CFG_GLPI["languages"][$_SESSION["glpilanguage"]][1]))
145
                                        include_once (GLPI_ROOT . "/plugins/$name/locales/".$CFG_GLPI["languages"][$_SESSION["glpilanguage"]][1]);
146
                                else if (file_exists(GLPI_ROOT . "/plugins/$name/locales/".$CFG_GLPI["languages"][$CFG_GLPI["default_language"]][1]))
147
                                        include_once (GLPI_ROOT . "/plugins/$name/locales/".$CFG_GLPI["languages"][$CFG_GLPI["default_language"]][1]);
148
                                else if (file_exists(GLPI_ROOT . "/plugins/$name/locales/en_GB.php"))
149
                                        include_once (GLPI_ROOT . "/plugins/$name/locales/en_GB.php");
150
                                else if (file_exists(GLPI_ROOT . "/plugins/$name/locales/fr_FR.php"))
151
                                        include_once (GLPI_ROOT . "/plugins/$name/locales/fr_FR.php");
152

    
153
                                usePlugin($name);
154

    
155
                        }
156
                }
157
        }
158
}
159

    
160
// Get search_option array / need to be included after plugin definition
161
if (isset($NEEDED_ITEMS)&&in_array('search', $NEEDED_ITEMS)){
162
        $SEARCH_OPTION=getSearchOptions();
163
}
164

    
165
if (!isset($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"]="";
166
?>
Redmine Appliance - Powered by TurnKey Linux