]> git.mxchange.org Git - friendica.git/commitdiff
Just some more removed baseurls ...
authorMichael Vogel <icarus@dabo.de>
Wed, 17 Feb 2016 07:08:28 +0000 (08:08 +0100)
committerMichael Vogel <icarus@dabo.de>
Wed, 17 Feb 2016 07:08:28 +0000 (08:08 +0100)
boot.php
include/ForumManager.php
include/conversation.php
include/identity.php
include/nav.php
index.php
mod/content.php
mod/directory.php
mod/profiles.php
object/Item.php
view/theme/vier/theme.php

index 0217750136b194235e9e462e8d35b7f05c0f8e84..851008aef515c23d89d2fe6a9d5ab7d5d47290a5 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -920,10 +920,6 @@ 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.
@@ -951,6 +947,25 @@ class App {
        }
 
 
+       /**
+        * @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
         * 
index 73eb511de60b2374d687ea58088c6f2e041a5117..6fede0204d945f3901f91c266ab4b7c1b38b1680 100644 (file)
@@ -89,7 +89,7 @@ class ForumManager {
                if(count($contacts)) {
 
                        $id = 0;
-$a = get_app();
+
                        foreach($contacts as $contact) {
 
                                $selected = (($cid == $contact['id']) ? ' forum-selected' : '');
@@ -100,7 +100,7 @@ $a = get_app();
                                        '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;
index 6c33be84fb33971d1f9a167e7607e244487268c0..53a7b3d1edfa1668e18b285292ad0a0409bea137 100644 (file)
@@ -614,7 +614,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                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);
index ec66225d0ffd8261e82cbf87def67c723276186f..aba69bae491262dcffe6afe8ecabba2fabb75c9f 100644 (file)
@@ -332,9 +332,9 @@ function profile_sidebar($profile, $block = 0) {
                '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){
index fb7225af920c2341e11ec2a859e3de75a4fee52d..0fa671a27d5118a384aebbaf69945dd265f8772b 100644 (file)
@@ -82,7 +82,7 @@ function nav_info(&$a) {
                // 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'],
                );
 
index 8471735d016af1fd617d908a614c8ded21013db5..e364389b2cf36ada83138e23c1c3da8f1c9ca82a 100644 (file)
--- a/index.php
+++ b/index.php
@@ -371,7 +371,7 @@ $a->init_page_end();
 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>';
@@ -423,10 +423,10 @@ if($a->module != 'install' && $a->module != 'maintenance') {
 
 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,
index c5a55561167e767ab02c63b490e14f899e2ceb91..c2b1546bf1799653c163353dc29206f475e9e24c 100644 (file)
@@ -420,7 +420,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                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);
@@ -791,7 +791,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                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']) : '');
index 294a55585df14ed8eca9856edabd395ad1eefb31..be09dd37f681ac451003f11d917306b7d6dfe9c6 100644 (file)
@@ -158,14 +158,14 @@ function directory_content(&$a) {
                        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,
index 5c372de8ee9243067c9c5e800a5e464022c573e6..0b8261422f3b5b36b316f44b2e95eb2edac84ebd 100644 (file)
@@ -16,7 +16,7 @@ function profiles_init(&$a) {
                );
                if(! count($r)) {
                        notice( t('Profile not found.') . EOL);
-                       goaway($a->get_baseurl(true) . '/profiles');
+                       goaway('profiles');
                        return; // NOTREACHED
                }
 
@@ -34,9 +34,9 @@ function profiles_init(&$a) {
                        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
        }
 
@@ -73,9 +73,9 @@ function profiles_init(&$a) {
 
                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')) {
@@ -116,9 +116,9 @@ function profiles_init(&$a) {
                );
                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
        }
@@ -582,15 +582,7 @@ function profile_activity($changed, $value) {
 
        $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");
-
        }
 }
 
@@ -786,7 +778,7 @@ function profiles_content(&$a) {
                        );
                        if(count($r)){
                                //Go to the default profile.
-                               goaway($a->get_baseurl(true) . '/profiles/'.$r[0]['id']);
+                               goaway('profiles/'.$r[0]['id']);
                        }
                }
 
@@ -807,12 +799,12 @@ function profiles_content(&$a) {
 
                        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>')
                                ));
                        }
                }
index 7b542c472453bc4df80c477081241060c0bb2b29..9daf44648eba18744362317dbe631578b92bb8fa 100644 (file)
@@ -154,7 +154,7 @@ class Item extends BaseObject {
                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);
@@ -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->get_cached_avatar_image($a->contact['thumb']),
+                               '$myphoto' => $a->remove_baseurl($a->contact['thumb']),
                                '$comment' => t('Comment'),
                                '$submit' => t('Submit'),
                                '$edbold' => t('Bold'),
index 25954350f978f25d9c2ae4df8ea3674832e8db03..f33a9178ac1d51b7dbeb6d54cf73da98c53e4b26 100644 (file)
@@ -188,7 +188,7 @@ function vier_community_info() {
                                $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;
                        }