if (DI::args()->getArgc() > 1) {
$owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
- if (empty($owner) || $owner['account_removed']) {
+ if (!isset($owner['account_removed']) || $owner['account_removed']) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
}
if (DI::args()->getArgc() > 3 && DI::args()->getArgv()[2] === 'album') {
- if (!Strings::isHex(DI::args()->getArgv()[3])) {
+ if (!Strings::isHex(DI::args()->getArgv()[3] ?? '')) {
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
}
$album = hex2bin(DI::args()->getArgv()[3]);
if ($albname !== $origaname) {
Photo::clearAlbumCache($page_owner_uid);
}
- /* Don't make the item visible if the only change was the album name */
-
- $visibility = 0;
- if ($photo['desc'] !== $desc || strlen($rawtags)) {
- $visibility = 1;
- }
}
if (DBA::isResult($photos) && !$item_id) {
// Create item container
$title = '';
- $uri = Item::newURI($page_owner_uid);
+ $uri = Item::newURI();
$arr = [];
$arr['guid'] = System::createUUID();
$arr['allow_gid'] = $photo['allow_gid'];
$arr['deny_cid'] = $photo['deny_cid'];
$arr['deny_gid'] = $photo['deny_gid'];
- $arr['visible'] = $visibility;
+ $arr['visible'] = 0;
$arr['origin'] = 1;
$arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $user['nickname'] . '/image/' . $photo['resource-id'] . ']'
if (count($taginfo)) {
foreach ($taginfo as $tagged) {
- $uri = Item::newURI($page_owner_uid);
+ $uri = Item::newURI();
$arr = [];
$arr['guid'] = System::createUUID();
$arr['allow_gid'] = $photo['allow_gid'];
$arr['deny_cid'] = $photo['deny_cid'];
$arr['deny_gid'] = $photo['deny_gid'];
- $arr['visible'] = 1;
+ $arr['visible'] = 0;
$arr['verb'] = Activity::TAG;
$arr['gravity'] = GRAVITY_PARENT;
$arr['object-type'] = Activity\ObjectType::PERSON;
$smallest = 2;
}
- $uri = Item::newURI($page_owner_uid);
+ $uri = Item::newURI();
// Create item container
$lat = $lon = null;
return;
}
- $selname = Strings::isHex($datum) ? hex2bin($datum) : '';
+ $selname = (!is_null($datum) && Strings::isHex($datum)) ? hex2bin($datum) : '';
$albumselect = '';
// Display a single photo album
if ($datatype === 'album') {
// if $datum is not a valid hex, redirect to the default page
- if (!Strings::isHex($datum)) {
+ if (is_null($datum) || !Strings::isHex($datum)) {
DI::baseUrl()->redirect('photos/' . $user['nickname']. '/album');
}
$album = hex2bin($datum);
/// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
$order_field = $_GET['order'] ?? '';
- if ($order_field === 'posted') {
+ if ($order_field === 'created') {
$order = 'ASC';
} else {
$order = 'DESC';
$drop = [DI::l10n()->t('Drop Album'), 'photos/' . $user['nickname'] . '/album/' . bin2hex($album) . '/drop'];
}
- if ($order_field === 'posted') {
+ if ($order_field === 'created') {
$order = [DI::l10n()->t('Show Newest First'), 'photos/' . $user['nickname'] . '/album/' . bin2hex($album), 'oldest'];
} else {
- $order = [DI::l10n()->t('Show Oldest First'), 'photos/' . $user['nickname'] . '/album/' . bin2hex($album) . '?order=posted', 'newest'];
+ $order = [DI::l10n()->t('Show Oldest First'), 'photos/' . $user['nickname'] . '/album/' . bin2hex($album) . '?order=created', 'newest'];
}
$photos = [];
'id' => $rr['id'],
'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
'link' => 'photos/' . $user['nickname'] . '/image/' . $rr['resource-id']
- . ($order_field === 'posted' ? '?order=posted' : ''),
+ . ($order_field === 'created' ? '?order=created' : ''),
'title' => DI::l10n()->t('View Photo'),
'src' => 'photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
'alt' => $imgalt_e,
if ($cmd === 'view' && !DI::config()->get('system', 'no_count', false)) {
$order_field = $_GET['order'] ?? '';
- if ($order_field === 'posted') {
+ if ($order_field === 'created') {
$params = ['order' => [$order_field]];
} elseif (!empty($order_field)) {
$params = ['order' => [$order_field => true]];
}
if (!is_null($prv)) {
- $prevlink = 'photos/' . $user['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . ($order_field === 'posted' ? '?order=posted' : '');
+ $prevlink = 'photos/' . $user['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . ($order_field === 'created' ? '?order=created' : '');
}
if (!is_null($nxt)) {
- $nextlink = 'photos/' . $user['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . ($order_field === 'posted' ? '?order=posted' : '');
+ $nextlink = 'photos/' . $user['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . ($order_field === 'created' ? '?order=created' : '');
}
$tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl');