X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp.php;h=b910765e12f02c35719523d9c9393c6a2cfd86f6;hb=fc0acd7b1f4723b9e45badcaae53e466e1a29b85;hp=cfe254581a6d8bd0ece9f50684ef8a68f7fb147a;hpb=6150c2fa9cbb15efbdd1432a295ece64086959ac;p=friendica.git diff --git a/src/App.php b/src/App.php index cfe254581a..b910765e12 100644 --- a/src/App.php +++ b/src/App.php @@ -8,7 +8,6 @@ use Detection\MobileDetect; use DOMDocument; use DOMXPath; use Exception; -use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\Network\HTTPException\InternalServerErrorException; use Psr\Log\LoggerInterface; @@ -121,6 +120,7 @@ class App * @see initHead() * * @param string $path + * @throws InternalServerErrorException */ public function registerStylesheet($path) { @@ -137,6 +137,7 @@ class App * @see initFooter() * * @param string $path + * @throws InternalServerErrorException */ public function registerFooterScript($path) { @@ -159,7 +160,7 @@ class App * * @throws Exception if the Basepath is not usable */ - public function __construct($basePath, $logger, $isBackend = true) + public function __construct($basePath, LoggerInterface $logger, $isBackend = true) { $this->logger = $logger; @@ -617,6 +618,7 @@ class App * finally for PWD * * @return string + * @throws InternalServerErrorException */ public function getBasePath() { @@ -676,6 +678,7 @@ class App * * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN * @return string Friendica server base URL + * @throws InternalServerErrorException */ public function getBaseURL($ssl = false) { @@ -700,7 +703,7 @@ class App $this->hostname = Core\Config::get('config', 'hostname'); } - return $scheme . '://' . $this->hostname . !empty($this->getURLPath() ? '/' . $this->getURLPath() : '' ); + return $scheme . '://' . $this->hostname . (!empty($this->getURLPath()) ? '/' . $this->getURLPath() : '' ); } /** @@ -709,6 +712,7 @@ class App * Clears the baseurl cache to prevent inconsistencies * * @param string $url + * @throws InternalServerErrorException */ public function setBaseURL($url) { @@ -882,6 +886,7 @@ class App * @param string $origURL * * @return string The cleaned url + * @throws InternalServerErrorException */ public function removeBaseURL($origURL) { @@ -935,6 +940,7 @@ class App * Returns the current UserAgent as a String * * @return string the UserAgent as a String + * @throws InternalServerErrorException */ public function getUserAgent() { @@ -1058,6 +1064,7 @@ class App * @brief Checks if the minimal memory is reached * * @return bool Is the memory limit reached? + * @throws InternalServerErrorException */ public function isMinMemoryReached() { @@ -1102,6 +1109,7 @@ class App * @brief Checks if the maximum load is reached * * @return bool Is the load reached? + * @throws InternalServerErrorException */ public function isMaxLoadReached() { @@ -1134,6 +1142,7 @@ class App * * @param string $command The command to execute * @param array $args Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ] + * @throws InternalServerErrorException */ public function proc_run($command, $args) { @@ -1190,7 +1199,10 @@ class App /** * @brief Checks if a given directory is usable for the system * + * @param $directory + * @param bool $check_writable * @return boolean the directory is usable + * @throws Exception */ public static function isDirectoryUsable($directory, $check_writable = true) { @@ -1368,6 +1380,7 @@ class App * Generates the site's default sender email address * * @return string + * @throws InternalServerErrorException */ public function getSenderEmailAddress() { @@ -1388,6 +1401,7 @@ class App * Returns the current theme name. * * @return string the name of the current theme + * @throws InternalServerErrorException */ public function getCurrentTheme() { @@ -1469,6 +1483,7 @@ class App * Provide a sane default if nothing is chosen or the specified theme does not exist. * * @return string + * @throws InternalServerErrorException */ public function getCurrentThemeStylesheetPath() { @@ -1854,14 +1869,14 @@ class App // And then append it to the target $target->documentElement->appendChild($item); } - } - if (isset($_GET["mode"]) && ($_GET["mode"] == "raw")) { - header("Content-type: text/html; charset=utf-8"); + if ($_GET["mode"] == "raw") { + header("Content-type: text/html; charset=utf-8"); - echo substr($target->saveHTML(), 6, -8); + echo substr($target->saveHTML(), 6, -8); - exit(); + exit(); + } } $page = $this->page; @@ -1930,7 +1945,7 @@ class App * 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($toUrl) {