Add a check on syntax of hostname for email colector
This commit is contained in:
parent
c9f34cc0d4
commit
4a97690f78
@ -251,6 +251,15 @@ class EmailCollector extends CommonObject
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Check parameters
|
||||
if ($this->host && preg_match('/^http:/i', trim($this->host))) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans("ErrorHostMustNotStartWithHttp", $this->host);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$id = $this->createCommon($user, $notrigger);
|
||||
|
||||
if (is_array($this->filters) && count($this->filters)) {
|
||||
@ -449,6 +458,15 @@ class EmailCollector extends CommonObject
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Check parameters
|
||||
if ($this->host && preg_match('/^http:/i', trim($this->host))) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans("ErrorHostMustNotStartWithHttp", $this->host);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
|
||||
@ -227,6 +227,7 @@ ErrorDuringChartLoad=Error when loading chart of accounts. If few accounts were
|
||||
ErrorBadSyntaxForParamKeyForContent=Bad syntax for param keyforcontent. Must have a value starting with %s or %s
|
||||
ErrorVariableKeyForContentMustBeSet=Error, the constant with name %s (with text content to show) or %s (with external url to show) must be set.
|
||||
ErrorURLMustStartWithHttp=URL %s must start with http:// or https://
|
||||
ErrorHostMustNotStartWithHttp=Host name %s must NOT start with http:// or https://
|
||||
ErrorNewRefIsAlreadyUsed=Error, the new reference is already used
|
||||
ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible=Error, delete payment linked to a closed invoice is not possible.
|
||||
ErrorSearchCriteriaTooSmall=Search criteria too small.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user