]> git.mxchange.org Git - friendica.git/blobdiff - mod/fbrowser.php
Merge pull request #3965 from tobiasd/20171126-docGettingStarted
[friendica.git] / mod / fbrowser.php
index 9c1d43cd8bc606a89c688dd81b8d145986d38ba2..ce90eaee9152980c28aef8619339da3dfd2a29bf 100644 (file)
@@ -5,32 +5,33 @@
  * @author             Fabio Comuni <fabrixxm@kirgroup.com>
  */
 
+use Friendica\App;
+use Friendica\Core\System;
+
 require_once('include/Photo.php');
 
 /**
  * @param App $a
  */
-/// @TODO & is missing or App ?
-function fbrowser_content($a){
+function fbrowser_content(App $a) {
 
-       if (!local_user())
+       if (!local_user()) {
                killme();
+       }
 
-       if ($a->argc==1)
+       if ($a->argc == 1) {
                killme();
+       }
 
        $template_file = "filebrowser.tpl";
        $mode = "";
        if (x($_GET,'mode')) {
-               $template_file = "filebrowser_plain.tpl";
                $mode  = "?mode=".$_GET['mode'];
        }
 
-       //echo "<pre>"; var_dump($a->argv); killme();
-
-       switch($a->argv[1]){
+       switch ($a->argv[1]) {
                case "image":
-                       $path = array( array("", t("Photos")));
+                       $path = array(array("", t("Photos")));
                        $albums = false;
                        $sql_extra = "";
                        $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
@@ -55,7 +56,8 @@ function fbrowser_content($a){
                                $path[]=array($a->argv[2], $album);
                        }
 
-                       $r = q("SELECT `resource-id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc`
+                       $r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`type`) AS `type`,
+                                       min(`scale`) AS `hiq`, max(`scale`) AS `loq`, ANY_VALUE(`desc`) AS `desc`, ANY_VALUE(`created`) AS `created`
                                        FROM `photo` WHERE `uid` = %d $sql_extra AND `album` != '%s' AND `album` != '%s'
                                        GROUP BY `resource-id` $sql_extra2",
                                intval(local_user()),
@@ -84,9 +86,9 @@ function fbrowser_content($a){
                                        $scale = $rr['loq'];
 
                                return array(
-                                       App::get_baseurl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'],
+                                       System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'],
                                        $filename_e,
-                                       App::get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext
+                                       System::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext
                                );
                        }
                        $files = array_map("_map_files1", $r);
@@ -95,7 +97,7 @@ function fbrowser_content($a){
 
                        $o =  replace_macros($tpl, array(
                                '$type'     => 'image',
-                               '$baseurl'  => App::get_baseurl(),
+                               '$baseurl'  => System::baseUrl(),
                                '$path'     => $path,
                                '$folders'  => $albums,
                                '$files'    => $files,
@@ -122,7 +124,7 @@ function fbrowser_content($a){
                                                $filename_e = $rr['filename'];
                                        }
 
-                                       return array( App::get_baseurl() . '/attach/' . $rr['id'], $filename_e, App::get_baseurl() . '/images/icons/16/' . $filetype . '.png');
+                                       return array( System::baseUrl() . '/attach/' . $rr['id'], $filename_e, System::baseUrl() . '/images/icons/16/' . $filetype . '.png');
                                }
                                $files = array_map("_map_files2", $files);
 
@@ -130,7 +132,7 @@ function fbrowser_content($a){
                                $tpl = get_markup_template($template_file);
                                $o = replace_macros($tpl, array(
                                        '$type'     => 'file',
-                                       '$baseurl'  => App::get_baseurl(),
+                                       '$baseurl'  => System::baseUrl(),
                                        '$path'     => array( array( "", t("Files")) ),
                                        '$folders'  => false,
                                        '$files'    =>$files,