-use \Friendica\Core\Config;
-
-require_once 'include/Photo.php';
-
-
-function wall_upload_post(App $a, $desktopmode = true) {
-
- logger("wall upload: starting new upload", LOGGER_DEBUG);
-
- $r_json = (x($_GET, 'response') && $_GET['response'] == 'json');
- $album = (x($_GET, 'album') ? notags(trim($_GET['album'])) : '');
-
- if ($a->argc > 1) {
- if (! x($_FILES, 'media')) {
- $nick = $a->argv[1];
- $r = q("SELECT `user`.*, `contact`.`id` FROM `user`
- INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`
- WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0
- AND `contact`.`self` = 1 LIMIT 1",
- dbesc($nick)
- );
-
- if (! dbm::is_result($r)) {
+use Friendica\App;
+use Friendica\Core\Logger;
+use Friendica\Core\Session;
+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");
+
+ $r_json = (!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)) {