blob: 77ba04dc0c15b6e2e80d8405a33efe6199de47eb (
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
|
<?php
require_once dirname(__FILE__) . '/inc/auth.inc.php';
require_once dirname(__FILE__) . '/../app/app.php';
//Load configuration
$config_file = dirname(__FILE__) . '/../custom/config.yml';
if (is_file($config_file)){
$conf = Spyc::YAMLLoad($config_file);
$PlanetConfig = new PlanetConfig($conf);
} else {
die('Config file (custom/config.yml) is missing.');
}
//Instantiate app
$Planet = new Planet($PlanetConfig);
//Load
if (0 < $Planet->loadOpml(dirname(__FILE__) . '/../custom/people.opml')) {
$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>Add a new feed</h3>
<form action="subscriptions.php" method="post" id="feedimport">
<fieldset>
<label for="url">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="Add feed" />
</fieldset>
<p class="help">Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.</p>
</form>
</div>
<div class="widget">
<h3>Manage existing feeds</h3>
<form action="subscriptions.php" method="post" id="feedmanage">
<p class="action">
<span class="count">Number of feeds: <?=$count_feeds?></span>
<input type="submit" class="submit save" name="save" id="save" value="Save changes" />
<input type="submit" class="submit delete" name="delete" id="delete" value="Delete selected" />
</p>
<p class="select">Select : <a href="javascript:void(0);" id="selectall">All</a>, <a href="javascript:void(0);" id="selectnone">None</a></p>
<table>
<thead>
<tr>
<th><span>Selection</span></th>
<th>Name</th>
<th>Last entry</th>
<th>Website link</th>
<th>Feed link</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 "Not in cache";
}
?>
</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>
</tr>
<?php } ?>
</tbody>
</table>
</form>
</div>
<?php
$page_content = ob_get_contents();
ob_end_clean();
$admin_access = 1;
require_once dirname(__FILE__) . '/template.php';
|