}
$term = XML::unescape(trim($_GET['term']));
- $cat = XML::unescape(trim($_GET['cat']));
+ $cat = XML::unescape(trim(defaults($_GET, 'cat', '')));
$category = (($cat) ? true : false);
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
- Logger::log('filerm: tag ' . $term . ' item ' . $item_id);
+ Logger::log('filerm: tag ' . $term . ' item ' . $item_id . ' category ' . ($category ? 'true' : 'false'));
if ($item_id && strlen($term))
{
- FileTag::unsaveFile(local_user(), $item_id, $term, $category);
+ if (FileTag::unsaveFile(local_user(), $item_id, $term, $category)){
+ info('Item removed');
+ }
+ }
+ else {
+ info('Item was not deleted');
}
+ $a->internalRedirect('/network?f=&file=' . $term);
killme();
}
// Set this so that the conversation function can find out contact info for our wall-wall items
$a->page_contact = $a->contact;
+ $items = (empty($items) ? [] : $items);
$o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user());
if (!$update) {
return false;
}
- $fields = ['file' => str_replace($pattern, '', $item['file'])];
+ $fields = ['file' => str_replace($pattern, null, $item['file'])];
Item::update($fields, ['id' => $item_id]);
$r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d",
}
}
- if (!empty($files)) {
+ if (!is_null($files)) {
Term::insertFromFileFieldByItemId($item['id'], $files);
if (!empty($item['file'])) {
DBA::update('item', ['file' => ''], ['id' => $item['id']]);