3 * @package Friendica\modules
4 * @subpackage FileBrowser
5 * @author Fabio Comuni <fabrixxm@kirgroup.com>
11 function fbrowser_content($a){
19 //echo "<pre>"; var_dump($a->argv); killme();
23 $path = array( array($a->get_baseurl()."/fbrowser/image/", t("Photos")));
26 $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ",
29 // anon functions only from 5.3.0... meglio tardi che mai..
30 function folder1($el){return array(bin2hex($el['album']),$el['album']);}
31 $albums = array_map( "folder1" , $albums);
37 $album = hex2bin($a->argv[2]);
38 $sql_extra = sprintf("AND `album` = '%s' ",dbesc($album));
39 $path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/", $album);
42 $r = q("SELECT `resource-id`, `id`, `filename`, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc` FROM `photo` WHERE `uid` = %d $sql_extra
43 AND `scale` <= 4 $sql_extra GROUP BY `resource-id`",
48 function files1($rr){ global $a; return array( $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['hiq'] . '.jpg', template_escape($rr['filename']), $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['loq'] . '.jpg'); }
49 $files = array_map("files1", $r);
51 $tpl = get_markup_template("filebrowser.tpl");
52 echo replace_macros($tpl, array(
54 '$baseurl' => $a->get_baseurl(),
56 '$folders' => $albums,
64 $files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ",
68 function files2($rr){ global $a;
69 list($m1,$m2) = explode("/",$rr['filetype']);
70 $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
71 return array( $a->get_baseurl() . '/attach/' . $rr['id'], template_escape($rr['filename']), $a->get_baseurl() . '/images/icons/16/' . $filetype . '.png');
73 $files = array_map("files2", $files);
74 //echo "<pre>"; var_dump($files); killme();
77 $tpl = get_markup_template("filebrowser.tpl");
78 echo replace_macros($tpl, array(
80 '$baseurl' => $a->get_baseurl(),
81 '$path' => array( array($a->get_baseurl()."/fbrowser/image/", t("Files")) ),