use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
+use Friendica\Model\Tag;
use Friendica\Model\User;
use Friendica\Module\BaseProfile;
use Friendica\Network\Probe;
if (!DBA::isResult($r)) {
notice(DI::l10n()->t('Album not found.') . EOL);
- DI::baseUrl()->redirect($_SESSION['photo_return']);
+ DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album');
return; // NOTREACHED
}
// Check if the user has responded to a delete confirmation query
if (!empty($_REQUEST['canceled'])) {
- DI::baseUrl()->redirect($_SESSION['photo_return']);
+ DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album/' . $a->argv[3]);
}
// RENAME photo album
}
}
- DI::baseUrl()->redirect('photos/' . $a->argv[1]);
+ DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album');
}
if ($a->argc > 3 && $a->argv[2] === 'image') {
$desc = !empty($_POST['desc']) ? Strings::escapeTags(trim($_POST['desc'])) : '';
$rawtags = !empty($_POST['newtag']) ? Strings::escapeTags(trim($_POST['newtag'])) : '';
$item_id = !empty($_POST['item_id']) ? intval($_POST['item_id']) : 0;
- $albname = !empty($_POST['albname']) ? Strings::escapeTags(trim($_POST['albname'])) : '';
+ $albname = !empty($_POST['albname']) ? trim($_POST['albname']) : '';
$origaname = !empty($_POST['origaname']) ? Strings::escapeTags(trim($_POST['origaname'])) : '';
$aclFormatter = DI::aclFormatter();
}
if ($item_id) {
- $item = Item::selectFirst(['tag', 'inform'], ['id' => $item_id, 'uid' => $page_owner_uid]);
+ $item = Item::selectFirst(['tag', 'inform', 'uri-id'], ['id' => $item_id, 'uid' => $page_owner_uid]);
if (DBA::isResult($item)) {
$old_tag = $item['tag'];
$profile = str_replace(',', '%2c', $profile);
$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]';
+
+ if (!empty($item['uri-id'])) {
+ Tag::store($item['uri-id'], Tag::MENTION, $newname, $profile);
+ }
}
} elseif (strpos($tag, '#') === 0) {
$tagname = substr($tag, 1);
$str_tags .= '#[url=' . DI::baseUrl() . "/search?tag=" . $tagname . ']' . $tagname . '[/url],';
+ if (!empty($item['uri-id'])) {
+ Tag::store($item['uri-id'], Tag::HASHTAG, $tagname);
+ }
}
}
}
Hook::callAll('photo_post_init', $_POST);
// Determine the album to use
- $album = !empty($_REQUEST['album']) ? Strings::escapeTags(trim($_REQUEST['album'])) : '';
- $newalbum = !empty($_REQUEST['newalbum']) ? Strings::escapeTags(trim($_REQUEST['newalbum'])) : '';
+ $album = trim($_REQUEST['album'] ?? '');
+ $newalbum = trim($_REQUEST['newalbum'] ?? '');
- Logger::log('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , Logger::DEBUG);
+ Logger::info('album= ' . $album . ' newalbum= ' . $newalbum);
if (!strlen($album)) {
if (strlen($newalbum)) {
return;
}
- if ($type == "") {
- $type = Images::guessType($filename);
- }
+ $type = Images::getMimeTypeBySource($src, $filename, $type);
Logger::log('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', Logger::DEBUG);
$likebuttons = '';
$comments = '';
$paginate = '';
- $responses = '';
if (!empty($link_item['id']) && !empty($link_item['uri'])) {
$cmnt_tpl = Renderer::getMarkupTemplate('comment_item.tpl');
}
$conv_responses = [
- 'like' => ['title' => DI::l10n()->t('Likes','title')],
- 'dislike' => ['title' => DI::l10n()->t('Dislikes','title')],
- 'attendyes' => ['title' => DI::l10n()->t('Attending','title')],
- 'attendno' => ['title' => DI::l10n()->t('Not attending','title')],
- 'attendmaybe' => ['title' => DI::l10n()->t('Might attend','title')]
+ 'like' => [],
+ 'dislike' => [],
+ 'attendyes' => [],
+ 'attendno' => [],
+ 'attendmaybe' => []
];
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
foreach ($items as $item) {
$comment = '';
$template = $tpl;
- $sparkle = '';
$activity = DI::activity();
}
}
- $responses = get_responses($conv_responses, ['like', 'dislike'], $link_item);
-
$paginate = $pager->renderFull($total);
}
'$likebuttons' => $likebuttons,
'$like' => $like,
'$dislike' => $dislike,
- 'responses' => $responses,
'$comments' => $comments,
'$paginate' => $paginate,
]);