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