}
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.
}
+ /**
+ * @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
*
if(count($contacts)) {
$id = 0;
-$a = get_app();
+
foreach($contacts as $contact) {
$selected = (($cid == $contact['id']) ? ' forum-selected' : '');
'name' => $contact['name'],
'cid' => $contact['id'],
'selected' => $selected,
- 'micro' => $a->get_cached_avatar_image(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)),
+ 'micro' => App::remove_baseurl(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)),
'id' => ++$id,
);
$entries[] = $entry;
if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
$profile_avatar = $a->contacts[$normalised]['thumb'];
else
- $profile_avatar = ((strlen($item['author-avatar'])) ? $a->get_cached_avatar_image($item['author-avatar']) : $item['thumb']);
+ $profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']));
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
call_hooks('render_location',$locate);
'fullname' => $profile['name'],
'firstname' => $firstname,
'lastname' => $lastname,
- 'photo300' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg'),
- 'photo100' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg'),
- 'photo50' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg'),
+ 'photo300' => $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg',
+ 'photo100' => $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg',
+ 'photo50' => $a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg',
);
if (!$block){
// user info
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
$userinfo = array(
- 'icon' => (count($r) ? $a->get_cached_avatar_image($r[0]['micro']) : $a->get_baseurl($ssl_state)."/images/person-48.jpg"),
+ 'icon' => (count($r) ? $a->remove_baseurl($r[0]['micro']) : "images/person-48.jpg"),
'name' => $a->user['username'],
);
if(x($_SESSION,'visitor_home'))
$homebase = $_SESSION['visitor_home'];
elseif(local_user())
- $homebase = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
+ $homebase = 'profile/' . $a->user['nickname'];
if(isset($homebase))
$a->page['content'] .= '<script>var homebase="' . $homebase . '" ; </script>';
if($a->is_mobile || $a->is_tablet) {
if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
- $link = $a->get_baseurl() . '/toggle_mobile?address=' . curPageURL();
+ $link = 'toggle_mobile?address=' . curPageURL();
}
else {
- $link = $a->get_baseurl() . '/toggle_mobile?off=1&address=' . curPageURL();
+ $link = 'toggle_mobile?off=1&address=' . curPageURL();
}
$a->page['footer'] = replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array(
'$toggle_link' => $link,
if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
$profile_avatar = $a->contacts[$normalised]['thumb'];
else
- $profile_avatar = ((strlen($item['author-avatar'])) ? $a->get_cached_avatar_image($item['author-avatar']) : $item['thumb']);
+ $profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']));
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
call_hooks('render_location',$locate);
if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
$profile_avatar = $a->contacts[$normalised]['thumb'];
else
- $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($thumb));
+ $profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar']) && $diff_author) ? $item['author-avatar'] : $thumb));
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
else {
$location_e = $location;
}
-
+
$photo_menu = array(array(t("View Profile"), zrl($profile_link)));
$entry = array(
'id' => $rr['id'],
'url' => $profile_link,
'itemurl' => $itemurl,
- 'thumb' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB),
+ 'thumb' => proxy_url($rr[$photo], false, PROXY_SIZE_THUMB),
'img_hover' => $rr['name'],
'name' => $rr['name'],
'details' => $details,
);
if(! count($r)) {
notice( t('Profile not found.') . EOL);
- goaway($a->get_baseurl(true) . '/profiles');
+ goaway('profiles');
return; // NOTREACHED
}
intval(local_user())
);
if($r)
- info( t('Profile deleted.') . EOL);
+ info(t('Profile deleted.').EOL);
- goaway($a->get_baseurl(true) . '/profiles');
+ goaway('profiles');
return; // NOTREACHED
}
info( t('New profile created.') . EOL);
if(count($r3) == 1)
- goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
+ goaway('profiles/'.$r3[0]['id']);
- goaway($a->get_baseurl(true) . '/profiles');
+ goaway('profiles');
}
if(($a->argc > 2) && ($a->argv[1] === 'clone')) {
);
info( t('New profile created.') . EOL);
if(count($r3) == 1)
- goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
+ goaway('profiles/'.$r3[0]['id']);
- goaway($a->get_baseurl(true) . '/profiles');
+ goaway('profiles');
return; // NOTREACHED
}
$i = item_store($arr);
if($i) {
-
- // give it a permanent link
- //q("update item set plink = '%s' where id = %d",
- // dbesc($a->get_baseurl() . '/display/' . $a->user['nickname'] . '/' . $i),
- // intval($i)
- //);
-
proc_run('php',"include/notifier.php","activity","$i");
-
}
}
);
if(count($r)){
//Go to the default profile.
- goaway($a->get_baseurl(true) . '/profiles/'.$r[0]['id']);
+ goaway('profiles/'.$r[0]['id']);
}
}
foreach($r as $rr) {
$o .= replace_macros($tpl, array(
- '$photo' => $a->get_cached_avatar_image($rr['thumb']),
+ '$photo' => $a->remove_baseurl($rr['thumb']),
'$id' => $rr['id'],
'$alt' => t('Profile Image'),
'$profile_name' => $rr['profile-name'],
'$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>'
- : '<a href="' . $a->get_baseurl(true) . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
+ : '<a href="'.'profperm/'.$rr['id'].'" />' . t('Edit visibility') . '</a>')
));
}
}
if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
$profile_avatar = $a->contacts[$normalised]['thumb'];
else
- $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($this->get_data_value('thumb')));
+ $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->remove_baseurl($this->get_data_value('thumb')));
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
call_hooks('render_location',$locate);
'$profile_uid' => $conv->get_profile_owner(),
'$mylink' => $a->contact['url'],
'$mytitle' => t('This is you'),
- '$myphoto' => $a->get_cached_avatar_image($a->contact['thumb']),
+ '$myphoto' => $a->remove_baseurl($a->contact['thumb']),
'$comment' => t('Comment'),
'$submit' => t('Submit'),
'$edbold' => t('Bold'),
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $profile_link,
- '$photo' => $a->get_cached_avatar_image($rr['thumb']),
+ '$photo' => $a->remove_baseurl($rr['thumb']),
'$alt_text' => $rr['name']));
$aside['$lastusers_items'][] = $entry;
}