Skip to content
Snippets Groups Projects
Select Git revision
  • dc0056086dae50571fa2bef952de6bd4abb9817f
  • master default protected
  • explicit
3 results

fcyc.h

Blame
  • main.inc.php 91.19 KiB
    <?php
    /* Copyright (C) 2002-2007  Rodolphe Quiedeville    <rodolphe@quiedeville.org>
     * Copyright (C) 2003       Xavier Dutoit           <doli@sydesy.com>
     * Copyright (C) 2004-2015  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-2015  Regis Houssin           <regis.houssin@capnetworks.com>
     * Copyright (C) 2011-2014  Philippe Grand          <philippe.grand@atoo-net.com>
     * Copyright (C) 2008       Matteli
     * Copyright (C) 2011-2013  Juanjo Menent           <jmenent@2byte.es>
     * Copyright (C) 2012       Christophe Battarel     <christophe.battarel@altairis.fr>
     * Copyright (C) 2014-2015  Marcos García           <marcosgdf@gmail.com>
     * Copyright (C) 2015       Raphaël Doursenaud      <rdoursenaud@gpcsolutions.fr>
     *
     * 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 3 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 optional tuning. Enabled if environment variable MAIN_SHOW_TUNING_INFO is defined.
    $micro_start_time=0;
    if (! empty($_SERVER['MAIN_SHOW_TUNING_INFO']))
    {
        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);
        }
    }