blob: 76ebb25502de4d6b44928611bb9108629c2a73f0 (
plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
<?php
require_once __DIR__ . '/../app/app.php';
require_once __DIR__ . '/inc/auth.inc.php';
if (!$PlanetConfig::isInstalled()) {
die('<p>' . _g('You might want to <a href="../install.php">install moonmoon</a>.') . '</p>');
}
//Instantiate app
$Planet = new Planet($PlanetConfig);
//Load
if (0 < $Planet->loadOpml($PlanetConfig->getOpmlFile())) {
$Planet->loadFeeds();
$items = $Planet->getItems();
}
$everyone = $Planet->getPeople();
$count_feeds = count($everyone);
$page_id = 'admin-feed';
$footer_extra = <<<FRAGMENT
<script>
var allCheckboxes = function(status){
var form = document.getElementById('feedmanage');
var selectboxes = form.getElementsByTagName('input');
for (var i=0; i<selectboxes.length; i++){
if ('checkbox' == selectboxes[i].type){
selectboxes[i].checked = status;
}
}
}
window.onload = function(){
//Select/unselect rows
var form = document.getElementById('feedmanage');
var selectboxes = form.getElementsByTagName('input');
for (var i=0; i<selectboxes.length; i++){
if ('checkbox' == selectboxes[i].type) {
selectboxes[i].onchange = function() {
var tr = this.parentNode.parentNode;
if (this.checked) {
tr.className += ' selected';
} else {
tr.className = tr.className.replace('selected','');
}
}
}
}
var btSelectall = document.getElementById('selectall');
btSelectall.onclick = function(){
allCheckboxes('checked');
}
var btSelectnone = document.getElementById('selectnone');
btSelectnone.onclick = function(){
allCheckboxes('');
}
}
</script>
FRAGMENT;
ob_start();
?>
<div class="widget">
<h3><?=_g('Add Feed')?></h3>
<form action="subscriptions.php" method="post" id="feedimport">
<fieldset>
<label for="url"><?=_g('Link:')?></label>
<input type="text" class="text" name="url" id="url" placeholder="http://" class="text" size="50" />
<input type="submit" class="submit add" name="add" value="<?=_g('Add Feed')?>" />
</fieldset>
<p class="help"><?=_g('Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.')?></p>
<input type="hidden" value="<?php echo $csrf->generate('feedmanage'); ?>" name="_csrf">
</form>
</div>
<div class="widget">
<h3><?=_g('Manage existing feeds')?></h3>
<form action="subscriptions.php" method="post" id="feedmanage">
<p class="action">
<span class="count"><?php echo sprintf(_g('Number of feeds: %s'), $count_feeds)?></span>
<input type="hidden" value="<?php echo $csrf->generate('feedmanage'); ?>" name="_csrf">
<input type="submit" class="submit save" name="save" id="save" value="<?=_g('Save changes')?>" />
<input type="submit" class="submit delete" name="delete" id="delete" value="<?=_g('Delete selected Feeds')?>" />
</p>
<p class="select"><?=_g('Select :')?> <a href="javascript:void(0);" id="selectall"><?=_g('All')?></a>, <a href="javascript:void(0);" id="selectnone"><?=_g('None')?></a></p>
<table>
<thead>
<tr>
<th><span><?=_g('Selection')?></span></th>
<th><?=_g('Name')?></th>
<th><?=_g('Last entry')?></th>
<th><?=_g('Website link')?></th>
<th><?=_g('Feed link')?></th>
<th><?=_g('Unavailable')?></th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($everyone as $opml_person) {
$i++;
?>
<tr class="<?=($i%2)?'odd':'even'; ?>">
<td><input type="checkbox" class="checkbox" name="opml[<?=$i; ?>][delete]" /></td>
<td><input type="text" size="10" class="text" name="opml[<?=$i; ?>][name]" value="<?=$opml_person->getName(); ?>" /></td>
<td>
<?php
$items = $opml_person->get_items();
if (count($items) > 0) {
echo $items[0]->get_date();
} else {
echo _g('Not in cache');
}
$check_is_down = $opml_person->getIsDown() === '1' ? 'checked="checked"' : '';
?>
</td>
<td><input type="text" size="30" class="text" name="opml[<?=$i; ?>][website]" value="<?=$opml_person->getWebsite(); ?>" /></td>
<td><input type="text" size="30" class="text" name="opml[<?=$i; ?>][feed]" value="<?=$opml_person->getFeed(); ?>" /></td>
<td><input type="checkbox" readonly="readonly" name="opml[<?=$i; ?>][isDown]" <?=$check_is_down?> value="1" /></td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
</div>
<div class="widget">
<h3><?=_g('Upload OPML file')?></h3>
<form action="subscriptions.php" method="post" id="opmlimport" enctype="multipart/form-data">
<p>Beware! This will totally erase and replace the list of your feeds just above.</p>
<fieldset>
<label for="url"><?=_g('File:')?></label>
<input type="file" class="text" name="opml" id="opml" class="text" size="50" />
<input type="submit" class="submit add" name="upload" value="<?=_g('Upload OPML file and replace existing feeds')?>" />
</fieldset>
<input type="hidden" value="<?php echo $csrf->generate('feedmanage'); ?>" name="_csrf">
</form>
</div>
<?php
$page_content = ob_get_contents();
ob_end_clean();
$admin_access = 1;
require_once __DIR__ . '/template.php';
|