<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.0
 *
 * Copyright (C) 2006-2014  Sylvain FATOME
 * 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
 * (in the directory docs);
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Contact : galawa@free.fr
 *
 * Web : http://smi.no-ip.org
 ****************************************************************************************/


// Vérification des tentatives de hack
$pos = strpos($_SERVER['PHP_SELF'], "inc.php");
if ($pos === FALSE)
    $ok_inc = TRUE;
else
    $ok_inc = FALSE;
if ($ok_inc == FALSE) header("Location: ../index.php");

/***********************/
/* Gestion des langues */
/***********************/

/**
 * Met en place la langue par défaut
 *
 * @param $lng
 * @param $depuis_idx
 * @return string
 */
function setlng($lng, $depuis_idx)
{
    $codelng = "fr";
    if (trim($lng) <> "") {
        $chklng = strip_tags(trim(strtolower($lng)));
        if ($depuis_idx == TRUE)
            $lienfl = ".";
        else
            $lienfl = "..";
        $lienfl .= "/lng/" . $chklng . ".inc.php";
        if (file_exists($lienfl)) // Vérifie existence fichier de language
            $codelng = $chklng;
    } else
        $codelng = "fr";
    return $codelng;
}
?>