Fix: possibility to use an alternative path

This commit is contained in:
Regis Houssin 2011-04-15 07:54:10 +00:00
parent 310ba4aa5f
commit 66992ad45e

View File

@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -182,7 +182,6 @@ if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "FICHEINTER_NUM
llxHeader(); llxHeader();
$dir=DOL_DOCUMENT_ROOT."/includes/modules/fichinter/";
$html=new Form($db); $html=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
@ -204,67 +203,75 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$handle = opendir($dir); foreach ($conf->file->dol_document_root as $dirroot)
if (is_resource($handle))
{ {
$var=true; $dir = $dirroot . "/includes/modules/fichinter/";
while (($file = readdir($handle))!==false) if (is_dir($dir))
{ {
if (preg_match('/^(mod_.*)\.php$/i',$file,$reg)) $handle = opendir($dir);
if (is_resource($handle))
{ {
$file = $reg[1]; $var=true;
$classname = substr($file,4);
require_once($dir.$file.".php"); while (($file = readdir($handle))!==false)
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{ {
$var=!$var; if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
print '<td align="center">';
if ($conf->global->FICHEINTER_ADDON == $classname)
{ {
print img_picto($langs->trans("Activated"),'on'); $file = $reg[1];
} $classname = substr($file,4);
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
$ficheinter=new Fichinter($db); require_once($dir.$file.".php");
$ficheinter->initAsSpecimen();
// Info $module = new $file;
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; // Show modules according to features level
$nextval=$module->getNextValue($mysoc,$ficheinter); if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($nextval != $langs->trans("NotAvailable")) if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
{
$htmltooltip.=''.$langs->trans("NextValue").': '.$nextval; if ($module->isEnabled())
{
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
print '<td align="center">';
if ($conf->global->FICHEINTER_ADDON == $classname)
{
print img_picto($langs->trans("Activated"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
$ficheinter=new Fichinter($db);
$ficheinter->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$ficheinter);
if ($nextval != $langs->trans("NotAvailable"))
{
$htmltooltip.=''.$langs->trans("NextValue").': '.$nextval;
}
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
} }
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
} }
closedir($handle);
} }
} }
closedir($handle);
} }
print '</table><br>'; print '</table><br>';
@ -310,83 +317,90 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$var=true; $var=true;
foreach ($conf->file->dol_document_root as $dirroot)
$handle=opendir($dir);
if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) $dir = $dirroot . "/includes/modules/fichinter/";
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var; if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
print '<tr '.$bc[$var].'><td>'; $var=!$var;
echo "$name";
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
print $module->description;
print '</td>';
// Active print '<tr '.$bc[$var].'><td>';
if (in_array($name, $def)) echo "$name";
{ print "</td><td>\n";
print "<td align=\"center\">\n"; require_once($dir.$file);
if ($conf->global->FICHEINTER_ADDON_PDF != "$name") $module = new $classname();
{ print $module->description;
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '</td>';
print img_picto($langs->trans("Enabled"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Enabled"),'on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut // Active
print "<td align=\"center\">"; if (in_array($name, $def))
if ($conf->global->FICHEINTER_ADDON_PDF == "$name") {
{ print "<td align=\"center\">\n";
print img_picto($langs->trans("Default"),'on'); if ($conf->global->FICHEINTER_ADDON_PDF != "$name")
} {
else print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
{ print img_picto($langs->trans("Enabled"),'on');
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '</a>';
} }
print '</td>'; else
{
print img_picto($langs->trans("Enabled"),'on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Info // Defaut
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; print "<td align=\"center\">";
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; {
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; print img_picto($langs->trans("Default"),'on');
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); }
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); else
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); {
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); }
print '<td align="center">'; print '</td>';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>';
print '</td>';
print '</tr>'; // Info
} $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
} $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
closedir($handle); $htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>';
print '</td>';
print '</tr>';
}
}
closedir($handle);
}
}
} }
print '</table>'; print '</table>';