diff --git a/mod/filerm.php b/mod/filerm.php deleted file mode 100644 index 9013dd62b4..0000000000 --- a/mod/filerm.php +++ /dev/null @@ -1,40 +0,0 @@ -argc > 1) ? intval($a->argv[1]) : 0); - - Logger::log('filerm: tag ' . $term . ' item ' . $item_id . ' category ' . ($category ? 'true' : 'false')); - - if ($item_id && strlen($term)) { - if (FileTag::unsaveFile(local_user(), $item_id, $term, $category)) { - info('Item removed'); - } - } - else { - info('Item was not deleted'); - } - - $a->internalRedirect('/network?f=&file=' . rawurlencode($term)); - exit(); -} diff --git a/src/App/Router.php b/src/App/Router.php index b94c0bb58d..48d63224ed 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -109,7 +109,8 @@ class Router $collector->addRoute(['GET'], '/{guid}/status_message', Module\Diaspora\Fetch::class); $collector->addRoute(['GET'], '/{guid}/reshare', Module\Diaspora\Fetch::class); }); - $this->routeCollector->addRoute(['GET'], '/filer[/{id:\d+}]', Module\Filer::class); + $this->routeCollector->addRoute(['GET'], '/filer[/{id:\d+}]', Module\Filer\SaveTag::class); + $this->routeCollector->addRoute(['GET'], '/filerm/{id:\d+}', Module\Filer\RemoveTag::class); $this->routeCollector->addRoute(['GET'], '/followers/{owner}', Module\Followers::class); $this->routeCollector->addRoute(['GET'], '/following/{owner}', Module\Following::class); $this->routeCollector->addGroup('/group', function (RouteCollector $collector) { diff --git a/src/Module/Filer/RemoveTag.php b/src/Module/Filer/RemoveTag.php new file mode 100644 index 0000000000..bddaaf9dc2 --- /dev/null +++ b/src/Module/Filer/RemoveTag.php @@ -0,0 +1,51 @@ +getLogger(); + + $item_id = (($app->argc > 1) ? intval($app->argv[1]) : 0); + + $term = XML::unescape(trim(defaults($_GET, 'term', ''))); + $cat = XML::unescape(trim(defaults($_GET, 'cat', ''))); + + $category = (($cat) ? true : false); + + if ($category) { + $term = $cat; + } + + $logger->info('Filer - Remove Tag', [ + 'term' => $term, + 'item' => $item_id, + 'category' => ($category ? 'true' : 'false') + ]); + + if ($item_id && strlen($term)) { + if (FileTag::unsaveFile(local_user(), $item_id, $term, $category)) { + info('Item removed'); + } + } else { + info('Item was not deleted'); + } + + $app->internalRedirect('/network?f=&file=' . rawurlencode($term)); + } +} diff --git a/src/Module/Filer.php b/src/Module/Filer/SaveTag.php similarity index 95% rename from src/Module/Filer.php rename to src/Module/Filer/SaveTag.php index da59084da0..f5d6115199 100644 --- a/src/Module/Filer.php +++ b/src/Module/Filer/SaveTag.php @@ -1,6 +1,6 @@