| '; print ''; + // Show Quick Add link + print ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $langs->trans("ShowQuickAddLink") . ' | '; + print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); + print ' | '; + print '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . ' | '; + print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); + //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); + print ' | '; + print '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $langs->trans("DefaultMaxSizeList") . ' | '; print ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $langs->trans("ShowQuickAddLink") . ' | '; - print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); - print ' | '; - print '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '; print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc")); @@ -463,14 +471,6 @@ if ($mode == 'other') { print ' | '; print '||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . ' | '; - print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); - //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); - print ' | '; - print '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . ' | '; print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index db92c33a7fb..3f72fc77c6c 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -285,7 +285,7 @@ foreach($object->fields as $key => $val) $sql .= "t.".$key.", "; } // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); } // Add where from hooks diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 7f60b2260d7..d65bcefb11f 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -45,10 +45,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langsArray=array("errors", "admin", "mails", "languages"); -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { $langsArray[]='members'; } -if (!empty($conf->eventorganization->enabled)) { +if (isModEnabled('eventorganization')) { $langsArray[]='eventorganization'; } @@ -179,22 +179,22 @@ $elementList = array(); $elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --'; $elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --'; $elementList['user'] = img_picto('', 'user', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToUser')); -if (!empty($conf->adherent->enabled) && !empty($user->rights->adherent->lire)) { +if (isModEnabled('adherent') && !empty($user->rights->adherent->lire)) { $elementList['member'] = img_picto('', 'object_member', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToMember')); } -if (!empty($conf->recruitment->enabled) && !empty($user->rights->recruitment->recruitmentjobposition->read)) { +if (isModEnabled('recruitment') && !empty($user->rights->recruitment->recruitmentjobposition->read)) { $elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures')); } if (isModEnabled("societe") && !empty($user->rights->societe->lire)) { $elementList['thirdparty'] = img_picto('', 'company', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToThirdparty')); } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $elementList['project'] = img_picto('', 'project', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToProject')); } if (isModEnabled("propal") && !empty($user->rights->propal->lire)) { $elementList['propal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendProposal')); } -if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) { +if (isModEnabled('commande') && !empty($user->rights->commande->lire)) { $elementList['order_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendOrder')); } if (isModEnabled('facture') && !empty($user->rights->facture->lire)) { @@ -209,7 +209,7 @@ if (isModEnabled("reception")) { if (!empty($conf->ficheinter->enabled)) { $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention')); } -if (!empty($conf->supplier_proposal->enabled)) { +if (isModEnabled('supplier_proposal')) { $elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation')); } if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire))) { @@ -218,19 +218,19 @@ if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->commande- if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) { $elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice')); } -if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) { +if (isModEnabled('contrat') && !empty($user->rights->contrat->lire)) { $elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract')); } if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) { $elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket')); } -if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) { +if (isModEnabled('expensereport') && !empty($user->rights->expensereport->lire)) { $elementList['expensereport_send'] = img_picto('', 'trip', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToExpenseReport')); } if (isModEnabled('agenda')) { $elementList['actioncomm_send'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventPush')); } -if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) { +if (isModEnabled('eventorganization') && !empty($user->rights->eventorganization->read)) { $elementList['conferenceorbooth'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); } if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) { @@ -823,7 +823,7 @@ if ($action == 'add') { } elseif ($tmpfieldlist == 'joinfiles') { print ''; } else { - // print ''; + // print ''; $okforextended = true; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $okforextended = false; @@ -1074,7 +1074,7 @@ if ($num) { $okforextended = true; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); print $doleditor->Create(1); } print ' | '; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9378fc28bbe..471b34866a7 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -219,29 +219,6 @@ if ($action == 'add') { } } -// delete -if ($action == 'confirm_delete' && $confirm == 'yes') { - $db->begin(); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu WHERE rowid = ".GETPOST('menuId', 'int'); - $result = $db->query($sql); - - if ($result == 0) { - $db->commit(); - - llxHeader(); - setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs'); - llxFooter(); - exit; - } else { - $db->rollback(); - - $reload = 0; - $_GET["action"] = ''; - $action = ''; - } -} - /* diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 16500c62d59..dbcc9cfdade 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -137,7 +137,7 @@ foreach ($modulesdir as $dir) { } // We discard modules according to property disabled - //if (! empty($objMod->hidden)) $modulequalified=0; + //if (!empty($objMod->hidden)) $modulequalified=0; if ($modulequalified > 0) { $publisher = dol_escape_htmltag($objMod->getPublisher()); diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 997c71bb335..eb918086720 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -378,7 +378,7 @@ print '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans("Parameter").' | '.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").' | ';
-//if (! empty($conf->global->MAIN_MULTILANGS))
+//if (!empty($conf->global->MAIN_MULTILANGS))
//{
$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0);
print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php
index 88a02e90457..c76cccdcc5c 100644
--- a/htdocs/admin/prelevement.php
+++ b/htdocs/admin/prelevement.php
@@ -392,7 +392,7 @@ print ' '; */ /* Disable this, there is no trigger with elementtype 'withdraw' -if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) +if (!empty($conf->global->MAIN_MODULE_NOTIFICATION)) { $langs->load("mails"); print load_fiche_titre($langs->trans("Notifications")); diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index eea567ea27c..408c42cc3a8 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -705,7 +705,7 @@ if (isModEnabled('facture')) print ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' | ';
- if (! empty($conf->use_javascript_ajax))
+ if (!empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL');
}
diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php
index ade62c29081..fcca4cf2f18 100644
--- a/htdocs/admin/stock.php
+++ b/htdocs/admin/stock.php
@@ -180,13 +180,13 @@ $formproduct = new FormProduct($db);
$disabled = '';
-if (!empty($conf->productbatch->enabled)) {
+if (isModEnabled('productbatch')) {
$langs->load("productbatch");
$disabled = ' disabled';
print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced"));
}
-//if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
+//if (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
//{
print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule"));
print ' '; @@ -226,7 +226,7 @@ $found++; print ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans("DeStockOnValidateOrder").' | '; print ''; -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1); } else { @@ -239,7 +239,7 @@ if (!empty($conf->commande->enabled)) { print " | \n|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans("StockMustBeEnoughForInvoice").' | '; print ''; @@ -408,7 +408,7 @@ if (!empty($conf->invoice->enabled)) { print " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans("StockMustBeEnoughForOrder").' | '; print ''; @@ -763,7 +763,7 @@ print " | \n"; print "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $langs->trans("ShowAllBatchByDefault") . ' | '; print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 9482a06be41..0204f184de7 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -468,7 +468,7 @@ if (isModEnabled('banque')) { print ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' | ';
- if (! empty($conf->use_javascript_ajax))
+ if (!empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER');
}
diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php
index fdb3117423b..3e4c088620d 100644
--- a/htdocs/admin/ticket_public.php
+++ b/htdocs/admin/ticket_public.php
@@ -101,7 +101,7 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
- if (!empty($text_home)) {
+ if (GETPOSTISSET('TICKET_PUBLIC_TEXT_HOME')) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
@@ -235,12 +235,10 @@ $head = ticketAdminPrepareHead();
print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
-print ''.$langs->trans("TicketPublicAccess").' : '.dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 2).'';
-
-print dol_get_fiche_end();
-
$param = '';
+print ' '; + $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' '; if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { // Button off, click to enable @@ -256,9 +254,30 @@ if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $enabledisablehtml; print ''; -print ' '; +print dol_get_fiche_end(); + + if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { + print ' '; + + + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + print ''.$langs->trans("TicketPublicAccess").' : '; + print ' ';
+ print '';
+ print ''.img_picto('', 'globe', 'class="paddingleft"').'';
+ print ' ';
+ print ajax_autoselect('publicurlmember');
+
+
+ print ''; + + print ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").''; print ' | '; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -383,7 +402,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help'); print ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").''; print ' | '; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index d21622d1f68..3f3316f6996 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -56,21 +56,23 @@ if (!$user->admin) { accessforbidden(); } -if ($file && !$what) { - //print DOL_URL_ROOT.'/dolibarr_export.php'; - header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : '')); - exit; -} - $errormsg = ''; +$utils = new Utils($db); + /* * Actions */ +if ($file && !$what) { + //print DOL_URL_ROOT.'/dolibarr_export.php'; + header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : '')); + exit; +} + if ($action == 'delete') { - $file = $conf->admin->dir_output.'/'.GETPOST('urlfile'); + $file = $conf->admin->dir_output.'/'.dol_sanitizeFileName(GETPOST('urlfile')); $ret = dol_delete_file($file, 1); if ($ret) { setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); @@ -80,11 +82,6 @@ if ($action == 'delete') { $action = ''; } - -/* - * View - */ - $_SESSION["commandbackuplastdone"] = ''; $_SESSION["commandbackuptorun"] = ''; $_SESSION["commandbackupresult"] = ''; @@ -103,13 +100,6 @@ if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } - -//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad'; -//llxHeader('','',$help_url); - -//print load_fiche_titre($langs->trans("Backup"),'','title_setup'); - - // Start with empty buffer $dump_buffer = ''; $dump_buffer_len = 0; @@ -122,9 +112,6 @@ $outputdir = $conf->admin->dir_output.'/backup'; $result = dol_mkdir($outputdir); -$utils = new Utils($db); - - // MYSQL if ($what == 'mysql') { $cmddump = GETPOST("mysqldump", 'none'); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg @@ -166,7 +153,7 @@ if ($what == 'postgresql') { $cmddump = dol_sanitizePathName($cmddump); /* Not required, the command is output on screen but not ran for pgsql - if (! empty($dolibarr_main_restrict_os_commands)) + if (!empty($dolibarr_main_restrict_os_commands)) { $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump); @@ -216,7 +203,16 @@ if ($errormsg) { }*/ } + + +/* + * View + */ + +top_httphead(); + $db->close(); // Redirect to backup page header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : '')); +exit(); diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index bc627cc14f0..84bbd197a64 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -127,7 +127,7 @@ $result = dol_mkdir($outputdir); $utils = new Utils($db); -if ($export_type == 'externalmodule' && ! empty($what)) { +if ($export_type == 'externalmodule' && !empty($what)) { $fulldirtocompress = DOL_DOCUMENT_ROOT.'/custom/'.dol_sanitizeFileName($what); } else { $fulldirtocompress = DOL_DATA_ROOT; @@ -205,7 +205,12 @@ if ($compression == 'zip') { print $errormsg; } + +// Output export + if ($export_type != 'externalmodule' || empty($what)) { + top_httphead(); + if ($errormsg) { setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors'); } else { @@ -218,12 +223,15 @@ if ($export_type != 'externalmodule' || empty($what)) { $returnto = 'dolibarr_export.php'; header("Location: ".$returnto); + exit(); } else { + top_httphead('application/zip'); + $zipname = $outputdir."/".$file; // Then download the zipped file. - header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename='.basename($zipname)); header('Content-Length: '.filesize($zipname)); readfile($zipname); diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index e1899b35a56..e29a351a705 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -62,13 +62,13 @@ $workflowcodes = array( 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array( 'family'=>'create', 'position'=>10, - 'enabled'=>(isModEnabled("propal") && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled("propal") && isModEnabled('commande')), 'picto'=>'order' ), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array( 'family'=>'create', 'position'=>20, - 'enabled'=>(!empty($conf->commande->enabled) && isModEnabled('facture')), + 'enabled'=>(isModEnabled('commande') && isModEnabled('facture')), 'picto'=>'bill' ), 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array ( @@ -84,7 +84,7 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array( 'family'=>'classify_proposal', 'position'=>30, - 'enabled'=>(isModEnabled("propal") && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled("propal") && isModEnabled('commande')), 'picto'=>'propal', 'warning'=>'' ), @@ -100,19 +100,19 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated 'family'=>'classify_order', 'position'=>40, - 'enabled'=>(isModEnabled("expedition") && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled("expedition") && isModEnabled('commande')), 'picto'=>'order' ), 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed 'family'=>'classify_order', 'position'=>41, - 'enabled'=>(isModEnabled("expedition") && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled("expedition") && isModEnabled('commande')), 'picto'=>'order' ), 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( 'family'=>'classify_order', 'position'=>42, - 'enabled'=>(isModEnabled('facture') && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled('facture') && isModEnabled('commande')), 'picto'=>'order', 'warning'=>'' ), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. @@ -123,7 +123,7 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array( 'family'=>'classify_supplier_proposal', 'position'=>60, - 'enabled'=>(!empty($conf->supplier_proposal->enabled) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 'enabled'=>(isModEnabled('supplier_proposal') && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), 'picto'=>'supplier_proposal', 'warning'=>'' ), diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 5282a43dacc..d5362f4ac56 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -88,7 +88,7 @@ class Login global $conf, $dolibarr_main_authentication, $dolibarr_auto_user; // Is the login API disabled ? The token must be generated from backoffice only. - if (! empty($conf->global->API_DISABLE_LOGIN_API)) { + if (!empty($conf->global->API_DISABLE_LOGIN_API)) { dol_syslog("Warning: A try to use the login API has been done while the login API is disabled. You must generate or get the token from the backoffice.", LOG_WARNING); throw new RestException(403, "Error, the login API has been disabled for security purpose. You must generate or get the token from the backoffice."); } diff --git a/htdocs/asset/accountancy_codes.php b/htdocs/asset/accountancy_codes.php index 431b4ba7c68..824f1a75bbb 100644 --- a/htdocs/asset/accountancy_codes.php +++ b/htdocs/asset/accountancy_codes.php @@ -58,7 +58,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); $result = $assetaccountancycodes->fetchAccountancyCodes($object->id); if ($result < 0) { diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index 3d40cf62328..8d325954a76 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -86,7 +86,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); /* @@ -123,7 +123,7 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; + //if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En'; llxHeader('', $title, $help_url); diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index d94ba613d91..c2d768b5405 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -80,7 +80,7 @@ if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/asset/depreciation.php b/htdocs/asset/depreciation.php index 8f3547d81fb..679d750c668 100644 --- a/htdocs/asset/depreciation.php +++ b/htdocs/asset/depreciation.php @@ -56,7 +56,7 @@ if ($id > 0 || !empty($ref)) { if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!empty($object->not_depreciated)) accessforbidden(); $object->asset_depreciation_options = &$assetdepreciationoptions; diff --git a/htdocs/asset/depreciation_options.php b/htdocs/asset/depreciation_options.php index ba5719705dc..23c66d8961b 100644 --- a/htdocs/asset/depreciation_options.php +++ b/htdocs/asset/depreciation_options.php @@ -58,7 +58,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!empty($object->not_depreciated)) accessforbidden(); $object->asset_depreciation_options = &$assetdepreciationoptions; diff --git a/htdocs/asset/disposal.php b/htdocs/asset/disposal.php index 7fddb92b05f..e06e86c78ac 100644 --- a/htdocs/asset/disposal.php +++ b/htdocs/asset/disposal.php @@ -57,7 +57,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!isset($object->disposal_date) || $object->disposal_date === "") accessforbidden(); diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 96b222b26c1..9f4439f94d6 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -78,7 +78,7 @@ $permissiontoadd = $user->rights->asset->asset->write; // Used by the include of if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); /* diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index c475e22fc83..45f90101adc 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -125,7 +125,7 @@ $permissiontoadd = $user->rights->asset->write; $permissiontodelete = $user->rights->asset->delete; // Security check -if (empty($conf->asset->enabled)) { +if (!isModEnabled('asset')) { accessforbidden('Module not enabled'); } @@ -134,7 +134,7 @@ if ($user->socid > 0) accessforbidden(); $socid = 0; if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/asset/model/accountancy_codes.php b/htdocs/asset/model/accountancy_codes.php index 7582b61177e..6eb6d70abaf 100644 --- a/htdocs/asset/model/accountancy_codes.php +++ b/htdocs/asset/model/accountancy_codes.php @@ -59,7 +59,7 @@ $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rig if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); $result = $assetaccountancycodes->fetchAccountancyCodes(0, $object->id); diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index f1db3030dc2..fb2ff12aa88 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -88,7 +88,7 @@ if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); @@ -125,7 +125,7 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; + //if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En'; llxHeader('', $title, $help_url); diff --git a/htdocs/asset/model/card.php b/htdocs/asset/model/card.php index 3d3ec2f67d2..756ac32e31f 100644 --- a/htdocs/asset/model/card.php +++ b/htdocs/asset/model/card.php @@ -80,7 +80,7 @@ if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/asset/model/depreciation_options.php b/htdocs/asset/model/depreciation_options.php index c34bd38dc46..f3f585f5397 100644 --- a/htdocs/asset/model/depreciation_options.php +++ b/htdocs/asset/model/depreciation_options.php @@ -59,7 +59,7 @@ $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rig if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); $object->asset_depreciation_options = &$assetdepreciationoptions; diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index a55d5f49f9a..1d85a982e5d 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -126,7 +126,7 @@ $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rig $permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))); // Security check -if (empty($conf->asset->enabled)) { +if (!isModEnabled('asset')) { accessforbidden('Module not enabled'); } @@ -140,7 +140,7 @@ if ($user->socid > 0) { } $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); /* diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index 8de86d49bb7..810ab7f4462 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -57,7 +57,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); /* diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 8880e6c1e86..0f9034e374a 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -22,22 +22,25 @@ * \brief Page setup for blockedlog module */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("admin", "other", "blockedlog")); +$langs->loadLangs(array('admin', 'blockedlog', 'other')); +// Access Control if (!$user->admin || empty($conf->blockedlog->enabled)) { accessforbidden(); } -$action = GETPOST('action', 'aZ09'); +// Get Parameters +$action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); - -$withtab = GETPOST('withtab', 'int'); +$withtab = GETPOST('withtab', 'int'); /* diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 4490b3897df..9bb4456e840 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -18,11 +18,13 @@ */ /** - * \file htdocs/blockedlog/admin/blockedlog_list.php - * \ingroup blockedlog - * \brief Page setup for blockedlog module + * \file htdocs/blockedlog/admin/blockedlog_list.php + * \ingroup blockedlog + * \brief Page setup for blockedlog module */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; @@ -31,16 +33,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("admin", "other", "blockedlog", "bills")); +$langs->loadLangs(array('admin', 'bills', 'blockedlog', 'other')); +// Access Control if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) { accessforbidden(); } -$action = GETPOST('action', 'aZ09'); +// Get Parameters +$action = GETPOST('action', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $search_showonlyerrors = GETPOST('search_showonlyerrors', 'int'); if ($search_showonlyerrors < 0) { @@ -95,7 +99,7 @@ $block_static->loadTrackedEvents(); $result = restrictedArea($user, 'blockedlog', 0, ''); - +// Execution Time $max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined $max_time = @ini_get("max_execution_time"); if ($max_time && $max_time < $max_execution_time_for_importexport) { @@ -523,7 +527,7 @@ if (is_array($blocks)) { print ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '.$block->id.' | '; + print ''.dol_escape_htmltag($block->id).' | '; // Date print ''.dol_print_date($block->date_creation, 'dayhour').' | '; @@ -531,11 +535,11 @@ if (is_array($blocks)) { // User print ''; //print $block->getUser() - print $block->user_fullname; + print dol_escape_htmltag($block->user_fullname); print ' | '; // Action - print ''.$langs->trans('log'.$block->action).' | '; + print ''.$langs->trans('log'.$block->action).' | '; // Ref print '';
diff --git a/htdocs/blockedlog/ajax/authority.php b/htdocs/blockedlog/ajax/authority.php
index 78f944f692a..2da0544e0a7 100644
--- a/htdocs/blockedlog/ajax/authority.php
+++ b/htdocs/blockedlog/ajax/authority.php
@@ -44,6 +44,13 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
$user = new User($db);
$user->fetch(1); //TODO conf user authority
+
+/*
+ * View
+ */
+
+top_httphead();
+
$auth = new BlockedLogAuthority($db);
$signature = GETPOST('s');
diff --git a/htdocs/blockedlog/ajax/block-add.php b/htdocs/blockedlog/ajax/block-add.php
index 53093f02d18..e2009a01da1 100644
--- a/htdocs/blockedlog/ajax/block-add.php
+++ b/htdocs/blockedlog/ajax/block-add.php
@@ -42,6 +42,13 @@ $id = GETPOST('id', 'int');
$element = GETPOST('element', 'alpha');
$action = GETPOST('action', 'aZ09');
+
+/*
+ * View
+ */
+
+top_httphead();
+
if ($element === 'facture') {
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
diff --git a/htdocs/blockedlog/ajax/block-info.php b/htdocs/blockedlog/ajax/block-info.php
index e6f9ea0de15..da27b8fc50e 100644
--- a/htdocs/blockedlog/ajax/block-info.php
+++ b/htdocs/blockedlog/ajax/block-info.php
@@ -54,6 +54,8 @@ $langs->loadLangs(array("admin"));
* View
*/
+top_httphead();
+
print '
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||