Fix: Fix regression by adding "custom" feature making web server hang in infinite loop.

This commit is contained in:
Laurent Destailleur 2010-12-15 18:15:08 +00:00
parent ebd25c5c75
commit b5e5dc3849
40 changed files with 1892 additions and 1795 deletions

File diff suppressed because it is too large Load Diff

View File

@ -208,7 +208,7 @@ clearstatcache();
$dir = "../includes/modules/commande/";
$handle = opendir($dir);
if ($handle)
if (is_resource($handle))
{
$var=true;
@ -330,84 +330,86 @@ clearstatcache();
$handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>";
print "$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print "</td>\n";
$var=!$var;
print "<tr ".$bc[$var].">\n <td>";
print "$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print "</td>\n";
// Activated
print "<td align=\"center\">\n";
if (in_array($name, $def))
{
if ($conf->global->COMMANDE_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Activated"),'on');
}
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">';
print img_picto($langs->trans("Disabled"),'off');
print '</a>';
}
print "</td>";
// Activated
print "<td align=\"center\">\n";
if (in_array($name, $def))
{
if ($conf->global->COMMANDE_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Activated"),'on');
}
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">';
print img_picto($langs->trans("Disabled"),'off');
print '</a>';
}
print "</td>";
// Defaut
print "<td align=\"center\">";
if ($conf->global->COMMANDE_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Yes"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'">';
print img_picto($langs->trans("No"),'off');
print '</a>';
}
print '</td>';
// Defaut
print "<td align=\"center\">";
if ($conf->global->COMMANDE_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Yes"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'">';
print img_picto($langs->trans("No"),'off');
print '</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
$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("Escompte").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
$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("Escompte").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,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"),'order').'</a>';
print '</td>';
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"),'order').'</a>';
print '</td>';
print "</tr>\n";
}
print "</tr>\n";
}
}
closedir($handle);
}
closedir($handle);
print '</table>';
//Autres Options

View File

@ -177,84 +177,87 @@ clearstatcache();
$handle=opendir($dir);
$var=True;
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
if (preg_match('/\.modules\.php$/i',$file))
while (($file = readdir($handle))!==false)
{
$var = !$var;
$name = substr($file, 0, dol_strlen($file) -12);
$classname = substr($file, 0, dol_strlen($file) -12);
if (preg_match('/\.modules\.php$/i',$file))
{
$var = !$var;
$name = substr($file, 0, dol_strlen($file) -12);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once($dir.'/'.$file);
$module=new $classname($db);
require_once($dir.'/'.$file);
$module=new $classname($db);
// 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;
// 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())
{
print '<tr '.$bc[$var].'><td width=\"100\">';
echo $module->name;
print '</td>';
print '<td>';
print $module->description;
print '</td>';
if ($module->isEnabled())
{
print '<tr '.$bc[$var].'><td width=\"100\">';
echo $module->name;
print '</td>';
print '<td>';
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->DON_ADDON_MODEL == $name)
{
print img_picto($langs->trans("Enabled"),'on');
}
else
{
print '&nbsp;';
print '</td><td align="center">';
print '<a href="dons.php?action=setdoc&value='.$name.'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
print '</td>';
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->DON_ADDON_MODEL == $name)
{
print img_picto($langs->trans("Enabled"),'on');
}
else
{
print '&nbsp;';
print '</td><td align="center">';
print '<a href="dons.php?action=setdoc&value='.$name.'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
print '</td>';
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->DON_ADDON_MODEL == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Defaut
print "<td align=\"center\">";
if ($conf->global->DON_ADDON_MODEL == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,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.'" target="specimen">'.img_object($langs->trans("Preview"),'generic').'</a>';
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,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.'" target="specimen">'.img_object($langs->trans("Preview"),'generic').'</a>';
print '</td>';
print "</tr>\n";
}
print "</tr>\n";
}
}
}
closedir($handle);
}
closedir($handle);
print '</table>';

View File

@ -304,75 +304,78 @@ if(is_dir($dir))
$handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
{
$name = substr($file, 15, dol_strlen($file) - 27);
$classname = substr($file, 0, dol_strlen($file) - 12);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
{
$name = substr($file, 15, dol_strlen($file) - 27);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
print $module->description;
print '</td>';
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->EXPEDITION_ADDON_PDF != $name)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Activated"),'on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->EXPEDITION_ADDON_PDF != $name)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Activated"),'on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Default
print "<td align=\"center\">";
if ($conf->global->EXPEDITION_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Default
print "<td align=\"center\">";
if ($conf->global->EXPEDITION_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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);
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"),'sending').'</a>';
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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);
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"),'sending').'</a>';
print '</td>';
print '</tr>';
}
}
closedir($handle);
print '</tr>';
}
}
closedir($handle);
}
}
else
{

View File

@ -258,7 +258,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (is_dir($dir))
{
$handle = opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
@ -414,7 +414,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (is_dir($dir))
{
$handle=opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -197,7 +197,7 @@ print "</tr>\n";
clearstatcache();
$handle = opendir($dir);
if ($handle)
if (is_resource($handle))
{
$var=true;
@ -304,79 +304,82 @@ clearstatcache();
$var=true;
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
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);
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);
$var=!$var;
$var=!$var;
print '<tr '.$bc[$var].'><td>';
echo "$name";
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
print $module->description;
print '</td>';
print '<tr '.$bc[$var].'><td>';
echo "$name";
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->FICHEINTER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
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.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->FICHEINTER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
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.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Defaut
print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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>';
}
print '</tr>';
}
}
closedir($handle);
}
closedir($handle);
print '</table>';

View File

