X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=69440e69d29aa25f8f3566d6ccedd59262b2ce53;hb=8af8567567e67af97871d12333d6d55c79c5a67d;hp=049dc911054ab294bafbaa0c3bb4cbd6d6fbd1c9;hpb=471963a14258de347390ccc84e5fb54dbdb3afaf;p=friendica.git diff --git a/boot.php b/boot.php index 049dc91105..69440e69d2 100644 --- a/boot.php +++ b/boot.php @@ -17,6 +17,8 @@ * easily as email does today. */ +require_once('include/autoloader.php'); + require_once('include/config.php'); require_once('include/network.php'); require_once('include/plugin.php'); @@ -36,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Asparagus'); define ( 'FRIENDICA_VERSION', '3.5-dev' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1193 ); +define ( 'DB_UPDATE_VERSION', 1194 ); /** * @brief Constant with a HTML line break. @@ -530,6 +532,8 @@ class App { private $cached_profile_image; private $cached_profile_picdate; + private static $a; + /** * @brief App constructor. */ @@ -553,9 +557,7 @@ class App { $this->performance["rendering"] = 0; $this->performance["parser"] = 0; $this->performance["marktime"] = 0; - - $this->performance["file"] = 0; - $this->performance["file"] = 0; + $this->performance["markstart"] = microtime(true); $this->callstack["database"] = array(); $this->callstack["network"] = array(); @@ -712,6 +714,8 @@ class App { } } + self::$a = $this; + } function get_basepath() { @@ -736,6 +740,10 @@ class App { function get_baseurl($ssl = false) { + // Is the function called statically? + if (!is_object($this)) + return(self::$a->get_baseurl($ssl)); + $scheme = $this->scheme; if((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) { @@ -856,11 +864,11 @@ class App { $shortcut_icon = get_config("system", "shortcut_icon"); if ($shortcut_icon == "") - $shortcut_icon = $this->get_baseurl()."/images/friendica-32.png"; + $shortcut_icon = "images/friendica-32.png"; $touch_icon = get_config("system", "touch_icon"); if ($touch_icon == "") - $touch_icon = $this->get_baseurl()."/images/friendica-128.png"; + $touch_icon = "images/friendica-128.png"; $tpl = get_markup_template('head.tpl'); $this->page['htmlhead'] = replace_macros($tpl,array( @@ -912,6 +920,10 @@ class App { } function get_cached_avatar_image($avatar_image){ + return $avatar_image; + + // The following code is deactivated. It doesn't seem to make any sense and it slows down the system. + /* if($this->cached_profile_image[$avatar_image]) return $this->cached_profile_image[$avatar_image]; @@ -931,9 +943,29 @@ class App { } } return $this->cached_profile_image[$avatar_image]; + */ } + /** + * @brief Removes the baseurl from an url. This avoids some mixed content problems. + * + * @param string $url + * + * @return string The cleaned url + */ + function remove_baseurl($url){ + + // Is the function called statically? + if (!is_object($this)) + return(self::$a->remove_baseurl($ssl)); + + $url = normalise_link($url); + $base = normalise_link($this->get_baseurl()); + $url = str_replace($base."/", "", $url); + return $url; + } + /** * @brief Register template engine class * @@ -1026,22 +1058,29 @@ class App { $this->performance[$value] += (float)$duration; $this->performance["marktime"] += (float)$duration; - // Trace the different functions with their timestamps - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5); + $callstack = $this->callstack(); - array_shift($trace); + $this->callstack[$value][$callstack] += (float)$duration; - $function = array(); - foreach ($trace AS $func) - $function[] = $func["function"]; + } - $function = implode(", ", $function); + /** + * @brief Returns a string with a callstack. Can be used for logging. + * + * @return string + */ + function callstack() { + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 6); - //$last = array_pop($trace); - //$function = $last["function"]; + // We remove the first two items from the list since they contain data that we don't need. + array_shift($trace); + array_shift($trace); - $this->callstack[$value][$function] += (float)$duration; + $callstack = array(); + foreach ($trace AS $func) + $callstack[] = $func["function"]; + return implode(", ", $callstack); } function mark_timestamp($mark) { @@ -1408,7 +1447,7 @@ function login($register = false, $hiddens=false) { $noid = get_config('system','no_openid'); - $dest_url = $a->get_baseurl(true) . '/' . $a->query_string; + $dest_url = $a->query_string; if(local_user()) { $tpl = get_markup_template("logout.tpl"); @@ -1727,9 +1766,9 @@ function current_theme_url() { $opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : ''); if (file_exists('view/theme/' . $t . '/style.php')) - return($a->get_baseurl() . '/view/theme/' . $t . '/style.pcss' . $opts); + return('view/theme/'.$t.'/style.pcss'.$opts); - return($a->get_baseurl() . '/view/theme/' . $t . '/style.css'); + return('view/theme/'.$t.'/style.css'); } function feed_birthday($uid,$tz) {