3 * @package Friendica\modules
4 * @subpackage FileBrowser
5 * @author Fabio Comuni <fabrixxm@kirgroup.com>
8 require_once('include/Photo.php');
13 function fbrowser_content($a){
21 //echo "<pre>"; var_dump($a->argv); killme();
25 $path = array( array($a->get_baseurl()."/fbrowser/image/", t("Photos")));
28 $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
31 $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ",
34 // anon functions only from 5.3.0... meglio tardi che mai..
35 function folder1($el){return array(bin2hex($el['album']),$el['album']);}
36 $albums = array_map( "folder1" , $albums);
42 $album = hex2bin($a->argv[2]);
43 $sql_extra = sprintf("AND `album` = '%s' ",dbesc($album));
45 $path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/", $album);
48 $r = q("SELECT `resource-id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc`
49 FROM `photo` WHERE `uid` = %d AND (height <= 320 AND width <= 320) $sql_extra
50 GROUP BY `resource-id` $sql_extra2",
56 $types = Photo::supportedTypes();
57 $ext = $types[$rr['type']];
59 $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['hiq'] . '.' .$ext,
60 template_escape($rr['filename']),
61 $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['loq'] . '.'. $ext
64 $files = array_map("files1", $r);
66 $tpl = get_markup_template("filebrowser.tpl");
67 echo replace_macros($tpl, array(
69 '$baseurl' => $a->get_baseurl(),
71 '$folders' => $albums,
79 $files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ",
83 function files2($rr){ global $a;
84 list($m1,$m2) = explode("/",$rr['filetype']);
85 $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
86 return array( $a->get_baseurl() . '/attach/' . $rr['id'], template_escape($rr['filename']), $a->get_baseurl() . '/images/icons/16/' . $filetype . '.png');
88 $files = array_map("files2", $files);
89 //echo "<pre>"; var_dump($files); killme();
92 $tpl = get_markup_template("filebrowser.tpl");
93 echo replace_macros($tpl, array(
95 '$baseurl' => $a->get_baseurl(),
96 '$path' => array( array($a->get_baseurl()."/fbrowser/image/", t("Files")) ),