forked from yPhil-gh/nws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
131 lines (107 loc) · 3.17 KB
/
index.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
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
<?
/*
Index : View feeds
Time-stamp: <index.php - Wed 15-Feb-2012 17:14:23>
This script is part of NWS
NWS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (isset($_GET['code'])) { die(highlight_file(__FILE__, 1)); }
?>
<!DOCTYPE html>
<html>
<head>
<title>nws</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" type="image/x-icon" href="nws/favicon.png" />
<link href="nws/jquery-ui.css" rel="stylesheet" type="text/css"/>
<style type="text/css" media="screen">@import "nws/nws.css";</style>
</head>
<body>
<script src="nws/jquery.min.js"></script>
<script src="nws/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$.ajaxSetup ({
cache: false
});
var ajax_load = '<img src="nws/loading.gif" class="loading" alt="loading..." />';
var loadUrl = 'nws/nws-reload-feed.php';
$('.reload').click(function(){
var DivToReload = $(this).parent()
var myUrl = DivToReload.attr('title')
DivToReload.children('div.innerContainer')
.html(ajax_load)
.load(loadUrl, "z="+myUrl);
});
$( "#tabs" ).tabs().find( ".ui-tabs-nav" ).sortable({ axis: "x" });
// $( ".feed" ).tooltip();
$('.reload').trigger('click');
});
</script>
<div id="tabs">
<?php
$conf = "nws/feeds.xml";
$urls = simplexml_load_file($conf);
$z = 0;
/* limite d'items par feed */
if (isset($_GET['limit'])) $feedsByTab = $_GET['limit'];
$feedsByTab="8";
function parse($u) {
$limit="8";
$feedRss=simplexml_load_file($u);
$chars = array(" ", ".", ":");
$i=0;
if($feedRss)
{
$items = $feedRss->channel->item;
$idiv = str_replace($chars, "", $feedRss->channel->title);
echo '
<div class="outerContainer" style="" title ="'.$u.'">
<span class="reload" title="Reload '.htmlspecialchars($feedRss->channel->title).'">φ</span>
<div class="innerContainer"></div>
</div>
';
}
}
foreach ($urls->url as $url) {
$myUrls[] = $url;
foreach($url->attributes() as $attr => $val) {
if ($attr == 'tab') {
$myTabs[] = array('tab'=> (string) $val, 'url'=> (string) $url);
}
}
}
foreach($myTabs as $aRow){
$tabGroups[$aRow['tab']][] = $aRow['url'];
}
echo '
<ul>
';
foreach (array_keys($tabGroups) as $tabName) {
echo '
<li><a title="'.$tabName.', Drag to re-order" href="#tab-'.$tabName.'"><span>'.$tabName.'</span></a></li>';
}
echo '
</ul>
';
foreach (array_keys($tabGroups) as $tabName) {
echo '<div id="tab-'.$tabName.'">';
foreach ($tabGroups[$tabName] as $tabUrl) {
parse($tabUrl);
}
echo '</div>';
}
?>
</div>
<a href="mgmt.php">mgmt</a>
</body>
</html>