Merge pull request #12081 from MrPetovan/task/4090-move-mod-wall_upload

Move mod/wall_upload.php to src/Module
This commit is contained in:
Philipp 2022-10-31 07:43:05 +01:00 committed by GitHub
commit 6bf65eb515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 354 additions and 370 deletions

View File

@ -1,300 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2022, the Friendica project
*
* @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/>.
*
* Module for uploading a picture to the profile wall
*
* By default the picture will be stored in the photo album with the name Wall Photos.
* You can specify a different album by adding an optional query string "album="
* to the url
*
*/
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Photo;
use Friendica\Model\User;
use Friendica\Module\BaseApi;
use Friendica\Object\Image;
use Friendica\Util\Images;
use Friendica\Util\Strings;
function wall_upload_post(App $a, $desktopmode = true)
{
Logger::info('wall upload: starting new upload');
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
$album = trim($_GET['album'] ?? '');
if (DI::args()->getArgc() > 1) {
if (empty($_FILES['media'])) {
$nick = DI::args()->getArgv()[1];
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $nick, 'blocked' => false]);
if (!DBA::isResult($user)) {
Logger::warning('wall upload: user instance is not valid', ['user' => $user, 'nickname' => $nick]);
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
return;
}
} else {
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['uid' => BaseApi::getCurrentUserID(), 'blocked' => false]);
}
} else {
Logger:warning('Argument count is zero or one (invalid)');
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
return;
}
/*
* Setup permissions structures
*/
$can_post = false;
$visitor = 0;
$page_owner_uid = $user['uid'];
$default_cid = $user['id'];
$page_owner_nick = $user['nickname'];
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
if ((DI::userSession()->getLocalUserId()) && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
$can_post = true;
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
$visitor = $contact_id;
}
if (!$can_post) {
Logger::warning('No permission to upload files', ['contact_id' => $contact_id, 'page_owner_uid' => $page_owner_uid]);
$msg = DI::l10n()->t('Permission denied.');
if ($isJson) {
System::jsonExit(['error' => $msg]);
}
DI::sysmsg()->addNotice($msg);
System::exit();
}
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
Logger::warning('Empty "userfile" and "media" field');
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
System::exit();
}
$src = '';
$filename = '';
$filesize = 0;
$filetype = '';
if (!empty($_FILES['userfile'])) {
$src = $_FILES['userfile']['tmp_name'];
$filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type'];
} elseif (!empty($_FILES['media'])) {
if (!empty($_FILES['media']['tmp_name'])) {
if (is_array($_FILES['media']['tmp_name'])) {
$src = $_FILES['media']['tmp_name'][0];
} else {
$src = $_FILES['media']['tmp_name'];
}
}
if (!empty($_FILES['media']['name'])) {
if (is_array($_FILES['media']['name'])) {
$filename = basename($_FILES['media']['name'][0]);
} else {
$filename = basename($_FILES['media']['name']);
}
}
if (!empty($_FILES['media']['size'])) {
if (is_array($_FILES['media']['size'])) {
$filesize = intval($_FILES['media']['size'][0]);
} else {
$filesize = intval($_FILES['media']['size']);
}
}
if (!empty($_FILES['media']['type'])) {
if (is_array($_FILES['media']['type'])) {
$filetype = $_FILES['media']['type'][0];
} else {
$filetype = $_FILES['media']['type'];
}
}
}
if ($src == '') {
Logger::warning('File source (temporary file) cannot be determined');
$msg = DI::l10n()->t('Invalid request.');
if ($isJson) {
System::jsonExit(['error' => $msg]);
}
DI::sysmsg()->addNotice($msg);
System::exit();
}
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
Logger::info('File upload:', [
'src' => $src,
'filename' => $filename,
'filesize' => $filesize,
'filetype' => $filetype,
]);
$imagedata = @file_get_contents($src);
$image = new Image($imagedata, $filetype);
if (!$image->isValid()) {
$msg = DI::l10n()->t('Unable to process image.');
Logger::warning($msg, ['imagedata[]' => gettype($imagedata), 'filetype' => $filetype]);
@unlink($src);
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
echo $msg . '<br />';
}
System::exit();
}
$image->orient($src);
@unlink($src);
$max_length = DI::config()->get('system', 'max_image_length');
if ($max_length > 0) {
$image->scaleDown($max_length);
$filesize = strlen($image->asString());
Logger::info('File upload: Scaling picture to new size', ['max_length' => $max_length]);
}
$width = $image->getWidth();
$height = $image->getHeight();
$maximagesize = DI::config()->get('system', 'maximagesize');
if (!empty($maximagesize) && ($filesize > $maximagesize)) {
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore
foreach ([5120, 2560, 1280, 640] as $pixels) {
if (($filesize > $maximagesize) && (max($width, $height) > $pixels)) {
Logger::info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
$image->scaleDown($pixels);
$filesize = strlen($image->asString());
$width = $image->getWidth();
$height = $image->getHeight();
}
}
if ($filesize > $maximagesize) {
Logger::notice('Image size is too big', ['size' => $filesize, 'max' => $maximagesize]);
$msg = DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize));
@unlink($src);
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
echo $msg . '<br />';
}
System::exit();
}
}
$resource_id = Photo::newResource();
$smallest = 0;
// If we don't have an album name use the Wall Photos album
if (!strlen($album)) {
$album = DI::l10n()->t('Wall Photos');
}
$defperm = '<' . $default_cid . '>';
$r = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 0, Photo::DEFAULT, $defperm);
if (!$r) {
$msg = DI::l10n()->t('Image upload failed.');
Logger::warning('Photo::store() failed', ['r' => $r]);
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
echo $msg . '<br />';
}
System::exit();
}
if ($width > 640 || $height > 640) {
$image->scaleDown(640);
$r = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 1, Photo::DEFAULT, $defperm);
if ($r) {
$smallest = 1;
}
}
if ($width > 320 || $height > 320) {
$image->scaleDown(320);
$r = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 2, Photo::DEFAULT, $defperm);
if ($r && ($smallest == 0)) {
$smallest = 2;
}
}
if (!$desktopmode) {
$photo = Photo::selectFirst(['id', 'datasize', 'width', 'height', 'type'], ['resource-id' => $resource_id], ['order' => ['width']]);
if (!$photo) {
Logger::warning('Cannot find photo in database', ['resource-id' => $resource_id]);
if ($isJson) {
System::jsonExit(['error' => 'Cannot find photo']);
}
return false;
}
$picture = [
'id' => $photo['id'],
'size' => $photo['datasize'],
'width' => $photo['width'],
'height' => $photo['height'],
'type' => $photo['type'],
'albumpage' => DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id,
'picture' => DI::baseUrl() . "/photo/{$resource_id}-0." . $image->getExt(),
'preview' => DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $image->getExt(),
];
if ($isJson) {
System::jsonExit(['picture' => $picture]);
}
Logger::info('upload done');
return $picture;
}
Logger::info('upload done');
if ($isJson) {
System::jsonExit(['ok' => true]);
}
echo "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id . '][img]' . DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $image->getExt() . "[/img][/url]\n\n";
System::exit();
// NOTREACHED
}

