X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=93c7a3b9c10a4ff9979d8eafde851f8b6ead8311;hb=12f7c32f9b31a182596659d62a96c3c4c367576d;hp=d04a234aab98740da09430efe577612e4f58d948;hpb=ca371de509ba4d107e90431d9464252074df9136;p=friendica.git diff --git a/boot.php b/boot.php index d04a234aab..93c7a3b9c1 100644 --- a/boot.php +++ b/boot.php @@ -11,9 +11,9 @@ require_once('include/cache.php'); require_once('library/Mobile_Detect/Mobile_Detect.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '3.0.1455' ); +define ( 'FRIENDICA_VERSION', '3.0.1471' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1154 ); +define ( 'DB_UPDATE_VERSION', 1156 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -1025,11 +1025,29 @@ if(! function_exists('get_max_import_size')) { if(! function_exists('profile_load')) { function profile_load(&$a, $nickname, $profile = 0) { - if(remote_user()) { - $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", - intval($_SESSION['visitor_id'])); - if(count($r)) - $profile = $r[0]['profile-id']; + + $user = q("select uid from user where nickname = '%s' limit 1", + dbesc($nickname) + ); + + if(! ($user && count($user))) { + logger('profile error: ' . $a->query_string, LOGGER_DEBUG); + notice( t('Requested account is not available.') . EOL ); + $a->error = 404; + return; + } + + if(remote_user() && count($_SESSION['remote'])) { + foreach($_SESSION['remote'] as $visitor) { + if($visitor['uid'] == $user[0]['uid']) { + $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", + intval($visitor['cid']) + ); + if(count($r)) + $profile = $r[0]['profile-id']; + break; + } + } } $r = null; @@ -1070,9 +1088,12 @@ if(! function_exists('profile_load')) { $a->profile = $r[0]; + $a->profile['mobile-theme'] = get_pconfig($profile_uid, 'system', 'mobile_theme'); + $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename']; $_SESSION['theme'] = $a->profile['theme']; + $_SESSION['mobile-theme'] = $a->profile['mobile-theme']; /** * load/reload current theme info @@ -1144,8 +1165,14 @@ if(! function_exists('profile_sidebar')) { // don't show connect link to authenticated visitors either - if((remote_user()) && ($_SESSION['visitor_visiting'] == $profile['uid'])) - $connect = False; + if(remote_user() && count($_SESSION['remote'])) { + foreach($_SESSION['remote'] as $visitor) { + if($visitor['uid'] == $profile['uid']) { + $connect = false; + break; + } + } + } if(get_my_url() && $profile['unkmail']) $wallmessage = t('Message'); @@ -1484,8 +1511,20 @@ if(! function_exists('current_theme')) { $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet(); if($is_mobile) { - $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : ''); - $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme); + if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) { + $system_theme = ''; + $theme_name = ''; + } + else { + $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : ''); + $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme); + + if($theme_name === '---') { + // user has selected to have the mobile theme be the same as the normal one + $system_theme = ''; + $theme_name = ''; + } + } } if(!$is_mobile || ($system_theme === '' && $theme_name === '')) { $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : ''); @@ -1727,3 +1766,20 @@ function build_querystring($params, $name=null) { } return $ret; } + +/** +* Returns the complete URL of the current page, e.g.: http(s)://something.com/network +* +* Taken from http://webcheatsheet.com/php/get_current_page_url.php +*/ +function curPageURL() { + $pageURL = 'http'; + if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} + $pageURL .= "://"; + if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") { + $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; + } else { + $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; + } + return $pageURL; +}