Skip to content
Snippets Groups Projects
Select Git revision
  • d7f414f84a3603afe8cc4a2657047ef453bd21a9
  • 3.9 default
  • develop
  • 6.0
  • 5.0
  • 4.0
  • scrutinizer-patch-4
  • scrutinizer-patch-3
  • scrutinizer-patch-2
  • scrutinizer-patch-1
  • 3.7
  • 3.8
  • 3.6
  • 3.9_backported
  • 3.8_backported
  • 3.7_backported
  • 3.5
  • 3.6_backported
  • 3.5_backported
  • 3.4
  • 3.3_backported
  • 6.0.4
  • 6.0.3
  • 5.0.7
  • 6.0.2
  • 6.0.1
  • 5.0.6
  • 6.0.0
  • 5.0.5
  • 6.0.0-rc
  • 5.0.4
  • 6.0.0-beta
  • 5.0.3
  • 4.0.6
  • 5.0.2
  • 5.0.1
  • 4.0.5
  • 5.0.0
  • 4.0.4
  • 5.0.0-rc2
  • 5.0.0-rc1
41 results

main.inc.php

Blame
  • main.inc.php 55.21 KiB
    <?php
    /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
     * Copyright (C) 2003      Xavier Dutoit        <doli@sydesy.com>
     * Copyright (C) 2004-2011 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-2011 Regis Houssin        <regis@dolibarr.fr>
     * Copyright (C) 2008      Matteli
     *
     * 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, write to the Free Software
     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     */
    
    /**
     *	\file       htdocs/main.inc.php
     *	\ingroup	core
     *	\brief      File that defines environment for Dolibarr pages only (variables not required by scripts)
     *	\version    $Id$
     */
    
    @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 coverage of code
    	//define('XDEBUGCOVERAGE',1);
    	if (defined('XDEBUGCOVERAGE')) { xdebug_start_code_coverage(); }
    }
    
    // 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, you just do addslashes when an insert / update.
    function stripslashes_deep($value)
    {
    	return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value));
    }
    if (function_exists('get_magic_quotes_gpc'))	// magic_quotes_* removed in PHP6
    {
    	if (get_magic_quotes_gpc())
    	{
    		$_GET     = array_map('stripslashes_deep', $_GET);
    		$_POST    = array_map('stripslashes_deep', $_POST);
    //		$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
    		$_COOKIE  = array_map('stripslashes_deep', $_COOKIE);
    		@set_magic_quotes_runtime(0);
    	}
    }
    
    
    // Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST)
    function test_sql_and_script_inject($val,$get)
    {
    	$sql_inj = 0;