Only show new messages when clicking 'new' for subscribed users
This commit is contained in:
parent
c3825c2bd6
commit
27bdf4a60c
|
@ -668,7 +668,7 @@ function groups_show($gruppen) {
|
||||||
}
|
}
|
||||||
if(isset($userdata[$g->name])) {
|
if(isset($userdata[$g->name])) {
|
||||||
if($userdata[$g->name] < $lastarticleinfo->date) {
|
if($userdata[$g->name] < $lastarticleinfo->date) {
|
||||||
$groupdisplay.='<a href="overboard.php?thisgroup='._rawurlencode($g->name).'"><font class="search_result">(<b>new</b>)</font></a> ';
|
$groupdisplay.='<a href="overboard.php?thisgroup='._rawurlencode($g->name).'&time='.$userdata[$g->name].'"><font class="search_result">(<b>new</b>)</font></a> ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$groupdisplay.=get_date_interval(date("D, j M Y H:i T",$lastarticleinfo->date));
|
$groupdisplay.=get_date_interval(date("D, j M Y H:i T",$lastarticleinfo->date));
|
||||||
|
|
|
@ -79,6 +79,15 @@ $groupconfig=$file_groups;
|
||||||
$cachefile=$spooldir."/".$config_name."-overboard.dat";
|
$cachefile=$spooldir."/".$config_name."-overboard.dat";
|
||||||
$oldest = (time() - (86400 * $article_age));
|
$oldest = (time() - (86400 * $article_age));
|
||||||
|
|
||||||
|
if (isset($_GET['time'])) {
|
||||||
|
$user_time = $_GET['time'];
|
||||||
|
if(is_numeric($user_time)) {
|
||||||
|
if(($user_time > time()) || ($user_time < $oldest)) {
|
||||||
|
unset($user_time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['thisgroup'])) {
|
if (isset($_GET['thisgroup'])) {
|
||||||
$grouplist = array();
|
$grouplist = array();
|
||||||
$grouplist[0] = _rawurldecode(_rawurldecode($_GET['thisgroup']));
|
$grouplist[0] = _rawurldecode(_rawurldecode($_GET['thisgroup']));
|
||||||
|
@ -99,19 +108,21 @@ if(is_file($cachefile)) {
|
||||||
$stats = stat($cachefile);
|
$stats = stat($cachefile);
|
||||||
$oldest = $stats[9];
|
$oldest = $stats[9];
|
||||||
$cached_overboard = unserialize(file_get_contents($cachefile));
|
$cached_overboard = unserialize(file_get_contents($cachefile));
|
||||||
if($stats[9] > (time() - $cachetime)) {
|
if(!isset($user_time)) {
|
||||||
echo '<table cellspacing="0" width="100%" class="np_results_table">';
|
if($stats[9] > (time() - $cachetime)) {
|
||||||
foreach($cached_overboard as $result) {
|
echo '<table cellspacing="0" width="100%" class="np_results_table">';
|
||||||
if(($results % 2) != 0){
|
foreach($cached_overboard as $result) {
|
||||||
echo '<tr class="np_result_line1"><td class="np_result_line1" style="word-wrap:break-word";>';
|
if(($results % 2) != 0){
|
||||||
} else {
|
echo '<tr class="np_result_line1"><td class="np_result_line1" style="word-wrap:break-word";>';
|
||||||
echo '<tr class="np_result_line2"><td class="np_result_line2" style="word-wrap:break-word";>';
|
} else {
|
||||||
|
echo '<tr class="np_result_line2"><td class="np_result_line2" style="word-wrap:break-word";>';
|
||||||
|
}
|
||||||
|
echo $result;
|
||||||
|
$results++;
|
||||||
}
|
}
|
||||||
echo $result;
|
show_overboard_footer($stats, $results, true);
|
||||||
$results++;
|
exit(0);
|
||||||
}
|
}
|
||||||
show_overboard_footer($stats, $results, true);
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//ob_start();
|
//ob_start();
|
||||||
|
@ -332,17 +343,23 @@ foreach($files as $article) {
|
||||||
if(isset($cached_overboard) && isset($this_overboard)) {
|
if(isset($cached_overboard) && isset($this_overboard)) {
|
||||||
$new_overboard = array_merge($this_overboard, $cached_overboard);
|
$new_overboard = array_merge($this_overboard, $cached_overboard);
|
||||||
$new_overboard = array_slice($new_overboard, 0, $maxdisplay);
|
$new_overboard = array_slice($new_overboard, 0, $maxdisplay);
|
||||||
file_put_contents($cachefile, serialize($new_overboard));
|
if (!isset($user_time)) {
|
||||||
|
file_put_contents($cachefile, serialize($new_overboard));
|
||||||
|
}
|
||||||
} elseif(isset($this_overboard)) {
|
} elseif(isset($this_overboard)) {
|
||||||
$new_overboard = $this_overboard;
|
$new_overboard = $this_overboard;
|
||||||
file_put_contents($cachefile, serialize($new_overboard));
|
if (!isset($user_time)) {
|
||||||
|
file_put_contents($cachefile, serialize($new_overboard));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$new_overboard = $cached_overboard;
|
$new_overboard = $cached_overboard;
|
||||||
}
|
}
|
||||||
if(isset($cachedate)) {
|
if(isset($cachedate)) {
|
||||||
touch($cachefile, $cachedate);
|
if (!isset($user_time)) {
|
||||||
|
touch($cachefile, $cachedate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$results = 0;
|
$results = 1;
|
||||||
|
|
||||||
foreach($new_overboard as $result) {
|
foreach($new_overboard as $result) {
|
||||||
|
|
||||||
|
@ -352,6 +369,14 @@ foreach($files as $article) {
|
||||||
echo '<tr class="np_result_line2"><td class="np_result_line2" style="word-wrap:break-word";>';
|
echo '<tr class="np_result_line2"><td class="np_result_line2" style="word-wrap:break-word";>';
|
||||||
}
|
}
|
||||||
echo $result;
|
echo $result;
|
||||||
|
if (isset($user_time)) {
|
||||||
|
preg_match('/Posted:.*/i', $result, $posted_date);
|
||||||
|
$get_date = explode(': ', $posted_date[0]);
|
||||||
|
$showme = strtotime(trim(substr($get_date[1], 0, -2)));
|
||||||
|
if(($showme > time()) || ($showme < $user_time)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if($results++ > ($maxdisplay - 2))
|
if($results++ > ($maxdisplay - 2))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -416,8 +441,14 @@ if (isset($_GET['thisgroup'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_overboard_footer($stats, $results, $iscached) {
|
function show_overboard_footer($stats, $results, $iscached) {
|
||||||
|
global $user_time;
|
||||||
|
if(isset($user_time)) {
|
||||||
|
$recent = 'new';
|
||||||
|
} else {
|
||||||
|
$recent = 'recent';
|
||||||
|
}
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo "<p class=np_ob_tail><b>".$results."</b> recent articles found.</p>\r\n";
|
echo "<p class=np_ob_tail><b>".$results."</b> ".$recent." articles found.</p>\r\n";
|
||||||
#echo "<center><i>Rocksolid Overboard</i> version ".$version;
|
#echo "<center><i>Rocksolid Overboard</i> version ".$version;
|
||||||
include "tail.inc";
|
include "tail.inc";
|
||||||
if($iscached) {
|
if($iscached) {
|
||||||
|
|
Loading…
Reference in New Issue