X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=4e1249e197ce14bfb2d2f6bc58c3a43ea9ecafdc;hb=fa6c33d3ac7d3d8f8bd2cdfc341217cd88a6a557;hp=f36e770da189ccddde55ef7c70569f8222c71165;hpb=244f440d97436e92836a95b207fb6737c12c9d0d;p=friendica.git diff --git a/boot.php b/boot.php index f36e770da1..4e1249e197 100644 --- a/boot.php +++ b/boot.php @@ -17,9 +17,6 @@ * easily as email does today. */ -use Friendica\App; -use Friendica\Core\Config; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; @@ -36,7 +33,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. @@ -45,7 +42,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, @@ -235,7 +232,7 @@ if (!defined('CURLE_OPERATION_TIMEDOUT')) { } /** - * @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 */ @@ -248,7 +245,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 */ @@ -272,7 +269,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 */ @@ -290,7 +287,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 * @@ -312,7 +309,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 * @@ -322,7 +319,7 @@ function info($s) { $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; } @@ -377,7 +374,7 @@ 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 */ @@ -385,7 +382,7 @@ function is_site_admin() { $a = DI::app(); - $admin_email = Config::get('config', 'admin_email'); + $admin_email = DI::config()->get('config', 'admin_email'); $adminlist = explode(',', str_replace(' ', '', $admin_email)); @@ -446,20 +443,9 @@ function curPageURL() return $pageURL; } -function get_server() -{ - $server = Config::get("system", "directory"); - - if ($server == "") { - $server = "https://dir.friendica.social"; - } - - return $server; -} - function get_temppath() { - $temppath = Config::get("system", "temppath"); + $temppath = DI::config()->get("system", "temppath"); if (($temppath != "") && System::isDirectoryUsable($temppath)) { // We have a temp path and it is usable @@ -483,7 +469,7 @@ function get_temppath() if (System::isDirectoryUsable($new_temppath)) { // The new path is usable, we are happy - Config::set("system", "temppath", $new_temppath); + DI::config()->set("system", "temppath", $new_temppath); return $new_temppath; } else { // We can't create a subdirectory, strange. @@ -533,7 +519,7 @@ function clear_cache($basepath = "", $path = "") return; } - $cachetime = (int) Config::get('system', 'itemcache_duration'); + $cachetime = (int) DI::config()->get('system', 'itemcache_duration'); if ($cachetime == 0) { $cachetime = 86400; } @@ -557,12 +543,12 @@ function clear_cache($basepath = "", $path = "") function get_itemcachepath() { // Checking, if the cache is deactivated - $cachetime = (int) Config::get('system', 'itemcache_duration'); + $cachetime = (int) DI::config()->get('system', 'itemcache_duration'); if ($cachetime < 0) { return ""; } - $itemcache = Config::get('system', 'itemcache'); + $itemcache = DI::config()->get('system', 'itemcache'); if (($itemcache != "") && System::isDirectoryUsable($itemcache)) { return BasePath::getRealPath($itemcache); } @@ -576,7 +562,7 @@ function get_itemcachepath() } if (System::isDirectoryUsable($itemcache)) { - Config::set("system", "itemcache", $itemcache); + DI::config()->set("system", "itemcache", $itemcache); return $itemcache; } } @@ -584,13 +570,13 @@ function get_itemcachepath() } /** - * @brief Returns the path where spool files are stored + * Returns the path where spool files are stored * * @return string Spool path */ function get_spoolpath() { - $spoolpath = Config::get('system', 'spoolpath'); + $spoolpath = DI::config()->get('system', 'spoolpath'); if (($spoolpath != "") && System::isDirectoryUsable($spoolpath)) { // We have a spool path and it is usable return $spoolpath; @@ -608,7 +594,7 @@ function get_spoolpath() if (System::isDirectoryUsable($spoolpath)) { // The new path is usable, we are happy - Config::set("system", "spoolpath", $spoolpath); + DI::config()->set("system", "spoolpath", $spoolpath); return $spoolpath; } else { // We can't create a subdirectory, strange. @@ -660,22 +646,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); - } -}