2022-11-20 22:15:07 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2023-01-01 14:36:24 +00:00
|
|
|
* @copyright Copyright (C) 2010-2023, the Friendica project
|
2022-11-20 22:15:07 +00:00
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-11-27 00:25:59 +00:00
|
|
|
namespace Friendica\Module\Profile;
|
2022-11-20 22:15:07 +00:00
|
|
|
|
|
|
|
use Friendica\App;
|
2022-11-23 19:08:58 +00:00
|
|
|
use Friendica\Content\Feature;
|
2022-11-20 22:15:07 +00:00
|
|
|
use Friendica\Content\Pager;
|
|
|
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
2022-11-23 19:08:58 +00:00
|
|
|
use Friendica\Core\Hook;
|
2022-11-20 22:15:07 +00:00
|
|
|
use Friendica\Core\L10n;
|
|
|
|
use Friendica\Core\Renderer;
|
|
|
|
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
2022-11-23 19:08:58 +00:00
|
|
|
use Friendica\Core\System;
|
2022-11-20 22:15:07 +00:00
|
|
|
use Friendica\Database\Database;
|
|
|
|
use Friendica\Model\Contact;
|
2022-11-23 19:08:58 +00:00
|
|
|
use Friendica\Model\Item;
|
2022-11-20 22:15:07 +00:00
|
|
|
use Friendica\Model\Photo;
|
|
|
|
use Friendica\Model\Profile;
|
|
|
|
use Friendica\Module\Response;
|
2022-11-23 19:08:58 +00:00
|
|
|
use Friendica\Navigation\SystemMessages;
|
2022-11-20 22:15:07 +00:00
|
|
|
use Friendica\Network\HTTPException;
|
2022-11-23 19:08:58 +00:00
|
|
|
use Friendica\Object\Image;
|
2022-11-20 22:15:07 +00:00
|
|
|
use Friendica\Security\Security;
|
2022-11-23 19:08:58 +00:00
|
|
|
use Friendica\Util\ACLFormatter;
|
|
|
|
use Friendica\Util\DateTimeFormat;
|
2022-11-20 22:15:07 +00:00
|
|
|
use Friendica\Util\Images;
|
|
|
|
use Friendica\Util\Profiler;
|
2022-11-23 19:08:58 +00:00
|
|
|
use Friendica\Util\Strings;
|
2022-11-20 22:15:07 +00:00
|
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
|
2022-11-27 00:25:59 +00:00
|
|
|
class Photos extends \Friendica\Module\BaseProfile
|
2022-11-20 22:15:07 +00:00
|
|
|
{
|
|
|
|
/** @var IHandleUserSessions */
|
|
|
|
private $session;
|
|
|
|
/** @var App\Page */
|
|
|
|
private $page;
|
|
|
|
/** @var IManageConfigValues */
|
|
|
|
private $config;
|
|
|
|
/** @var App */
|
|
|
|
private $app;
|
|
|
|
/** @var Database */
|
|
|
|
private $database;
|
2022-11-23 19:08:58 +00:00
|
|
|
/** @var SystemMessages */
|
|
|
|
private $systemMessages;
|
|
|
|
/** @var ACLFormatter */
|
|
|
|
private $aclFormatter;
|
|
|
|
/** @var array owner-view record */
|
|
|
|
private $owner;
|
2022-11-20 22:15:07 +00:00
|
|
|
|
2022-11-23 19:08:58 +00:00
|
|
|
public function __construct(ACLFormatter $aclFormatter, SystemMessages $systemMessages, Database $database, App $app, IManageConfigValues $config, App\Page $page, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
2022-11-20 22:15:07 +00:00
|
|
|
{
|
|
|
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
|
|
|
|
2022-11-23 19:08:58 +00:00
|
|
|
$this->session = $session;
|
|
|
|
$this->page = $page;
|
|
|
|
$this->config = $config;
|
|
|
|
$this->app = $app;
|
|
|
|
$this->database = $database;
|
|
|
|
$this->systemMessages = $systemMessages;
|
|
|
|
$this->aclFormatter = $aclFormatter;
|
|
|
|
|
2022-12-19 04:52:33 +00:00
|
|
|
$owner = Profile::load($this->app, $this->parameters['nickname'] ?? '', false);
|
2022-11-23 19:08:58 +00:00
|
|
|
if (!$owner || $owner['account_removed'] || $owner['account_expired']) {
|
|
|
|
throw new HTTPException\NotFoundException($this->t('User not found.'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->owner = $owner;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function post(array $request = [])
|
|
|
|
{
|
|
|
|
if ($this->session->getLocalUserId() != $this->owner['uid']) {
|
|
|
|
throw new HTTPException\ForbiddenException($this->t('Permission denied.'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$str_contact_allow = isset($request['contact_allow']) ? $this->aclFormatter->toString($request['contact_allow']) : $this->owner['allow_cid'] ?? '';
|
|
|
|
$str_group_allow = isset($request['group_allow']) ? $this->aclFormatter->toString($request['group_allow']) : $this->owner['allow_gid'] ?? '';
|
|
|
|
$str_contact_deny = isset($request['contact_deny']) ? $this->aclFormatter->toString($request['contact_deny']) : $this->owner['deny_cid'] ?? '';
|
|
|
|
$str_group_deny = isset($request['group_deny']) ? $this->aclFormatter->toString($request['group_deny']) : $this->owner['deny_gid'] ?? '';
|
|
|
|
|
|
|
|
$visibility = $request['visibility'] ?? '';
|
|
|
|
if ($visibility === 'public') {
|
|
|
|
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
|
|
|
|
$str_contact_allow = $str_group_allow = $str_contact_deny = $str_group_deny = '';
|
|
|
|
} else if ($visibility === 'custom') {
|
|
|
|
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
|
|
|
|
// case that would make it public. So we always append the author's contact id to the allowed contacts.
|
|
|
|
// See https://github.com/friendica/friendica/issues/9672
|
|
|
|
$str_contact_allow .= $this->aclFormatter->toString(Contact::getPublicIdByUserId($this->owner['uid']));
|
|
|
|
}
|
|
|
|
|
|
|
|
// default post action - upload a photo
|
|
|
|
Hook::callAll('photo_post_init', $request);
|
|
|
|
|
|
|
|
// Determine the album to use
|
|
|
|
$album = trim($request['album'] ?? '');
|
|
|
|
$newalbum = trim($request['newalbum'] ?? '');
|
|
|
|
|
|
|
|
$this->logger->debug('album= ' . $album . ' newalbum= ' . $newalbum);
|
|
|
|
|
|
|
|
$album = $album ?: $newalbum ?: DateTimeFormat::localNow('Y');
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We create a wall item for every photo, but we don't want to
|
|
|
|
* overwhelm the data stream with a hundred newly uploaded photos.
|
|
|
|
* So we will make the first photo uploaded to this album in the last several hours
|
|
|
|
* visible by default, the rest will become visible over time when and if
|
|
|
|
* they acquire comments, likes, dislikes, and/or tags
|
|
|
|
*/
|
|
|
|
|
|
|
|
$r = Photo::selectToArray([], ['`album` = ? AND `uid` = ? AND `created` > ?', $album, $this->owner['uid'], DateTimeFormat::utc('now - 3 hours')]);
|
|
|
|
if (!$r || ($album == $this->t(Photo::PROFILE_PHOTOS))) {
|
|
|
|
$visible = 1;
|
|
|
|
} else {
|
|
|
|
$visible = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($request['not_visible']) && $request['not_visible'] !== 'false') {
|
|
|
|
$visible = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''];
|
|
|
|
|
|
|
|
Hook::callAll('photo_post_file', $ret);
|
|
|
|
|
|
|
|
if (!empty($ret['src']) && !empty($ret['filesize'])) {
|
|
|
|
$src = $ret['src'];
|
|
|
|
$filename = $ret['filename'];
|
|
|
|
$filesize = $ret['filesize'];
|
|
|
|
$type = $ret['type'];
|
|
|
|
$error = UPLOAD_ERR_OK;
|
|
|
|
} elseif (!empty($_FILES['userfile'])) {
|
|
|
|
$src = $_FILES['userfile']['tmp_name'];
|
|
|
|
$filename = basename($_FILES['userfile']['name']);
|
|
|
|
$filesize = intval($_FILES['userfile']['size']);
|
|
|
|
$type = $_FILES['userfile']['type'];
|
|
|
|
$error = $_FILES['userfile']['error'];
|
|
|
|
} else {
|
|
|
|
$error = UPLOAD_ERR_NO_FILE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($error !== UPLOAD_ERR_OK) {
|
|
|
|
switch ($error) {
|
|
|
|
case UPLOAD_ERR_INI_SIZE:
|
|
|
|
$this->systemMessages->addNotice($this->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
|
|
|
|
break;
|
|
|
|
case UPLOAD_ERR_FORM_SIZE:
|
|
|
|
$this->systemMessages->addNotice($this->t('Image exceeds size limit of %s', Strings::formatBytes($request['MAX_FILE_SIZE'] ?? 0)));
|
|
|
|
break;
|
|
|
|
case UPLOAD_ERR_PARTIAL:
|
|
|
|
$this->systemMessages->addNotice($this->t('Image upload didn\'t complete, please try again'));
|
|
|
|
break;
|
|
|
|
case UPLOAD_ERR_NO_FILE:
|
|
|
|
$this->systemMessages->addNotice($this->t('Image file is missing'));
|
|
|
|
break;
|
|
|
|
case UPLOAD_ERR_NO_TMP_DIR:
|
|
|
|
case UPLOAD_ERR_CANT_WRITE:
|
|
|
|
case UPLOAD_ERR_EXTENSION:
|
|
|
|
$this->systemMessages->addNotice($this->t('Server can\'t accept new file upload at this time, please contact your administrator'));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
@unlink($src);
|
|
|
|
$foo = 0;
|
|
|
|
Hook::callAll('photo_post_end', $foo);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$type = Images::getMimeTypeBySource($src, $filename, $type);
|
|
|
|
|
|
|
|
$this->logger->info('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes');
|
|
|
|
|
|
|
|
$maximagesize = Strings::getBytesFromShorthand($this->config->get('system', 'maximagesize'));
|
|
|
|
|
|
|
|
if ($maximagesize && ($filesize > $maximagesize)) {
|
|
|
|
$this->systemMessages->addNotice($this->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
|
|
|
|
@unlink($src);
|
|
|
|
$foo = 0;
|
|
|
|
Hook::callAll('photo_post_end', $foo);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$filesize) {
|
|
|
|
$this->systemMessages->addNotice($this->t('Image file is empty.'));
|
|
|
|
@unlink($src);
|
|
|
|
$foo = 0;
|
|
|
|
Hook::callAll('photo_post_end', $foo);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->logger->debug('loading contents', ['src' => $src]);
|
|
|
|
|
|
|
|
$imagedata = @file_get_contents($src);
|
|
|
|
|
|
|
|
$image = new Image($imagedata, $type);
|
|
|
|
|
|
|
|
if (!$image->isValid()) {
|
|
|
|
$this->logger->notice('unable to process image');
|
|
|
|
$this->systemMessages->addNotice($this->t('Unable to process image.'));
|
|
|
|
@unlink($src);
|
|
|
|
$foo = 0;
|
|
|
|
Hook::callAll('photo_post_end',$foo);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$exif = $image->orient($src);
|
|
|
|
@unlink($src);
|
|
|
|
|
|
|
|
$max_length = $this->config->get('system', 'max_image_length');
|
|
|
|
if ($max_length > 0) {
|
|
|
|
$image->scaleDown($max_length);
|
|
|
|
}
|
|
|
|
|
|
|
|
$resource_id = Photo::newResource();
|
|
|
|
|
2023-05-09 06:32:16 +00:00
|
|
|
$preview = Photo::storeWithPreview($image, $this->owner['uid'], $resource_id, $filename, $filesize, $album, '', $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
|
|
|
|
if ($preview < 0) {
|
2022-11-23 19:08:58 +00:00
|
|
|
$this->logger->warning('image store failed');
|
|
|
|
$this->systemMessages->addNotice($this->t('Image upload failed.'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$uri = Item::newURI();
|
|
|
|
|
|
|
|
// Create item container
|
|
|
|
$lat = $lon = null;
|
|
|
|
if (!empty($exif['GPS']) && Feature::isEnabled($this->owner['uid'], 'photo_location')) {
|
|
|
|
$lat = Photo::getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']);
|
|
|
|
$lon = Photo::getGps($exif['GPS']['GPSLongitude'], $exif['GPS']['GPSLongitudeRef']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$arr = [];
|
|
|
|
if ($lat && $lon) {
|
|
|
|
$arr['coord'] = $lat . ' ' . $lon;
|
|
|
|
}
|
|
|
|
|
|
|
|
$arr['guid'] = System::createUUID();
|
|
|
|
$arr['uid'] = $this->owner['uid'];
|
|
|
|
$arr['uri'] = $uri;
|
|
|
|
$arr['post-type'] = Item::PT_IMAGE;
|
|
|
|
$arr['wall'] = 1;
|
|
|
|
$arr['resource-id'] = $resource_id;
|
|
|
|
$arr['contact-id'] = $this->owner['id'];
|
|
|
|
$arr['owner-name'] = $this->owner['name'];
|
|
|
|
$arr['owner-link'] = $this->owner['url'];
|
|
|
|
$arr['owner-avatar'] = $this->owner['thumb'];
|
|
|
|
$arr['author-name'] = $this->owner['name'];
|
|
|
|
$arr['author-link'] = $this->owner['url'];
|
|
|
|
$arr['author-avatar'] = $this->owner['thumb'];
|
|
|
|
$arr['title'] = '';
|
|
|
|
$arr['allow_cid'] = $str_contact_allow;
|
|
|
|
$arr['allow_gid'] = $str_group_allow;
|
|
|
|
$arr['deny_cid'] = $str_contact_deny;
|
|
|
|
$arr['deny_gid'] = $str_group_deny;
|
|
|
|
$arr['visible'] = $visible;
|
|
|
|
$arr['origin'] = 1;
|
|
|
|
|
2023-05-09 20:44:58 +00:00
|
|
|
$arr['body'] = Images::getImageUrl($resource_id, $this->owner['nickname'], $preview, $image->getExt(), '');
|
2022-11-23 19:08:58 +00:00
|
|
|
|
|
|
|
$item_id = Item::insert($arr);
|
|
|
|
// Update the photo albums cache
|
|
|
|
Photo::clearAlbumCache($this->owner['uid']);
|
|
|
|
|
|
|
|
Hook::callAll('photo_post_end', $item_id);
|
|
|
|
|
|
|
|
// addon uploaders should call "exit()" within the photo_post_end hook
|
|
|
|
// if they do not wish to be redirected
|
|
|
|
|
|
|
|
$this->baseUrl->redirect($this->session->get('photo_return') ?? 'profile/' . $this->owner['nickname'] . '/photos');
|
2022-11-20 22:15:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function content(array $request = []): string
|
|
|
|
{
|
|
|
|
parent::content($request);
|
|
|
|
|
|
|
|
if ($this->config->get('system', 'block_public') && !$this->session->isAuthenticated()) {
|
|
|
|
throw new HttpException\ForbiddenException($this->t('Public access denied.'));
|
|
|
|
}
|
|
|
|
|
2022-11-23 19:08:58 +00:00
|
|
|
$owner_uid = $this->owner['uid'];
|
|
|
|
$is_owner = $this->session->getLocalUserId() == $owner_uid;
|
2022-11-20 22:15:07 +00:00
|
|
|
|
2022-11-23 19:08:58 +00:00
|
|
|
if ($this->owner['hidewall'] && !$this->session->isAuthenticated()) {
|
2022-12-19 04:52:33 +00:00
|
|
|
$this->baseUrl->redirect('profile/' . $this->owner['nickname'] . '/restricted');
|
2022-11-20 22:15:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->session->set('photo_return', $this->args->getCommand());
|
|
|
|
|
|
|
|
$sql_extra = Security::getPermissionsSQLByUserId($owner_uid);
|
|
|
|
|
|
|
|
$photo = $this->database->toArray($this->database->p(
|
|
|
|
"SELECT COUNT(DISTINCT `resource-id`) AS `count`
|
|
|
|
FROM `photo`
|
|
|
|
WHERE `uid` = ?
|
|
|
|
AND `photo-type` = ?
|
|
|
|
$sql_extra",
|
2022-11-23 19:08:58 +00:00
|
|
|
$this->owner['uid'],
|
2022-11-20 22:15:07 +00:00
|
|
|
Photo::DEFAULT,
|
|
|
|
));
|
|
|
|
$total = $photo[0]['count'];
|
|
|
|
|
|
|
|
$pager = new Pager($this->l10n, $this->args->getQueryString(), 20);
|
|
|
|
|
|
|
|
$photos = $this->database->toArray($this->database->p(
|
|
|
|
"SELECT
|
|
|
|
`resource-id`,
|
|
|
|
ANY_VALUE(`id`) AS `id`,
|
|
|
|
ANY_VALUE(`filename`) AS `filename`,
|
|
|
|
ANY_VALUE(`type`) AS `type`,
|
|
|
|
ANY_VALUE(`album`) AS `album`,
|
|
|
|
max(`scale`) AS `scale`,
|
|
|
|
ANY_VALUE(`created`) AS `created`
|
|
|
|
FROM `photo`
|
|
|
|
WHERE `uid` = ?
|
|
|
|
AND `photo-type` = ?
|
|
|
|
$sql_extra
|
|
|
|
GROUP BY `resource-id`
|
|
|
|
ORDER BY `created` DESC
|
2023-05-09 05:34:56 +00:00
|
|
|
LIMIT ? , ?",
|
2022-11-23 19:08:58 +00:00
|
|
|
$this->owner['uid'],
|
2022-11-20 22:15:07 +00:00
|
|
|
Photo::DEFAULT,
|
|
|
|
$pager->getStart(),
|
|
|
|
$pager->getItemsPerPage()
|
|
|
|
));
|
|
|
|
|
|
|
|
$phototypes = Images::supportedTypes();
|
|
|
|
|
2022-11-23 19:08:58 +00:00
|
|
|
$photos = array_map(function ($photo) use ($phototypes) {
|
2022-11-20 22:15:07 +00:00
|
|
|
return [
|
|
|
|
'id' => $photo['id'],
|
2022-11-23 19:08:58 +00:00
|
|
|
'link' => 'photos/' . $this->owner['nickname'] . '/image/' . $photo['resource-id'],
|
2022-11-20 22:15:07 +00:00
|
|
|
'title' => $this->t('View Photo'),
|
|
|
|
'src' => 'photo/' . $photo['resource-id'] . '-' . ((($photo['scale']) == 6) ? 4 : $photo['scale']) . '.' . $phototypes[$photo['type']],
|
|
|
|
'alt' => $photo['filename'],
|
|
|
|
'album' => [
|
2022-11-23 19:08:58 +00:00
|
|
|
'link' => 'photos/' . $this->owner['nickname'] . '/album/' . bin2hex($photo['album']),
|
2022-11-20 22:15:07 +00:00
|
|
|
'name' => $photo['album'],
|
|
|
|
'alt' => $this->t('View Album'),
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}, $photos);
|
|
|
|
|
|
|
|
$tpl = Renderer::getMarkupTemplate('photos_head.tpl');
|
|
|
|
$this->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
|
|
|
'$ispublic' => $this->t('everybody')
|
|
|
|
]);
|
|
|
|
|
2022-11-23 19:08:58 +00:00
|
|
|
if ($albums = Photo::getAlbums($this->owner['uid'])) {
|
|
|
|
$albums = array_map(function ($album) {
|
2022-11-20 22:15:07 +00:00
|
|
|
return [
|
|
|
|
'text' => $album['album'],
|
|
|
|
'total' => $album['total'],
|
2022-11-23 19:08:58 +00:00
|
|
|
'url' => 'photos/' . $this->owner['nickname'] . '/album/' . bin2hex($album['album']),
|
2022-11-20 22:15:07 +00:00
|
|
|
'urlencode' => urlencode($album['album']),
|
|
|
|
'bin2hex' => bin2hex($album['album'])
|
|
|
|
];
|
|
|
|
}, $albums);
|
|
|
|
|
|
|
|
$photo_albums_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('photo_albums.tpl'), [
|
2022-11-23 19:08:58 +00:00
|
|
|
'$nick' => $this->owner['nickname'],
|
2022-11-20 22:15:07 +00:00
|
|
|
'$title' => $this->t('Photo Albums'),
|
|
|
|
'$recent' => $this->t('Recent Photos'),
|
|
|
|
'$albums' => $albums,
|
2022-11-23 19:08:58 +00:00
|
|
|
'$upload' => [$this->t('Upload New Photos'), 'photos/' . $this->owner['nickname'] . '/upload'],
|
|
|
|
'$can_post' => $this->session->getLocalUserId() && $this->owner['uid'] == $this->session->getLocalUserId(),
|
2022-11-20 22:15:07 +00:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2022-12-19 04:52:33 +00:00
|
|
|
// Removing vCard for owner
|
|
|
|
if ($is_owner) {
|
|
|
|
$this->page['aside'] = '';
|
|
|
|
}
|
|
|
|
|
2022-11-20 22:15:07 +00:00
|
|
|
if (!empty($photo_albums_widget)) {
|
|
|
|
$this->page['aside'] .= $photo_albums_widget;
|
|
|
|
}
|
|
|
|
|
2022-11-23 19:08:58 +00:00
|
|
|
$o = self::getTabsHTML('photos', $is_owner, $this->owner['nickname'], Profile::getByUID($this->owner['uid'])['hide-friends'] ?? false);
|
2022-11-20 22:15:07 +00:00
|
|
|
|
|
|
|
$tpl = Renderer::getMarkupTemplate('photos_recent.tpl');
|
|
|
|
$o .= Renderer::replaceMacros($tpl, [
|
|
|
|
'$title' => $this->t('Recent Photos'),
|
2022-11-23 19:08:58 +00:00
|
|
|
'$can_post' => $is_owner,
|
|
|
|
'$upload' => [$this->t('Upload New Photos'), 'photos/' . $this->owner['nickname'] . '/upload'],
|
2022-11-20 22:15:07 +00:00
|
|
|
'$photos' => $photos,
|
|
|
|
'$paginate' => $pager->renderFull($total),
|
|
|
|
]);
|
|
|
|
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
}
|