]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
remove tag URI stuff; unused and confusing
[quix0rs-gnu-social.git] / lib / util.php
index e8ca5271631d63194e3c5debfa526163db59814f..1aa9d2944c9b044da1930fdfb3cb37639bf3cfa2 100644 (file)
@@ -548,7 +548,7 @@ function common_forgetme() {
 
 # who is the current user?
 function common_current_user() {
-       if ($_REQUEST[session_name()]) {
+       if ($_REQUEST[session_name()] || $_SESSION && $_SESSION['userid']) {
                common_ensure_session();
                $id = $_SESSION['userid'];
                if ($id) {
@@ -559,6 +559,11 @@ function common_current_user() {
        }
        # that didn't work; try to remember
        $user = common_remembered_user();
+       common_debug("Got User " . $user->nickname);
+       if ($user) {
+           common_debug("Faking session on remembered user");
+           $_SESSION['userid'] = $user->id;
+       }
        return $user;
 }
 
@@ -875,10 +880,7 @@ function common_save_replies($notice) {
                return true;
        }
        # XXX: is there another way to make an array copy?
-       $names = array_merge($match[1], array());
-       if ($tname) {
-               array_unshift($names, $tname);
-       }
+       $names = ($tname) ? array_unique(array_merge(array(strtolower($tname)), $match[1])) : $match[1];
        $sender = Profile::staticGet($notice->profile_id);
        # store replied only for first @ (what user/notice what the reply directed,
        # we assume first @ is it)
@@ -996,13 +998,6 @@ function common_notice_form($action=NULL, $content=NULL) {
        common_element_end('form');
 }
 
-function common_mint_tag($extra) {
-       global $config;
-       return
-         'tag:'.$config['tag']['authority'].','.
-         $config['tag']['date'].':'.$config['tag']['prefix'].$extra;
-}
-
 # Should make up a reasonable root URL
 
 function common_root_url() {
@@ -1290,4 +1285,20 @@ function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) {
                return common_default_avatar($size);
        }
 }
-       
\ No newline at end of file
+
+function common_profile_uri($profile) {
+       if (!$profile) {
+               return NULL;
+       }
+       $user = User::staticGet($profile->id);
+       if ($user) {
+               return $user->uri;
+       }
+       
+       $remote = Remote_profile::staticGet($profile->id);
+       if ($remote) {
+               return $remote->uri;
+       }
+       # XXX: this is a very bad profile!
+       return NULL;
+}
\ No newline at end of file