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

View File

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

View File

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

View File

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

View File

@ -197,7 +197,7 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$handle = opendir($dir); $handle = opendir($dir);
if ($handle) if (is_resource($handle))
{ {
$var=true; $var=true;
@ -304,79 +304,82 @@ clearstatcache();
$var=true; $var=true;
$handle=opendir($dir); $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_') while (($file = readdir($handle))!==false)
{ {
$name = substr($file, 4, dol_strlen($file) -16); if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
$classname = substr($file, 0, dol_strlen($file) -12); {
$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>'; print '<tr '.$bc[$var].'><td>';
echo "$name"; echo "$name";
print "</td><td>\n"; print "</td><td>\n";
require_once($dir.$file); require_once($dir.$file);
$module = new $classname(); $module = new $classname();
print $module->description; print $module->description;
print '</td>'; print '</td>';
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->FICHEINTER_ADDON_PDF != "$name") if ($conf->global->FICHEINTER_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"),'on'); print img_picto($langs->trans("Enabled"),'on');
print '</a>'; print '</a>';
} }
else else
{ {
print img_picto($langs->trans("Enabled"),'on'); print img_picto($langs->trans("Enabled"),'on');
} }
print "</td>"; print "</td>";
} }
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>"; print "</td>";
} }
// Defaut // Defaut
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name") if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"),'on'); print img_picto($langs->trans("Default"),'on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $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>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $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("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,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("MultiLanguage").': '.yn($module->option_multilang,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); $htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">'; print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0); print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>'; print '</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
}
closedir($handle);
} }
closedir($handle);
print '</table>'; print '</table>';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -188,7 +188,7 @@ clearstatcache();
$dir = "../includes/modules/societe/"; $dir = "../includes/modules/societe/";
$handle = opendir($dir); $handle = opendir($dir);
if ($handle) if (is_resource($handle))
{ {
$var = true; $var = true;
@ -259,7 +259,7 @@ clearstatcache();
$dir = "../includes/modules/societe/"; $dir = "../includes/modules/societe/";
$handle = opendir($dir); $handle = opendir($dir);
if ($handle) if (is_resource($handle))
{ {
$var = true; $var = true;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
@ -348,7 +348,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (is_dir($dir)) if (is_dir($dir))
{ {
$handle=opendir($dir); $handle=opendir($dir);
if ($handle) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) 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/"; if (preg_match('/custom$/i',$searchdir)) $dirtoscan = $searchdir . "/modules/";
else $dirtoscan = $searchdir . "/includes/modules/"; else $dirtoscan = $searchdir . "/includes/modules/";
$handle=opendir($dirtoscan); $handle=opendir($dirtoscan);
while (($file = readdir($handle))!==false) if (is_resource($handle))
{ {
if (is_readable($dirtoscan.$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 (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) if ($modName)
{ {
include_once($dirtoscan.$file); include_once($dirtoscan.$file);
$objMod = new $modName($db); $objMod = new $modName($db);
$modules[$objMod->numero]=$objMod; $modules[$objMod->numero]=$objMod;
$modules_names[$objMod->numero]=$objMod->name; $modules_names[$objMod->numero]=$objMod->name;
$modules_files[$objMod->numero]=$file; $modules_files[$objMod->numero]=$file;
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic'; $picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
} }
} }
} }
close($handle);
}
} }
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

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

View File

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

View File

@ -73,69 +73,71 @@ $dir=DOL_DOCUMENT_ROOT."/includes/modules/mailings";
$handle=opendir($dir); $handle=opendir($dir);
$var=True; $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 (preg_match("/(.*)\.(.*)\.(.*)/i",$file,$reg))
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 (! $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; if (! $conf->$key->enabled || (! $user->admin && $mailmodule->require_admin))
//print "Les pr<70>requis d'activation du module mailing ne sont pas respect<63>s. Il ne sera pas actif"; {
break; $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> // Si le module mailing est qualifi<66>
if ($qualified) if ($qualified)
{
$var = !$var;
foreach ($mailmodule->getSqlArrayForStats() as $sql)
{ {
print '<tr '.$bc[$var].'>'; $var = !$var;
$result=$db->query($sql); foreach ($mailmodule->getSqlArrayForStats() as $sql)
if ($result)
{ {
$num = $db->num_rows($result); print '<tr '.$bc[$var].'>';
$i = 0; $result=$db->query($sql);
if ($result)
while ($i < $num )
{ {
$obj = $db->fetch_object($result); $num = $db->num_rows($result);
print '<td>'.img_object('',$mailmodule->picto).' '.$obj->label.'</td><td align="right">'.$obj->nb.'<td>';
$i++;
}
$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>"; print "</table><br>";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,32 +64,35 @@ class ModeleImports
// Recherche des fichiers drivers imports disponibles // Recherche des fichiers drivers imports disponibles
$var=True; $var=True;
$i=0; $i=0;
while (($file = readdir($handle))!==false) if (is_resource($handle))
{ {
if (preg_match("/^import_(.*)\.modules\.php/i",$file,$reg)) while (($file = readdir($handle))!==false)
{ {
$moduleid=$reg[1]; if (preg_match("/^import_(.*)\.modules\.php/i",$file,$reg))
{
$moduleid=$reg[1];
// Chargement de la classe // Chargement de la classe
$file = $dir."/import_".$moduleid.".modules.php"; $file = $dir."/import_".$moduleid.".modules.php";
$classname = "Import".ucfirst($moduleid); $classname = "Import".ucfirst($moduleid);
require_once($file); require_once($file);
$module = new $classname($db); $module = new $classname($db);
// Picto // Picto
$this->picto[$module->id]=$module->picto; $this->picto[$module->id]=$module->picto;
// Driver properties // Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel(); $this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc(); $this->driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion(); $this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib // If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel(); $this->liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion(); $this->libversion[$module->id]=$module->getLibVersion();
$i++; $i++;
} }
} }
}
return array_keys($this->driverlabel); 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); dolibarr_install_syslog("Open tables directory ".$dir." handle=".$handle,LOG_DEBUG);
$tablefound = 0; $tablefound = 0;
$tabledata=array(); $tabledata=array();
while (($file = readdir($handle))!==false) if (is_resource($handle))
{ {
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file) && ! preg_match('/\.key\.sql$/i',$file)) while (($file = readdir($handle))!==false)
{ {
$tablefound++; if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file) && ! preg_match('/\.key\.sql$/i',$file))
$tabledata[]=$file; {
} $tablefound++;
} $tabledata[]=$file;
closedir($handle); }
}
closedir($handle);
}
// Sort list of sql files on alphabetical order (load order is important) // Sort list of sql files on alphabetical order (load order is important)
sort($tabledata); sort($tabledata);
@ -255,15 +258,18 @@ if ($_POST["action"] == "set")
dolibarr_install_syslog("Open keys directory ".$dir." handle=".$handle,LOG_DEBUG); dolibarr_install_syslog("Open keys directory ".$dir." handle=".$handle,LOG_DEBUG);
$tablefound = 0; $tablefound = 0;
$tabledata=array(); $tabledata=array();
while (($file = readdir($handle))!==false) if (is_resource($handle))
{ {
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file) && preg_match('/\.key\.sql$/i',$file)) while (($file = readdir($handle))!==false)
{ {
$tablefound++; if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file) && preg_match('/\.key\.sql$/i',$file))
$tabledata[]=$file; {
} $tablefound++;
} $tabledata[]=$file;
closedir($handle); }
}
closedir($handle);
}
// Sort list of sql files on alphabetical order (load order is important) // Sort list of sql files on alphabetical order (load order is important)
sort($tabledata); sort($tabledata);
@ -474,15 +480,18 @@ if ($_POST["action"] == "set")
dolibarr_install_syslog("Open directory data ".$dir." handle=".$handle,LOG_DEBUG); dolibarr_install_syslog("Open directory data ".$dir." handle=".$handle,LOG_DEBUG);
$tablefound = 0; $tablefound = 0;
$tabledata=array(); $tabledata=array();
while (($file = readdir($handle))!==false) if (is_resource($handle))
{ {
if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file)) while (($file = readdir($handle))!==false)
{ {
$tablefound++; if (preg_match('/\.sql$/i',$file) && preg_match('/^llx_/i',$file))
$tabledata[]=$file; {
} $tablefound++;
} $tabledata[]=$file;
closedir($handle); }
}
closedir($handle);
}
// Sort list of data files on alphabetical order (load order is important) // Sort list of data files on alphabetical order (load order is important)
sort($tabledata); 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'); $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'; $dir=DOL_DOCUMENT_ROOT.'/lib/databases';
$handle=opendir($dir); $handle=opendir($dir);
$modules = array(); if (is_resource($handle))
$nbok = $nbko = 0; {
$option=''; 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) // Version min de la base
{ $versionbasemin=array();
if (is_readable($dir."/".$file) && preg_match('/^(.*)\.lib\.php/i',$file,$reg)) if ($type=='mysql') { $versionbasemin=array(3,1,0); $testfunction='mysql_connect'; }
{ if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; }
$type=$reg[1]; 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 // Remarques
$versionbasemin=array(); $note='';
if ($type=='mysql') { $versionbasemin=array(3,1,0); $testfunction='mysql_connect'; } if ($type=='mysql') $note='(Mysql >= '.versiontostring($versionbasemin).')';
if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; } if ($type=='mysqli') $note='(Mysql >= '.versiontostring($versionbasemin).')';
if ($type=='pgsql') { $versionbasemin=array(8,1,0); $testfunction='pg_connect'; } if ($type=='pgsql') $note='(Postgresql >= '.versiontostring($versionbasemin).')';
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; } if ($type=='mssql') $note='(SQL Server >= '.versiontostring($versionbasemin).')';
// Remarques // Switch to mysql if mysqli is not present
$note=''; if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
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 // Affiche ligne dans liste
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql'; $option.='<option value="'.$type.'"'.($defaultype == $type?' selected':'');
if (! function_exists($testfunction)) $option.=' disabled="disabled"';
// Affiche ligne dans liste $option.='>';
$option.='<option value="'.$type.'"'.($defaultype == $type?' selected':''); $option.=$type.'&nbsp; &nbsp;';
if (! function_exists($testfunction)) $option.=' disabled="disabled"'; if ($note) $option.=' '.$note;
$option.='>'; // Experimental
$option.=$type.'&nbsp; &nbsp;'; if ($type=='pgsql') $option.=' '.$langs->trans("Experimental");
if ($note) $option.=' '.$note; elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental");
// Experimental // No available
if ($type=='pgsql') $option.=' '.$langs->trans("Experimental"); elseif (! function_exists($testfunction)) $option.=' - '.$langs->trans("FunctionNotAvailableInThisPHP");
elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental"); $option.='</option>';
// No available }
elseif (! function_exists($testfunction)) $option.=' - '.$langs->trans("FunctionNotAvailableInThisPHP"); }
$option.='</option>'; }
}
}
?> <select name='db_type'> ?> <select name='db_type'>
<?php echo $option ?> <?php echo $option ?>

