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 $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
29 $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ",
32 // anon functions only from 5.3.0... meglio tardi che mai..
33 function folder1($el){return array(bin2hex($el['album']),$el['album']);}
34 $albums = array_map( "folder1" , $albums);
40 $album = hex2bin($a->argv[2]);
41 $sql_extra = sprintf("AND `album` = '%s' ",dbesc($album));
43 $path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/", $album);
46 $r = q("SELECT `resource-id`, `id`, `filename`, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc`
47 FROM `photo` WHERE `uid` = %d $sql_extra
48 GROUP BY `resource-id` $sql_extra2",
53 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'); }
54 $files = array_map("files1", $r);
56 $tpl = get_markup_template("filebrowser.tpl");
57 echo replace_macros($tpl, array(
59 '$baseurl' => $a->get_baseurl(),
61 '$folders' => $albums,
69 $files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ",
73 function files2($rr){ global $a;
74 list($m1,$m2) = explode("/",$rr['filetype']);
75 $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
76 return array( $a->get_baseurl() . '/attach/' . $rr['id'], template_escape($rr['filename']), $a->get_baseurl() . '/images/icons/16/' . $filetype . '.png');
78 $files = array_map("files2", $files);
79 //echo "<pre>"; var_dump($files); killme();
82 $tpl = get_markup_template("filebrowser.tpl");
83 echo replace_macros($tpl, array(
85 '$baseurl' => $a->get_baseurl(),
86 '$path' => array( array($a->get_baseurl()."/fbrowser/image/", t("Files")) ),