X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=0835f7ffae1ce9efadbc9013934ba8e6d16b8139;hb=9082d844c0b43f002740fb60276087f405369452;hp=fd87576725cfbdfd53ceb30fbcb2428aed94d6c6;hpb=e7ea5dac2464e790142c134c7f3d0f01aab39fce;p=friendica.git diff --git a/boot.php b/boot.php index fd87576725..0835f7ffae 100644 --- a/boot.php +++ b/boot.php @@ -17,14 +17,11 @@ * easily as email does today. */ -use Friendica\App; -use Friendica\BaseObject; use Friendica\Core\Config; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\System; -use Friendica\Core\Session; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Term; use Friendica\Util\BasePath; @@ -37,7 +34,7 @@ define('DFRN_PROTOCOL_VERSION', '2.23'); define('NEW_UPDATE_ROUTINE_VERSION', 1170); /** - * @brief Constant with a HTML line break. + * Constant with a HTML line break. * * Contains a HTML line break (br) element and a real carriage return with line * feed for the source. @@ -46,7 +43,7 @@ define('NEW_UPDATE_ROUTINE_VERSION', 1170); define('EOL', "
\r\n"); /** - * @brief Image storage quality. + * Image storage quality. * * Lower numbers save space at cost of image detail. * For ease of upgrade, please do not change here. Set system.jpegquality = n in config/local.config.php, @@ -236,30 +233,7 @@ if (!defined('CURLE_OPERATION_TIMEDOUT')) { } /** - * @brief Retrieve the App structure - * - * Useful in functions which require it but don't get it passed to them - * - * @deprecated since version 2018.09 - * @see BaseObject::getApp() - * @return App - */ -function get_app() -{ - return BaseObject::getApp(); -} - -/** - * @brief Used to end the current process, after saving session state. - * @deprecated - */ -function killme() -{ - exit(); -} - -/** - * @brief Returns the user id of locally logged in user or false. + * Returns the user id of locally logged in user or false. * * @return int|bool user id or false */ @@ -272,7 +246,7 @@ function local_user() } /** - * @brief Returns the public contact id of logged in user or false. + * Returns the public contact id of logged in user or false. * * @return int|bool public contact id or false */ @@ -296,7 +270,7 @@ function public_contact() } /** - * @brief Returns contact id of authenticated site visitor or false + * Returns contact id of authenticated site visitor or false * * @return int|bool visitor_id or false */ @@ -314,7 +288,7 @@ function remote_user() } /** - * @brief Show an error message to user. + * Show an error message to user. * * This function save text in session, to be shown to the user at next page load * @@ -326,7 +300,7 @@ function notice($s) return; } - $a = \get_app(); + $a = DI::app(); if (empty($_SESSION['sysmsg'])) { $_SESSION['sysmsg'] = []; } @@ -336,7 +310,7 @@ function notice($s) } /** - * @brief Show an info message to user. + * Show an info message to user. * * This function save text in session, to be shown to the user at next page load * @@ -344,9 +318,9 @@ function notice($s) */ function info($s) { - $a = \get_app(); + $a = DI::app(); - if (local_user() && PConfig::get(local_user(), 'system', 'ignore_info')) { + if (local_user() && DI::pConfig()->get(local_user(), 'system', 'ignore_info')) { return; } @@ -401,13 +375,13 @@ function feed_birthday($uid, $tz) } /** - * @brief Check if current user has admin role. + * Check if current user has admin role. * * @return bool true if user is an admin */ function is_site_admin() { - $a = \get_app(); + $a = DI::app(); $admin_email = Config::get('config', 'admin_email'); @@ -470,21 +444,8 @@ function curPageURL() return $pageURL; } -function get_server() -{ - $server = Config::get("system", "directory"); - - if ($server == "") { - $server = "https://dir.friendica.social"; - } - - return $server; -} - function get_temppath() { - $a = \get_app(); - $temppath = Config::get("system", "temppath"); if (($temppath != "") && System::isDirectoryUsable($temppath)) { @@ -501,7 +462,7 @@ function get_temppath() $temppath = BasePath::getRealPath($temppath); // To avoid any interferences with other systems we create our own directory - $new_temppath = $temppath . "/" . $a->getHostName(); + $new_temppath = $temppath . "/" . DI::baseUrl()->getHostname(); if (!is_dir($new_temppath)) { /// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method? mkdir($new_temppath); @@ -610,7 +571,7 @@ function get_itemcachepath() } /** - * @brief Returns the path where spool files are stored + * Returns the path where spool files are stored * * @return string Spool path */ @@ -686,22 +647,3 @@ function validate_include(&$file) // Simply return flag return $valid; } - -/** - * PHP 5 compatible dirname() with count parameter - * - * @see http://php.net/manual/en/function.dirname.php#113193 - * - * @deprecated with PHP 7 - * @param string $path - * @param int $levels - * @return string - */ -function rdirname($path, $levels = 1) -{ - if ($levels > 1) { - return dirname(rdirname($path, --$levels)); - } else { - return dirname($path); - } -}