root/trunk/gregarius/update.php

Revision 1774, 3.4 kB (checked in by cfriesen, 6 months ago)

Individual update (hope nothing is missing)

  • Property svn:eol-style set to native
  • Property svn:eolstyle set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 ###############################################################################
3 # Gregarius - A PHP based RSS aggregator.
4 # Copyright (C) 2003 - 2006 Marco Bonetti
5 #
6 ###############################################################################
7 # This program is free software and open source software; you can redistribute
8 # it and/or modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of the License,
10 # or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 # FITNESS FOR A PARTICULAR PURPOSE.     See the GNU General Public License for
15 # more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 59 Temple Place, Suite 330, Boston, MA    02111-1307    USA  or visit
20 # http://www.gnu.org/licenses/gpl.html
21 #
22 ###############################################################################
23 # E-mail:        mbonetti at gmail dot com
24 # Web page:        http://gregarius.net/
25 #
26 ###############################################################################
27
28 define ('RSS_NO_CACHE',true);
29 require_once('init.php');
30
31 $cline = isset($argv) && !$_REQUEST && isset($argc) && $argc;
32 if (!$cline && getConfig('rss.config.restrictrefresh')) {
33     die(__('Sorry, updating from the web is currently not allowed.'));
34 }
35 rss_require("cls/update.php");
36 rss_require("extlib/browser.php");
37
38 $sajax_request_type = "POST";
39 $sajax_debug_mode = 0;
40 $sajax_remote_uri = getPath() . "update.php";
41 $sajax_export_list = array("ajaxUpdate","ajaxUpdateCleanup");
42 sajax_init();
43
44 if (array_key_exists('js',$_GET)) {
45     header('Content-Type: text/javascript');
46     ajaxUpdateJavascript();
47     exit();
48 } elseif(array_key_exists('rs',$_REQUEST)) {
49     // this one handles the xmlhttprequest call from the above javascript
50     sajax_handle_client_request();
51     exit();
52 }
53
54 $browser = new Browser();
55 $silent = array_key_exists('silent', $_GET) || ($cline && in_array('--silent',$argv));
56 $newsonly = array_key_exists('newsonly', $_GET) || ($cline && in_array('--newsonly', $argv));
57 $mobile = array_key_exists('mobile',$_GET);
58
59 $cid = DEFAULT_CID;
60 if(array_key_exists('cid', $_GET)) {
61     $cid = $_GET['cid'];
62 } else if ($cline && in_array('--update-only', $argv)) {
63     foreach($argv as $k => $v) {
64         if ('--update-only' == $v) {
65             $cid = $argv[$k+1];
66             break;
67         }
68     }
69 }
70
71 $GLOBALS['rss'] -> header = new Header(
72             __('Updating'),
73             LOCATION_UPDATE,
74             null,
75             "",
76             (HDR_NONE | HDR_NO_CACHECONTROL )
77         );
78     
79 $GLOBALS['rss'] -> feedList = new FeedList(false);
80
81 // Instantiate a different Update object, depending on the client
82 if ($cline && !$silent && !$newsonly) {
83     $update = new CommandLineUpdate($cid);
84
85 } elseif ($cline && !$silent && $newsonly) {
86     $update = new CommandLineUpdateNews($cid);
87     
88 } elseif (getConfig('rss.config.serverpush') && !$silent && $browser->supportsServerPush()) {
89     $update = new HTTPServerPushUpdate($cid);   
90     
91 } elseif(!$silent && $browser->supportsAJAX()) {
92     $update = new AJAXUpdate($cid);   
93
94 } elseif($mobile) {
95     $update = new MobileUpdate($cid);
96     
97 } else {
98     error_reporting(0);
99     $update = new SilentUpdate($cid);
100 }
101
102 $GLOBALS['rss'] -> appendContentObject($update);
103 if (!$silent && !$cline) {
104     $GLOBALS['rss'] -> renderWithTemplate('index.php','update');
105 } else {
106     $update->render();
107 }
108
109 ?>
110
Note: See TracBrowser for help on using the browser.