Merge remote-tracking branch 'friendica/stable' into develop
# Conflicts: # composer.lock
This commit is contained in:
commit
a852455d0e
154 changed files with 26577 additions and 25630 deletions
|
@ -49,7 +49,7 @@ abstract class MailBuilder
|
|||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
||||
/** @var string */
|
||||
/** @var string[][] */
|
||||
protected $headers;
|
||||
|
||||
/** @var string */
|
||||
|
@ -76,13 +76,14 @@ abstract class MailBuilder
|
|||
$hostname = substr($hostname, 0, strpos($hostname, ':'));
|
||||
}
|
||||
|
||||
$this->headers = "";
|
||||
$this->headers .= "Precedence: list\n";
|
||||
$this->headers .= "X-Friendica-Host: " . $hostname . "\n";
|
||||
$this->headers .= "X-Friendica-Platform: " . FRIENDICA_PLATFORM . "\n";
|
||||
$this->headers .= "X-Friendica-Version: " . FRIENDICA_VERSION . "\n";
|
||||
$this->headers .= "List-ID: <notification." . $hostname . ">\n";
|
||||
$this->headers .= "List-Archive: <" . $baseUrl->get() . "/notifications/system>\n";
|
||||
$this->headers = [
|
||||
'Precedence' => ['list'],
|
||||
'X-Friendica-Host' => [$hostname],
|
||||
'X-Friendica-Platform' => [FRIENDICA_PLATFORM],
|
||||
'X-Friendica-Version' => [FRIENDICA_VERSION],
|
||||
'List-ID' => ['<notification.' . $hostname . '>'],
|
||||
'List-Archive' => ['<' . $baseUrl->get() . '/notifications/system>'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,15 +160,31 @@ abstract class MailBuilder
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds new headers to the default headers
|
||||
* Adds a value to a header
|
||||
*
|
||||
* @param string $headers New headers
|
||||
* @param string $name The header name
|
||||
* @param string $value The value of the header to add
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function addHeaders(string $headers)
|
||||
public function addHeader(string $name, string $value)
|
||||
{
|
||||
$this->headers .= $headers;
|
||||
$this->headers[$name][] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a value to a header (overwrites existing values)
|
||||
*
|
||||
* @param string $name The header name
|
||||
* @param string $value The value to set
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function setHeader(string $name, string $value)
|
||||
{
|
||||
$this->headers[$name] = [$value];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ class Emailer
|
|||
. rand(10000, 99999);
|
||||
|
||||
// generate a multipart/alternative message header
|
||||
$messageHeader = $email->getAdditionalMailHeader() .
|
||||
$messageHeader = $email->getAdditionalMailHeaderString() .
|
||||
"From: $fromName <{$fromAddress}>\n" .
|
||||
"Reply-To: $fromName <{$replyTo}>\n" .
|
||||
"MIME-Version: 1.0\n" .
|
||||
|
|
|
@ -39,6 +39,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\PConfig\IPConfig;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
|
|
|
@ -177,6 +177,35 @@ class Network
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the provided url is on the list of domains where redirects are blocked.
|
||||
* Returns true if it is or malformed URL, false if not.
|
||||
*
|
||||
* @param string $url The url to check the domain from
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isRedirectBlocked(string $url)
|
||||
{
|
||||
$host = @parse_url($url, PHP_URL_HOST);
|
||||
if (!$host) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$no_redirect_list = DI::config()->get('system', 'no_redirect_list', []);
|
||||
if (!$no_redirect_list) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($no_redirect_list as $no_redirect) {
|
||||
if (fnmatch(strtolower($no_redirect), strtolower($host))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if email address is allowed to register here.
|
||||
*
|
||||
|
|
|
@ -68,6 +68,7 @@ class Strings
|
|||
*
|
||||
* @param string $string Input string
|
||||
* @return string Filtered string
|
||||
* @deprecated since 2020.09 Please use Smarty default HTML escaping for templates or htmlspecialchars() otherwise
|
||||
*/
|
||||
public static function escapeTags($string)
|
||||
{
|
||||
|
|
|
@ -488,6 +488,21 @@ class XML
|
|||
return $first_item->attributes;
|
||||
}
|
||||
|
||||
public static function getFirstValue($xpath, $search, $context)
|
||||
{
|
||||
$result = $xpath->query($search, $context);
|
||||
if (!is_object($result)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$first_item = $result->item(0);
|
||||
if (!is_object($first_item)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $first_item->nodeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* escape text ($str) for XML transport
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue