diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 40af4c4ae2a..79ddda792e0 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -427,11 +427,15 @@ if ($action == 'edit') { // Method print ''.$langs->trans("MAIN_MAIL_SENDMODE").''; - $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING]; + $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')]; if (empty($text)) { $text = $langs->trans("Undefined").img_warning(); } - print $text; + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'default') { + print ''.$text.''; + } else { + print $text; + } print ''; if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 481fcad212c..a439bdabcf0 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -394,11 +394,15 @@ if ($action == 'edit') { // Method print ''.$langs->trans("MAIN_MAIL_SENDMODE").''; - $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_TICKET]; + $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')]; if (empty($text)) { $text = $langs->trans("Undefined").img_warning(); } - print $text; + if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'default') { + print ''.$text.''; + } else { + print $text; + } print ''; if (!empty($conf->global->MAIN_MAIL_SENDMODE_TICKET) && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') { diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 96cb98809ef..9a27feb3d7a 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -89,6 +89,7 @@ $configfileparameters = array( 'separator', '?dolibarr_mailing_limit_sendbyweb', '?dolibarr_mailing_limit_sendbycli', + '?dolibarr_mailing_limit_sendbyday', '?dolibarr_strict_mode' ); $configfilelib = array( diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index e58cf45dd7e..8a982f6e0bd 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -360,6 +360,7 @@ $configfileparameters = array( 'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only', '?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page', '?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli', + '?dolibarr_mailing_limit_sendbyday' => 'Limit nb of email sent per day', '?dolibarr_strict_mode' => 'Strict mode is on/off', '?dolibarr_nocsrfcheck' => 'Disable CSRF security checks' ); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d46a02132a1..748c5fabf10 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -801,13 +801,20 @@ if ($action == 'create') { // MAILING_NO_USING_PHPMAIL may be defined or not. // MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden). // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit). + // MAILING_LIMIT_SENDBYDAY may be defined ot not (0 or undefined=no limit). if (!empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. // You ensure that every user is using its own SMTP server when using the mass emailing module. $linktoadminemailbefore = ''; $linktoadminemailend = ''; setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); - setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); + $messagetoshow = $langs->trans("MailSendSetupIs2", '{s1}', '{s2}', '{s3}', '{s4}'); + $messagetoshow = str_replace('{s1}', $linktoadminemailbefore, $messagetoshow); + $messagetoshow = str_replace('{s2}', $linktoadminemailend, $messagetoshow); + $messagetoshow = str_replace('{s3}', $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $messagetoshow); + $messagetoshow = str_replace('{s4}', $listofmethods['smtps'], $messagetoshow); + setEventMessages($messagetoshow, null, 'warnings'); + if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) { setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); } @@ -836,14 +843,21 @@ if ($action == 'create') { } $text = ''; - if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { - $text .= $langs->trans("MailingNeedCommand"); - $text .= '
'; + + if (isset($conf->global->MAILING_LIMIT_SENDBYDAY) && $conf->global->MAILING_LIMIT_SENDBYDAY >= 0) { + $text .= $langs->trans('WarningLimitSendByDay', $conf->global->MAILING_LIMIT_SENDBYDAY); $text .= '

'; } $text .= $langs->trans('ConfirmSendingEmailing').'
'; $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600); + + if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { + $text .= '

'; + $text .= $langs->trans("MailingNeedCommand"); + $text .= '
'; + } + + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600, 0, $langs->trans("Confirm"), $langs->trans("Cancel")); } } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 22a6f8da7a4..2e544a9953a 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1038,12 +1038,15 @@ class Conf if (!empty($this->file->mailing_limit_sendbyweb)) { $this->global->MAILING_LIMIT_SENDBYWEB = $this->file->mailing_limit_sendbyweb; } - if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) { + if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) { // Limit by web can't be 0 $this->global->MAILING_LIMIT_SENDBYWEB = 25; } if (!empty($this->file->mailing_limit_sendbycli)) { $this->global->MAILING_LIMIT_SENDBYCLI = $this->file->mailing_limit_sendbycli; } + if (!empty($this->file->mailing_limit_sendbyday)) { + $this->global->MAILING_LIMIT_SENDBYDAY = $this->file->mailing_limit_sendbyday; + } return 0; } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 03c1aa4afdf..6c097e97073 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -777,7 +777,7 @@ function isInEEC($object) */ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatelink = 0, $morehtmlright = '') { - global $user; + global $user, $action, $hookmanager; $i = -1; @@ -791,8 +791,9 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel print "\n"; print load_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"), $newcardbutton.$morehtmlright, ''); - print '
'; - print "\n".''; + + print '
'."\n"; + print '
'; $sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; $sql .= ", cls.code as opp_status_code"; @@ -877,6 +878,11 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel } else { dol_print_error($db); } + + $parameters = array('sql'=>$sql, 'function'=>'show_projects'); + $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print "
"; print '
'; diff --git a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php index c69ebb9a121..3193fe26176 100644 --- a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php @@ -84,7 +84,7 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid protected function getMailInfo() { global $conf, $langs; - global $dolibarr_mailing_limit_sendbyweb; + global $dolibarr_mailing_limit_sendbyweb, $dolibarr_mailing_limit_sendbycli, $dolibarr_mailing_limit_sendbyday; $info = $langs->trans('Method').': '.getDolGlobalString("MAIN_MAIL_SENDMODE").'
'; $info .= $langs->trans('Server').': '.getDolGlobalString("MAIN_MAIL_SMTP_SERVER").'
'; @@ -94,6 +94,8 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid $info .= $langs->trans('TLS/STARTTLS').': '.getDolGlobalString("MAIN_MAIL_EMAIL_TLS").' / '.getDolGlobalString("MAIN_MAIL_EMAIL_STARTTLS").'
'; $info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': '.(empty($conf->global->MAIN_DISABLE_ALL_MAILS) ? $langs->trans('No') : $langs->trans('Yes')).'
'; $info .= 'dolibarr_mailing_limit_sendbyweb = '.$dolibarr_mailing_limit_sendbyweb.'
'; + $info .= 'dolibarr_mailing_limit_sendbycli = '.$dolibarr_mailing_limit_sendbycli.'
'; + $info .= 'dolibarr_mailing_limit_sendbyday = '.$dolibarr_mailing_limit_sendbyday.'
'; return $info; } diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 89b6640eb4d..ccd85e47810 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -179,6 +179,9 @@ if (empty($dolibarr_mailing_limit_sendbyweb)) { if (empty($dolibarr_mailing_limit_sendbycli)) { $dolibarr_mailing_limit_sendbycli = 0; } +if (empty($dolibarr_mailing_limit_sendbyday)) { + $dolibarr_mailing_limit_sendbyday = 0; +} if (empty($dolibarr_strict_mode)) { $dolibarr_strict_mode = 0; // For debug in php strict mode } diff --git a/htdocs/install/default.css b/htdocs/install/default.css index e7bbe6c7771..79f6d3eb9c1 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -129,6 +129,10 @@ a.button.runupgrade { padding: 10px; } +tr.title.tablesupport-title { + height: 100px; +} + /* Force values for small screen 570 */ @media only screen and (max-width: 570px) { @@ -464,7 +468,7 @@ table.login.tablesupport .title { } table.tablesupport { - min-height: 250px; + min-height: 300px; border: 1px solid #E0E0E0; background: #FFF; } diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 27a3fc01abd..6ca9a99cdcf 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -419,6 +419,7 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl // We force the content charset header("Content-type: text/html; charset=".$conf->file->character_set_client); header("X-Content-Type-Options: nosniff"); + header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks) print ''."\n"; print ''."\n"; diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 9613e1a86b5..7235e564275 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -911,6 +911,8 @@ function write_conf_file($conffile) fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';'); fputs($fp, "\n"); + fputs($fp, '$dolibarr_mailing_limit_sendbycli=\'0\';'); + fputs($fp, "\n"); // Write params to overwrites default lib path fputs($fp, "\n"); diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 22fe0696363..b86ec3ebbd8 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -178,3 +178,4 @@ IsAnAnswer=Is an answer of an initial email RecordCreatedByEmailCollector=Record created by the Email Collector %s from email %s DefaultBlacklistMailingStatus=Default value for field '%s' when creating a new contact DefaultStatusEmptyMandatory=Empty but mandatory +WarningLimitSendByDay=WARNING: The setup or contract of your instance limits your number of emails per day to %s. Trying to send more may result in having your instance slow down or suspended. Please contact your support if you need a higher quota. diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index aa836842e71..fe4bdf42d79 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -75,8 +75,9 @@ if (defined('TEST_DB_FORCE_TYPE')) { // Set properties specific to conf file $conf->file->main_limit_users = $dolibarr_main_limit_users; -$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; -$conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli; +$conf->file->mailing_limit_sendbyweb = empty($dolibarr_mailing_limit_sendbyweb) ? 0 : $dolibarr_mailing_limit_sendbyweb; +$conf->file->mailing_limit_sendbycli = empty($dolibarr_mailing_limit_sendbycli) ? 0 : $dolibarr_mailing_limit_sendbycli; +$conf->file->mailing_limit_sendbyday = empty($dolibarr_mailing_limit_sendbyday) ? 0 : $dolibarr_mailing_limit_sendbyday; $conf->file->main_authentication = empty($dolibarr_main_authentication) ? '' : $dolibarr_main_authentication; // Identification mode $conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https $conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 097d670e8ea..c246b73e816 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -515,6 +515,7 @@ if ($action == 'create' && $user->rights->projet->creer) { print ''; print ''; print ''; + print ''; print ''; print dol_get_fiche_head(); diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index d5c92cade7b..e6f2afd504d 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -236,6 +236,7 @@ function pHeader($soutitre, $next, $action = 'none') // On force contenu dans format sortie header("Content-type: text/html; charset=".$conf->file->character_set_client); header("X-Content-Type-Options: nosniff"); + header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks) print ''."\n"; print ''."\n"; diff --git a/htdocs/support/index.php b/htdocs/support/index.php index 7330c034aa7..e61fef41f23 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -77,17 +77,22 @@ print '
'; -print ''; +print ''; +print ''; print ''; print ''; @@ -141,17 +148,22 @@ print "\n"; print '
'; // EMail support -print '
'; -print ''; +print ''; +print ''; print '