View File

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

View File

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

View File

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

View File

@ -232,48 +232,49 @@ if ($conf->global->PRODUCT_CANVAS_ABILITY)
require_once(DOL_DOCUMENT_ROOT . "/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT . "/product/class/product.class.php");
$handle=opendir($dir); $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) require_once($classfile);
{ $object = new $classname();
if (file_exists($dir.$file.'/product.'.$file.'.class.php'))
{
$classfile = $dir.$file.'/product.'.$file.'.class.php';
$classname = 'Product'.ucfirst($file);
require_once($classfile); $module = $object->module;
$object = new $classname();
$module = $object->module; if ($conf->$module->enabled)
{
$var=!$var;
print "<tr $bc[$var]><td>";
if ($conf->$module->enabled) print $object->description;
{
$var=!$var;
print "<tr $bc[$var]><td>";
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 '</td></tr>';
{ }
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>'; closedir($handle);
} }
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);
} }
else else
{ {

View File

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

View File

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

View File

@ -212,7 +212,7 @@ if ($socid > 0)
error_reporting(0); error_reporting(0);
$handle=opendir($courrier_dir); $handle=opendir($courrier_dir);
error_reporting($errorlevel); error_reporting($errorlevel);
if ($handle) if (is_resource($handle))
{ {
$i=0; $i=0;
while (($file = readdir($handle))!==false) 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 // Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>"; //print $dir."\n<br>";
$handle=@opendir($dir); $handle=@opendir($dir);
if ($handle) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {

View File

@ -128,26 +128,29 @@ foreach($listdir as $dirroot)
$dir=$dirroot."/includes/modules/"; $dir=$dirroot."/includes/modules/";
$handle=opendir($dir); $handle=opendir($dir);
while (($file = readdir($handle))!==false) if (is_resource($handle))
{ {
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 (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) if ($modName)
{ {
include_once($dir.$file); include_once($dir.$file);
$objMod = new $modName($db); $objMod = new $modName($db);
if ($objMod->rights_class) { if ($objMod->rights_class) {
$ret=$objMod->insert_permissions(0); $ret=$objMod->insert_permissions(0);
$modules[$objMod->rights_class]=$objMod; $modules[$objMod->rights_class]=$objMod;
//print "modules[".$objMod->rights_class."]=$objMod;"; //print "modules[".$objMod->rights_class."]=$objMod;";
} }
} }
} }
} }
}
} }
$db->commit(); $db->commit();