@ -232,7 +232,7 @@ print "</tr>\n";
clearstatcache();
$handle = opendir($dir);
if ($handle)
if (is_resource($handle))
{
$var=true;
@ -356,77 +356,80 @@ clearstatcache();
$handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db,$specimenthirdparty);
print $module->description;
print "</td>\n";
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db,$specimenthirdparty);
print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print '<td align="center">'."\n";
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;type=supplier_order">';
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;type=supplier_order">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td align="center">'."\n";
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;type=supplier_order">';
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;type=supplier_order">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print '<td align="center">';
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;type=supplier_order"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'on').'</a>';
}
print '</td>';
// Defaut
print '<td align="center">';
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;type=supplier_order"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'on').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
print "</tr>\n";
}
print "</tr>\n";
}
}
closedir($handle);
}
closedir($handle);
print '</table><br/>';
/*
@ -476,73 +479,77 @@ clearstatcache();
$handle=opendir($dir);
$var=true;
while (($file = readdir($handle)) !== false)
if (is_resource($handle))
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
while (($file = readdir($handle)) !== false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db,$specimenthirdparty);
print $module->description;
print "</td>\n";
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db,$specimenthirdparty);
print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;type=supplier_invoice">';
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;type=supplier_invoice">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;type=supplier_invoice">';
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;type=supplier_invoice">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;type=supplier_invoice" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'on').'</a>';
}
print '</td>';
// Defaut
print "<td align=\"center\">";
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;type=supplier_invoice" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'on').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimenfacture&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimenfacture&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
print '</td>';
print "</tr>\n";
}
print "</tr>\n";
}
}
close($handle);
}
print '</table><br/>';

View File

@ -207,7 +207,7 @@ clearstatcache();
$handle = opendir($dir);
$var=true;
if ($handle)
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
@ -329,74 +329,77 @@ if(is_dir($dir))
$handle=opendir($dir);
$var=true;
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);
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);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname($db);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print '</td>';
print $module->description;
print '</td>';
// Activ
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->LIVRAISON_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
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.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Activ
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->LIVRAISON_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
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.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Defaut
print "<td align=\"center\">";
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,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"),'sending').'</a>';
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,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"),'sending').'</a>';
print '</td>';
print '</tr>';
}
}
closedir($handle);
print '</tr>';
}
}
closedir($handle);
}
}
else
{

View File

@ -91,7 +91,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
//print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for modules");
$handle=@opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -84,7 +84,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
$handle=@opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -173,7 +173,7 @@ print "</tr>\n";
clearstatcache();
$handle = opendir($dir);
if ($handle)
if (is_resource($handle))
{
$var=true;
@ -294,73 +294,76 @@ clearstatcache();
$handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print "</td>\n";
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->PROJECT_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
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.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->PROJECT_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
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.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->PROJECT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Defaut
print "<td align=\"center\">";
if ($conf->global->PROJECT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$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);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
print "</tr>\n";
}
print "</tr>\n";
}
}
closedir($handle);
}
closedir($handle);
print '</table><br/>';

View File

@ -212,7 +212,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (is_dir($dir))
{
$handle = opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
@ -333,85 +333,88 @@ clearstatcache();
$handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
{
$name = substr($file, 12, dol_strlen($file) - 24);
$classname = substr($file, 0, dol_strlen($file) -12);
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
{
$name = substr($file, 12, dol_strlen($file) - 24);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>";
print $name;
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print '</td>';
$var=!$var;
print "<tr ".$bc[$var].">\n <td>";
print $name;
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print '</td>';
// Activate
print "<td align=\"center\">\n";
if (in_array($name, $def))
{
if ($conf->global->PROPALE_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Activated"),'on');
}
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">';
print img_picto($langs->trans("Disabled"),'off');
print '</a>';
}
print "</td>";
// Activate
print "<td align=\"center\">\n";
if (in_array($name, $def))
{
if ($conf->global->PROPALE_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'on');
print '</a>';
}
else
{
print img_picto($langs->trans("Activated"),'on');
}
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">';
print img_picto($langs->trans("Disabled"),'off');
print '</a>';
}
print "</td>";
// Default
print "<td align=\"center\">";
if ($conf->global->PROPALE_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Yes"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'">';
print img_picto($langs->trans("No"),'off');
print '</a>';
}
print '</td>';
// Default
print "<td align=\"center\">";
if ($conf->global->PROPALE_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Yes"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'">';
print img_picto($langs->trans("No"),'off');
print '</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
$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("Escompte").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark,1,1);
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
$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("Escompte").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftProposal").': '.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"),'propal').'</a>';
print '</td>';
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"),'propal').'</a>';
print '</td>';
print "</tr>\n";
}
print "</tr>\n";
}
}
closedir($handle);
}
closedir($handle);
print '</table>';
print '<br>';

View File

@ -218,20 +218,23 @@ $dir = "../includes/modules/security/generate";
clearstatcache();
$handle=opendir($dir);
$i=1;
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg))
while (($file = readdir($handle))!==false)
{
// Chargement de la classe de numerotation
$classname = $reg[1];
require_once($dir.'/'.$file);
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg))
{
// Chargement de la classe de numerotation
$classname = $reg[1];
require_once($dir.'/'.$file);
$obj = new $classname($db,$conf,$langs,$user);
$arrayhandler[$obj->id]=$obj;
$i++;
$obj = new $classname($db,$conf,$langs,$user);
$arrayhandler[$obj->id]=$obj;
$i++;
}
}
closedir($handle);
}
closedir($handle);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@ -188,7 +188,7 @@ clearstatcache();
$dir = "../includes/modules/societe/";
$handle = opendir($dir);
if ($handle)
if (is_resource($handle))
{
$var = true;
@ -259,7 +259,7 @@ clearstatcache();
$dir = "../includes/modules/societe/";
$handle = opendir($dir);
if ($handle)
if (is_resource($handle))
{
$var = true;
while (($file = readdir($handle))!==false)
@ -348,7 +348,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (is_dir($dir))
{
$handle=opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -55,24 +55,28 @@ foreach($conf->file->dol_document_root as $searchdir)
if (preg_match('/custom$/i',$searchdir)) $dirtoscan = $searchdir . "/modules/";
else $dirtoscan = $searchdir . "/includes/modules/";
$handle=opendir($dirtoscan);
while (($file = readdir($handle))!==false)
{
if (is_readable($dirtoscan.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dirtoscan.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{
include_once($dirtoscan.$file);
$objMod = new $modName($db);
if ($modName)
{
include_once($dirtoscan.$file);
$objMod = new $modName($db);
$modules[$objMod->numero]=$objMod;
$modules_names[$objMod->numero]=$objMod->name;
$modules_files[$objMod->numero]=$file;
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
}
}
}
$modules[$objMod->numero]=$objMod;
$modules_names[$objMod->numero]=$objMod->name;
$modules_files[$objMod->numero]=$file;
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
}
}
}
close($handle);
}
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@ -1097,35 +1097,37 @@ class Categorie
if (file_exists($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) != false)
{
if (is_file($dir.$file))
{
$nbphoto++;
$photo = $file;
while (($file = readdir($handle)) != false)
{
if (is_file($dir.$file))
{
$nbphoto++;
$photo = $file;
// On determine nom du fichier vignette
$photo_vignette='';
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
{
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0];
}
// On determine nom du fichier vignette
$photo_vignette='';
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
{
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0];
}
// Objet
$obj=array();
$obj['photo']=$photo;
if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']=$photo_vignette;
else $obj['photo_vignette']="";
// Objet
$obj=array();
$obj['photo']=$photo;
if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']=$photo_vignette;
else $obj['photo_vignette']="";
$tabobj[$nbphoto-1]=$obj;
$tabobj[$nbphoto-1]=$obj;
// On continue ou on arrete de boucler
if ($nbmax && $nbphoto >= $nbmax) break;
}
}
// On continue ou on arrete de boucler
if ($nbmax && $nbphoto >= $nbmax) break;
}
}
closedir($handle);
closedir($handle);
}
}
return $tabobj;

View File

@ -236,7 +236,7 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
if (is_dir($dir))
{
$handle=opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -73,69 +73,71 @@ $dir=DOL_DOCUMENT_ROOT."/includes/modules/mailings";
$handle=opendir($dir);
$var=True;
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
while (($file = readdir($handle))!==false)
{
if (preg_match("/(.*)\.(.*)\.(.*)/i",$file,$reg))
if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$modulename=$reg[1];
if ($modulename == 'example') continue;
// Chargement de la classe
$file = $dir."/".$modulename.".modules.php";
$classname = "mailing_".$modulename;
require_once($file);
$mailmodule = new $classname($db);
$qualified=1;
foreach ($mailmodule->require_module as $key)
if (preg_match("/(.*)\.(.*)\.(.*)/i",$file,$reg))
{
if (! $conf->$key->enabled || (! $user->admin && $mailmodule->require_admin))
$modulename=$reg[1];
if ($modulename == 'example') continue;
// Chargement de la classe
$file = $dir."/".$modulename.".modules.php";
$classname = "mailing_".$modulename;
require_once($file);
$mailmodule = new $classname($db);
$qualified=1;
foreach ($mailmodule->require_module as $key)
{
$qualified=0;
//print "Les pr<70>requis d'activation du module mailing ne sont pas respect<63>s. Il ne sera pas actif";
break;
if (! $conf->$key->enabled || (! $user->admin && $mailmodule->require_admin))
{
$qualified=0;
//print "Les pr<70>requis d'activation du module mailing ne sont pas respect<63>s. Il ne sera pas actif";
break;
}
}
}
// Si le module mailing est qualifi<66>
if ($qualified)
{
$var = !$var;
foreach ($mailmodule->getSqlArrayForStats() as $sql)
// Si le module mailing est qualifi<66>
if ($qualified)
{
print '<tr '.$bc[$var].'>';
$var = !$var;
$result=$db->query($sql);
if ($result)
foreach ($mailmodule->getSqlArrayForStats() as $sql)
{
$num = $db->num_rows($result);
print '<tr '.$bc[$var].'>';
$i = 0;
while ($i < $num )
$result=$db->query($sql);
if ($result)
{
$obj = $db->fetch_object($result);
print '<td>'.img_object('',$mailmodule->picto).' '.$obj->label.'</td><td align="right">'.$obj->nb.'<td>';
$i++;
}
$num = $db->num_rows($result);
$db->free($result);
$i = 0;
while ($i < $num )
{
$obj = $db->fetch_object($result);
print '<td>'.img_object('',$mailmodule->picto).' '.$obj->label.'</td><td align="right">'.$obj->nb.'<td>';
$i++;
}
$db->free($result);
}
else
{
dol_print_error($db);
}
print '</tr>';
}
else
{
dol_print_error($db);
}
print '</tr>';
}
}
}
}
closedir($handle);
}
closedir($handle);
print "</table><br>";

View File

@ -37,9 +37,9 @@ $dir = $conf->facture->dir_output.'/payments';
$socid=0;
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
$dir = $conf->facture->dir_output.'/payments/private/'.$user->id;
$action = '';
$socid = $user->societe_id;
$dir = $conf->facture->dir_output.'/payments/private/'.$user->id;
}
$year = $_GET["year"];
@ -52,30 +52,30 @@ if (! $year) { $year=date("Y"); }
if ($_POST["action"] == 'builddoc')
{
$rap = new pdf_paiement($db);
$rap = new pdf_paiement($db);
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($rap->write_file($dir, $_POST["remonth"], $_POST["reyear"], $outputlangs) > 0)
{
$outputlangs->charset_output=$sav_charset_output;
}
else
{
$outputlangs->charset_output=$sav_charset_output;
dol_syslog("Erreur dans commande_pdf_create");
dol_print_error($db,$obj->error);
}
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($rap->write_file($dir, $_POST["remonth"], $_POST["reyear"], $outputlangs) > 0)
{
$outputlangs->charset_output=$sav_charset_output;
}
else
{
$outputlangs->charset_output=$sav_charset_output;
dol_syslog("Erreur dans commande_pdf_create");
dol_print_error($db,$obj->error);
}
$year = $_POST["reyear"];
$year = $_POST["reyear"];
}
@ -98,28 +98,28 @@ $syear = date("Y", time());
print '<select name="remonth">';
for ($month = 1 ; $month < 13 ; $month++)
{
if ($month == $cmonth)
{
print "<option value=\"$month\" selected=\"true\">" . dol_print_date(mktime(0,0,0,$month),"%B");
}
else
{
print "<option value=\"$month\">" . dol_print_date(mktime(0,0,0,$month),"%B");
}
if ($month == $cmonth)
{
print "<option value=\"$month\" selected=\"true\">" . dol_print_date(mktime(0,0,0,$month),"%B");
}
else
{
print "<option value=\"$month\">" . dol_print_date(mktime(0,0,0,$month),"%B");
}
}
print "</select>";
print '<select name="reyear">';
for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++)
{
if ($formyear == $syear)
{
print "<option value=\"$formyear\" selected=\"true\">".$formyear."</option>";
}
else
{
print "<option value=\"$formyear\">".$formyear."</option>";
}
if ($formyear == $syear)
{
print "<option value=\"$formyear\" selected=\"true\">".$formyear."</option>";
}
else
{
print "<option value=\"$formyear\">".$formyear."</option>";
}
}
print "</select>\n";
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
@ -133,51 +133,58 @@ $linkforyear=array();
$found=0;
if (is_dir($dir))
{
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
{
if (is_dir($dir.'/'.$file) && ! preg_match('/^\./',$file))
{
$found=1;
$linkforyear[]=$file;
}
}
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_dir($dir.'/'.$file) && ! preg_match('/^\./',$file))
{
$found=1;
$linkforyear[]=$file;
}
}
}
}
asort($linkforyear);
foreach($linkforyear as $cursoryear)
{
print '<a href="rapport.php?year='.$cursoryear.'">'.$cursoryear.'</a> &nbsp;';
print '<a href="rapport.php?year='.$cursoryear.'">'.$cursoryear.'</a> &nbsp;';
}
if ($year)
{
if (is_dir($dir.'/'.$year))
{
$handle=opendir($dir.'/'.$year);
if (is_dir($dir.'/'.$year))
{
$handle=opendir($dir.'/'.$year);
if ($found) print '<br>';
print '<br>';
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Reporting").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="right">'.$langs->trans("Date").'</td>';
print '</tr>';
$var=true;
while (($file = readdir($handle))!==false)
{
if (preg_match('/^payment/i',$file))
{
$var=!$var;
$tfile = $dir . '/'.$year.'/'.$file;
$relativepath = $year.'/'.$file;
print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
print '<td align="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
print '<td align="right">'.dol_print_date(dol_filemtime($tfile),"dayhour").'</td></tr>';
}
}
print '</table>';
}
if ($found) print '<br>';
print '<br>';
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Reporting").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="right">'.$langs->trans("Date").'</td>';
print '</tr>';
$var=true;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/^payment/i',$file))
{
$var=!$var;
$tfile = $dir . '/'.$year.'/'.$file;
$relativepath = $year.'/'.$file;
print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
print '<td align="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
print '<td align="right">'.dol_print_date(dol_filemtime($tfile),"dayhour").'</td></tr>';
}
}
close($handle);
}
print '</table>';
}
}
$db->close();

View File

@ -135,25 +135,29 @@ class FormAdmin
$menuarray=array();
$handle=opendir($dirmenu);
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
while (($file = readdir($handle))!==false)
{
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
$filelib=preg_replace('/\.php$/i','',$file);
$prefix='';
if (preg_match('/^eldy|^iphone/i',$file)) $prefix='0'; // 0=Recommanded, 1=Experimental, 2=Other
else $prefix='2';
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
$filelib=preg_replace('/\.php$/i','',$file);
$prefix='';
if (preg_match('/^eldy|^iphone/i',$file)) $prefix='0'; // 0=Recommanded, 1=Experimental, 2=Other
else $prefix='2';
if ($file == $selected)
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="selected">'.$filelib.'</option>';
}
else
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
if ($file == $selected)
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="selected">'.$filelib.'</option>';
}
else
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
}
}
}
close($handle);
}
ksort($menuarray);
@ -194,20 +198,23 @@ class FormAdmin
foreach($dirmenuarray as $dirmenu)
{
$handle=opendir($dirmenu);
while (($file = readdir($handle))!==false)
{
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i','',$file);
if (preg_match('/^default/i',$filelib)) continue;
if (preg_match('/^empty/i',$filelib)) continue;
if (preg_match('/\.lib/i',$filelib)) continue;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i','',$file);
if (preg_match('/^default/i',$filelib)) continue;
if (preg_match('/^empty/i',$filelib)) continue;
if (preg_match('/\.lib/i',$filelib)) continue;
$menuarray[$filelib]=1;
}
$menuarray['all']=1;
}
closedir($handle);
$menuarray[$filelib]=1;
}
$menuarray['all']=1;
}
closedir($handle);
}
}
ksort($menuarray);

View File

@ -76,86 +76,88 @@ class Interfaces
$handle=opendir($dir);
$modules = array();
$nbfile = $nbtotal = $nbok = $nbko = 0;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir."/".$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php$/i',$file,$reg))
{
$nbfile++;
while (($file = readdir($handle))!==false)
{
if (is_readable($dir."/".$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php$/i',$file,$reg))
{
$nbfile++;
$modName = "Interface".ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules))
{
$langs->load("errors");
dol_syslog("Interface::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/"),LOG_ERR);
continue;
}
$modName = "Interface".ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules))
{
$langs->load("errors");
dol_syslog("Interface::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/"),LOG_ERR);
continue;
}
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i',$file))
{
continue;
}
// Check if trigger file is for a particular module
$qualified=true;
if (strtolower($reg[1]) != 'all')
{
$module=preg_replace('/^mod/i','',$reg[1]);
$constparam='MAIN_MODULE_'.strtoupper($module);
if (empty($conf->global->$constparam)) $qualified=false;
}
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i',$file))
{
continue;
}
// Check if trigger file is for a particular module
$qualified=true;
if (strtolower($reg[1]) != 'all')
{
$module=preg_replace('/^mod/i','',$reg[1]);
$constparam='MAIN_MODULE_'.strtoupper($module);
if (empty($conf->global->$constparam)) $qualified=false;
}
if (! $qualified)
{
dol_syslog("Interfaces::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled",LOG_INFO);
continue;
}
if (! $qualified)
{
dol_syslog("Interfaces::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled",LOG_INFO);
continue;
}
include_once($dir."/".$file);
$objMod = new $modName($this->db);
$i=0;
if ($objMod)
{
// Bypass if workflow module is enabled and if the trigger asked to be disable in such case
if ($conf->workflow->enabled && ! empty($objMod->disabled_if_workflow))
{
dol_syslog("Interfaces::run_triggers action=".$action." Bypass triggers for file '".$file."'",LOG_INFO);
continue;
}
include_once($dir."/".$file);
$objMod = new $modName($this->db);
$i=0;
if ($objMod)
{
// Bypass if workflow module is enabled and if the trigger asked to be disable in such case
if ($conf->workflow->enabled && ! empty($objMod->disabled_if_workflow))
{
dol_syslog("Interfaces::run_triggers action=".$action." Bypass triggers for file '".$file."'",LOG_INFO);
continue;
}
dol_syslog("Interfaces::run_triggers action=".$action." Launch triggers for file '".$file."'",LOG_INFO);
dol_syslog("Interfaces::run_triggers action=".$action." Launch triggers for file '".$file."'",LOG_INFO);
$modules[$i] = $modName;
//dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
$result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
if ($result > 0)
{
// Action OK
$nbtotal++;
$nbok++;
}
if ($result == 0)
{
// Aucune action faite
$nbtotal++;
}
if ($result < 0)
{
// Action KO
$nbtotal++;
$nbko++;
$this->errors[]=$objMod->error;
}
$i++;
}
else
{
dol_syslog("Interfaces::run_triggers action=".$action." Failed to instantiate trigger for file '".$file."'",LOG_ERROR);
}
}
}
closedir($handle);
$modules[$i] = $modName;
//dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
$result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
if ($result > 0)
{
// Action OK
$nbtotal++;
$nbok++;
}
if ($result == 0)
{
// Aucune action faite
$nbtotal++;
}
if ($result < 0)
{
// Action KO
$nbtotal++;
$nbko++;
$this->errors[]=$objMod->error;
}
$i++;
}
else
{
dol_syslog("Interfaces::run_triggers action=".$action." Failed to instantiate trigger for file '".$file."'",LOG_ERROR);
}
}
}
closedir($handle);
}
}
if ($nbko)
@ -191,37 +193,39 @@ class Interfaces
if (!is_dir($dir)) continue;
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.'/'.$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php/',$file,$reg))
{
$modName = 'Interface'.ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules))
{
$langs->load("errors");
print '<div class="error">'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/").'</div>';
$objMod = new $modName($db);
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.'/'.$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php/',$file,$reg))
{
$modName = 'Interface'.ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules))
{
$langs->load("errors");
print '<div class="error">'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/").'</div>';
$objMod = new $modName($db);
$modules[$i] = $modName;
$files[$i] = $file;
$orders[$i] = $objMod->family; // Tri par famille
$i++;
}
else
{
include_once($dir.'/'.$file);
$objMod = new $modName($db);
$modules[$i] = $modName;
$files[$i] = $file;
$orders[$i] = $objMod->family; // Tri par famille
$i++;
}
else
{
include_once($dir.'/'.$file);
$objMod = new $modName($db);
$modules[$i] = $modName;
$files[$i] = $file;
$orders[$i] = $objMod->family; // Tri par famille
$i++;
}
}
}
closedir($handle);
$modules[$i] = $modName;
$files[$i] = $file;
$orders[$i] = $objMod->family; // Tri par famille
$i++;
}
}
}
closedir($handle);
}
}
asort($orders);

View File

@ -127,7 +127,7 @@ $errorlevel=error_reporting();
error_reporting(0);
$handle=opendir($upload_dir);
error_reporting($errorlevel);
if ($handle)
if (is_resource($handle))
{
$i=0;
while (($file = readdir($handle))!==false)

View File

@ -78,7 +78,7 @@ class Export
// Search available exports
$handle=@opendir($dir);
if ($handle)
if (is_resource($handle))
{
$var=True;
$i=0;

View File

@ -70,7 +70,7 @@ class Import
// Search available exports
$handle=@opendir($dir);
if ($handle)
if (is_resource($handle))
{
// Recherche des exports disponibles
$var=True;

View File

@ -551,7 +551,7 @@ if ($step == 3 && $datatoimport)
$dir = $conf->import->dir_temp;
$newdir=utf8_check($dir)?utf8_decode($dir):$dir; // opendir need ISO
$handle=@opendir($newdir);
if ($handle)
if (is_resource($handle))
{
//print '<tr><td colspan="4">';
//print '<table class="noborder" width="100%">';

View File

@ -501,7 +501,7 @@ class DolibarrModules
// Run llx_mytable.sql files
$handle=@opendir($dir); // Dir may not exists
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
@ -516,7 +516,7 @@ class DolibarrModules
// Run llx_mytable.key.sql files
$handle=@opendir($dir); // Dir may not exist
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
@ -531,7 +531,7 @@ class DolibarrModules
// Run data_xxx.sql files
$handle=@opendir($dir); // Dir may not exist
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -89,7 +89,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
$dir = $dirroot . "/includes/modules/barcode/";
$handle=@opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -64,33 +64,36 @@ class ModeleExports
// Recherche des fichiers drivers exports disponibles
$var=True;
$i=0;
while (($file = readdir($handle))!==false)
{
if (preg_match("/^export_(.*)\.modules\.php$/i",$file,$reg))
{
$moduleid=$reg[1];
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match("/^export_(.*)\.modules\.php$/i",$file,$reg))
{
$moduleid=$reg[1];
// Chargement de la classe
$file = $dir."/export_".$moduleid.".modules.php";
$classname = "Export".ucfirst($moduleid);
// Chargement de la classe
$file = $dir."/export_".$moduleid.".modules.php";
$classname = "Export".ucfirst($moduleid);
require_once($file);
$module = new $classname($db);
require_once($file);
$module = new $classname($db);
// Picto
$this->picto[$module->id]=$module->picto;
// Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion();
$i++;
}
}
// Picto
$this->picto[$module->id]=$module->picto;
// Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion();
$i++;
}
}
close($handle);
}
return $this->driverlabel;
}

View File

@ -64,32 +64,35 @@ class ModeleImports
// Recherche des fichiers drivers imports disponibles
$var=True;
$i=0;
while (($file = readdir($handle))!==false)
{
if (preg_match("/^import_(.*)\.modules\.php/i",$file,$reg))
{
$moduleid=$reg[1];
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match("/^import_(.*)\.modules\.php/i",$file,$reg))
{
$moduleid=$reg[1];
// Chargement de la classe
$file = $dir."/import_".$moduleid.".modules.php";
$classname = "Import".ucfirst($moduleid);
// Chargement de la classe
$file = $dir."/import_".$moduleid.".modules.php";
$classname = "Import".ucfirst($moduleid);
require_once($file);
$module = new $classname($db);
require_once($file);
$module = new $classname($db);
// Picto
$this->picto[$module->id]=$module->picto;
// Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion();
// Picto
$this->picto[$module->id]=$module->picto;
// Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion();
$i++;
}
}
$i++;
}
}
}
return array_keys($this->driverlabel);
}

View File

@ -149,15 +149,18 @@ if ($_POST["action"] == "set")
dolibarr_install_syslog("Open tables directory ".$dir." handle=".$handle,LOG_DEBUG);
$tablefound = 0;
$tabledata=array();
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file) && ! preg_match('/\.key\.sql$/i',$file))
{
$tablefound++;
$tabledata[]=$file;
}
}
closedir($handle);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file) && ! preg_match('/\.key\.sql$/i',$file))
{
$tablefound++;
$tabledata[]=$file;
}
}
closedir($handle);
}
// Sort list of sql files on alphabetical order (load order is important)
sort($tabledata);
@ -255,15 +258,18 @@ if ($_POST["action"] == "set")
dolibarr_install_syslog("Open keys directory ".$dir." handle=".$handle,LOG_DEBUG);
$tablefound = 0;
$tabledata=array();
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file) && preg_match('/\.key\.sql$/i',$file))
{
$tablefound++;
$tabledata[]=$file;
}
}
closedir($handle);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file) && preg_match('/\.key\.sql$/i',$file))
{
$tablefound++;
$tabledata[]=$file;
}
}
closedir($handle);
}
// Sort list of sql files on alphabetical order (load order is important)
sort($tabledata);
@ -474,15 +480,18 @@ if ($_POST["action"] == "set")
dolibarr_install_syslog("Open directory data ".$dir." handle=".$handle,LOG_DEBUG);
$tablefound = 0;
$tabledata=array();
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file))
{
$tablefound++;
$tabledata[]=$file;
}
}
closedir($handle);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file))
{
$tablefound++;
$tabledata[]=$file;
}
}
closedir($handle);
}
// Sort list of data files on alphabetical order (load order is important)
sort($tabledata);

View File

@ -250,50 +250,53 @@ if (1 == 2) { // Disabled during install process because HTTPS may not be yet
$defaultype=! empty($dolibarr_main_db_type)?$dolibarr_main_db_type:($force_install_type?$force_install_type:'mysqli');
// Scan les drivers
$modules = array();
$nbok = $nbko = 0;
$option='';
// Scan les drivers
$dir=DOL_DOCUMENT_ROOT.'/lib/databases';
$handle=opendir($dir);
$modules = array();
$nbok = $nbko = 0;
$option='';
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir."/".$file) && preg_match('/^(.*)\.lib\.php/i',$file,$reg))
{
$type=$reg[1];
while (($file = readdir($handle))!==false)
{
if (is_readable($dir."/".$file) && preg_match('/^(.*)\.lib\.php/i',$file,$reg))
{
$type=$reg[1];
// Version min de la base
$versionbasemin=array();
if ($type=='mysql') { $versionbasemin=array(3,1,0); $testfunction='mysql_connect'; }
if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; }
if ($type=='pgsql') { $versionbasemin=array(8,1,0); $testfunction='pg_connect'; }
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; }
// Version min de la base
$versionbasemin=array();
if ($type=='mysql') { $versionbasemin=array(3,1,0); $testfunction='mysql_connect'; }
if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; }
if ($type=='pgsql') { $versionbasemin=array(8,1,0); $testfunction='pg_connect'; }
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; }
// Remarques
$note='';
if ($type=='mysql') $note='(Mysql >= '.versiontostring($versionbasemin).')';
if ($type=='mysqli') $note='(Mysql >= '.versiontostring($versionbasemin).')';
if ($type=='pgsql') $note='(Postgresql >= '.versiontostring($versionbasemin).')';
if ($type=='mssql') $note='(SQL Server >= '.versiontostring($versionbasemin).')';
// Remarques
$note='';
if ($type=='mysql') $note='(Mysql >= '.versiontostring($versionbasemin).')';
if ($type=='mysqli') $note='(Mysql >= '.versiontostring($versionbasemin).')';
if ($type=='pgsql') $note='(Postgresql >= '.versiontostring($versionbasemin).')';
if ($type=='mssql') $note='(SQL Server >= '.versiontostring($versionbasemin).')';
// Switch to mysql if mysqli is not present
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
// Switch to mysql if mysqli is not present
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
// Affiche ligne dans liste
$option.='<option value="'.$type.'"'.($defaultype == $type?' selected':'');
if (! function_exists($testfunction)) $option.=' disabled="disabled"';
$option.='>';
$option.=$type.'&nbsp; &nbsp;';
if ($note) $option.=' '.$note;
// Experimental
if ($type=='pgsql') $option.=' '.$langs->trans("Experimental");
elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental");
// No available
elseif (! function_exists($testfunction)) $option.=' - '.$langs->trans("FunctionNotAvailableInThisPHP");
$option.='</option>';
}
}
// Affiche ligne dans liste
$option.='<option value="'.$type.'"'.($defaultype == $type?' selected':'');
if (! function_exists($testfunction)) $option.=' disabled="disabled"';
$option.='>';
$option.=$type.'&nbsp; &nbsp;';
if ($note) $option.=' '.$note;
// Experimental
if ($type=='pgsql') $option.=' '.$langs->trans("Experimental");
elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental");
// No available
elseif (! function_exists($testfunction)) $option.=' - '.$langs->trans("FunctionNotAvailableInThisPHP");
$option.='</option>';
}
}
}
?> <select name='db_type'>
<?php echo $option ?>

View File

@ -163,10 +163,13 @@ if ($ok)
# Recupere list fichier
$filesindir=array();
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file)) $filesindir[]=$file;
}
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file)) $filesindir[]=$file;
}
}
sort($filesindir);
foreach($filesindir as $file)

View File

@ -290,7 +290,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
# Recupere list fichier
$filesindir=array();
$handle=opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -1438,37 +1438,39 @@ function getLoginMethod()
if (!is_dir($dir)) continue;
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.'/'.$file) && preg_match('/^functions_([^_]+)\.php/',$file,$reg))
{
$authfile = $dir.'/'.$file;
$mode = $reg[1];
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.'/'.$file) && preg_match('/^functions_([^_]+)\.php/',$file,$reg))
{
$authfile = $dir.'/'.$file;
$mode = $reg[1];
$result=include_once($authfile);
if ($result)
{
// Call function to check user/password
$usertotest=$_POST["username"];
$passwordtotest=$_POST["password"];
$function='check_user_password_'.$mode;
$login=$function($usertotest,$passwordtotest);
if ($login)
{
$conf->authmode=$mode; // This properties is defined only when logged
}
}
else
{
dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
sleep(1);
$langs->load('main');
$langs->load('other');
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode);
}
}
}
$result=include_once($authfile);
if ($result)
{
// Call function to check user/password
$usertotest=$_POST["username"];
$passwordtotest=$_POST["password"];
$function='check_user_password_'.$mode;
$login=$function($usertotest,$passwordtotest);
if ($login)
{
$conf->authmode=$mode; // This properties is defined only when logged
}
}
else
{
dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
sleep(1);
$langs->load('main');
$langs->load('other');
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode);
}
}
}
}
closedir($handle);
}
return $login;

View File

@ -232,48 +232,49 @@ if ($conf->global->PRODUCT_CANVAS_ABILITY)
require_once(DOL_DOCUMENT_ROOT . "/product/class/product.class.php");
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (file_exists($dir.$file.'/product.'.$file.'.class.php'))
{
$classfile = $dir.$file.'/product.'.$file.'.class.php';
$classname = 'Product'.ucfirst($file);
while (($file = readdir($handle))!==false)
{
if (file_exists($dir.$file.'/product.'.$file.'.class.php'))
{
$classfile = $dir.$file.'/product.'.$file.'.class.php';
$classname = 'Product'.ucfirst($file);
require_once($classfile);
$object = new $classname();
require_once($classfile);
$object = new $classname();
$module = $object->module;
$module = $object->module;
if ($conf->$module->enabled)
{
$var=!$var;
print "<tr $bc[$var]><td>";
if ($conf->$module->enabled)
{
$var=!$var;
print "<tr $bc[$var]><td>";
print $object->description;
print $object->description;
print '</td><td align="right">';
print '</td><td align="right">';
$const = "PRODUCT_SPECIAL_".strtoupper($file);
$const = "PRODUCT_SPECIAL_".strtoupper($file);
if ($conf->global->$const)
{
print img_tick();
print '</td><td align="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;spe='.$file.'&amp;value=0">'.$langs->trans("Disable").'</a>';
}
else
{
print '&nbsp;</td><td align="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;spe='.$file.'&amp;value=1">'.$langs->trans("Activate").'</a>';
}
if ($conf->global->$const)
{
print img_tick();
print '</td><td align="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;spe='.$file.'&amp;value=0">'.$langs->trans("Disable").'</a>';
}
else
{
print '&nbsp;</td><td align="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;spe='.$file.'&amp;value=1">'.$langs->trans("Activate").'</a>';
}
print '</td></tr>';
}
}
}
closedir($handle);
print '</td></tr>';
}
}
}
closedir($handle);
}
}
else
{

View File

@ -2462,10 +2462,13 @@ class Product extends CommonObject
if (file_exists($dir_osencoded))
{
$handle=opendir($dir_osencoded);
while (($file = readdir($handle)) != false)
if (is_resource($handle))
{
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in UTF8 in memory
if (dol_is_file($dir.$file)) return true;
while (($file = readdir($handle)) != false)
{
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in UTF8 in memory
if (dol_is_file($dir.$file)) return true;
}
}
}
return false;
@ -2502,100 +2505,103 @@ class Product extends CommonObject
if (file_exists($dir_osencoded))
{
$handle=opendir($dir_osencoded);
while (($file = readdir($handle)) != false)
{
$photo='';
if (is_resource($handle))
{
while (($file = readdir($handle)) != false)
{
$photo='';
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
{
$nbphoto++;
$photo = $file;
$viewfilename = $file;
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
{
$nbphoto++;
$photo = $file;
$viewfilename = $file;
if ($size == 1) { // Format vignette
// On determine nom du fichier vignette
$photo_vignette='';
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs)) {
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo)."_small".$regs[0];
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
}
if ($size == 1) { // Format vignette
// On determine nom du fichier vignette
$photo_vignette='';
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs)) {
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo)."_small".$regs[0];
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
}
// Get filesize of original file
$imgarray=dol_getImageSize($dir.$photo);
// Get filesize of original file
$imgarray=dol_getImageSize($dir.$photo);
if ($nbbyrow && $nbphoto == 1) $return.= '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
if ($nbbyrow && $nbphoto == 1) $return.= '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) $return.= '<tr align=center valign=middle border=1>';
if ($nbbyrow) $return.= '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) $return.= '<tr align=center valign=middle border=1>';
if ($nbbyrow) $return.= '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
$return.= "\n";
$return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" target="_blank">';
$return.= "\n";
$return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" target="_blank">';
// Show image (width height=$maxheight)
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
$alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo;
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
if ($photo_vignette && $imgarray['height'] > $maxheight) {
$return.= '<!-- Show thumb -->';
$return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
}
else {
$return.= '<!-- Show original file -->';
$return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
}
// Show image (width height=$maxheight)
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
$alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo;
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
if ($photo_vignette && $imgarray['height'] > $maxheight) {
$return.= '<!-- Show thumb -->';
$return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
}
else {
$return.= '<!-- Show original file -->';
$return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
}
$return.= '</a>';
$return.= '</a>';
if ($showfilename) $return.= '<br>'.$viewfilename;
if ($showaction)
{
$return.= '<br>';
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
{
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=addthumb&amp;file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).'&nbsp;&nbsp;</a>';
}
if ($user->rights->produit->creer || $user->rights->service->creer)
{
// Link to resize
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$_GET["id"].'&amp;file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
if ($showfilename) $return.= '<br>'.$viewfilename;
if ($showaction)
{
$return.= '<br>';
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
{
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=addthumb&amp;file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).'&nbsp;&nbsp;</a>';
}
if ($user->rights->produit->creer || $user->rights->service->creer)
{
// Link to resize
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$_GET["id"].'&amp;file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
// Link to delete
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
$return.= img_delete().'</a>';
}
}
$return.= "\n";
// Link to delete
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
$return.= img_delete().'</a>';
}
}
$return.= "\n";
if ($nbbyrow) $return.= '</td>';
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) $return.= '</tr>';
if ($nbbyrow) $return.= '</td>';
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) $return.= '</tr>';
}
}
if ($size == 0) { // Format origine
$return.= '<img class="photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'">';
if ($size == 0) { // Format origine
$return.= '<img class="photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'">';
if ($showfilename) $return.= '<br>'.$viewfilename;
if ($showaction)
{
if ($user->rights->produit->creer || $user->rights->service->creer)
{
// Link to resize
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$_GET["id"].'&amp;file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
if ($showfilename) $return.= '<br>'.$viewfilename;
if ($showaction)
{
if ($user->rights->produit->creer || $user->rights->service->creer)
{
// Link to resize
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$_GET["id"].'&amp;file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
// Link to delete
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
$return.= img_delete().'</a>';
}
}
}
// Link to delete
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
$return.= img_delete().'</a>';
}
}
}
// On continue ou on arrete de boucler ?
if ($nbmax && $nbphoto >= $nbmax) break;
}
}
// On continue ou on arrete de boucler ?
if ($nbmax && $nbphoto >= $nbmax) break;
}
}
}
if ($nbbyrow && $size==1)
{
@ -2632,7 +2638,7 @@ class Product extends CommonObject
$dir_osencoded=dol_osencode($dir);
$handle=@opendir($dir_osencoded);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle)) != false)
{

View File

@ -81,52 +81,54 @@ foreach ($dirlist as $dirroot)
// Charge tableaux modules, nom, numero, orders depuis repertoire dir
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
if (is_resource($handle))
{
//print "$i ".$file."\n<br>";
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
while (($file = readdir($handle))!==false)
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
//print "$i ".$file."\n<br>";
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
include_once($dir.$file);
$objMod = new $modName($db);
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($objMod->numero > 0)
if ($modName)
{
$j = $objMod->numero;
}
else
{
$j = 1000 + $i;
}
include_once($dir.$file);
$objMod = new $modName($db);
$modulequalified=1;
if ($objMod->numero > 0)
{
$j = $objMod->numero;
}
else
{
$j = 1000 + $i;
}
// We discard modules that does not respect constraint on menu handlers
if ($objMod->needtopmenu && sizeof($objMod->needtopmenu) && ! in_array($conf->top_menu,$objMod->needtopmenu)) $modulequalified=0;
$modulequalified=1;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
// We discard modules that does not respect constraint on menu handlers
if ($objMod->needtopmenu && sizeof($objMod->needtopmenu) && ! in_array($conf->top_menu,$objMod->needtopmenu)) $modulequalified=0;
if ($modulequalified)
{
$modules[$i] = $objMod;
$filename[$i]= $modName;
$orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
//print "x".$modName." ".$orders[$i]."\n<br>";
$categ[$objMod->special]++; // Array of all different modules categories
$dirmod[$i] = $dirroot;
$j++;
$i++;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
if ($modulequalified)
{
$modules[$i] = $objMod;
$filename[$i]= $modName;
$orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
//print "x".$modName." ".$orders[$i]."\n<br>";
$categ[$objMod->special]++; // Array of all different modules categories
$dirmod[$i] = $dirroot;
$j++;
$i++;
}
}
}
}
}
}
asort($orders);

View File

@ -212,7 +212,7 @@ if ($socid > 0)
error_reporting(0);
$handle=opendir($courrier_dir);
error_reporting($errorlevel);
if ($handle)
if (is_resource($handle))
{
$i=0;
while (($file = readdir($handle))!==false)

View File

@ -101,7 +101,7 @@ if ($_GET["id"])
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
$handle=@opendir($dir);
if ($handle)
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{

View File

@ -128,26 +128,29 @@ foreach($listdir as $dirroot)
$dir=$dirroot."/includes/modules/";
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{
include_once($dir.$file);
$objMod = new $modName($db);
if ($objMod->rights_class) {
if ($modName)
{
include_once($dir.$file);
$objMod = new $modName($db);
if ($objMod->rights_class) {
$ret=$objMod->insert_permissions(0);
$ret=$objMod->insert_permissions(0);
$modules[$objMod->rights_class]=$objMod;
//print "modules[".$objMod->rights_class."]=$objMod;";
}
}
}
}
$modules[$objMod->rights_class]=$objMod;
//print "modules[".$objMod->rights_class."]=$objMod;";
}
}
}
}
}
}
$db->commit();