2
0
forked from Wavyzz/dolibarr

Qual: Clean a lot of code to prepare remove of pre.inc.php

This commit is contained in:
Laurent Destailleur
2010-02-28 14:16:46 +00:00
parent addbd8b132
commit 99e6134e82
19 changed files with 94 additions and 735 deletions

View File

@@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
@@ -26,7 +26,7 @@
* \version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./main.inc.php");
$langs->load("admin"); $langs->load("admin");

View File

@@ -39,8 +39,6 @@ function llxHeader($head = '', $title='', $help_url='')
$menuarray=array(); $menuarray=array();
//if ($conf->left_menu == 'rodolphe.php')
//{
$langs->load("admin"); $langs->load("admin");
$langs->load("users"); $langs->load("users");
$menu = new Menu(); $menu = new Menu();
@@ -59,7 +57,6 @@ function llxHeader($head = '', $title='', $help_url='')
$menu->add(DOL_URL_ROOT."/admin/system/", $langs->trans("System")); $menu->add(DOL_URL_ROOT."/admin/system/", $langs->trans("System"));
$menu->add(DOL_URL_ROOT."/admin/tools/", $langs->trans("Tools")); $menu->add(DOL_URL_ROOT."/admin/tools/", $langs->trans("Tools"));
$varmenuarray=$menu->liste; $varmenuarray=$menu->liste;
//}
left_menu($varmenuarray, $help_url); left_menu($varmenuarray, $help_url);
} }

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -178,30 +178,23 @@ $var=true;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Parameters").'</td>'; print '<td colspan="3">'.$langs->trans("Parameters").'</td>';
print '<td align="center" width="80">'.$langs->trans("Activated").'</td>'; print '<td align="center" width="80">'.$langs->trans("Status").'</td>';
print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
print '</tr>'; print '</tr>';
// Enable Captcha code // Enable Captcha code
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>'; print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
print '<td align="center" width="60">'; print '<td align="center">';
if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1)
{
print img_tick();
}
print '</td>';
print '<td align="center" width="100">';
if (function_exists("imagecreatefrompng")) if (function_exists("imagecreatefrompng"))
{ {
if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0) if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0)
{ {
print '<a href="security_other.php?action=activate_captcha">'.$langs->trans("Activate").'</a>'; print '<a href="security_other.php?action=activate_captcha">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1) if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1)
{ {
print '<a href="security_other.php?action=disable_captcha">'.$langs->trans("Disable").'</a>'; print '<a href="security_other.php?action=disable_captcha">'.img_picto($langs->trans("Enabled"),'on').'</a>';
} }
} }
else else

View File

@@ -19,11 +19,11 @@
*/ */
/** /**
\file htdocs/boxes.php * \file htdocs/boxes.php
\brief Fichier de la classe boxes * \brief Fichier de la classe boxes
\author Rodolphe Qiedeville * \author Rodolphe Qiedeville
\author Laurent Destailleur * \author Laurent Destailleur
\version $Id$ * \version $Id$
*/ */

View File

@@ -1,5 +1,6 @@
<html> <html>
<body> <body>
Cette fonctionnalitÈ a ÈtÈ dÈsactivÈe sur ce serveur de test. This feature has been disabled on this test server. This feature has been disabled on this test server.<br>
Cette fonctionnalité a été désactivée sur ce serveur de test.<br>
</body> </body>
</html> </html>

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com> * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *
@@ -24,7 +24,7 @@
* \file htdocs/document.php * \file htdocs/document.php
* \brief Wrapper to download data files * \brief Wrapper to download data files
* \version $Id$ * \version $Id$
* \remarks Call of this wrapper is mad with URL: * \remarks Call of this wrapper is made with URL:
* document.php?modulepart=repfichierconcerne&file=pathrelatifdufichier * document.php?modulepart=repfichierconcerne&file=pathrelatifdufichier
*/ */
@@ -37,19 +37,21 @@ $modulepart = isset($_GET["modulepart"])?$_GET["modulepart"]:'';
$urlsource = isset($_GET["urlsource"])?$_GET["urlsource"]:''; $urlsource = isset($_GET["urlsource"])?$_GET["urlsource"]:'';
// Pour autre que bittorrent, on charge environnement + info issus de logon (comme le user) // Pour autre que bittorrent, on charge environnement + info issus de logon (comme le user)
if (($modulepart == 'bittorrent') && ! defined("NOLOGIN")) define("NOLOGIN",1); if (($modulepart == 'bittorrent') && ! defined("NOLOGIN"))
{
define("NOLOGIN",1);
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
}
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
require("./main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
// C'est un wrapper, donc header vierge // C'est un wrapper, donc header vierge
function llxHeader() { } function llxHeader() { }
require("./main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
// Define mime type // Define mime type
$type = 'application/octet-stream'; $type = 'application/octet-stream';

View File

@@ -29,17 +29,17 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
$datatoimport=isset($_GET["datatoimport"])? $_GET["datatoimport"] : (isset($_POST["datatoimport"])?$_POST["datatoimport"]:''); $datatoimport=isset($_GET["datatoimport"])? $_GET["datatoimport"] : (isset($_POST["datatoimport"])?$_POST["datatoimport"]:'');
$format=isset($_GET["format"])? $_GET["format"] : (isset($_POST["format"])?$_POST["format"]:''); $format=isset($_GET["format"])? $_GET["format"] : (isset($_POST["format"])?$_POST["format"]:'');
require("../master.inc.php"); // C'est un wrapper, donc header vierge
function llxHeader() { print '<html><title>Build an import example file</title><body>'; }
function llxFooter() { print '</body></html>'; }
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/imports/import.class.php"); require_once(DOL_DOCUMENT_ROOT."/imports/import.class.php");
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/import/modules_import.php'); require_once(DOL_DOCUMENT_ROOT.'/includes/modules/import/modules_import.php');
$langs->load("exports"); $langs->load("exports");
// C'est un wrapper, donc header vierge
function llxHeader() { print '<html><title>Build an import example file</title><body>'; }
function llxFooter() { print '</body></html>'; }
// Check exportkey // Check exportkey
if (empty($datatoimport)) if (empty($datatoimport))
{ {

View File

@@ -1,215 +0,0 @@
<?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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/includes/menus/barre_left/rodolphe.php
* \brief Gestionnaire du menu de gauche Rodolphe
* \version $Id$
*
* \remarks La construction d'un gestionnaire pour le menu de gauche est simple:
* \remarks A l'aide d'un objet $newmenu=new Menu() et de la methode add,
* \remarks definir la liste des entrees menu a faire apparaitre.
* \remarks En fin de code, mettre la ligne $menu=$newmenu->liste.
* \remarks Ce qui est definir dans un tel gestionnaire sera alors prioritaire sur
* \remarks les definitions de menu des fichiers pre.inc.php
*/
/** \class MenuLeft
* \brief Classe permettant la gestion par defaut du menu du gauche
* \remarks Le gestionnaire par defaut ne fait rien: C'est donc le menu defini dans les
* \remarks fichiers pre.inc.php du repertoire de la page qui est utilise.
*/
class MenuLeft {
var $require_top=array(""); // Si doit etre en phase avec un gestionnaire de menu du haut particulier
/**
* \brief Constructeur
* \param db Handler d'acces base de donnee
* \param menu_array Tableau des entree de menu defini dans les fichier pre.inc.php
*/
function MenuLeft($db,&$menu_array='')
{
$this->db=$db;
$this->menu_array=$menu_array;
}
/**
* \brief Show menu
* \return int Number of menu entries shown
*/
function showmenu()
{
global $user, $conf, $langs, $dolibarr_main_db_name;
// Read mainmenu and leftmenu that define which menu to show
if (isset($_GET["mainmenu"]))
{
// On sauve en session le menu principal choisi
$mainmenu=$_GET["mainmenu"];
$_SESSION["mainmenu"]=$mainmenu;
$_SESSION["leftmenuopened"]="";
}
else
{
// On va le chercher en session si non defini par le lien
$mainmenu=$_SESSION["mainmenu"];
}
if (isset($_GET["leftmenu"]))
{
// On sauve en session le menu principal choisi
$leftmenu=$_GET["leftmenu"];
$_SESSION["leftmenu"]=$leftmenu;
if ($_SESSION["leftmenuopened"]==$leftmenu)
{
//$leftmenu="";
$_SESSION["leftmenuopened"]="";
}
else
{
$_SESSION["leftmenuopened"]=$leftmenu;
}
} else {
// On va le chercher en session si non defini par le lien
$leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:'';
}
$newmenu = new Menu();
// Show logo company
if (! empty($conf->global->MAIN_SHOW_LOGO))
{
$mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_mini);
print "\n".'<!-- Show logo on menu -->'."\n";
print '<div class="blockvmenuimpair">'."\n";
print '<center><img title="'.$title.'" src="'.$urllogo.'"></center>'."\n";
print '</div>'."\n";
}
}
if ($mainmenu)
{
require_once(DOL_DOCUMENT_ROOT."/core/menubase.class.php");
$this->menuArbo = new Menubase($this->db,'rodolphe','left');
$this->overwritemenufor = $this->menuArbo->listeMainmenu();
$newmenu = $this->menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,0,'eldy');
/*
* Menu AUTRES (Pour les menus du haut qui ne serait pas g<>r<EFBFBD>s)
*/
if ($mainmenu && ! in_array($mainmenu,$this->overwritemenufor)) { $mainmenu=""; }
}
/**
* Si on est sur un cas g<>r<EFBFBD> de surcharge du menu, on ecrase celui par defaut
*/
if ($mainmenu) {
$this->menu_array=$newmenu->liste;
}
// Affichage du menu
$alt=0;
if (sizeof($this->menu_array))
{
$contenu = 0;
for ($i = 0 ; $i < sizeof($this->menu_array) ; $i++)
{
$alt++;
if ($this->menu_array[$i]['level']==0)
{
if (($alt%2==0))
{
print '<div class="blockvmenuimpair">'."\n";
}
else
{
print '<div class="blockvmenupair">'."\n";
}
}
// Place tabulation
$tabstring='';
$tabul=($this->menu_array[$i]['level'] - 1);
if ($tabul > 0)
{
for ($j=0; $j < $tabul; $j++)
{
$tabstring.='&nbsp; &nbsp;';
}
}
// Menu niveau 0
if ($this->menu_array[$i]['level'] == 0)
{
if ($contenu == 1) print '<div class="menu_fin"></div>'."\n";
if ($this->menu_array[$i]['enabled'])
{
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$this->menu_array[$i]['url'].'"'.($this->menu_array[$i]['target']?' target="'.$this->menu_array[$i]['target'].'"':'').'>'.$this->menu_array[$i]['titre'].'</a></div>';
}
else
{
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font></div>';
}
}
// Menu niveau > 0
if ($this->menu_array[$i]['level'] > 0)
{
if ($this->menu_array[$i]['level']==1) $contenu = 1;
if ($this->menu_array[$i]['enabled'])
{
print '<div class="menu_contenu">';
print $tabstring.'<a class="vsmenu" href="'.$this->menu_array[$i]['url'].'"'.($this->menu_array[$i]['target']?' target="'.$this->menu_array[$i]['target'].'"':'').'>';
print $this->menu_array[$i]['titre'];
print '</a>';
// If title is not pure text and contains a table, no carriage return added
if (! strstr($this->menu_array[$i]['titre'],'<table')) print '<br>';
print '</div>';
}
else
{
print '<div class="menu_contenu">';
print $tabstring.'<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
print '</div>';
}
}
if ($i == (sizeof($this->menu_array)-1) || $this->menu_array[$i+1]['level']==0)
{
print "</div>\n";
}
}
if ($contenu == 1) print '<div class="menu_fin"></div>'."\n";
}
return sizeof($this->menu_array);
}
}
?>

View File

@@ -1,398 +0,0 @@
<?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2009 Regis Houssin <regis@dolibarr.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 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/includes/menus/barre_top/rodolphe.php
* \brief Gestionnaire nomme rodolphe du menu du haut
* \version $Id$
*
* \remarks La construction d'un gestionnaire pour le menu du haut est simple:
* \remarks Toutes les entrees de menu a faire apparaitre dans la barre du haut
* \remarks doivent etre affichees par <a class="tmenu" href="...?mainmenu=...">...</a>
* \remarks ou si menu selectionne <a class="tmenusel" href="...?mainmenu=...">...</a>
*/
/**
* \class MenuTop
* \brief Classe permettant la gestion du menu du haut Rodolphe
*/
class MenuTop {
var $require_left=array(); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $hideifnotallowed=false; // Put 0 for back office menu, 1 for front office menu
var $atarget=""; // Valeur du target a utiliser dans les liens
/**
* \brief Constructeur
* \param db Handler d'acces base de donnee
*/
function MenuTop($db)
{
$this->db=$db;
}
/**
* \brief Affiche le menu
*/
function showmenu()
{
global $user,$conf,$langs,$dolibarr_main_db_name;;
// On sauve en session le menu principal choisi
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];
$_SESSION["leftmenuopened"]="";
print '<table class="tmenu" summary="topmenu"><tr class="tmenu">';
// Home
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="home" ';
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/index.php?mainmenu=home&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Home").'</a></td>';
// Third parties
if ($conf->societe->enabled || $conf->fournisseur->enabled)
{
$langs->load("companies");
$langs->load("suppliers");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="companies" ';
if (($conf->societe->enabled && $user->rights->societe->lire)
|| ($conf->fournisseur->enabled && $user->rights->fournisseur->lire))
{
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/index.php?mainmenu=companies&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("ThirdParties").'</a></td>';
}
else
{
if (! $this->hideifnotallowed) print '<td class="tmenu"><a class="tmenudisabled" '.$idsel.'href="#">'.$langs->trans("ThirdParties").'</a></td>';
}
}
// Products-Services
if ($conf->produit->enabled || $conf->service->enabled)
{
$langs->load("products");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$chaine="";
if ($conf->produit->enabled) { $chaine.=$langs->trans("Products"); }
if ($conf->produit->enabled && $conf->service->enabled) { $chaine.="/"; }
if ($conf->service->enabled) { $chaine.=$langs->trans("Services"); }
$idsel='id="products" ';
if ($user->rights->produit->lire || $user->rights->service->lire)
{
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/product/index.php?mainmenu=products&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$chaine.'</a></td>';
}
else
{
if (! $this->hideifnotallowed) print '<td class="tmenu"><a class="tmenudisabled" '.$idsel.'href="#">'.$chaine.'</a></td>';
}
}
// Commercial
if ($conf->societe->enabled)
{
$langs->load("commercial");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="commercial" ';
if($user->rights->societe->lire)
{
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Commercial").'</a></td>';
}
else
{
if (! $this->hideifnotallowed) print '<td class="tmenu"><a class="tmenudisabled" '.$idsel.'href="#">'.$langs->trans("Commercial").'</a></td>';
}
}
// Financial
if ($conf->compta->enabled || $conf->accounting->enabled || $conf->banque->enabled
|| $conf->facture->enabled)
{
$langs->load("compta");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="accountancy" ';
if ($user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire
|| $user->rights->facture->lire || $user->rights->banque->lire)
{
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("MenuFinancial").'</a></td>';
}
else
{
if (! $this->hideifnotallowed) print '<td class="tmenu"><a class="tmenudisabled" '.$idsel.'href="#">'.$langs->trans("MenuFinancial").'</a></td>';
}
}
// Projects
if ($conf->projet->enabled)
{
$langs->load("projects");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="project" ';
if ($user->rights->projet->lire)
{
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/projet/index.php?mainmenu=project&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Projects").'</a></td>';
}
else
{
if (! $this->hideifnotallowed) print '<td class="tmenu"><a class="tmenudisabled" '.$idsel.'href="#">'.$langs->trans("Projects").'</a></td>';
}
}
// Tools
if ($conf->mailing->enabled || $conf->export->enabled || $conf->global->MAIN_MODULE_IMPORT || $conf->global->MAIN_MODULE_DOMAIN)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="tools" ';
if ($user->rights->mailing->lire || $user->rights->bookmark->lire || $user->rights->export->lire)
{
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/index.php?mainmenu=tools&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Tools").'</a></td>';
}
else
{
if (! $this->hideifnotallowed) print '<td class="tmenu"><a class="tmenudisabled" '.$idsel.'href="#">'.$langs->trans("Tools").'</a></td>';
}
}
// Telephonie
if ($conf->telephonie->enabled && $user->rights->telephonie->lire)
{
$class="";
$path = DOL_URL_ROOT.'/telephonie/';
if (preg_match('/^'.preg_quote($path,'/').'/i',$_SERVER["PHP_SELF"]))
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="telephonie" ';
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/telephonie/index.php?mainmenu=telephonie"'.($this->atarget?" target=$this->atarget":"").'>Telephonie</a></td>';
}
// Energie
if ($conf->energie->enabled)
{
$langs->load("energy");
$class="";
$path = DOL_URL_ROOT.'/energie/';
if (preg_match('/^'.preg_quote($path,'/').'/i',$_SERVER["PHP_SELF"]))
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="energie" ';
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/energie/index.php?mainmenu=energie"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Energy").'</a></td>';
}
// OSCommerce 1
if ($conf->boutique->enabled)
{
$langs->load("shop");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "shop")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="shop" ';
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/boutique/index.php?mainmenu=shop&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("OSCommerce").'</a></td>';
}
// OSCommerce WS
if ($conf->oscommercews->enabled)
{
$langs->load("shop");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "shop")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="shop" ';
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/oscommerce_ws/index.php?mainmenu=shop&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("OSCommerce").'</a></td>';
}
// Members
if ($conf->adherent->enabled)
{
// $langs->load("members"); Added in main file
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members")
{
$class='class="tmenusel"'; $_SESSION['idmenu']='';
}
else
{
$class = 'class="tmenu"';
}
$idsel='id="members" ';
if ($user->rights->adherent->lire)
{
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("MenuMembers").'</a></td>';
}
else
{
if (! $this->hideifnotallowed) print '<td class="tmenu"><a class="tmenudisabled" '.$idsel.'href="#">'.$langs->trans("MenuMembers").'</a></td>';
}
}
// Affichage des menus personnalises
require_once(DOL_DOCUMENT_ROOT."/core/menubase.class.php");
$menuArbo = new Menubase($this->db,'eldy','top');
$tabMenu = $menuArbo->menuTopCharger(0,$_SESSION['mainmenu'],'eldy');
for($i=0; $i<count($tabMenu); $i++)
{
if ($tabMenu[$i]['enabled'] == true)
{
$idsel=(empty($tabMenu[$i]['mainmenu'])?'id="none" ':'id="'.$tabMenu[$i]['mainmenu'].'" ');
if ($tabMenu[$i]['right'] == true)
{
if (preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$i]['url']))
{
$url = $tabMenu[$i]['url'];
}
else
{
$url=DOL_URL_ROOT.$tabMenu[$i]['url'];
if (! preg_match('/\?/',DOL_URL_ROOT.$tabMenu[$i]['url'])) $url.='?';
else $url.='&';
$url.='mainmenu='.$tabMenu[$i]['mainmenu'].'&leftmenu=';
$url.="&idmenu=".$tabMenu[$i]['rowid'];
}
// Define the class (top menu selected or not)
if (! empty($_SESSION['idmenu']) && $tabMenu[$i]['rowid'] == $_SESSION['idmenu']) $class='class="tmenusel"';
else if (! empty($_SESSION['mainmenu']) && $tabMenu[$i]['mainmenu'] == $_SESSION['mainmenu']) $class='class="tmenusel"';
else $class='class="tmenu"';
print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.$url.'"'.($tabMenu[$i]['atarget']?" target='".$tabMenu[$i]['atarget']."'":($this->atarget?" target=$this->atarget":"")).'>';
print $tabMenu[$i]['titre'];
print '</a></td>';
}
else
{
if (! $this->hideifnotallowed) print '<td class="tmenu"><a class="tmenudisabled" '.$idsel.'href="#">'.$tabMenu[$i]['titre'].'</a></td>';
}
}
}
print '</tr></table>';
}
}
?>

View File

@@ -1720,7 +1720,8 @@ function migrate_delete_old_files($db,$langs,$conf)
} }
/* /*
* Supprime fichiers obsoletes * Disable/Reenable features modules.
* We must do this when internal menu of module or permissions has changed
*/ */
function migrate_module_menus($db,$langs,$conf) function migrate_module_menus($db,$langs,$conf)
{ {

View File

@@ -18,35 +18,19 @@
*/ */
/** /**
\file htdocs/lib/antispamimage.php * \file htdocs/lib/antispamimage.php
\brief Return antispam image * \brief Return antispam image
\version $Id$ * \version $Id$
*/ */
define('NOLOGIN',1);
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
// This is to make Dolibarr working with Plesk require_once("../main.inc.php");
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
// Add real path in session
$realpath='';
if (preg_match('/\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"]))
{
$result = preg_match('/^([^.]+)\/htdocs\//i',$_SERVER["SCRIPT_FILENAME"],$regs);
$realpath = $regs[1];
}
// Init session. Name of session is specific to Dolibarr instance.
$sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath);
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath);
if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]);
session_name($sessionname);
session_start();
require_once("../master.inc.php");
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php'; require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
require_once ARTICHOW."/AntiSpam.class.php"; require_once ARTICHOW."/AntiSpam.class.php";
@@ -75,8 +59,4 @@ $object->border->setColor($colorbr);
// On affiche l'image à l'écran // On affiche l'image à l'écran
$object->draw(); $object->draw();
// C'est un wrapper, donc header vierge
function llxHeader() { }
?> ?>

View File

@@ -234,12 +234,15 @@ function dol_syslog($message, $level=LOG_INFO)
//print $level.' - '.$conf->global->SYSLOG_LEVEL.' - '.$conf->syslog->enabled." \n"; //print $level.' - '.$conf->global->SYSLOG_LEVEL.' - '.$conf->syslog->enabled." \n";
if ($level > $conf->global->SYSLOG_LEVEL) return; if ($level > $conf->global->SYSLOG_LEVEL) return;
// Load error message files if this is an error message (rare) // Translate error message if this is an error message (rare) and langs is loaded
if ($level == LOG_ERR) if ($level == LOG_ERR)
{
if (is_object($langs))
{ {
$langs->load("errors"); $langs->load("errors");
if ($message != $langs->trans($message)) $message = $langs->trans($message); if ($message != $langs->trans($message)) $message = $langs->trans($message);
} }
}
// Add page/script name to log message // Add page/script name to log message
$script=isset($_SERVER['PHP_SELF'])?basename($_SERVER['PHP_SELF'],'.php').' ':''; $script=isset($_SERVER['PHP_SELF'])?basename($_SERVER['PHP_SELF'],'.php').' ':'';

View File

@@ -248,7 +248,7 @@ if (! empty($_SESSION["disablemodules"]))
// Init Smarty // Init Smarty
if (sizeof($conf->need_smarty) > 0 || $conf->global->MAIN_SMARTY) if (sizeof($conf->need_smarty) > 0 || $conf->global->MAIN_SMARTY)
{ {
// Usage of const in conf.php file can overwrite default dir. // Usage of const in conf.php file (deprecated) can overwrite default dir.
if (empty($dolibarr_smarty_libs_dir)) $dolibarr_smarty_libs_dir=DOL_DOCUMENT_ROOT.'/includes/smarty/libs/'; if (empty($dolibarr_smarty_libs_dir)) $dolibarr_smarty_libs_dir=DOL_DOCUMENT_ROOT.'/includes/smarty/libs/';
if (empty($dolibarr_smarty_compile)) $dolibarr_smarty_compile=DOL_DATA_ROOT.'/smarty/templates/temp'; if (empty($dolibarr_smarty_compile)) $dolibarr_smarty_compile=DOL_DATA_ROOT.'/smarty/templates/temp';
if (empty($dolibarr_smarty_cache)) $dolibarr_smarty_cache=DOL_DATA_ROOT.'/smarty/cache/temp'; if (empty($dolibarr_smarty_cache)) $dolibarr_smarty_cache=DOL_DATA_ROOT.'/smarty/cache/temp';
@@ -259,7 +259,6 @@ if (sizeof($conf->need_smarty) > 0 || $conf->global->MAIN_SMARTY)
$smarty = new Smarty(); $smarty = new Smarty();
$smarty->compile_dir = $dolibarr_smarty_compile; $smarty->compile_dir = $dolibarr_smarty_compile;
$smarty->cache_dir = $dolibarr_smarty_cache; $smarty->cache_dir = $dolibarr_smarty_cache;
//$smarty->config_dir = '/web/www.domain.com/smarty/configs';
} }
else else
{ {
@@ -621,24 +620,26 @@ if (! empty($_GET["theme"]))
$conf->theme=$_GET["theme"]; $conf->theme=$_GET["theme"];
$conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php"; $conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php";
} }
// Style sheet must be a php file
//$conf->css.=".php";
// Define menu manager to use // Define menu manager to use
if (empty($user->societe_id)) // If internal user or not defined if (empty($user->societe_id)) // If internal user or not defined
{ {
$conf->top_menu=$conf->global->MAIN_MENU_BARRETOP; $conf->top_menu=$conf->global->MAIN_MENU_BARRETOP;
$conf->left_menu=$conf->global->MAIN_MENU_BARRELEFT; $conf->left_menu=$conf->global->MAIN_MENU_BARRELEFT;
// Pour compatibilite // For backward compatibility
if ($conf->left_menu == 'eldy.php') $conf->left_menu='eldy_backoffice.php'; if ($conf->left_menu == 'eldy.php') $conf->left_menu='eldy_backoffice.php';
if ($conf->top_menu == 'rodolphe.php') $conf->top_menu='eldy_backoffice.php';
if ($conf->left_menu == 'rodolphe.php') $conf->left_menu='eldy_backoffice.php';
} }
else // If external user else // If external user
{ {
$conf->top_menu=$conf->global->MAIN_MENUFRONT_BARRETOP; $conf->top_menu=$conf->global->MAIN_MENUFRONT_BARRETOP;
$conf->left_menu=$conf->global->MAIN_MENUFRONT_BARRELEFT; $conf->left_menu=$conf->global->MAIN_MENUFRONT_BARRELEFT;
// For backward compatibility
if ($conf->top_menu == 'rodolphe.php') $conf->top_menu='eldy_frontoffice.php';
if ($conf->left_menu == 'rodolphe.php') $conf->left_menu='eldy_frontoffice.php';
} }
if (! defined('NOLOGIN')) if (! defined('NOLOGIN'))
{ {
// If the login is not recovered, it is identified with an account that does not exist. // If the login is not recovered, it is identified with an account that does not exist.
@@ -666,9 +667,12 @@ dol_syslog("Access to ".$_SERVER["PHP_SELF"]);
// For backward compatibility // For backward compatibility
if (! defined('MAIN_INFO_SOCIETE_PAYS')) define('MAIN_INFO_SOCIETE_PAYS','1'); if (! defined('MAIN_INFO_SOCIETE_PAYS')) define('MAIN_INFO_SOCIETE_PAYS','1');
// It supports main lang files // Load main languages files
$langs->load("main"); if (! defined('NOREQUIRETRAN'))
$langs->load("dict"); {
$langs->load("main");
$langs->load("dict");
}
// Define some constants used for style of arrays // Define some constants used for style of arrays
$bc[0]="class=\"impair\""; $bc[0]="class=\"impair\"";

View File

@@ -26,6 +26,10 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// C'est un wrapper, donc header vierge
function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; }
function llxFooterVierge() { print '</body></html>'; }
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
@@ -49,11 +53,6 @@ if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"];
if (! empty($_GET["logind"])) $filters['logind']=$_GET["logind"]; if (! empty($_GET["logind"])) $filters['logind']=$_GET["logind"];
// C'est un wrapper, donc header vierge
function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; }
function llxFooterVierge() { print '</body></html>'; }
// Check config // Check config
if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY))
{ {

View File

@@ -26,6 +26,13 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// C'est un wrapper, donc header vierge
function llxHeaderVierge() {
header("Content-type: text/html; charset=".$conf->file->character_set_client);
print '<html><title>Export agenda cal</title><body>';
}
function llxFooterVierge() { print '</body></html>'; }
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT ."/don.class.php"); require_once(DOL_DOCUMENT_ROOT ."/don.class.php");
@@ -40,6 +47,8 @@ $langs->load("donations");
* View * View
*/ */
llxHeaderVierge();
$sql = "SELECT d.datedon as datedon, d.nom, d.prenom, d.amount, d.public, d.societe"; $sql = "SELECT d.datedon as datedon, d.nom, d.prenom, d.amount, d.public, d.societe";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC"; $sql.= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
@@ -96,4 +105,5 @@ else
$db->close(); $db->close();
llxFooterVierge();
?> ?>

View File

@@ -37,8 +37,9 @@ if (empty($conf->don->enabled)) accessforbidden('',1,1,1);
/* /*
* View * View (output an image)
*/ */
$dontherm = new Don($db); $dontherm = new Don($db);
$intentValue = $dontherm->sum_donations(1); $intentValue = $dontherm->sum_donations(1);

View File

@@ -48,6 +48,8 @@ function llxHeaderVierge($title, $head = "")
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
header("Content-type: text/html; charset=".$conf->file->character_set_client);
print "<html>\n"; print "<html>\n";
print "<head>\n"; print "<head>\n";
print "<title>".$title."</title>\n"; print "<title>".$title."</title>\n";
@@ -210,14 +212,15 @@ if (isset($_GET["action"]) && $_GET["action"] == 'added')
* View * View
*/ */
llxHeaderVierge($langs->trans("NewSubscription"));
$html = new Form($db); $html = new Form($db);
print_titre($langs->trans("NewSubscription"));
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adho = new AdherentOptions($db); $adho = new AdherentOptions($db);
llxHeaderVierge($langs->trans("NewSubscription"));
print_titre($langs->trans("NewSubscription"));
// fetch optionals attributes and labels // fetch optionals attributes and labels
$adho->fetch_name_optionals_label(); $adho->fetch_name_optionals_label();
@@ -268,7 +271,7 @@ print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT> Email</td
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$login.'"></td></tr>'."\n"; print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$login.'"></td></tr>'."\n";
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Password").'</td><td><input type="password" name="pass1" size="40"></td></tr>'."\n"; print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Password").'</td><td><input type="password" name="pass1" size="40"></td></tr>'."\n";
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("PasswordAgain").'</td><td><input type="password" name="pass2" size="40"></td></tr>'."\n"; print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("PasswordAgain").'</td><td><input type="password" name="pass2" size="40"></td></tr>'."\n";
print '<tr><td>Date de naissance<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.$naiss.'"></td></tr>'."\n"; print '<tr><td>'.$langs->trans("Birthday").'<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.$naiss.'"></td></tr>'."\n";
print '<tr><td><FONT COLOR="blue">**</FONT> URL Photo</td><td><input type="text" name="photo" size="40" value="'.$photo.'"></td></tr>'."\n"; print '<tr><td><FONT COLOR="blue">**</FONT> URL Photo</td><td><input type="text" name="photo" size="40" value="'.$photo.'"></td></tr>'."\n";
print '<tr><td>'.$langs->trans("Public").' ?</td><td><input type="checkbox" name="public" value="1" checked></td></tr>'."\n"; print '<tr><td>'.$langs->trans("Public").' ?</td><td><input type="checkbox" name="public" value="1" checked></td></tr>'."\n";
foreach($adho->attribute_label as $key=>$value){ foreach($adho->attribute_label as $key=>$value){

View File

@@ -41,13 +41,11 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
require("./main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
// C'est un wrapper, donc header vierge // C'est un wrapper, donc header vierge
function llxHeader() { } function llxHeader() { }
require("./main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
// Define mime type // Define mime type
$type = 'application/octet-stream'; $type = 'application/octet-stream';
@@ -231,24 +229,6 @@ if ($modulepart)
$original_file=$conf->prelevement->dir_output.'/receipts/'.$original_file; $original_file=$conf->prelevement->dir_output.'/receipts/'.$original_file;
} }
// Wrapping pour les graph telephonie
elseif ($modulepart == 'telephoniegraph')
{
$user->getrights('telephonie');
if ($user->rights->telephonie->lire)
{
$accessallowed=1;
}
$original_file=$conf->telephonie->dir_temp.'/'.$original_file;
}
// Wrapping pour les graph energie
elseif ($modulepart == 'energie')
{
$accessallowed=1;
$original_file=$conf->energie->dir_temp.'/'.$original_file;
}
// Wrapping pour les graph bank // Wrapping pour les graph bank
elseif ($modulepart == 'bank') elseif ($modulepart == 'bank')
{ {
@@ -329,10 +309,9 @@ if (! $accessallowed)
// les noms de fichiers. // les noms de fichiers.
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
{ {
$langs->load("main"); dol_syslog("Refused to deliver file ".$original_file, LOG_WARNING);
dol_syslog("Refused to deliver file ".$original_file);
// Do no show plain path in shown error message // Do no show plain path in shown error message
dol_print_error(0,$langs->trans("ErrorFileNameInvalid",$_GET["file"])); dol_print_error(0,'Error: File '.$_GET["file"].' does not exists');
exit; exit;
} }
@@ -372,8 +351,7 @@ else // Open and return file
// This test if file exists should be useless. We keep it to find bug more easily // This test if file exists should be useless. We keep it to find bug more easily
if (! file_exists($original_file_osencoded)) if (! file_exists($original_file_osencoded))
{ {
$langs->load("main"); dol_print_error(0,'Error: File '.$_GET["file"].' does not exists');
dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$_GET["file"]));
exit; exit;
} }

View File

@@ -25,13 +25,13 @@
// This is to make Dolibarr working with Plesk // This is to make Dolibarr working with Plesk
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require("../master.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/webcal/webcal.class.php');
// C'est un wrapper, donc header vierge // C'est un wrapper, donc header vierge
function llxHeader() { print '<html><title>Export cal</title><body>'; } function llxHeader() { print '<html><title>Export cal</title><body>'; }
function llxFooter() { print '</body></html>'; } function llxFooter() { print '</body></html>'; }
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/webcal/webcal.class.php');
// Security check // Security check
if (! $conf->webcal->enabled) if (! $conf->webcal->enabled)
accessforbidden(); accessforbidden();