throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
- $is_owner = (local_user() && (local_user() == $owner['uid']));
+ $is_owner = (Session::getLocalUser() && (Session::getLocalUser() == $owner['uid']));
$albums = Photo::getAlbums($owner['uid']);
}
}
- if (local_user() && $owner['uid'] == local_user()) {
+ if (Session::getLocalUser() && $owner['uid'] == Session::getLocalUser()) {
$can_post = true;
} else {
$can_post = false;
$page_owner_uid = intval($user['uid']);
$community_page = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
- if (local_user() && (local_user() == $page_owner_uid)) {
+ if (Session::getLocalUser() && (Session::getLocalUser() == $page_owner_uid)) {
$can_post = true;
} elseif ($community_page && !empty(Session::getRemoteContactID($page_owner_uid))) {
$contact_id = Session::getRemoteContactID($page_owner_uid);
}
if (!$can_post) {
- notice(DI::l10n()->t('Permission denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
System::exit();
}
$owner_record = User::getOwnerDataById($page_owner_uid);
if (!$owner_record) {
- notice(DI::l10n()->t('Contact information unavailable'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Contact information unavailable'));
DI::logger()->info('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
System::exit();
}
$album = hex2bin(DI::args()->getArgv()[3]);
if (!DBA::exists('photo', ['album' => $album, 'uid' => $page_owner_uid, 'photo-type' => Photo::DEFAULT])) {
- notice(DI::l10n()->t('Album not found.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Album not found.'));
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
return; // NOTREACHED
}
));
} else {
$r = DBA::toArray(DBA::p("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `uid` = ? AND `album` = ?",
- local_user(),
+ Session::getLocalUser(),
$album
));
}
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
- notice(DI::l10n()->t('Album successfully deleted'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Album successfully deleted'));
} else {
- notice(DI::l10n()->t('Album was empty.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Album was empty.'));
}
}
$condition = ['contact-id' => $visitor, 'uid' => $page_owner_uid, 'resource-id' => DI::args()->getArgv()[3]];
} else {
- $condition = ['uid' => local_user(), 'resource-id' => DI::args()->getArgv()[3]];
+ $condition = ['uid' => Session::getLocalUser(), 'resource-id' => DI::args()->getArgv()[3]];
}
$photo = DBA::selectFirst('photo', ['resource-id'], $condition);
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
} else {
- notice(DI::l10n()->t('Failed to delete the photo.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Failed to delete the photo.'));
DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]);
}
if ($error !== UPLOAD_ERR_OK) {
switch ($error) {
case UPLOAD_ERR_INI_SIZE:
- notice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
break;
case UPLOAD_ERR_FORM_SIZE:
- notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
break;
case UPLOAD_ERR_PARTIAL:
- notice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
break;
case UPLOAD_ERR_NO_FILE:
- notice(DI::l10n()->t('Image file is missing'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Image file is missing'));
break;
case UPLOAD_ERR_NO_TMP_DIR:
case UPLOAD_ERR_CANT_WRITE:
case UPLOAD_ERR_EXTENSION:
- notice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
break;
}
@unlink($src);
$maximagesize = DI::config()->get('system', 'maximagesize');
if ($maximagesize && ($filesize > $maximagesize)) {
- notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
@unlink($src);
$foo = 0;
Hook::callAll('photo_post_end', $foo);
}
if (!$filesize) {
- notice(DI::l10n()->t('Image file is empty.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Image file is empty.'));
@unlink($src);
$foo = 0;
Hook::callAll('photo_post_end', $foo);
if (!$image->isValid()) {
Logger::notice('unable to process image');
- notice(DI::l10n()->t('Unable to process image.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image.'));
@unlink($src);
$foo = 0;
Hook::callAll('photo_post_end',$foo);
if (!$r) {
Logger::warning('image store failed');
- notice(DI::l10n()->t('Image upload failed.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Image upload failed.'));
return;
}
}
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
- notice(DI::l10n()->t('Public access denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Public access denied.'));
return;
}
if (empty($user)) {
- notice(DI::l10n()->t('No photos selected'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('No photos selected'));
return;
}
$community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
- if (local_user() && (local_user() == $owner_uid)) {
+ if (Session::getLocalUser() && (Session::getLocalUser() == $owner_uid)) {
$can_post = true;
} elseif ($community_page && !empty(Session::getRemoteContactID($owner_uid))) {
$contact_id = Session::getRemoteContactID($owner_uid);
$remote_contact = DBA::isResult($contact);
}
- if (!$remote_contact && local_user()) {
+ if (!$remote_contact && Session::getLocalUser()) {
$contact_id = $_SESSION['cid'];
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $owner_uid, 'blocked' => false, 'pending' => false]);
}
- if ($user['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
- notice(DI::l10n()->t('Access to this item is restricted.'));
+ if ($user['hidewall'] && (Session::getLocalUser() != $owner_uid) && !$remote_contact) {
+ DI::sysmsg()->addNotice(DI::l10n()->t('Access to this item is restricted.'));
return;
}
$o = "";
// tabs
- $is_owner = (local_user() && (local_user() == $owner_uid));
+ $is_owner = (Session::getLocalUser() && (Session::getLocalUser() == $owner_uid));
$o .= BaseProfile::getTabsHTML($a, 'photos', $is_owner, $user['nickname'], $profile['hide-friends']);
// Display upload form
if ($datatype === 'upload') {
if (!$can_post) {
- notice(DI::l10n()->t('Permission denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
if (!DBA::isResult($ph)) {
if (DBA::exists('photo', ['resource-id' => $datum, 'uid' => $owner_uid])) {
- notice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
} else {
- notice(DI::l10n()->t('Photo not available'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Photo not available'));
}
return;
}
}
if (
- $ph[0]['uid'] == local_user()
+ $ph[0]['uid'] == Session::getLocalUser()
&& (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid']) || strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid']))
) {
$tools['lock'] = DI::l10n()->t('Private Photo');
$params = ['order' => ['id'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
$items = Post::toArray(Post::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params));
- if (local_user() == $link_item['uid']) {
+ if (Session::getLocalUser() == $link_item['uid']) {
Item::update(['unseen' => false], ['parent' => $link_item['parent']]);
}
}
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
- $words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
+ $words = DI::pConfig()->get(Session::getLocalUser(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
'attendmaybe' => []
];
- if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
+ if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'hide_dislike')) {
unset($conv_responses['dislike']);
}
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
- $words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
+ $words = DI::pConfig()->get(Session::getLocalUser(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
$sparkle = '';
}
- $dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == local_user()));
+ $dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == Session::getLocalUser()));
$drop = [
'dropping' => $dropping,
'pagedrop' => false,
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
- $words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
+ $words = DI::pConfig()->get(Session::getLocalUser(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
'$dislike' => DI::l10n()->t('Dislike'),
'$wait' => DI::l10n()->t('Please wait'),
'$dislike_title' => DI::l10n()->t('I don\'t like this (toggle)'),
- '$hide_dislike' => DI::pConfig()->get(local_user(), 'system', 'hide_dislike'),
+ '$hide_dislike' => DI::pConfig()->get(Session::getLocalUser(), 'system', 'hide_dislike'),
'$responses' => $responses,
'$return_path' => DI::args()->getQueryString(),
]);