mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix image url on alias host (#5993)
* Fix image url on alias host * Fix image url on alias host * Fix tests * Updated CHANGELOG [skip ci] Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
parent
ac20a6fcb7
commit
e41aa801b3
@ -5,6 +5,7 @@ HumHub Changelog
|
||||
1.13.1 (Unreleased)
|
||||
--------------------------
|
||||
- Fix #5985: Space user search in picker
|
||||
- Fix #5993: Broken images on installations with multiple URLs
|
||||
|
||||
1.13.0 (December 21, 2022)
|
||||
--------------------------
|
||||
|
@ -9,7 +9,6 @@
|
||||
namespace humhub\components;
|
||||
|
||||
use humhub\modules\content\components\ContentContainerActiveRecord;
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* UrlManager
|
||||
@ -44,20 +43,4 @@ class UrlManager extends \yii\web\UrlManager
|
||||
|
||||
return parent::createUrl($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getHostInfo()
|
||||
{
|
||||
$baseUrl = Yii::$app->settings->get('baseUrl');
|
||||
|
||||
if (empty($baseUrl)) {
|
||||
return parent::getHostInfo();
|
||||
}
|
||||
|
||||
$data = parse_url($baseUrl);
|
||||
|
||||
return $data['scheme'] . '://' . $data['host'] . (isset($data['port']) ? ':' . $data['port'] : '');
|
||||
}
|
||||
}
|
||||
|
48
protected/humhub/libs/SafeBaseUrl.php
Normal file
48
protected/humhub/libs/SafeBaseUrl.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2022 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\libs;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\BaseUrl;
|
||||
|
||||
/**
|
||||
* SafeBaseUrl Helper to use host from general setting "Base URL"
|
||||
*
|
||||
* @since 1.13
|
||||
* @author Luke
|
||||
*/
|
||||
class SafeBaseUrl extends BaseUrl
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected static function getUrlManager()
|
||||
{
|
||||
$urlManager = clone parent::getUrlManager();
|
||||
$urlManager->setHostInfo(static::getHostInfoFromSetting());
|
||||
return $urlManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get host info from general setting "Base URL"
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getHostInfoFromSetting(): ?string
|
||||
{
|
||||
$baseUrl = Yii::$app->settings->get('baseUrl');
|
||||
|
||||
if (empty($baseUrl)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$data = parse_url($baseUrl);
|
||||
|
||||
return $data['scheme'] . '://' . $data['host'] . (isset($data['port']) ? ':' . $data['port'] : '');
|
||||
}
|
||||
}
|
@ -43,7 +43,7 @@ class RichTextEmailHtmlConverterTest extends HumHubDbTestCase
|
||||
|
||||
$this->assertConversionResult(
|
||||
'Test![' . $file->file_name . '](file-guid:' . $file->guid . ' "' . $file->file_name . '")Test',
|
||||
'<p>Test<img src="http://localhost:8080/index-test.php?r=file%2Ffile%2Fdownload&guid=' . $file->guid . '&hash_sha1=&token=' . $token . '" alt="test_image.jpg">Test</p>', [
|
||||
'<p>Test<img src="http://localhost/index-test.php?r=file%2Ffile%2Fdownload&guid=' . $file->guid . '&hash_sha1=&token=' . $token . '" alt="test_image.jpg">Test</p>', [
|
||||
RichTextToEmailHtmlConverter::OPTION_RECEIVER_USER => $admin,
|
||||
]);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [Link](/p/site)',
|
||||
'<p>Test <a href="http://localhost:8080/p/site" target="_blank" rel="nofollow noreferrer noopener">Link</a></p>');
|
||||
'<p>Test <a href="http://localhost/p/site" target="_blank" rel="nofollow noreferrer noopener">Link</a></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +96,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [Link &< Link](/p/site)',
|
||||
'<p>Test <a href="http://localhost:8080/p/site" target="_blank" rel="nofollow noreferrer noopener">Link &< Link</a></p>');
|
||||
'<p>Test <a href="http://localhost/p/site" target="_blank" rel="nofollow noreferrer noopener">Link &< Link</a></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [](/p/site)',
|
||||
'<p>Test <a href="http://localhost:8080/p/site" target="_blank" rel="nofollow noreferrer noopener"></a></p>');
|
||||
'<p>Test <a href="http://localhost/p/site" target="_blank" rel="nofollow noreferrer noopener"></a></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,8 +115,8 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
public function testLinkWithMarkedText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [**Bold** Link](http://localhost:8080/p/site)',
|
||||
'<p>Test <a href="http://localhost:8080/p/site" target="_blank" rel="nofollow noreferrer noopener"><strong>Bold</strong> Link</a></p>');
|
||||
'Test [**Bold** Link](http://localhost/p/site)',
|
||||
'<p>Test <a href="http://localhost/p/site" target="_blank" rel="nofollow noreferrer noopener"><strong>Bold</strong> Link</a></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,8 +125,8 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
public function testConvertLinkifiedLink()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test http://localhost:8080/p/site',
|
||||
"<p>Test http://localhost:8080/p/site</p>");
|
||||
'Test http://localhost/p/site',
|
||||
"<p>Test http://localhost/p/site</p>");
|
||||
}
|
||||
|
||||
public function testConvertMailtoLink()
|
||||
@ -199,7 +199,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Alt Text](/static/img/logo.png)',
|
||||
'<p>Test <img src="http://localhost:8080/static/img/logo.png" alt="Alt Text"></p>');
|
||||
'<p>Test <img src="http://localhost/static/img/logo.png" alt="Alt Text"></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -209,7 +209,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Alt & < Text](/static/img/logo.png)',
|
||||
'<p>Test <img src="http://localhost:8080/static/img/logo.png" alt="Alt & < Text"></p>');
|
||||
'<p>Test <img src="http://localhost/static/img/logo.png" alt="Alt & < Text"></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,8 +218,8 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithTitleText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Image Alt](http://localhost:8080/static/img/logo.png "Image Title")',
|
||||
'<p>Test <img src="http://localhost:8080/static/img/logo.png" alt="Image Alt" title="Image Title"></p>');
|
||||
'Test ![Image Alt](http://localhost/static/img/logo.png "Image Title")',
|
||||
'<p>Test <img src="http://localhost/static/img/logo.png" alt="Image Alt" title="Image Title"></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,8 +229,8 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
// Image size currently not supported in html output
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png "img6.jpg" =150x)',
|
||||
'<p>Test <img src="http://localhost:8080/static/img/logo.png" alt="Scaled Image" title="img6.jpg"></p>');
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png "img6.jpg" =150x)',
|
||||
'<p>Test <img src="http://localhost/static/img/logo.png" alt="Scaled Image" title="img6.jpg"></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -240,8 +240,8 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
// Image size currently not supported in html output
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png =150x)',
|
||||
'<p>Test <img src="http://localhost:8080/static/img/logo.png" alt="Scaled Image"></p>');
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png =150x)',
|
||||
'<p>Test <img src="http://localhost/static/img/logo.png" alt="Scaled Image"></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -250,8 +250,8 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentRight()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image>](http://localhost:8080/static/img/logo.png =150x)',
|
||||
'<p>Test <img src="http://localhost:8080/static/img/logo.png" alt="Scaled Image"></p>');
|
||||
'Test ![Scaled Image>](http://localhost/static/img/logo.png =150x)',
|
||||
'<p>Test <img src="http://localhost/static/img/logo.png" alt="Scaled Image"></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -260,8 +260,8 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentLeft()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image<](http://localhost:8080/static/img/logo.png =150x)',
|
||||
'<p>Test <img src="http://localhost:8080/static/img/logo.png" alt="Scaled Image"></p>');
|
||||
'Test ![Scaled Image<](http://localhost/static/img/logo.png =150x)',
|
||||
'<p>Test <img src="http://localhost/static/img/logo.png" alt="Scaled Image"></p>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -270,8 +270,8 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentCenter()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image><](http://localhost:8080/static/img/logo.png =150x)',
|
||||
'<p>Test <img src="http://localhost:8080/static/img/logo.png" alt="Scaled Image"></p>');
|
||||
'Test ![Scaled Image><](http://localhost/static/img/logo.png =150x)',
|
||||
'<p>Test <img src="http://localhost/static/img/logo.png" alt="Scaled Image"></p>');
|
||||
}
|
||||
|
||||
/*
|
||||
@ -294,7 +294,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
|
||||
$this->assertConversionResult(
|
||||
'Test mention ' . MentioningExtension::buildMentioning($user),
|
||||
'<p>Test mention <a href="http://localhost:8080/index-test.php?r=user%2Fprofile&cguid=01e50e0d-82cd-41fc-8b0c-552392f5839c" target="_blank" rel="nofollow noreferrer noopener">@Admin Tester</a></p>');
|
||||
'<p>Test mention <a href="http://localhost/index-test.php?r=user%2Fprofile&cguid=01e50e0d-82cd-41fc-8b0c-552392f5839c" target="_blank" rel="nofollow noreferrer noopener">@Admin Tester</a></p>');
|
||||
}
|
||||
|
||||
public function testMentionNotFound()
|
||||
@ -338,7 +338,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
|
||||
$this->assertConversionResult(
|
||||
'Test file [Test File](file-guid:xyz)',
|
||||
'<p>Test file <a href="http://localhost:8080/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" target="_blank" rel="nofollow noreferrer noopener">Test File</a></p>');
|
||||
'<p>Test file <a href="http://localhost/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" target="_blank" rel="nofollow noreferrer noopener">Test File</a></p>');
|
||||
}
|
||||
|
||||
public function testFileNotFound()
|
||||
@ -368,7 +368,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
}
|
||||
$this->assertConversionResult(
|
||||
'Test file ![Test File](file-guid:xyz)',
|
||||
'<p>Test file <img src="http://localhost:8080/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" alt="Test File"></p>');
|
||||
'<p>Test file <img src="http://localhost/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" alt="Test File"></p>');
|
||||
}
|
||||
|
||||
public function testImageFileWithRightAlign()
|
||||
@ -391,7 +391,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
}
|
||||
$this->assertConversionResult(
|
||||
'Test file ![Test File>](file-guid:xyz)',
|
||||
'<p>Test file <img src="http://localhost:8080/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" alt="Test File"></p>');
|
||||
'<p>Test file <img src="http://localhost/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" alt="Test File"></p>');
|
||||
}
|
||||
|
||||
public function testDataImage()
|
||||
@ -423,7 +423,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
}
|
||||
$this->assertConversionResult(
|
||||
'Test file ![Test File<](file-guid:xyz)',
|
||||
'<p>Test file <img src="http://localhost:8080/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" alt="Test File"></p>');
|
||||
'<p>Test file <img src="http://localhost/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" alt="Test File"></p>');
|
||||
}
|
||||
|
||||
public function testImageFileWithCenterAlign()
|
||||
@ -446,7 +446,7 @@ class RichTextHtmlConverterTest extends HumHubDbTestCase
|
||||
}
|
||||
$this->assertConversionResult(
|
||||
'Test file ![Test File><](file-guid:xyz)',
|
||||
'<p>Test file <img src="http://localhost:8080/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" alt="Test File"></p>');
|
||||
'<p>Test file <img src="http://localhost/index-test.php?r=file%2Ffile%2Fdownload&guid=xyz&hash_sha1=xxx" alt="Test File"></p>');
|
||||
}
|
||||
|
||||
public function testImageFileNotFound()
|
||||
|
@ -60,7 +60,7 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [Link](/p/site)',
|
||||
"Test [Link](http://localhost:8080/p/site)");
|
||||
"Test [Link](http://localhost/p/site)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +70,7 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [Link &< Link](/p/site)',
|
||||
"Test [Link &< Link](http://localhost:8080/p/site)");
|
||||
"Test [Link &< Link](http://localhost/p/site)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [](/p/site)',
|
||||
"Test [](http://localhost:8080/p/site)");
|
||||
"Test [](http://localhost/p/site)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,8 +89,8 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
public function testLinkWithMarkedText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [**Bold** Url](http://localhost:8080/p/site)',
|
||||
"Test [**Bold** Url](http://localhost:8080/p/site)");
|
||||
'Test [**Bold** Url](http://localhost/p/site)',
|
||||
"Test [**Bold** Url](http://localhost/p/site)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,8 +99,8 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
public function testConvertLinkifiedLink()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test http://localhost:8080/p/site',
|
||||
"Test http://localhost:8080/p/site");
|
||||
'Test http://localhost/p/site',
|
||||
"Test http://localhost/p/site");
|
||||
}
|
||||
|
||||
public function testConvertMailtoLink()
|
||||
@ -141,7 +141,7 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Alt Text](/static/img/logo.png)',
|
||||
"Test ![Alt Text](http://localhost:8080/static/img/logo.png)");
|
||||
"Test ![Alt Text](http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,7 +151,7 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Alt & < Text](/static/img/logo.png)',
|
||||
"Test ![Alt & < Text](http://localhost:8080/static/img/logo.png)");
|
||||
"Test ![Alt & < Text](http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,8 +160,8 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithTitleText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Image Label](http://localhost:8080/static/img/logo.png "Image Title")',
|
||||
"Test ![Image Label](http://localhost:8080/static/img/logo.png \"Image Title\")");
|
||||
'Test ![Image Label](http://localhost/static/img/logo.png "Image Title")',
|
||||
"Test ![Image Label](http://localhost/static/img/logo.png \"Image Title\")");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,8 +170,8 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithSizeToText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png "img6.jpg" =150x)',
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png "img6.jpg")');
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png "img6.jpg" =150x)',
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png "img6.jpg")');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -180,8 +180,8 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithSizeAndNoTitleToText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png =150x)',
|
||||
"Test ![Scaled Image](http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png =150x)',
|
||||
"Test ![Scaled Image](http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,8 +190,8 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentRight()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image>](http://localhost:8080/static/img/logo.png =150x)',
|
||||
"Test ![Scaled Image](http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image>](http://localhost/static/img/logo.png =150x)',
|
||||
"Test ![Scaled Image](http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,8 +200,8 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentLeft()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image<](http://localhost:8080/static/img/logo.png =150x)',
|
||||
"Test ![Scaled Image](http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image<](http://localhost/static/img/logo.png =150x)',
|
||||
"Test ![Scaled Image](http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,8 +210,8 @@ class RichTextMarkdownConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentCenter()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image><](http://localhost:8080/static/img/logo.png =150x)',
|
||||
"Test ![Scaled Image](http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image><](http://localhost/static/img/logo.png =150x)',
|
||||
"Test ![Scaled Image](http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -50,7 +50,7 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [Link](/p/site)',
|
||||
"Test Link(http://localhost:8080/p/site)");
|
||||
"Test Link(http://localhost/p/site)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +60,7 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [Link &< Link](/p/site)',
|
||||
"Test Link &< Link(http://localhost:8080/p/site)");
|
||||
"Test Link &< Link(http://localhost/p/site)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +70,7 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [](/p/site)',
|
||||
"Test (http://localhost:8080/p/site)");
|
||||
"Test (http://localhost/p/site)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,8 +89,8 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
public function testLinkWithMarkedText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [**Bold** Url](http://localhost:8080/p/site)',
|
||||
"Test Bold Url(http://localhost:8080/p/site)");
|
||||
'Test [**Bold** Url](http://localhost/p/site)',
|
||||
"Test Bold Url(http://localhost/p/site)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,8 +99,8 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertLinkifiedLink()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test http://localhost:8080/p/site',
|
||||
"Test http://localhost:8080/p/site");
|
||||
'Test http://localhost/p/site',
|
||||
"Test http://localhost/p/site");
|
||||
}
|
||||
|
||||
public function testConvertMailtoLink()
|
||||
@ -141,7 +141,7 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Alt Text](/static/img/logo.png)',
|
||||
"Test Alt Text(http://localhost:8080/static/img/logo.png)");
|
||||
"Test Alt Text(http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,7 +151,7 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Alt & < Text](/static/img/logo.png)',
|
||||
"Test Alt & < Text(http://localhost:8080/static/img/logo.png)");
|
||||
"Test Alt & < Text(http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,8 +160,8 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithTitleText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Image Label](http://localhost:8080/static/img/logo.png "Image Title")',
|
||||
"Test Image Label(http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Image Label](http://localhost/static/img/logo.png "Image Title")',
|
||||
"Test Image Label(http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,8 +170,8 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithSizeToText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png "img6.jpg" =150x)',
|
||||
"Test Scaled Image(http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png "img6.jpg" =150x)',
|
||||
"Test Scaled Image(http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -180,8 +180,8 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithSizeAndNoTitleToText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png =150x)',
|
||||
"Test Scaled Image(http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png =150x)',
|
||||
"Test Scaled Image(http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,8 +190,8 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentRight()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image>](http://localhost:8080/static/img/logo.png =150x)',
|
||||
"Test Scaled Image(http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image>](http://localhost/static/img/logo.png =150x)',
|
||||
"Test Scaled Image(http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,8 +200,8 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentLeft()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image<](http://localhost:8080/static/img/logo.png =150x)',
|
||||
"Test Scaled Image(http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image<](http://localhost/static/img/logo.png =150x)',
|
||||
"Test Scaled Image(http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,8 +210,8 @@ class RichTextPlaintextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentCenter()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image><](http://localhost:8080/static/img/logo.png =150x)',
|
||||
"Test Scaled Image(http://localhost:8080/static/img/logo.png)");
|
||||
'Test ![Scaled Image><](http://localhost/static/img/logo.png =150x)',
|
||||
"Test Scaled Image(http://localhost/static/img/logo.png)");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -119,7 +119,7 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
||||
public function testLinkWithMarkedText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test [**Bold** Url](http://localhost:8080/p/site)',
|
||||
'Test [**Bold** Url](http://localhost/p/site)',
|
||||
"Test Bold Url");
|
||||
}
|
||||
|
||||
@ -129,8 +129,8 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertLinkifiedLink()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test http://localhost:8080/p/site',
|
||||
"Test http://localhost:8080/p/site");
|
||||
'Test http://localhost/p/site',
|
||||
"Test http://localhost/p/site");
|
||||
}
|
||||
|
||||
public function testConvertMailtoLink()
|
||||
@ -197,7 +197,7 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithTitleText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Image Label](http://localhost:8080/static/img/logo.png "Image Title")',
|
||||
'Test ![Image Label](http://localhost/static/img/logo.png "Image Title")',
|
||||
'Test [Image]');
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithSizeToShortText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png "img6.jpg" =150x)',
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png "img6.jpg" =150x)',
|
||||
'Test [Image]');
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithSizeAndNoTitleToShortText()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image](http://localhost:8080/static/img/logo.png =150x)',
|
||||
'Test ![Scaled Image](http://localhost/static/img/logo.png =150x)',
|
||||
'Test [Image]');
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentRight()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image>](http://localhost:8080/static/img/logo.png =150x)',
|
||||
'Test ![Scaled Image>](http://localhost/static/img/logo.png =150x)',
|
||||
'Test [Image]');
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentLeft()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image<](http://localhost:8080/static/img/logo.png =150x)',
|
||||
'Test ![Scaled Image<](http://localhost/static/img/logo.png =150x)',
|
||||
'Test [Image]');
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
||||
public function testConvertImageWithImageAlignmentCenter()
|
||||
{
|
||||
$this->assertConversionResult(
|
||||
'Test ![Scaled Image><](http://localhost:8080/static/img/logo.png =150x)',
|
||||
'Test ![Scaled Image><](http://localhost/static/img/logo.png =150x)',
|
||||
'Test [Image]');
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
namespace humhub\modules\user\models\forms;
|
||||
|
||||
use humhub\libs\SafeBaseUrl;
|
||||
use humhub\modules\user\models\User;
|
||||
use humhub\modules\user\authclient\Password;
|
||||
use humhub\libs\UUID;
|
||||
use Yii;
|
||||
use yii\helpers\Url;
|
||||
use yii\base\Model;
|
||||
|
||||
/**
|
||||
@ -85,7 +85,7 @@ class AccountRecoverPassword extends Model
|
||||
'text' => '@humhub/modules/user/views/mails/plaintext/RecoverPassword'
|
||||
], [
|
||||
'user' => $user,
|
||||
'linkPasswordReset' => Url::to(['/user/password-recovery/reset', 'token' => $token, 'guid' => $user->guid], true)
|
||||
'linkPasswordReset' => SafeBaseUrl::to(['/user/password-recovery/reset', 'token' => $token, 'guid' => $user->guid], true)
|
||||
]);
|
||||
$mail->setTo($user->email);
|
||||
$mail->setSubject(Yii::t('UserModule.account', 'Password Recovery'));
|
||||
|
@ -28,7 +28,7 @@ class ApproveUserFormTest extends HumHubDbTestCase
|
||||
$form = new ApproveUserForm($this->unapprovedUser->id);
|
||||
$form->setApprovalDefaults();
|
||||
$this->assertEquals("Hello UnApproved User,\n\nYour account has been activated.\n\n" .
|
||||
"Click here to login:\nhttp://localhost:8080/index-test.php?r=user%2Fauth%2Flogin\n\n" .
|
||||
"Click here to login:\nhttp://localhost/index-test.php?r=user%2Fauth%2Flogin\n\n" .
|
||||
"Kind Regards\nAdmin Tester\n\n", $form->message);
|
||||
|
||||
$settings = new AuthenticationSettingsForm();
|
||||
@ -68,7 +68,7 @@ Mit freundlichen Grüßen
|
||||
|
||||
$form = new ApproveUserForm($this->unapprovedUser->id);
|
||||
$form->setApprovalDefaults();
|
||||
$this->assertEquals("Hey UnApproved User your account was approved by Admin Tester, please click <a href=\"http://localhost:8080/index-test.php?r=user%2Fauth%2Flogin\">http://localhost:8080/index-test.php?r=user/auth/login</a>"
|
||||
$this->assertEquals("Hey UnApproved User your account was approved by Admin Tester, please click <a href=\"http://localhost/index-test.php?r=user%2Fauth%2Flogin\">http://localhost/index-test.php?r=user/auth/login</a>"
|
||||
, $form->message);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ Mit freundlichen Grüßen
|
||||
Dein Konto wurde aktiviert.
|
||||
|
||||
Klicke hier um dich einzuloggen:
|
||||
http://localhost:8080/index-test.php?r=user%2Fauth%2Flogin
|
||||
http://localhost/index-test.php?r=user%2Fauth%2Flogin
|
||||
|
||||
Mit freundlichen Grüßen
|
||||
Admin Tester", $form->message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user