forked from RomanSixty/Feed-on-Feeds
-
Notifications
You must be signed in to change notification settings - Fork 3
/
view-action.php
executable file
·78 lines (67 loc) · 2.44 KB
/
view-action.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/*
* This file is part of FEED ON FEEDS - http://feedonfeeds.com/
*
* view-action.php - marks selected items as read (or unread)
*
*
* Copyright (C) 2004-2007 Stephen Minutillo
* [email protected] - http://minutillo.com/steve/
*
* Distributed under the GPL - see LICENSE
*
*/
include_once "fof-main.php";
$items = array();
foreach ($_POST as $key => $val) {
if ($val == "checked") {
$key = substr($key, 1);
$items[] = $key;
}
}
/* update a view's sorting settings, removes the view if it matches user's current default */
if (!empty($_POST['view_order'])) {
$feed = empty($_POST['view_feed']) ? NULL : $_POST['view_feed'];
$what = empty($_POST['view_what']) ? NULL : $_POST['view_what'];
$prefs = &FoF_Prefs::instance();
$order = $prefs->get('order');
$tag_ids = fof_db_get_tag_name_map(explode(' ', $what));
$feed_ids = array_filter(array($feed));
$settings = fof_db_view_settings_get(fof_current_user(), $tag_ids, $feed_ids);
$settings['order'] = $_POST['view_order'];
if ($order == $_POST['view_order']) {
/* As there's only one view option currently, just remove view entirely if desired order matches default. */
fof_db_view_expunge(fof_current_user(), $tag_ids, $feed_ids);
echo '<span title="Your default sort order has been reinstated for viewing this collection of items.">♥</span>';
} else {
fof_db_view_settings_set(fof_current_user(), $tag_ids, $feed_ids, $settings);
echo '<span title="The current sort order will now be used for viewing this collection of items.">♥</span>';
}
exit();
}
if (!empty($_POST['deltag'])) {
fof_untag(fof_current_user(), $_POST['deltag']);
} else if (!empty($_POST['feed'])) {
fof_db_mark_feed_read(fof_current_user(), $_POST['feed']);
} else if (!empty($_POST['mark_read'])) {
fof_db_mark_read(fof_current_user(), array($_POST['mark_read']));
} else if (!empty($_POST['fold'])) {
fof_db_fold(fof_current_user(), array($_POST['fold']));
} else if (!empty($_POST['unfold'])) {
fof_db_unfold(fof_current_user(), array($_POST['unfold']));
} else if (!empty($_POST['tag_read'])) {
fof_db_mark_tag_read(fof_current_user(), $_POST['tag_read']);
} else {
if (!empty($items) && !empty($_POST['action'])) {
if ($_POST['action'] == 'read') {
fof_db_mark_read(fof_current_user(), $items);
}
if ($_POST['action'] == 'unread') {
fof_db_mark_unread(fof_current_user(), $items);
}
}
if (!empty($_POST['return'])) {
header("Location: " . urldecode($_POST['return']));
}
}
?>