forked from RomanSixty/Feed-on-Feeds
-
Notifications
You must be signed in to change notification settings - Fork 3
/
add-tag.php
executable file
·37 lines (33 loc) · 883 Bytes
/
add-tag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
* This file is part of FEED ON FEEDS - http://feedonfeeds.com/
*
* add-tag.php - adds (or removes) a tag to an item
*
*
* Copyright (C) 2004-2007 Stephen Minutillo
* [email protected] - http://minutillo.com/steve/
*
* Distributed under the GPL - see LICENSE
*
*/
include_once 'fof-main.php';
if (empty($_POST['tag']) or empty($_POST['item'])) {
header('Status: 400 Bad Request');
echo 'Incomplete data.';
exit();
}
$tags = $_POST['tag'];
$items = explode(',', $_POST['item']);
$remove = (isset($_POST['remove']) ? $_POST['remove'] : null);
foreach (explode(' ', $tags) as $tag) {
if ($remove == 'true') {
foreach ($items as $item) {
fof_untag_item(fof_current_user(), $item, $tag);
}
} else {
foreach ($items as $item) {
fof_tag_item ( fof_current_user (), $item, $tag );
}
}
}