View File

@ -0,0 +1,279 @@
<?php
/**
* @copyright Copyright (C) 2010-2022, the Friendica project
*
* @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/>.
*
*/
namespace Friendica\Module\Profile\Photos;
use Friendica\App;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Database\Database;
use Friendica\Model\Photo;
use Friendica\Model\User;
use Friendica\Module\BaseApi;
use Friendica\Module\Response;
use Friendica\Navigation\SystemMessages;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Object\Image;
use Friendica\Util\Images;
use Friendica\Util\Profiler;
use Friendica\Util\Strings;
use Psr\Log\LoggerInterface;
/**
* Asynchronous photo upload module
*
* Only used as the target action of the AjaxUpload Javascript library
*/
class Upload extends \Friendica\BaseModule
{
/** @var Database */
private $database;
/** @var IHandleUserSessions */
private $userSession;
/** @var SystemMessages */
private $systemMessages;
/** @var IManageConfigValues */
private $config;
/** @var bool */
private $isJson = false;
public function __construct(IManageConfigValues $config, SystemMessages $systemMessages, IHandleUserSessions $userSession, Database $database, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->database = $database;
$this->userSession = $userSession;
$this->systemMessages = $systemMessages;
$this->config = $config;
}
protected function post(array $request = [])
{
$this->isJson = !empty($request['response']) && $request['response'] == 'json';
$album = trim($request['album'] ?? '');
if (empty($_FILES['media'])) {
$user = $this->database->selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $this->parameters['nickname'], 'blocked' => false]);
} else {
$user = $this->database->selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['uid' => BaseApi::getCurrentUserID() ?: null, 'blocked' => false]);
}
if (!$this->database->isResult($user)) {
$this->logger->warning('User is not valid', ['nickname' => $this->parameters['nickname'], 'user' => $user]);
return $this->return(404, $this->t('User not found.'));
}
/*
* Setup permissions structures
*/
$can_post = false;
$visitor = 0;
$contact_id = 0;
$page_owner_uid = $user['uid'];
if ($this->userSession->getLocalUserId() && $this->userSession->getLocalUserId() == $page_owner_uid) {
$can_post = true;
} elseif ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY && !$this->userSession->getRemoteContactID($page_owner_uid)) {
$contact_id = $this->userSession->getRemoteContactID($page_owner_uid);
$can_post = $this->database->exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
$visitor = $contact_id;
}
if (!$can_post) {
$this->logger->warning('No permission to upload files', ['contact_id' => $contact_id, 'page_owner_uid' => $page_owner_uid]);
return $this->return(403, $this->t('Permission denied.'), true);
}
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
$this->logger->warning('Empty "userfile" and "media" field');
return $this->return(401, $this->t('Invalid request.'));
}
$src = '';
$filename = '';
$filesize = 0;
$filetype = '';
if (!empty($_FILES['userfile'])) {
$src = $_FILES['userfile']['tmp_name'];
$filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type'];
} elseif (!empty($_FILES['media'])) {
if (!empty($_FILES['media']['tmp_name'])) {
if (is_array($_FILES['media']['tmp_name'])) {
$src = $_FILES['media']['tmp_name'][0];
} else {
$src = $_FILES['media']['tmp_name'];
}
}
if (!empty($_FILES['media']['name'])) {
if (is_array($_FILES['media']['name'])) {
$filename = basename($_FILES['media']['name'][0]);
} else {
$filename = basename($_FILES['media']['name']);
}
}
if (!empty($_FILES['media']['size'])) {
if (is_array($_FILES['media']['size'])) {
$filesize = intval($_FILES['media']['size'][0]);
} else {
$filesize = intval($_FILES['media']['size']);
}
}
if (!empty($_FILES['media']['type'])) {
if (is_array($_FILES['media']['type'])) {
$filetype = $_FILES['media']['type'][0];
} else {
$filetype = $_FILES['media']['type'];
}
}
}
if ($src == '') {
$this->logger->warning('File source (temporary file) cannot be determined', ['$_FILES' => $_FILES]);
return $this->return(401, $this->t('Invalid request.'), true);
}
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
$this->logger->info('File upload:', [
'src' => $src,
'filename' => $filename,
'filesize' => $filesize,
'filetype' => $filetype,
]);
$imagedata = @file_get_contents($src);
$image = new Image($imagedata, $filetype);
if (!$image->isValid()) {
@unlink($src);
$this->logger->warning($this->t('Unable to process image.'), ['imagedata[]' => gettype($imagedata), 'filetype' => $filetype]);
return $this->return(401, $this->t('Unable to process image.'));
}
$image->orient($src);
@unlink($src);
$max_length = $this->config->get('system', 'max_image_length');
if ($max_length > 0) {
$image->scaleDown($max_length);
$filesize = strlen($image->asString());
$this->logger->info('File upload: Scaling picture to new size', ['max_length' => $max_length]);
}
$width = $image->getWidth();
$height = $image->getHeight();
$maximagesize = $this->config->get('system', 'maximagesize');
if (!empty($maximagesize) && $filesize > $maximagesize) {
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore
foreach ([5120, 2560, 1280, 640] as $pixels) {
if ($filesize > $maximagesize && max($width, $height) > $pixels) {
$this->logger->info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
$image->scaleDown($pixels);
$filesize = strlen($image->asString());
$width = $image->getWidth();
$height = $image->getHeight();
}
}
if ($filesize > $maximagesize) {
@unlink($src);
$this->logger->notice('Image size is too big', ['size' => $filesize, 'max' => $maximagesize]);
return $this->return(401, $this->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
}
}
$resource_id = Photo::newResource();
$smallest = 0;
// If we don't have an album name use the Wall Photos album
if (!strlen($album)) {
$album = $this->t('Wall Photos');
}
$allow_cid = '<' . $user['id'] . '>';
$result = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 0, Photo::DEFAULT, $allow_cid);
if (!$result) {
$this->logger->warning('Photo::store() failed', ['result' => $result]);
return $this->return(401, $this->t('Image upload failed.'));
}
if ($width > 640 || $height > 640) {
$image->scaleDown(640);
$result = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 1, Photo::DEFAULT, $allow_cid);
if ($result) {
$smallest = 1;
}
}
if ($width > 320 || $height > 320) {
$image->scaleDown(320);
$result = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 2, Photo::DEFAULT, $allow_cid);
if ($result && ($smallest == 0)) {
$smallest = 2;
}
}
$this->logger->info('upload done');
return $this->return(200, "\n\n" . '[url=' . $this->baseUrl . '/photos/' . $user['nickname'] . '/image/' . $resource_id . '][img]' . $this->baseUrl . "/photo/$resource_id-$smallest." . $image->getExt() . "[/img][/url]\n\n");
}
/**
* @param int $httpCode
* @param string $message
* @param bool $systemMessage
* @return void
* @throws InternalServerErrorException
*/
private function return(int $httpCode, string $message, bool $systemMessage = false): void
{
if ($this->isJson) {
$message = $httpCode >= 400 ? ['error' => $message] : ['ok' => true];
$this->response->setType(Response::TYPE_JSON, 'application/json');
$this->response->addContent(json_encode($message, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
} else {
if ($systemMessage) {
$this->systemMessages->addNotice($message);
}
if ($httpCode >= 400) {
$this->response->setStatus($httpCode, $message);
}
$this->response->addContent($message);
}
}
}

View File

@ -31,14 +31,15 @@ use Friendica\App\Router as R;
use Friendica\Module;
$profileRoutes = [
'' => [Module\Profile\Index::class, [R::GET]],
'/profile' => [Module\Profile\Profile::class, [R::GET]],
'/schedule' => [Module\Profile\Schedule::class, [R::GET, R::POST]],
'/contacts/common' => [Module\Profile\Common::class, [R::GET]],
'/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]],
'/status[/{category}[/{date1}[/{date2}]]]' => [Module\Profile\Status::class, [R::GET]],
'/media' => [Module\Profile\Media::class, [R::GET]],
'/unkmail' => [Module\Profile\UnkMail::class, [R::GET, R::POST]],
'' => [Module\Profile\Index::class, [R::GET]],
'/profile' => [Module\Profile\Profile::class, [R::GET]],
'/schedule' => [Module\Profile\Schedule::class, [R::GET, R::POST]],
'/contacts/common' => [Module\Profile\Common::class, [R::GET]],
'/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]],
'/status[/{category}[/{date1}[/{date2}]]]' => [Module\Profile\Status::class, [R::GET]],
'/media' => [Module\Profile\Media::class, [R::GET]],
'/unkmail' => [Module\Profile\UnkMail::class, [R::GET, R::POST]],
'/photos/upload' => [Module\Profile\Photos\Upload::class, [ R::POST]],
];
$apiRoutes = [

View File

@ -103,7 +103,7 @@ var FileBrowser = {
if ($("#upload-image").length)
var image_uploader = new window.AjaxUpload(
'upload-image',
{ action: 'wall_upload/'+FileBrowser.nickname+'?response=json',
{ action: 'profile/' + FileBrowser.nickname + '/photos/upload?response=json',
name: 'userfile',
responseType: 'json',
onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); },

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2022.12-dev\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-29 21:45-0400\n"
"POT-Creation-Date: 2022-10-30 14:22-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -32,8 +32,8 @@ msgstr ""
#: src/Module/HCard.php:51 src/Module/Profile/Common.php:40
#: src/Module/Profile/Common.php:51 src/Module/Profile/Contacts.php:39
#: src/Module/Profile/Contacts.php:49 src/Module/Profile/Media.php:38
#: src/Module/Profile/Status.php:58 src/Module/Register.php:267
#: src/Module/RemoteFollow.php:59
#: src/Module/Profile/Photos/Upload.php:87 src/Module/Profile/Status.php:58
#: src/Module/Register.php:267 src/Module/RemoteFollow.php:59
msgid "User not found."
msgstr ""
@ -119,28 +119,29 @@ msgid "The feed for this item is unavailable."
msgstr ""
#: mod/editpost.php:38 mod/events.php:218 mod/follow.php:56 mod/follow.php:130
#: mod/item.php:181 mod/item.php:186 mod/item.php:864 mod/message.php:69
#: mod/item.php:181 mod/item.php:186 mod/item.php:870 mod/message.php:69
#: mod/message.php:114 mod/notes.php:44 mod/ostatus_subscribe.php:33
#: mod/photos.php:159 mod/photos.php:886 mod/repair_ostatus.php:31
#: mod/settings.php:40 mod/settings.php:50 mod/settings.php:156
#: mod/suggest.php:34 mod/uimport.php:33 mod/unfollow.php:35
#: mod/unfollow.php:50 mod/unfollow.php:82 mod/wall_attach.php:70
#: mod/wall_attach.php:72 mod/wall_upload.php:90 src/Module/Attach.php:56
#: src/Module/BaseApi.php:94 src/Module/BaseNotifications.php:98
#: src/Module/Contact/Advanced.php:60 src/Module/Delegation.php:118
#: src/Module/FollowConfirm.php:38 src/Module/FriendSuggest.php:57
#: src/Module/Group.php:40 src/Module/Group.php:83 src/Module/Invite.php:42
#: src/Module/Invite.php:131 src/Module/Notifications/Notification.php:76
#: mod/wall_attach.php:72 src/Module/Attach.php:56 src/Module/BaseApi.php:94
#: src/Module/BaseNotifications.php:98 src/Module/Contact/Advanced.php:60
#: src/Module/Delegation.php:118 src/Module/FollowConfirm.php:38
#: src/Module/FriendSuggest.php:57 src/Module/Group.php:40
#: src/Module/Group.php:83 src/Module/Invite.php:42 src/Module/Invite.php:131
#: src/Module/Notifications/Notification.php:76
#: src/Module/Notifications/Notification.php:107
#: src/Module/Profile/Common.php:55 src/Module/Profile/Contacts.php:55
#: src/Module/Profile/Schedule.php:39 src/Module/Profile/Schedule.php:56
#: src/Module/Profile/UnkMail.php:69 src/Module/Profile/UnkMail.php:121
#: src/Module/Profile/UnkMail.php:132 src/Module/Register.php:77
#: src/Module/Register.php:90 src/Module/Register.php:206
#: src/Module/Register.php:245 src/Module/Search/Directory.php:37
#: src/Module/Settings/Account.php:50 src/Module/Settings/Account.php:410
#: src/Module/Settings/Delegation.php:41 src/Module/Settings/Delegation.php:69
#: src/Module/Settings/Display.php:41 src/Module/Settings/Display.php:119
#: src/Module/Profile/Photos/Upload.php:108 src/Module/Profile/Schedule.php:39
#: src/Module/Profile/Schedule.php:56 src/Module/Profile/UnkMail.php:69
#: src/Module/Profile/UnkMail.php:121 src/Module/Profile/UnkMail.php:132
#: src/Module/Register.php:77 src/Module/Register.php:90
#: src/Module/Register.php:206 src/Module/Register.php:245
#: src/Module/Search/Directory.php:37 src/Module/Settings/Account.php:50
#: src/Module/Settings/Account.php:410 src/Module/Settings/Delegation.php:41
#: src/Module/Settings/Delegation.php:69 src/Module/Settings/Display.php:41
#: src/Module/Settings/Display.php:119
#: src/Module/Settings/Profile/Photo/Crop.php:165
#: src/Module/Settings/Profile/Photo/Index.php:111
#: src/Module/Settings/UserExport.php:84 src/Module/Settings/UserExport.php:118
@ -523,19 +524,19 @@ msgstr ""
msgid "Empty post discarded."
msgstr ""
#: mod/item.php:674
#: mod/item.php:680
msgid "Post updated."
msgstr ""
#: mod/item.php:684 mod/item.php:689
#: mod/item.php:690 mod/item.php:695
msgid "Item wasn't stored."
msgstr ""
#: mod/item.php:700
#: mod/item.php:706
msgid "Item couldn't be fetched."
msgstr ""
#: mod/item.php:840 src/Module/Admin/Themes/Details.php:39
#: mod/item.php:846 src/Module/Admin/Themes/Details.php:39
#: src/Module/Admin/Themes/Index.php:59 src/Module/Debug/ItemBody.php:42
#: src/Module/Debug/ItemBody.php:57
msgid "Item not found."
@ -907,7 +908,8 @@ msgid "%1$s was tagged in %2$s by %3$s"
msgstr ""
#: mod/photos.php:631 mod/photos.php:634 mod/photos.php:661
#: mod/wall_upload.php:212 src/Module/Settings/Profile/Photo/Index.php:59
#: src/Module/Profile/Photos/Upload.php:213
#: src/Module/Settings/Profile/Photo/Index.php:59
#, php-format
msgid "Image exceeds size limit of %s"
msgstr ""
@ -930,12 +932,13 @@ msgstr ""
msgid "Image file is empty."
msgstr ""
#: mod/photos.php:684 mod/wall_upload.php:173
#: mod/photos.php:684 src/Module/Profile/Photos/Upload.php:179
#: src/Module/Profile/Photos/Upload.php:180
#: src/Module/Settings/Profile/Photo/Index.php:68
msgid "Unable to process image."
msgstr ""
#: mod/photos.php:710 mod/wall_upload.php:237
#: mod/photos.php:710 src/Module/Profile/Photos/Upload.php:231
#: src/Module/Settings/Profile/Photo/Index.php:95
msgid "Image upload failed."
msgstr ""
@ -1410,7 +1413,7 @@ msgstr ""
msgid "Friend Suggestions"
msgstr ""
#: mod/tagger.php:77 src/Content/Item.php:304 src/Model/Item.php:2861
#: mod/tagger.php:77 src/Content/Item.php:304 src/Model/Item.php:2877
msgid "photo"
msgstr ""
@ -1502,8 +1505,8 @@ msgid "Unable to unfollow this contact, please contact your administrator"
msgstr ""
#: mod/wall_attach.php:41 mod/wall_attach.php:48 mod/wall_attach.php:79
#: mod/wall_upload.php:54 mod/wall_upload.php:64 mod/wall_upload.php:101
#: mod/wall_upload.php:152
#: src/Module/Profile/Photos/Upload.php:113
#: src/Module/Profile/Photos/Upload.php:162
msgid "Invalid request."
msgstr ""
@ -1524,10 +1527,6 @@ msgstr ""
msgid "File upload failed."
msgstr ""
#: mod/wall_upload.php:229 src/Model/Photo.php:1086
msgid "Wall Photos"
msgstr ""
#: src/App.php:490
msgid "No system theme config value set."
msgstr ""
@ -2271,7 +2270,7 @@ msgstr ""
msgid "show more"
msgstr ""
#: src/Content/Item.php:295 src/Model/Item.php:2859
#: src/Content/Item.php:295 src/Model/Item.php:2875
msgid "event"
msgstr ""
@ -2607,39 +2606,39 @@ msgstr ""
msgid "last"
msgstr ""
#: src/Content/Text/BBCode.php:1002 src/Content/Text/BBCode.php:1903
#: src/Content/Text/BBCode.php:1904
#: src/Content/Text/BBCode.php:1002 src/Content/Text/BBCode.php:1863
#: src/Content/Text/BBCode.php:1864
msgid "Image/photo"
msgstr ""
#: src/Content/Text/BBCode.php:1258
#: src/Content/Text/BBCode.php:1218
#, php-format
msgid ""
"<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s"
msgstr ""
#: src/Content/Text/BBCode.php:1283 src/Model/Item.php:3460
#: src/Model/Item.php:3466 src/Model/Item.php:3467
#: src/Content/Text/BBCode.php:1243 src/Model/Item.php:3476
#: src/Model/Item.php:3482 src/Model/Item.php:3483
msgid "Link to source"
msgstr ""
#: src/Content/Text/BBCode.php:1821 src/Content/Text/HTML.php:940
#: src/Content/Text/BBCode.php:1781 src/Content/Text/HTML.php:940
msgid "Click to open/close"
msgstr ""
#: src/Content/Text/BBCode.php:1852
#: src/Content/Text/BBCode.php:1812
msgid "$1 wrote:"
msgstr ""
#: src/Content/Text/BBCode.php:1908 src/Content/Text/BBCode.php:1909
#: src/Content/Text/BBCode.php:1868 src/Content/Text/BBCode.php:1869
msgid "Encrypted content"
msgstr ""
#: src/Content/Text/BBCode.php:2129
#: src/Content/Text/BBCode.php:2089
msgid "Invalid source protocol"
msgstr ""
#: src/Content/Text/BBCode.php:2144
#: src/Content/Text/BBCode.php:2104
msgid "Invalid link protocol"
msgstr ""
@ -3761,66 +3760,66 @@ msgstr ""
msgid "Edit groups"
msgstr ""
#: src/Model/Item.php:1971
#: src/Model/Item.php:1987
#, php-format
msgid "Detected languages in this post:\\n%s"
msgstr ""
#: src/Model/Item.php:2863
#: src/Model/Item.php:2879
msgid "activity"
msgstr ""
#: src/Model/Item.php:2865
#: src/Model/Item.php:2881
msgid "comment"
msgstr ""
#: src/Model/Item.php:2868
#: src/Model/Item.php:2884
msgid "post"
msgstr ""
#: src/Model/Item.php:3009
#: src/Model/Item.php:3025
#, php-format
msgid "Content warning: %s"
msgstr ""
#: src/Model/Item.php:3372
#: src/Model/Item.php:3388
msgid "bytes"
msgstr ""
#: src/Model/Item.php:3403
#: src/Model/Item.php:3419
#, php-format
msgid "%2$s (%3$d%%, %1$d vote)"
msgid_plural "%2$s (%3$d%%, %1$d votes)"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3405
#: src/Model/Item.php:3421
#, php-format
msgid "%2$s (%1$d vote)"
msgid_plural "%2$s (%1$d votes)"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3410
#: src/Model/Item.php:3426
#, php-format
msgid "%d voter. Poll end: %s"
msgid_plural "%d voters. Poll end: %s"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3412
#: src/Model/Item.php:3428
#, php-format
msgid "%d voter."
msgid_plural "%d voters."
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3414
#: src/Model/Item.php:3430
#, php-format
msgid "Poll end: %s"
msgstr ""
#: src/Model/Item.php:3448 src/Model/Item.php:3449
#: src/Model/Item.php:3464 src/Model/Item.php:3465
msgid "View on separate page"
msgstr ""
@ -3828,6 +3827,10 @@ msgstr ""
msgid "[no subject]"
msgstr ""
#: src/Model/Photo.php:1086 src/Module/Profile/Photos/Upload.php:223
msgid "Wall Photos"
msgstr ""
#: src/Model/Profile.php:361 src/Module/Profile/Profile.php:255
#: src/Module/Profile/Profile.php:257
msgid "Edit profile"

View File

@ -6,7 +6,7 @@
$(document).ready(function() {
var uploader = new window.AjaxUpload(
'prvmail-upload',
{ action: 'wall_upload/{{$nickname}}',
{ action: 'profile/{{$nickname}}/photos/upload',
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {

View File

@ -167,9 +167,9 @@ var FileBrowser = {
//AjaxUpload for images
var image_uploader = new window.AjaxUpload("upload-image", {
action:
"wall_upload/" +
"profile/" +
FileBrowser.nickname +
"?response=json&album=" +
"/photos/upload?response=json&album=" +
encodeURIComponent(FileBrowser.folder),
name: "userfile",
responseType: "json",

View File

@ -57,12 +57,13 @@ function enableOnUser(){
$(document).ready(function() {
/* enable editor on focus and click */
$("#profile-jot-text").focus(enableOnUser);
$("#profile-jot-text").click(enableOnUser);
$("#profile-jot-text")
.focus(enableOnUser)
.click(enableOnUser);
var uploader = new window.AjaxUpload(
'wall-image-upload',
{ action: 'wall_upload/{{$nickname}}',
{ action: 'profile/{{$nickname}}/photos/upload',
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {