Select Git revision
-
ZakaryKeck authoredZakaryKeck authored
main.inc.php 73.15 KiB
<?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2008 Matteli
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/main.inc.php
* \ingroup core
* \brief File that defines environment for Dolibarr pages only (variables not required by scripts)
*/
//@ini_set('memory_limit', '64M'); // This may be useless if memory is hard limited by your PHP
// For optionnal tuning. Enabled if environment variable DOL_TUNING is defined.
// A call first. Is the equivalent function dol_microtime_float not yet loaded.
$micro_start_time=0;
if (! empty($_SERVER['DOL_TUNING']))
{
list($usec, $sec) = explode(" ", microtime());
$micro_start_time=((float) $usec + (float) $sec);
// Add Xdebug code coverage
//define('XDEBUGCOVERAGE',1);
if (defined('XDEBUGCOVERAGE')) {
xdebug_start_code_coverage();
}
}
// Removed magic_quotes
if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP6
{
if (get_magic_quotes_gpc())
{
// Forcing parameter setting magic_quotes_gpc and cleaning parameters
// (Otherwise he would have for each position, condition
// Reading stripslashes variable according to state get_magic_quotes_gpc).
// Off mode recommended (just do $db->escape for insert / update).
function stripslashes_deep($value)
{
return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value));
}
$_GET = array_map('stripslashes_deep', $_GET);
$_POST = array_map('stripslashes_deep', $_POST);
$_FILES = array_map('stripslashes_deep', $_FILES);
//$_COOKIE = array_map('stripslashes_deep', $_COOKIE); // Useless because a cookie should never be outputed on screen nor used into sql
@set_magic_quotes_runtime(0);
}
}
/**
* Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF).