Meilleure gestion d'erreur si smarty mal configuré

This commit is contained in:
Laurent Destailleur 2007-10-07 14:49:36 +00:00
parent 0f49ae8e44
commit 9586bccf27
7 changed files with 262 additions and 244 deletions

View File

@ -132,6 +132,11 @@ $character_set_client="ISO-8859-1";
# Parameters not used yet # Parameters not used yet
# dolibarr_smarty_libs_dir
# Examples:
# $dolibarr_smarty_libs_dir="/var/www/dolibarr/external-libs/smarty/libs/";
# $dolibarr_smarty_compile="/var/www/dolibarr/documents/temp/smarty_templates";
# $dolibarr_smarty_cache="/var/www/dolibarr/documents/temp/smarty_cache";
$dolibarr_smarty_libs_dir=""; $dolibarr_smarty_libs_dir="";
$dolibarr_smarty_compile=""; $dolibarr_smarty_compile="";
$dolibarr_smarty_cache=""; $dolibarr_smarty_cache="";

View File

@ -183,8 +183,9 @@ if ($socid > 0)
// Courriers // Courriers
// Les courriers sont des documents speciaux generes par des scripts // Les courriers sont des documents speciaux generes par des scripts
// situes dans scripts/courrier.
// Voir Rodo // Voir Rodo
if ($conf->global->SOCIETE_NOLIST_COURRIER) if ($conf->global->MAIN_MODULE_EDITEUR)
{ {
$filearray=array(); $filearray=array();
$errorlevel=error_reporting(); $errorlevel=error_reporting();

View File

@ -492,6 +492,7 @@ if ($user->admin)
$user->rights->user->self->password=1; $user->rights->user->self->password=1;
} }
/** /**
* Overwrite configs global par configs perso * Overwrite configs global par configs perso
* ------------------------------------------ * ------------------------------------------
@ -534,22 +535,6 @@ if (isset($user->conf->MAIN_DISABLE_JAVASCRIPT) && $user->conf->MAIN_DISABLE_JAV
$conf->use_javascript=! $user->conf->MAIN_DISABLE_JAVASCRIPT; $conf->use_javascript=! $user->conf->MAIN_DISABLE_JAVASCRIPT;
} }
// SMARTY
// Definit dans le fichier de conf
// $dolibarr_smarty_libs_dir="/home/www/dolitar/external-libs/smarty/libs/";
// $dolibarr_smarty_compile="/home/www/dolitar/smarty_templates";
// $dolibarr_smarty_cache="/home/www/dolitar/smarty_cache";
$smarty_libs = $dolibarr_smarty_libs_dir. "Smarty.class.php";
if (file_exists ($smarty_libs))
{
require($smarty_libs);
$smarty = new Smarty();
$smarty->compile_dir = $dolibarr_smarty_compile;
$smarty->cache_dir = $dolibarr_smarty_cache;
//$smarty->config_dir = '/web/www.domain.com/smarty/configs';
}
// Defini gestionnaire de menu a utiliser // Defini gestionnaire de menu a utiliser
if (! $user->societe_id) // Si utilisateur interne if (! $user->societe_id) // Si utilisateur interne
{ {
@ -564,6 +549,33 @@ else // Si utilisateur externe
$conf->left_menu=$conf->global->MAIN_MENUFRONT_BARRELEFT; $conf->left_menu=$conf->global->MAIN_MENUFRONT_BARRELEFT;
} }
if ($conf->left_menu != 'default.php') $conf->global->PRODUCT_CANVAS_ABILITY=0;
// Si besoin de smarty
if ($conf->global->PRODUCT_CANVAS_ABILITY)
{
// SMARTY
// Definit dans le fichier de conf
// $dolibarr_smarty_libs_dir="/home/www/dolibarr/external-libs/smarty/libs/";
// $dolibarr_smarty_compile="/home/www/dolibarr/documents/temp/smarty_templates";
// $dolibarr_smarty_cache="/home/www/dolibarr/documents/temp/smarty_cache";
$smarty_libs = $dolibarr_smarty_libs_dir. "Smarty.class.php";
if (file_exists ($smarty_libs))
{
require_once($smarty_libs);
$smarty = new Smarty();
$smarty->compile_dir = $dolibarr_smarty_compile;
$smarty->cache_dir = $dolibarr_smarty_cache;
//$smarty->config_dir = '/web/www.domain.com/smarty/configs';
}
else
{
dolibarr_print_error('',"Library Smarty ".$smarty_libs." not found. Check parameter dolibarr_smarty_libs_dir in conf file.");
}
}
// Si le login n'a pu etre recupere, on est identifie avec un compte qui n'existe pas. // Si le login n'a pu etre recupere, on est identifie avec un compte qui n'existe pas.
// Tentative de hacking ? // Tentative de hacking ?
if (! $user->login) accessforbidden(); if (! $user->login) accessforbidden();

View File

@ -175,6 +175,7 @@ if (! defined('NOREQUIREUSER'))
/* /*
* Chargement objet $conf * Chargement objet $conf
* After this, all parameters conf->global->CONSTANTS are loaded
*/ */
if (! defined('NOREQUIREDB')) if (! defined('NOREQUIREDB'))
{ {

View File

@ -382,7 +382,6 @@ class ProductLivre extends Product
*/ */
function assign_smarty_values(&$smarty, $action='') function assign_smarty_values(&$smarty, $action='')
{ {
if ($action =='edit' or $action == 'create') if ($action =='edit' or $action == 'create')
{ {
$this->GetAvailableFormat(); $this->GetAvailableFormat();

View File

@ -409,10 +409,11 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
{ {
if (! isset($product)) if (! isset($product))
{ {
if ($_GET["canvas"] <> '' && file_exists('canvas/product.'.$_GET["canvas"].'.class.php') ) $filecanvas=DOL_DOCUMENT_ROOT.'/product/canvas/product.'.$_GET["canvas"].'.class.php';
if ($_GET["canvas"] && file_exists($filecanvas) )
{ {
$class = 'Product'.ucfirst($_GET["canvas"]); $class = 'Product'.ucfirst($_GET["canvas"]);
include_once('canvas/product.'.$_GET["canvas"].'.class.php'); include_once($filecanvas);
$product = new $class($db,0,$user); $product = new $class($db,0,$user);
} }
@ -433,7 +434,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
if ($mesg) print "$mesg\n"; if ($mesg) print "$mesg\n";
if ($_GET["canvas"] == '') if (! $_GET["canvas"])
{ {
print '<form action="fiche.php" method="post">'; print '<form action="fiche.php" method="post">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';

View File

@ -59,8 +59,7 @@ function llxHeader($head = "", $urlp = "", $title="")
// Produit specifique // Produit specifique
$dir = DOL_DOCUMENT_ROOT . "/product/canvas/"; $dir = DOL_DOCUMENT_ROOT . "/product/canvas/";
if(is_dir($dir) && $conf->global->PRODUCT_CANVAS_ABILITY)
if(is_dir($dir) && $conf->global->PRODUCT_CANVAS_ABILITY==='1' )
{ {
if ($handle = opendir($dir)) if ($handle = opendir($dir))
{ {