This commit is contained in:
Laurent Destailleur 2021-03-02 01:58:36 +01:00
parent f1f950e8b7
commit ebc3210308
2 changed files with 16 additions and 12 deletions

View File

@ -402,13 +402,13 @@ foreach ($dirmodels as $reldir) {
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
@ -417,7 +417,7 @@ foreach ($dirmodels as $reldir) {
if ($conf->global->PROPALE_ADDON_PDF == "$name") {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';

View File

@ -913,16 +913,20 @@ IMG;
{
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
$filename=''; $linenum=0;
if (headers_sent($filename, $linenum)) {
throw new OdfException("headers already sent ($filename at $linenum)");
if (php_sapi_name() != 'cli') { // If we are in a web context (not into CLI context)
if (headers_sent($filename, $linenum)) {
throw new OdfException("headers already sent ($filename at $linenum)");
}
if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$name=preg_replace('/\.od(x|t)/i', '', $name);
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.$name.'.pdf"');
readfile($name.".pdf");
}
}
if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$name=preg_replace('/\.od(x|t)/i', '', $name);
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.$name.'.pdf"');
readfile($name.".pdf");
}
if (!empty($conf->global->MAIN_ODT_AS_PDF_DEL_SOURCE))
{
unlink($name);
@ -931,7 +935,7 @@ IMG;
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG);
if ($retval==126) {
if ($retval == 126) {
throw new OdfException('Permission execute convert script : ' . $command);
}
else {