Adjust for templates

Use new t() for template button text
This commit is contained in:
Adam Magness 2018-01-22 22:20:35 -05:00
parent 220c566fbd
commit 21f593bf4b
3 changed files with 25 additions and 21 deletions

View file

@ -13,8 +13,8 @@ use Friendica\Object\Image;
/** /**
* @param App $a * @param App $a
*/ */
function fbrowser_content(App $a) { function fbrowser_content(App $a)
{
if (!local_user()) { if (!local_user()) {
killme(); killme();
} }
@ -25,7 +25,7 @@ function fbrowser_content(App $a) {
$template_file = "filebrowser.tpl"; $template_file = "filebrowser.tpl";
$mode = ""; $mode = "";
if (x($_GET,'mode')) { if (x($_GET, 'mode')) {
$mode = "?mode=".$_GET['mode']; $mode = "?mode=".$_GET['mode'];
} }
@ -36,22 +36,25 @@ function fbrowser_content(App $a) {
$sql_extra = ""; $sql_extra = "";
$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10"; $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
if ($a->argc==2){ if ($a->argc==2) {
$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' ", $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' ",
intval(local_user()), intval(local_user()),
dbesc('Contact Photos'), dbesc('Contact Photos'),
dbesc(L10n::t('Contact Photos')) dbesc(L10n::t('Contact Photos'))
); );
function _map_folder1($el){return [bin2hex($el['album']),$el['album']];}; function _map_folder1($el)
$albums = array_map( "_map_folder1" , $albums); {
return [bin2hex($el['album']),$el['album']];
};
$albums = array_map("_map_folder1", $albums);
} }
$album = ""; $album = "";
if ($a->argc==3){ if ($a->argc==3) {
$album = hex2bin($a->argv[2]); $album = hex2bin($a->argv[2]);
$sql_extra = sprintf("AND `album` = '%s' ",dbesc($album)); $sql_extra = sprintf("AND `album` = '%s' ", dbesc($album));
$sql_extra2 = ""; $sql_extra2 = "";
$path[]=[$a->argv[2], $album]; $path[]=[$a->argv[2], $album];
} }
@ -65,7 +68,8 @@ function fbrowser_content(App $a) {
dbesc(L10n::t('Contact Photos')) dbesc(L10n::t('Contact Photos'))
); );
function _map_files1($rr){ function _map_files1($rr)
{
$a = get_app(); $a = get_app();
$types = Image::supportedTypes(); $types = Image::supportedTypes();
$ext = $types[$rr['type']]; $ext = $types[$rr['type']];
@ -74,10 +78,11 @@ function fbrowser_content(App $a) {
// Take the largest picture that is smaller or equal 640 pixels // Take the largest picture that is smaller or equal 640 pixels
$p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `height` <= 640 AND `width` <= 640 ORDER BY `resource-id`, `scale` LIMIT 1", $p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `height` <= 640 AND `width` <= 640 ORDER BY `resource-id`, `scale` LIMIT 1",
dbesc($rr['resource-id'])); dbesc($rr['resource-id']));
if ($p) if ($p) {
$scale = $p[0]["scale"]; $scale = $p[0]["scale"];
else } else {
$scale = $rr['loq']; $scale = $rr['loq'];
}
return [ return [
System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'], System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'],
@ -97,9 +102,9 @@ function fbrowser_content(App $a) {
'$files' => $files, '$files' => $files,
'$cancel' => L10n::t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$upload' => L10n::t('Upload')
]); ]);
break; break;
case "file": case "file":
if ($a->argc==2) { if ($a->argc==2) {
@ -107,9 +112,10 @@ function fbrowser_content(App $a) {
intval(local_user()) intval(local_user())
); );
function _map_files2($rr){ function _map_files2($rr)
{
$a = get_app(); $a = get_app();
list($m1,$m2) = explode("/",$rr['filetype']); list($m1,$m2) = explode("/", $rr['filetype']);
$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip"); $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
$filename_e = $rr['filename']; $filename_e = $rr['filename'];
@ -124,22 +130,20 @@ function fbrowser_content(App $a) {
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$path' => [ [ "", L10n::t("Files")] ], '$path' => [ [ "", L10n::t("Files")] ],
'$folders' => false, '$folders' => false,
'$files' =>$files, '$files' => $files,
'$cancel' => L10n::t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$upload' => L10n::t('Upload')
]); ]);
} }
break; break;
} }
if (x($_GET,'mode')) { if (x($_GET, 'mode')) {
return $o; return $o;
} else { } else {
echo $o; echo $o;
killme(); killme();
} }
} }

View file

@ -40,7 +40,7 @@
</div> </div>
<div class="upload"> <div class="upload">
<button id="upload-{{$type}}"><img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait|escape:'html'}}" style="display: none;" /> {{"Upload"|t}}</button> <button id="upload-{{$type}}"><img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait|escape:'html'}}" style="display: none;" /> {{$upload}}</button>
</div> </div>
</div> </div>

View file

@ -58,7 +58,7 @@
</div> </div>
<div class="upload"> <div class="upload">
<button id="upload-{{$type}}">{{"Upload"|t}}</button> <button id="upload-{{$type}}">{{$upload}}</button>
</div> </div>
</div> </div>