]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
Diabook threaded comments.
[friendica.git] / mod / photos.php
index 9a3a402a4b1a169aff24c0bd89934e338a4ffdb9..12ca99e60f25f76a0c1e5cbca30a52606c2cb2d2 100644 (file)
@@ -4,14 +4,18 @@ require_once('include/items.php');
 require_once('include/acl_selectors.php');
 require_once('include/bbcode.php');
 require_once('include/security.php');
+require_once('include/redir.php');
 
 
 function photos_init(&$a) {
 
+       if($a->argc > 1)
+               auto_redir($a, $a->argv[1]);
 
        if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
                return;
        }
+
        $o = '';
 
        if($a->argc > 1) {
@@ -23,6 +27,11 @@ function photos_init(&$a) {
                if(! count($r))
                        return;
 
+               $o .= '<div class="vcard">';
+               $o .= '<div class="fn">' . $a->data['user']['username'] . '</div>';
+               $o .= '<div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="' . $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg') . '" alt="' . $a->data['user']['username'] . '" /></div>';
+               $o .= '</div>';
+
                $a->data['user'] = $r[0];
 
                $sql_extra = permissions_sql($a->data['user']['uid']);
@@ -34,11 +43,6 @@ function photos_init(&$a) {
                if(count($albums)) {
                        $a->data['albums'] = $albums;
 
-                       $o .= '<div class="vcard">';
-                       $o .= '<div class="fn">' . $a->data['user']['username'] . '</div>';
-                       $o .= '<div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="' . $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg') . '" alt="' . $a->data['user']['username'] . '" /></div>';
-                       $o .= '</div>';
-
                        $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);     
 
                        if($albums_visible) {
@@ -599,7 +603,7 @@ function photos_post(&$a) {
                                        $arr['tag']           = $tagged[4];
                                        $arr['inform']        = $tagged[2];
                                        $arr['origin']        = 1;
-                                       $arr['body']          = '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]' . ' ' . t('was tagged in a') . ' ' . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('photo') . '[/url]' . ' ' . t('by') . ' ' . '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]' ;
+                                       $arr['body']          = sprintf( t('%1$s was tagged in %2$s by %3$s'), '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
                                        $arr['body'] .= "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
 
                                        $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
@@ -1402,7 +1406,8 @@ function photos_content(&$a) {
                                                        '$submit' => t('Submit'),
                                                        '$preview' => t('Preview'),
                                                        '$sourceapp' => t($a->sourcename),
-                                                       '$ww' => ''
+                                                       '$ww' => '',
+                                                       '$rand_num' => random_digits(12)
                                                ));
                                        }
                                }
@@ -1443,8 +1448,10 @@ function photos_content(&$a) {
                                                        '$myphoto' => $contact['thumb'],
                                                        '$comment' => t('Comment'),
                                                        '$submit' => t('Submit'),
+                                                       '$preview' => t('Preview'),
                                                        '$sourceapp' => t($a->sourcename),
-                                                       '$ww' => ''
+                                                       '$ww' => '',
+                                                       '$rand_num' => random_digits(12)
                                                ));
                                        }
                                }
@@ -1460,27 +1467,6 @@ function photos_content(&$a) {
 
                                        $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
                        
-                                       if($can_post || can_write_wall($a,$owner_uid)) {
-
-                                               if($item['last-child']) {
-                                                       $comments .= replace_macros($cmnt_tpl,array(
-                                                               '$return_path' => '',
-                                                               '$jsreload' => $return_url,
-                                                               '$type' => 'wall-comment',
-                                                               '$id' => $item['item_id'],
-                                                               '$parent' => $item['parent'],
-                                                               '$profile_uid' =>  $owner_uid,
-                                                               '$mylink' => $contact['url'],
-                                                               '$mytitle' => t('This is you'),
-                                                               '$myphoto' => $contact['thumb'],
-                                                               '$comment' => t('Comment'),
-                                                               '$submit' => t('Submit'),
-                                                               '$sourceapp' => t($a->sourcename),
-                                                               '$ww' => ''
-                                                       ));
-                                               }
-                                       }
-
 
                                        if(local_user() && ($item['contact-uid'] == local_user()) 
                                                && ($item['network'] == 'dfrn') && (! $item['self'] )) {
@@ -1518,6 +1504,29 @@ function photos_content(&$a) {
                                                '$drop' => $drop,
                                                '$comment' => $comment
                                        ));
+
+                                       if($can_post || can_write_wall($a,$owner_uid)) {
+
+                                               if($item['last-child']) {
+                                                       $comments .= replace_macros($cmnt_tpl,array(
+                                                               '$return_path' => '',
+                                                               '$jsreload' => $return_url,
+                                                               '$type' => 'wall-comment',
+                                                               '$id' => $item['item_id'],
+                                                               '$parent' => $item['parent'],
+                                                               '$profile_uid' =>  $owner_uid,
+                                                               '$mylink' => $contact['url'],
+                                                               '$mytitle' => t('This is you'),
+                                                               '$myphoto' => $contact['thumb'],
+                                                               '$comment' => t('Comment'),
+                                                               '$submit' => t('Submit'),
+                                                               '$preview' => t('Preview'),
+                                                               '$sourceapp' => t($a->sourcename),
+                                                               '$ww' => '',
+                                                               '$rand_num' => random_digits(12)
+                                                       ));
+                                               }
+                                       }
                                }
                        }