root/devel-backup/units/magpie/function_view.php

Revision 111, 1.6 kB (checked in by ben, 3 years ago)

Your Resources changes to emphasise individual resource feeds over the aggregator. More alterations are required.

  • Property svn:eol-style set to native
Line 
1 <?php
2
3     // $parameter = the ID number of the user
4     
5     // Convert $parameter to an integer, see if it exists
6         $parameter = (int) $parameter;
7
8     // If the feed offset hasn't been set, it's 0
9         if (!isset($_REQUEST['feed_offset'])) {
10             $feed_offset = 0;
11         } else {
12             $feed_offset = (int) $_REQUEST['feed_offset'];
13         }
14
15         $numposts = db_query("select count(*) as num from feed_subscriptions join feed_posts on feed_posts.feed = feed_subscriptions.feed_id where feed_subscriptions.user_id = $parameter");
16         $numposts = $numposts[0]->num;
17         
18         $posts = db_query("select feed_posts.*, feeds.name, feeds.siteurl, feeds.tagline, feeds.url as feedurl from feed_subscriptions join feed_posts on feed_posts.feed = feed_subscriptions.feed_id join feeds on feeds.ident = feed_subscriptions.feed_id where feed_subscriptions.user_id = $parameter order by feed_posts.added desc limit 25 offset $feed_offset");
19         
20         if (sizeof($posts) > 0) {
21             foreach($posts as $post) {
22
23                 $run_result .= run("rss:view:post",$post);
24                 
25             }
26         }
27         
28         $url = url;
29         $profile_name = htmlentities(stripslashes($_REQUEST['profile_name']));
30         
31         if ($numposts - ($feed_offset + 25) > 0) {
32             $display_feed_offset = $feed_offset + 25;
33             $back = gettext("Back");
34             $run_result .= <<< END
35                 
36                 <a href="{$url}{$profile_name}/feeds/all/skip={$display_feed_offset}">&lt;&lt; $back</a>
37                 
38 END;
39         }
40         if ($feed_offset > 0) {
41             $display_feed_offset = $feed_offset - 25;
42             if ($display_feed_offset < 0) {
43                 $display_feed_offset = 0;
44             }
45             $next = gettext("Next");
46             $run_result .= <<< END
47                 
48                 <a href="{$url}{$profile_name}/feeds/all/skip={$display_feed_offset}">$next &gt;&gt;</a>
49                 
50 END;
51         }
52         
53 ?>
Note: See TracBrowser for help on using the browser.