Remove the baseurl where possible to avoid mixed content

This commit is contained in:
Michael Vogel 2016-02-17 00:01:24 +01:00
parent e9fe220116
commit f7537c9e90
7 changed files with 46 additions and 44 deletions

View file

@ -920,6 +920,10 @@ class App {
} }
function get_cached_avatar_image($avatar_image){ 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; return $avatar_image;
// The following code is deactivated. It doesn't seem to make any sense and it slows down the system. // The following code is deactivated. It doesn't seem to make any sense and it slows down the system.

View file

@ -89,18 +89,18 @@ class ForumManager {
if(count($contacts)) { if(count($contacts)) {
$id = 0; $id = 0;
$a = get_app();
foreach($contacts as $contact) { foreach($contacts as $contact) {
$selected = (($cid == $contact['id']) ? ' forum-selected' : ''); $selected = (($cid == $contact['id']) ? ' forum-selected' : '');
$entry = array( $entry = array(
'url' => z_root() . '/network?f=&cid=' . $contact['id'], 'url' => 'network?f=&cid=' . $contact['id'],
'external_url' => z_root() . '/redir/' . $contact['id'], 'external_url' => 'redir/' . $contact['id'],
'name' => $contact['name'], 'name' => $contact['name'],
'cid' => $contact['id'], 'cid' => $contact['id'],
'selected' => $selected, '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, 'id' => ++$id,
); );
$entries[] = $entry; $entries[] = $entry;
@ -187,4 +187,4 @@ class ForumManager {
return $r; return $r;
} }
} }

View file

@ -107,7 +107,7 @@ function nav_info(&$a) {
if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user())) if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
$nav['register'] = array('register',t('Register'), "", t('Create an account')); $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')) if(! get_config('system','hide_help'))
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation')); $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));

View file

@ -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(),'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'] .= (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'] .= posted_date_widget('network',local_user(),false);
$a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search); $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( $tabs = array(
array( array(
'label' => t('Commented Order'), '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, 'sel' => $all_active,
'title' => t('Sort by Comment Date'), 'title' => t('Sort by Comment Date'),
'id' => 'commented-order-tab', 'id' => 'commented-order-tab',
@ -371,7 +371,7 @@ function network_content(&$a, $update = 0) {
), ),
array( array(
'label' => t('Posted Order'), '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, 'sel' => $postord_active,
'title' => t('Sort by Post Date'), 'title' => t('Sort by Post Date'),
'id' => 'posted-order-tab', 'id' => 'posted-order-tab',
@ -382,7 +382,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'personal_tab')) { if(feature_enabled(local_user(),'personal_tab')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Personal'), '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, 'sel' => $conv_active,
'title' => t('Posts that mention or involve you'), 'title' => t('Posts that mention or involve you'),
'id' => 'personal-tab', 'id' => 'personal-tab',
@ -393,7 +393,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'new_tab')) { if(feature_enabled(local_user(),'new_tab')) {
$tabs[] = array( $tabs[] = array(
'label' => t('New'), '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, 'sel' => $new_active,
'title' => t('Activity Stream - by date'), 'title' => t('Activity Stream - by date'),
'id' => 'activitiy-by-date-tab', 'id' => 'activitiy-by-date-tab',
@ -404,7 +404,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'link_tab')) { if(feature_enabled(local_user(),'link_tab')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Shared Links'), '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, 'sel' => $bookmarked_active,
'title' => t('Interesting Links'), 'title' => t('Interesting Links'),
'id' => 'shared-links-tab', 'id' => 'shared-links-tab',
@ -415,7 +415,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'star_posts')) { if(feature_enabled(local_user(),'star_posts')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Starred'), '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, 'sel' => $starred_active,
'title' => t('Favourite Posts'), 'title' => t('Favourite Posts'),
'id' => 'starred-posts-tab', 'id' => 'starred-posts-tab',
@ -547,7 +547,7 @@ function network_content(&$a, $update = 0) {
if($update) if($update)
killme(); killme();
notice( t('No such group') . EOL ); notice( t('No such group') . EOL );
goaway($a->get_baseurl(true) . '/network/0'); goaway('network/0');
// NOTREACHED // NOTREACHED
} }
@ -611,7 +611,7 @@ function network_content(&$a, $update = 0) {
} }
else { else {
notice( t('Invalid contact.') . EOL); notice( t('Invalid contact.') . EOL);
goaway($a->get_baseurl(true) . '/network'); goaway('network');
// NOTREACHED // NOTREACHED
} }
} }

View file

@ -705,7 +705,7 @@ class Item extends BaseObject {
'$profile_uid' => $conv->get_profile_owner(), '$profile_uid' => $conv->get_profile_owner(),
'$mylink' => $a->contact['url'], '$mylink' => $a->contact['url'],
'$mytitle' => t('This is you'), '$mytitle' => t('This is you'),
'$myphoto' => $a->contact['thumb'], '$myphoto' => $a->get_cached_avatar_image($a->contact['thumb']),
'$comment' => t('Comment'), '$comment' => t('Comment'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$edbold' => t('Bold'), '$edbold' => t('Bold'),

View file

@ -2,17 +2,17 @@
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<base href="{{$baseurl}}/" /> <base href="{{$baseurl}}/" />
<meta name="generator" content="{{$generator}}" /> <meta name="generator" content="{{$generator}}" />
<link rel="stylesheet" href="{{$baseurl}}/view/global.css" type="text/css" media="all" /> <link rel="stylesheet" href="view/global.css" type="text/css" media="all" />
<link rel="stylesheet" href="{{$baseurl}}/library/colorbox/colorbox.css" type="text/css" media="screen" /> <link rel="stylesheet" href="library/colorbox/colorbox.css" type="text/css" media="screen" />
<link rel="stylesheet" href="{{$baseurl}}/library/jgrowl/jquery.jgrowl.css" type="text/css" media="screen" /> <link rel="stylesheet" href="library/jgrowl/jquery.jgrowl.css" type="text/css" media="screen" />
<link rel="stylesheet" href="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.css" type="text/css" media="screen" /> <link rel="stylesheet" href="library/datetimepicker/jquery.datetimepicker.css" type="text/css" media="screen" />
<link rel="stylesheet" href="{{$baseurl}}/library/perfect-scrollbar/perfect-scrollbar.min.css" type="text/css" media="screen" /> <link rel="stylesheet" href="library/perfect-scrollbar/perfect-scrollbar.min.css" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="{{$stylesheet}}" media="all" /> <link rel="stylesheet" type="text/css" href="{{$stylesheet}}" media="all" />
<!-- <!--
<link rel="shortcut icon" href="{{$baseurl}}/images/friendica-32.png" /> <link rel="shortcut icon" href="images/friendica-32.png" />
<link rel="apple-touch-icon" href="{{$baseurl}}/images/friendica-128.png"/> <link rel="apple-touch-icon" href="images/friendica-128.png"/>
--> -->
<link rel="shortcut icon" href="{{$shortcut_icon}}" /> <link rel="shortcut icon" href="{{$shortcut_icon}}" />
<link rel="apple-touch-icon" href="{{$touch_icon}}"/> <link rel="apple-touch-icon" href="{{$touch_icon}}"/>
@ -28,20 +28,20 @@
<!--[if IE]> <!--[if IE]>
<script type="text/javascript" src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <script type="text/javascript" src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--> <![endif]-->
<script type="text/javascript" src="{{$baseurl}}/js/modernizr.js" ></script> <script type="text/javascript" src="js/modernizr.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.js" ></script> <script type="text/javascript" src="js/jquery.js" ></script>
<!-- <script type="text/javascript" src="{{$baseurl}}/js/jquery-migrate.js" ></script>--> <!-- <script type="text/javascript" src="js/jquery-migrate.js" ></script>-->
<script type="text/javascript" src="{{$baseurl}}/js/jquery-migrate.js" ></script> <script type="text/javascript" src="js/jquery-migrate.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.textinputs.js" ></script> <script type="text/javascript" src="js/jquery.textinputs.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/fk.autocomplete.js" ></script> <script type="text/javascript" src="js/fk.autocomplete.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script> <script type="text/javascript" src="library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script> <script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.js"></script> <script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script> <script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/library/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script> <script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/acl.js" ></script> <script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/webtoolkit.base64.js" ></script> <script type="text/javascript" src="js/webtoolkit.base64.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/main.js" ></script> <script type="text/javascript" src="js/main.js" ></script>
<script> <script>
var updateInterval = {{$update_interval}}; var updateInterval = {{$update_interval}};

View file

@ -19,8 +19,6 @@ function vier_init(&$a) {
set_template_engine($a, 'smarty3'); set_template_engine($a, 'smarty3');
$baseurl = $a->get_baseurl();
$a->theme_info = array(); $a->theme_info = array();
if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()) { if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()) {
@ -160,7 +158,7 @@ function vier_community_info() {
$entry = replace_macros($tpl,array( $entry = replace_macros($tpl,array(
'$id' => $rr['id'], '$id' => $rr['id'],
//'$profile_link' => zrl($rr['url']), //'$profile_link' => zrl($rr['url']),
'$profile_link' => $a->get_baseurl().'/follow/?url='.urlencode($rr['url']), '$profile_link' => 'follow/?url='.urlencode($rr['url']),
'$photo' => proxy_url($rr['photo'], false, PROXY_SIZE_MICRO), '$photo' => proxy_url($rr['photo'], false, PROXY_SIZE_MICRO),
'$alt_text' => $rr['name'], '$alt_text' => $rr['name'],
)); ));
@ -186,7 +184,7 @@ function vier_community_info() {
$aside['$lastusers_items'] = array(); $aside['$lastusers_items'] = array();
foreach($r as $rr) { foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); $profile_link = 'profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,array( $entry = replace_macros($tpl,array(
'$id' => $rr['id'], '$id' => $rr['id'],
'$profile_link' => $profile_link, '$profile_link' => $profile_link,
@ -207,7 +205,7 @@ function vier_community_info() {
$nv['suggest'] = Array('suggest', t('Friend Suggestions'), "", ""); $nv['suggest'] = Array('suggest', t('Friend Suggestions'), "", "");
$nv['invite'] = Array('invite', t('Invite Friends'), "", ""); $nv['invite'] = Array('invite', t('Invite Friends'), "", "");
$nv['search'] = '<form name="simple_bar" method="get" action="'.$a->get_baseurl().'/dirfind"> $nv['search'] = '<form name="simple_bar" method="get" action="dirfind">
<span class="sbox_l"></span> <span class="sbox_l"></span>
<span class="sbox"> <span class="sbox">
<input type="text" name="search" size="13" maxlength="50"> <input type="text" name="search" size="13" maxlength="50">