From: Philipp Holzer Date: Fri, 1 Mar 2019 10:01:44 +0000 (+0100) Subject: Moving mod/filer to src/Module/Filer X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=78d0d6e6e17ae211f0b5789b5db4fcfd206facc6;p=friendica.git Moving mod/filer to src/Module/Filer --- diff --git a/mod/filer.php b/mod/filer.php deleted file mode 100644 index 0d9afe638b..0000000000 --- a/mod/filer.php +++ /dev/null @@ -1,42 +0,0 @@ -argc > 1) ? intval($a->argv[1]) : 0); - - Logger::log('filer: tag ' . $term . ' item ' . $item_id); - - if ($item_id && strlen($term)) { - // file item - FileTag::saveFile(local_user(), $item_id, $term); - } else { - // return filer dialog - $filetags = PConfig::get(local_user(), 'system', 'filetags'); - $filetags = FileTag::fileToList($filetags, 'file'); - $filetags = explode(",", $filetags); - - $tpl = Renderer::getMarkupTemplate("filer_dialog.tpl"); - $o = Renderer::replaceMacros($tpl, [ - '$field' => ['term', L10n::t("Save to Folder:"), '', '', $filetags, L10n::t('- select -')], - '$submit' => L10n::t('Save'), - ]); - - echo $o; - } - exit(); -} diff --git a/src/Module/Filer.php b/src/Module/Filer.php new file mode 100644 index 0000000000..55015652db --- /dev/null +++ b/src/Module/Filer.php @@ -0,0 +1,54 @@ +internalRedirect(); + } + } + + public static function content() + { + $a = self::getApp(); + $logger = $a->getLogger(); + + $term = XML::unescape(trim(defaults($_GET, 'term', ''))); + $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); + + $logger->info('filer', ['tag' => $term, 'item' => $item_id]); + + if ($item_id && strlen($term)) { + // file item + Model\FileTag::saveFile(local_user(), $item_id, $term); + $a->internalRedirect(); + return; + + } else { + // return filer dialog + $filetags = PConfig::get(local_user(), 'system', 'filetags'); + $filetags = Model\FileTag::fileToList($filetags, 'file'); + $filetags = explode(",", $filetags); + + $tpl = Renderer::getMarkupTemplate("filer_dialog.tpl"); + return Renderer::replaceMacros($tpl, [ + '$field' => ['term', L10n::t("Save to Folder:"), '', '', $filetags, L10n::t('- select -')], + '$submit' => L10n::t('Save'), + ]); + } + } +}