This repository has been archived by the owner on Jan 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
all.php
156 lines (148 loc) · 5.48 KB
/
all.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
require_once 'includes/dbconnect.php';
if ($user_id) {
require 'includes/application_header.php';
require 'includes/application_navi.php';
echo '<div id="right-col">';
echo '<div id="wrap" class="reader-field"><h2>'._('Alle Feeds').'</h2><p>';
if(!isset($_GET['show']) || $_GET['show'] == 'unread') echo '<strong>'._('Ungelesene Einträge').'</strong> · '; else echo '<a href="?show=unread">'._('Ungelesene Einträge').'</a> · ';
if(isset($_GET['show']) && $_GET['show'] == 'all') echo '<strong>'._('Alle Einträge').'</strong> · '; else echo '<a href="?show=all">'._('Alle Einträge').'</a> · ';
echo '<a href="markasread.php?feedid=all">'._('Alles als gelesen markieren').'</a>';
echo '</p>';
$dq = mysql_query("SELECT COUNT(`feedid`) as c, (SELECT COUNT(id) FROM feeds WHERE lastupdate < ".(time()-1000).") as c2 FROM `view_feed_subscriptions` WHERE `userid` =". $user_id. " AND lastupdate < ".(time()-1000));
$d = mysql_fetch_object($dq);
if($d->c > 7 or $d->c2 > 13){
echo '<p class="error">
'._('Wir leiden derzeit leider unter einem technischen Problem und hoffen, dass dieses bald behoben werden kann.').'
</p>';
}
$lasttimestamp = mysql_query("SELECT
`timestamp`
FROM
`feeds_entries`
WHERE
".(
(!isset($_GET['show']) || $_GET['show'] == 'unread') ?
"0 = (SELECT
COUNT(`article_id`)
FROM
`feeds_read`
WHERE
`user_id` = ". $user_id. "
AND
`feeds_read`.`article_id` = `feeds_entries`.`article_id`
)
AND"
: '')."
1 = (SELECT
COUNT(`feedid`)
FROM
`feeds_subscription`
WHERE
`userid` =". $user_id. "
AND
`feeds_subscription`.`feedid` = `feeds_entries`.`feed_id`
)
ORDER by
timestamp DESC
LIMIT 30");
while($r = mysql_fetch_object($lasttimestamp)) {$last = $r;}
$lasttimestamp = $last->timestamp;
$all_qry = mysql_query("SELECT
`feed_id`,
IF(
((SELECT alias FROM feeds_subscription WHERE `userid` = ".$user_id." AND `feeds_subscription`.`feedid` = `feeds_entries`.`feed_id`) != ''),
(SELECT alias FROM feeds_subscription WHERE `userid` = ".$user_id." AND `feeds_subscription`.`feedid` = `feeds_entries`.`feed_id`),
`name`
) as `feedtitle`,
`feeds`.`url` as `feedurl`,
`article_id`,
`title`,
`guid`,
`timestamp`,
(SELECT COUNT(*) FROM sticky s WHERE user_id = ".$user_id." AND s.article_id = `feeds_entries`.article_id) as `sticky`,
`article_id`,
`summary`,
`updated`,
`feeds_entries`.`url` as `articleurl`,
(
SELECT
COUNT(`article_id`)
FROM
`feeds_read`
WHERE
`user_id` = ". $user_id. "
AND
`feeds_read`.`article_id` = `feeds_entries`.`article_id`
) as `read_status`
FROM
`feeds_entries`
INNER JOIN
`feeds`
ON
`feeds`.`id` = `feeds_entries`.`feed_id`
WHERE
".(
(!isset($_GET['show']) || $_GET['show'] == 'unread') ?
"0 = (SELECT
COUNT(`article_id`)
FROM
`feeds_read`
WHERE
`user_id` = ". $user_id. "
AND
`feeds_read`.`article_id` = `feeds_entries`.`article_id`
)
AND"
: '')."
1 = (SELECT
COUNT(`feedid`)
FROM
`feeds_subscription`
WHERE
`userid` =". $user_id. "
AND
`feeds_subscription`.`feedid` = `feeds_entries`.`feed_id`
)
AND timestamp >= ".intval($lasttimestamp)."
ORDER by
`timestamp` desc");
if($lasttimestamp < 1) $lasttimestamp = 0;
echo '<script type="text/javascript">
var lasttimestamp = '.$lasttimestamp.';
</script>';
if(mysql_num_rows($all_qry) == 0){
echo '<p class="info">
'.sprintf(_('Dieser Feed besitzt keine%s Einträge. Wenn du ihn gerade erst aboniert hast, kann es bis zu fünf Minuten dauern, bis hier Einträge erscheinen. Außerdem werden keine Einträge angezeigt, die älter als 30 Tage sind.'), ((!isset($_GET['show']) || $_GET['show'] == 'unread') ? _(' ungelesenen') : '')).'
</p>
<script type="text/javascript">
window.setTimeout(function(){
$("#wrap").append("<p class=\"reload\"><a href=\'javascript:location.reload();\'>'._('Neu laden').'</a></p>");
}, 120000);
</script>';
}
while ($row = mysql_fetch_assoc($all_qry)) {
echo '<div id="article_'.$row["article_id"].'"'.($row["read_status"] == 0 ? ' class="unreadarticle"' : ' class="readarticle'.(($row["sticky"] == 1) ? ' sticky' : '').'"').'>';
echo '<a href="'. $row["articleurl"]. '" class="titlelink" target="_blank">'. utf_correct($row["title"]). '</a>';
if($row["updated"] > 0){
echo '<span class="updated" title="'.sprintf(_("Dieser Artikel hat sich %d mal geändert"), $row["updated"]).'">'.$row["updated"].'</span>';
}
echo '<br />';
echo '<em>'. date(_("d.m.Y - H:i"), $row["timestamp"]). ': '. $row["feedtitle"]. '</em>';
if($row["sticky"] == 1) echo ' · <a href="javascript:unsticky('.$row["article_id"].');" class="stickylink">'._('nicht merken').'</a>';
else echo ' · <a href="javascript:sticky('.$row["article_id"].');" class="stickylink">'._('merken').'</a>';
echo '<br /><div class="sum">'. utf_correct(gzuncompress($row["summary"])). '</div><div class="clear"></div></div>';
}
echo '</div></div>
<div id="right-gap"></div>
<div class="clear"></div>
<script type="text/javascript">
register_scroll_hotkeys();
register_focus_handler();
register_scroll_readhandler();
</script>';
require 'includes/application_footer.php';
} else {
header('Location: index.php');
exit;
}