X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fphotos.php;h=3b2fa0c3a8d80c40a8024253735248e1a168f674;hb=a852455d0ed9824fb71c9374c9fffda28f95096f;hp=e5ab6b8dcea416b4eafd282efe232298f817a747;hpb=398e65d66b929a4931f62477f86ea1df6fe99c9a;p=friendica.git diff --git a/mod/photos.php b/mod/photos.php index e5ab6b8dce..3b2fa0c3a8 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -25,6 +25,7 @@ use Friendica\Content\Nav; use Friendica\Content\Pager; use Friendica\Content\Text\BBCode; use Friendica\Core\ACL; +use Friendica\Core\Addon; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; @@ -193,7 +194,7 @@ function photos_post(App $a) } $album = hex2bin($a->argv[3]); - if ($album === DI::l10n()->t('Profile Photos') || $album === 'Contact Photos' || $album === DI::l10n()->t('Contact Photos')) { + if ($album === DI::l10n()->t('Profile Photos') || $album === Photo::CONTACT_PHOTOS || $album === DI::l10n()->t(Photo::CONTACT_PHOTOS)) { DI::baseUrl()->redirect($_SESSION['photo_return']); return; // NOTREACHED } @@ -937,7 +938,7 @@ function photos_content(App $a) $albumselect .= ''; if (!empty($a->data['albums'])) { foreach ($a->data['albums'] as $album) { - if (($album['album'] === '') || ($album['album'] === 'Contact Photos') || ($album['album'] === DI::l10n()->t('Contact Photos'))) { + if (($album['album'] === '') || ($album['album'] === Photo::CONTACT_PHOTOS) || ($album['album'] === DI::l10n()->t(Photo::CONTACT_PHOTOS))) { continue; } $selected = (($selname === $album['album']) ? ' selected="selected" ' : ''); @@ -987,8 +988,6 @@ function photos_content(App $a) '$uploadurl' => $ret['post_url'], // ACL permissions box - '$group_perms' => DI::l10n()->t('Show to Groups'), - '$contact_perms' => DI::l10n()->t('Show to Contacts'), '$return_path' => DI::args()->getQueryString(), ]); @@ -1040,7 +1039,6 @@ function photos_content(App $a) return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'post', '$message' => DI::l10n()->t('Do you really want to delete this photo album and all its photos?'), - '$extra_inputs' => [], '$confirm' => DI::l10n()->t('Delete Album'), '$confirm_url' => $drop_url, '$confirm_name' => 'dropalbum', @@ -1050,7 +1048,7 @@ function photos_content(App $a) // edit album name if ($cmd === 'edit') { - if (($album !== DI::l10n()->t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== DI::l10n()->t('Contact Photos'))) { + if (($album !== DI::l10n()->t('Profile Photos')) && ($album !== Photo::CONTACT_PHOTOS) && ($album !== DI::l10n()->t(Photo::CONTACT_PHOTOS))) { if ($can_post) { $edit_tpl = Renderer::getMarkupTemplate('album_edit.tpl'); @@ -1067,7 +1065,7 @@ function photos_content(App $a) } } } else { - if (($album !== DI::l10n()->t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== DI::l10n()->t('Contact Photos')) && $can_post) { + if (($album !== DI::l10n()->t('Profile Photos')) && ($album !== Photo::CONTACT_PHOTOS) && ($album !== DI::l10n()->t(Photo::CONTACT_PHOTOS)) && $can_post) { $edit = [DI::l10n()->t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit']; $drop = [DI::l10n()->t('Drop Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/drop']; } @@ -1147,7 +1145,6 @@ function photos_content(App $a) return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'post', '$message' => DI::l10n()->t('Do you really want to delete this photo?'), - '$extra_inputs' => [], '$confirm' => DI::l10n()->t('Delete Photo'), '$confirm_url' => $drop_url, '$confirm_name' => 'delete', @@ -1352,8 +1349,6 @@ function photos_content(App $a) '$delete' => DI::l10n()->t('Delete Photo'), // ACL permissions box - '$group_perms' => DI::l10n()->t('Show to Groups'), - '$contact_perms' => DI::l10n()->t('Show to Contacts'), '$return_path' => DI::args()->getQueryString(), ]); } @@ -1382,6 +1377,16 @@ function photos_content(App $a) if (!DBA::isResult($items)) { if (($can_post || Security::canWriteToUserWall($owner_uid))) { + /* + * Hmmm, code depending on the presence of a particular addon? + * This should be better if done by a hook + */ + $qcomment = null; + if (Addon::isEnabled('qcomment')) { + $words = DI::pConfig()->get(local_user(), 'qcomment', 'words'); + $qcomment = $words ? explode("\n", $words) : []; + } + $comments .= Renderer::replaceMacros($cmnt_tpl, [ '$return_path' => '', '$jsreload' => $return_path, @@ -1396,7 +1401,7 @@ function photos_content(App $a) '$preview' => DI::l10n()->t('Preview'), '$loading' => DI::l10n()->t('Loading...'), '$sourceapp' => DI::l10n()->t($a->sourcename), - '$ww' => '', + '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12) ]); } @@ -1429,6 +1434,16 @@ function photos_content(App $a) } if (($can_post || Security::canWriteToUserWall($owner_uid))) { + /* + * Hmmm, code depending on the presence of a particular addon? + * This should be better if done by a hook + */ + $qcomment = null; + if (Addon::isEnabled('qcomment')) { + $words = DI::pConfig()->get(local_user(), 'qcomment', 'words'); + $qcomment = $words ? explode("\n", $words) : []; + } + $comments .= Renderer::replaceMacros($cmnt_tpl,[ '$return_path' => '', '$jsreload' => $return_path, @@ -1442,7 +1457,7 @@ function photos_content(App $a) '$submit' => DI::l10n()->t('Submit'), '$preview' => DI::l10n()->t('Preview'), '$sourceapp' => DI::l10n()->t($a->sourcename), - '$ww' => '', + '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12) ]); } @@ -1492,6 +1507,16 @@ function photos_content(App $a) ]); if (($can_post || Security::canWriteToUserWall($owner_uid))) { + /* + * Hmmm, code depending on the presence of a particular addon? + * This should be better if done by a hook + */ + $qcomment = null; + if (Addon::isEnabled('qcomment')) { + $words = DI::pConfig()->get(local_user(), 'qcomment', 'words'); + $qcomment = $words ? explode("\n", $words) : []; + } + $comments .= Renderer::replaceMacros($cmnt_tpl, [ '$return_path' => '', '$jsreload' => $return_path, @@ -1505,7 +1530,7 @@ function photos_content(App $a) '$submit' => DI::l10n()->t('Submit'), '$preview' => DI::l10n()->t('Preview'), '$sourceapp' => DI::l10n()->t($a->sourcename), - '$ww' => '', + '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12) ]); } @@ -1550,8 +1575,8 @@ function photos_content(App $a) $r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra GROUP BY `resource-id`", intval($a->data['user']['uid']), - DBA::escape('Contact Photos'), - DBA::escape(DI::l10n()->t('Contact Photos')) + DBA::escape(Photo::CONTACT_PHOTOS), + DBA::escape(DI::l10n()->t(Photo::CONTACT_PHOTOS)) ); if (DBA::isResult($r)) { $total = count($r); @@ -1565,8 +1590,8 @@ function photos_content(App $a) WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d", intval($a->data['user']['uid']), - DBA::escape('Contact Photos'), - DBA::escape(DI::l10n()->t('Contact Photos')), + DBA::escape(Photo::CONTACT_PHOTOS), + DBA::escape(DI::l10n()->t(Photo::CONTACT_PHOTOS)), $pager->getStart(), $pager->getItemsPerPage() );