2012-03-14 03:46:37 +00:00
|
|
|
<?php
|
|
|
|
|
2017-04-30 04:07:00 +00:00
|
|
|
use Friendica\App;
|
2018-10-29 21:20:46 +00:00
|
|
|
use Friendica\Core\Logger;
|
2017-08-26 06:04:21 +00:00
|
|
|
use Friendica\Core\System;
|
2018-10-30 18:51:45 +00:00
|
|
|
use Friendica\Model\FileTag;
|
2018-11-05 12:40:18 +00:00
|
|
|
use Friendica\Util\XML;
|
2017-04-30 04:07:00 +00:00
|
|
|
|
2018-10-30 18:51:45 +00:00
|
|
|
function filerm_content(App $a)
|
|
|
|
{
|
|
|
|
if (! local_user())
|
|
|
|
{
|
2012-03-14 03:46:37 +00:00
|
|
|
killme();
|
|
|
|
}
|
|
|
|
|
2018-11-05 12:40:18 +00:00
|
|
|
$term = XML::unescape(trim($_GET['term']));
|
2018-11-17 11:41:00 +00:00
|
|
|
$cat = XML::unescape(trim(defaults($_GET, 'cat', '')));
|
2012-05-04 13:42:56 +00:00
|
|
|
|
|
|
|
$category = (($cat) ? true : false);
|
2018-10-30 18:51:45 +00:00
|
|
|
|
|
|
|
if ($category)
|
|
|
|
{
|
2012-05-04 13:42:56 +00:00
|
|
|
$term = $cat;
|
2016-12-20 20:15:53 +00:00
|
|
|
}
|
2012-05-04 13:42:56 +00:00
|
|
|
|
2012-03-31 22:25:17 +00:00
|
|
|
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
2012-03-14 03:46:37 +00:00
|
|
|
|
2018-11-17 11:41:00 +00:00
|
|
|
Logger::log('filerm: tag ' . $term . ' item ' . $item_id . ' category ' . ($category ? 'true' : 'false'));
|
2012-03-14 03:46:37 +00:00
|
|
|
|
2018-10-30 18:51:45 +00:00
|
|
|
if ($item_id && strlen($term))
|
|
|
|
{
|
2018-11-17 11:41:00 +00:00
|
|
|
if (FileTag::unsaveFile(local_user(), $item_id, $term, $category)){
|
|
|
|
info('Item removed');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
info('Item was not deleted');
|
2016-12-20 20:15:53 +00:00
|
|
|
}
|
2012-03-14 03:46:37 +00:00
|
|
|
|
2018-11-17 11:41:00 +00:00
|
|
|
$a->internalRedirect('/network?f=&file=' . $term);
|
2012-03-14 03:46:37 +00:00
|
|
|
killme();
|
|
|
|
}
|