From f7537c9e90fa1b35618abd523d0d00f9658085a9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 17 Feb 2016 00:01:24 +0100 Subject: [PATCH] Remove the baseurl where possible to avoid mixed content --- boot.php | 4 ++++ include/ForumManager.php | 10 +++++----- include/nav.php | 2 +- mod/network.php | 22 ++++++++++---------- object/Item.php | 2 +- view/templates/head.tpl | 42 +++++++++++++++++++-------------------- view/theme/vier/theme.php | 8 +++----- 7 files changed, 46 insertions(+), 44 deletions(-) diff --git a/boot.php b/boot.php index d9d7c62dc7..0217750136 100644 --- a/boot.php +++ b/boot.php @@ -920,6 +920,10 @@ class App { } function get_cached_avatar_image($avatar_image){ + // Just remove the base url. This avoid mixed content + $avatar_image = normalise_link($avatar_image); + $base = normalise_link($this->get_baseurl()); + $avatar_image = str_replace($base."/", "", $avatar_image); return $avatar_image; // The following code is deactivated. It doesn't seem to make any sense and it slows down the system. diff --git a/include/ForumManager.php b/include/ForumManager.php index 49417d1831..73eb511de6 100644 --- a/include/ForumManager.php +++ b/include/ForumManager.php @@ -89,18 +89,18 @@ class ForumManager { if(count($contacts)) { $id = 0; - +$a = get_app(); foreach($contacts as $contact) { $selected = (($cid == $contact['id']) ? ' forum-selected' : ''); $entry = array( - 'url' => z_root() . '/network?f=&cid=' . $contact['id'], - 'external_url' => z_root() . '/redir/' . $contact['id'], + 'url' => 'network?f=&cid=' . $contact['id'], + 'external_url' => 'redir/' . $contact['id'], 'name' => $contact['name'], 'cid' => $contact['id'], 'selected' => $selected, - 'micro' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), + 'micro' => $a->get_cached_avatar_image(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)), 'id' => ++$id, ); $entries[] = $entry; @@ -187,4 +187,4 @@ class ForumManager { return $r; } -} \ No newline at end of file +} diff --git a/include/nav.php b/include/nav.php index 6512d35609..fb7225af92 100644 --- a/include/nav.php +++ b/include/nav.php @@ -107,7 +107,7 @@ function nav_info(&$a) { if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user())) $nav['register'] = array('register',t('Register'), "", t('Create an account')); - $help_url = $a->get_baseurl($ssl_state) . '/help'; + $help_url = 'help'; if(! get_config('system','hide_help')) $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation')); diff --git a/mod/network.php b/mod/network.php index 0010a3d824..a9f369a894 100644 --- a/mod/network.php +++ b/mod/network.php @@ -149,10 +149,10 @@ function network_init(&$a) { $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : ''); $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? ForumManager::widget(local_user(),$cid) : ''); - $a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false); - $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : '')); + $a->page['aside'] .= posted_date_widget('network',local_user(),false); + $a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= saved_searches($search); - $a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : '')); + $a->page['aside'] .= fileas_widget('network',(x($_GET, 'file') ? $_GET['file'] : '')); } @@ -363,7 +363,7 @@ function network_content(&$a, $update = 0) { $tabs = array( array( 'label' => t('Commented Order'), - 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), + 'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'sel' => $all_active, 'title' => t('Sort by Comment Date'), 'id' => 'commented-order-tab', @@ -371,7 +371,7 @@ function network_content(&$a, $update = 0) { ), array( 'label' => t('Posted Order'), - 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), + 'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'sel' => $postord_active, 'title' => t('Sort by Post Date'), 'id' => 'posted-order-tab', @@ -382,7 +382,7 @@ function network_content(&$a, $update = 0) { if(feature_enabled(local_user(),'personal_tab')) { $tabs[] = array( 'label' => t('Personal'), - 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1', + 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1', 'sel' => $conv_active, 'title' => t('Posts that mention or involve you'), 'id' => 'personal-tab', @@ -393,7 +393,7 @@ function network_content(&$a, $update = 0) { if(feature_enabled(local_user(),'new_tab')) { $tabs[] = array( 'label' => t('New'), - 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), + 'url' => str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), 'sel' => $new_active, 'title' => t('Activity Stream - by date'), 'id' => 'activitiy-by-date-tab', @@ -404,7 +404,7 @@ function network_content(&$a, $update = 0) { if(feature_enabled(local_user(),'link_tab')) { $tabs[] = array( 'label' => t('Shared Links'), - 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', + 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', 'sel' => $bookmarked_active, 'title' => t('Interesting Links'), 'id' => 'shared-links-tab', @@ -415,7 +415,7 @@ function network_content(&$a, $update = 0) { if(feature_enabled(local_user(),'star_posts')) { $tabs[] = array( 'label' => t('Starred'), - 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1', + 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1', 'sel' => $starred_active, 'title' => t('Favourite Posts'), 'id' => 'starred-posts-tab', @@ -547,7 +547,7 @@ function network_content(&$a, $update = 0) { if($update) killme(); notice( t('No such group') . EOL ); - goaway($a->get_baseurl(true) . '/network/0'); + goaway('network/0'); // NOTREACHED } @@ -611,7 +611,7 @@ function network_content(&$a, $update = 0) { } else { notice( t('Invalid contact.') . EOL); - goaway($a->get_baseurl(true) . '/network'); + goaway('network'); // NOTREACHED } } diff --git a/object/Item.php b/object/Item.php index 04c1a707e3..7b542c4724 100644 --- a/object/Item.php +++ b/object/Item.php @@ -705,7 +705,7 @@ class Item extends BaseObject { '$profile_uid' => $conv->get_profile_owner(), '$mylink' => $a->contact['url'], '$mytitle' => t('This is you'), - '$myphoto' => $a->contact['thumb'], + '$myphoto' => $a->get_cached_avatar_image($a->contact['thumb']), '$comment' => t('Comment'), '$submit' => t('Submit'), '$edbold' => t('Bold'), diff --git a/view/templates/head.tpl b/view/templates/head.tpl index 17c459c4d8..fdf9a7716e 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -2,17 +2,17 @@ - - - - - + + + + + @@ -28,20 +28,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + +