]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile.php
progress on photos
[friendica.git] / mod / profile.php
index b0ff85a447a4e25336ed24be89334d96cc45f737..c8cfc4edddd969aa98668582e059286495675c1a 100644 (file)
@@ -57,7 +57,12 @@ function profile_init(&$a) {
                        unset($_SESSION['authenticated']);
        }
 
-       profile_load($a,$which);
+       $profile = 0;
+       if((local_user()) && ($a->argc > 2) && ($a->argv[2] == 'view')) {
+               $which = $a->user['nickname'];
+               $profile = $a->argv[1];         
+       }
+       profile_load($a,$which,$profile);
        $a->page['htmlhead'] .= "<meta name=\"dfrn-template\" content=\"" . $a->get_baseurl() . "/profile/%s" . "\" />\r\n";
        
        $dfrn_pages = array('request', 'confirm', 'notify', 'poll');
@@ -77,8 +82,9 @@ function profile_content(&$a, $update = false) {
        $tab = 'posts';
 
 
-
-
+       if(! $update) {
+               $_SESSION['profile_uid'] = $a->profile['uid'];
+       }
 
        if(remote_user()) {
                $contact_id = $_SESSION['visitor_id'];
@@ -90,22 +96,7 @@ function profile_content(&$a, $update = false) {
 
        if($update) {
                // Ensure we've got a profile owner if updating.
-               if(remote_user()) {
-                       $r = q("SELECT `uid` FROM `contact` WHERE `id` = %d LIMIT 1",
-                               intval($_SESSION['visitor_id'])
-                       );
-                       if(count($r))
-                               $a->profile['uid'] = $r[0]['uid'];
-                       else
-                               killme();
-               }
-               elseif(local_user()) {
-                       $a->profile['uid'] = $_SESSION['uid'];
-               }
-               else {
-                       killme();
-                       return; // NOTREACHED
-               }
+               $a->profile['profile_uid'] = $_SESSION['profile_uid'];
        }
 
        else {
@@ -115,7 +106,8 @@ function profile_content(&$a, $update = false) {
                $tpl = file_get_contents('view/profile_tabs.tpl');
 
                $o .= replace_macros($tpl,array(
-                       '$url' => $a->get_baseurl() . '/' . $a->cmd
+                       '$url' => $a->get_baseurl() . '/' . $a->cmd,
+                       '$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname']
                ));
 
 
@@ -219,6 +211,10 @@ function profile_content(&$a, $update = false) {
 
        $tpl = file_get_contents('view/wall_item.tpl');
 
+       if($update)
+               $return_url = $_SESSION['return_url'];
+       else
+               $return_url = $_SESSION['return_url'] = $a->cmd;
 
        if(count($r)) {
                foreach($r as $item) {
@@ -227,10 +223,6 @@ function profile_content(&$a, $update = false) {
                        
                        $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
                        
-                       if($update)
-                               $return_url = $_SESSION['return_url'];
-                       else
-                               $return_url = $_SESSION['return_url'] = $a->cmd;
 
 
                        if(can_write_wall($a,$a->profile['uid'])) {
@@ -282,6 +274,7 @@ function profile_content(&$a, $update = false) {
                                '$profile_url' => $profile_link,
                                '$name' => $profile_name,
                                '$thumb' => $profile_avatar,
+                               '$title' => $item['title'],
                                '$body' => bbcode($item['body']),
                                '$ago' => relative_date($item['created']),
                                '$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),