X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fphotos.php;h=3d3b92a46d9a8b7861c54f5a3e44c3b78434e5f0;hb=5f89cb09234bc79aab2be93778609b344239c3da;hp=3ed8e9984c315f0e20deb4a42ff5b04fcb637db4;hpb=17514e0d684edccb41d16a452bf60debdc276fab;p=friendica.git diff --git a/mod/photos.php b/mod/photos.php index 3ed8e9984c..3d3b92a46d 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -29,71 +29,72 @@ function photos_init(&$a) { return; $a->data['user'] = $r[0]; + $a->profile_uid = $r[0]['uid']; - $profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg'); + $profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg'); - $tpl = get_markup_template("vcard-widget.tpl"); + $tpl = get_markup_template("vcard-widget.tpl"); $vcard_widget .= replace_macros($tpl, array( - '$name' => $a->data['user']['username'], - '$photo' => $profilephoto - )); + '$name' => $a->data['user']['username'], + '$photo' => $profilephoto + )); $sql_extra = permissions_sql($a->data['user']['uid']); $albums = q("SELECT count(distinct `resource-id`) AS `total`, `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' - $sql_extra group by album order by created desc", + $sql_extra group by album order by created desc", intval($a->data['user']['uid']), - dbesc('Contact Photos'), - dbesc( t('Contact Photos')) + dbesc('Contact Photos'), + dbesc( t('Contact Photos')) ); - $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true); - - // add various encodings to the array so we can just loop through and pick them out in a template - $ret = array('success' => false); - - if($albums) { - $a->data['albums'] = $albums; - if ($albums_visible) - $ret['success'] = true; - - $ret['albums'] = array(); - foreach($albums as $k => $album) { - $entry = array( - 'text' => $album['album'], - 'total' => $album['total'], - 'url' => z_root() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album['album']), - 'urlencode' => urlencode($album['album']), - 'bin2hex' => bin2hex($album['album']) - ); - $ret['albums'][] = $entry; - } - } - - $albums = $ret; - - if(local_user() && $a->data['user']['uid'] == local_user()) - $can_post = true; - - if($albums['success']) { - $photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'),array( - '$nick' => $a->data['user']['nickname'], - '$title' => t('Photo Albums'), - 'recent' => t('Recent Photos'), - '$albums' => $albums['albums'], - '$baseurl' => z_root(), - '$upload' => array( t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload'), - '$can_post' => $can_post - )); - } + $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true); + + // add various encodings to the array so we can just loop through and pick them out in a template + $ret = array('success' => false); + + if($albums) { + $a->data['albums'] = $albums; + if ($albums_visible) + $ret['success'] = true; + + $ret['albums'] = array(); + foreach($albums as $k => $album) { + $entry = array( + 'text' => $album['album'], + 'total' => $album['total'], + 'url' => z_root() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album['album']), + 'urlencode' => urlencode($album['album']), + 'bin2hex' => bin2hex($album['album']) + ); + $ret['albums'][] = $entry; + } + } + + $albums = $ret; + + if(local_user() && $a->data['user']['uid'] == local_user()) + $can_post = true; + + if($albums['success']) { + $photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'),array( + '$nick' => $a->data['user']['nickname'], + '$title' => t('Photo Albums'), + 'recent' => t('Recent Photos'), + '$albums' => $albums['albums'], + '$baseurl' => z_root(), + '$upload' => array( t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload'), + '$can_post' => $can_post + )); + } if(! x($a->page,'aside')) $a->page['aside'] = ''; - $a->page['aside'] .= $vcard_widget; - $a->page['aside'] .= $photo_albums_widget; + $a->page['aside'] .= $vcard_widget; + $a->page['aside'] .= $photo_albums_widget; $tpl = get_markup_template("photos_head.tpl"); @@ -1089,8 +1090,6 @@ function photos_content(&$a) { } } - $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $uploader = ''; $ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'], @@ -1139,11 +1138,11 @@ function photos_content(&$a) { if($a->theme['template_engine'] === 'internal') { $albumselect_e = template_escape($albumselect); - $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb))); + $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user))); } else { $albumselect_e = $albumselect; - $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb)); + $aclselect_e = (($visitor) ? '' : populate_acl($a->user)); } $o .= replace_macros($tpl,array(