use Friendica\Database\Definition\DbaDefinition;
use Friendica\Database\Definition\ViewDefinition;
use Friendica\Module\Maintenance;
+use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Security\Authentication;
use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\Config\Capability\IManageConfigValues;
* Automatically redirects to relative or absolute URL
* Should only be used if it isn't clear if the URL is either internal or external
*
+ * @deprecated 2024.12 Use AppHelper::redirect() instead
+ *
* @param string $toUrl The target URL
*
- * @throws HTTPException\InternalServerErrorException
+ * @throws InternalServerErrorException
*/
public function redirect(string $toUrl)
{
- if (!empty(parse_url($toUrl, PHP_URL_SCHEME))) {
- Core\System::externalRedirect($toUrl);
- } else {
- $this->baseURL->redirect($toUrl);
- }
+ $this->appHelper->redirect($toUrl);
}
/**
use DateTimeZone;
use Exception;
+use Friendica\App\BaseURL;
use Friendica\App\Mode;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Session\Capability\IHandleUserSessions;
+use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Database\Database;
+use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
*/
private $mode;
+ /**
+ * @var BaseURL
+ */
+ private $baseURL;
+
/**
* @var L10n The translator
*/
Database $database,
IManageConfigValues $config,
Mode $mode,
+ BaseURL $baseURL,
L10n $l10n,
IManagePersonalConfigValues $pConfig,
IHandleUserSessions $session
$this->config = $config;
$this->mode = $mode;
$this->l10n = $l10n;
+ $this->baseURL = $baseURL;
$this->pConfig = $pConfig;
$this->session = $session;
}
$this->setCurrentMobileTheme($mobile_theme_name);
}
}
+
+ /**
+ * Automatically redirects to relative or absolute URL
+ * Should only be used if it isn't clear if the URL is either internal or external
+ *
+ * @param string $toUrl The target URL
+ *
+ * @throws InternalServerErrorException
+ */
+ public function redirect(string $toUrl)
+ {
+ if (!empty(parse_url($toUrl, PHP_URL_SCHEME))) {
+ System::externalRedirect($toUrl);
+ } else {
+ $this->baseURL->redirect($toUrl);
+ }
+ }
}