| 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 | $cline = isset($argv) && !$_REQUEST && isset($argc) && $argc; |
|---|
| 31 | if (!$cline && getConfig('rss.config.restrictrefresh')) { |
|---|
| 32 | die(__('Sorry, updating from the web is currently not allowed.')); |
|---|
| 33 | } |
|---|
| 34 | rss_require("cls/update.php"); |
|---|
| 35 | rss_require("extlib/browser.php"); |
|---|
| 36 | |
|---|
| 37 | $sajax_request_type = "POST"; |
|---|
| 38 | $sajax_debug_mode = 0; |
|---|
| 39 | $sajax_remote_uri = getPath() . "update.php"; |
|---|
| 40 | $sajax_export_list = array("ajaxUpdate","ajaxUpdateCleanup"); |
|---|
| 41 | sajax_init(); |
|---|
| 42 | |
|---|
| 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 | |
|---|
| 55 | $browser = new Browser(); |
|---|
| 56 | $silent = array_key_exists('silent', $_GET) || ($cline && in_array('--silent',$argv)); |
|---|
| 57 | $newsonly = array_key_exists('newsonly', $_GET) || ($cline && in_array('--newsonly', $argv)); |
|---|
| 58 | $mobile = array_key_exists('mobile',$_GET); |
|---|
| 59 | |
|---|
| 60 | $GLOBALS['rss'] -> header = new Header( |
|---|
| 61 | __('Updating'), |
|---|
| 62 | LOCATION_UPDATE, |
|---|
| 63 | null, |
|---|
| 64 | "", |
|---|
| 65 | (HDR_NONE | HDR_NO_CACHECONTROL ) |
|---|
| 66 | ); |
|---|
| 67 | |
|---|
| 68 | $GLOBALS['rss'] -> feedList = new FeedList(false); |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | // Instantiate a different Update object, depending on the client |
|---|
| 72 | if ($cline && !$silent && !$newsonly) { |
|---|
| 73 | $update = new CommandLineUpdate(); |
|---|
| 74 | |
|---|
| 75 | } elseif ($cline && !$silent && $newsonly) { |
|---|
| 76 | $update = new CommandLineUpdateNews(); |
|---|
| 77 | |
|---|
| 78 | } elseif (getConfig('rss.config.serverpush') && !$silent && $browser->supportsServerPush()) { |
|---|
| 79 | $update = new HTTPServerPushUpdate(); |
|---|
| 80 | |
|---|
| 81 | } elseif(!$silent && $browser->supportsAJAX()) { |
|---|
| 82 | $update = new AJAXUpdate(); |
|---|
| 83 | |
|---|
| 84 | } elseif($mobile) { |
|---|
| 85 | $update = new MobileUpdate(); |
|---|
| 86 | |
|---|
| 87 | } else { |
|---|
| 88 | error_reporting(0); |
|---|
| 89 | $update = new SilentUpdate(); |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | $GLOBALS['rss'] -> appendContentObject($update); |
|---|
| 93 | if (!$silent && !$cline) { |
|---|
| 94 | $GLOBALS['rss'] -> renderWithTemplate('index.php','update'); |
|---|
| 95 | } else { |
|---|
| 96 | $update->render(); |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | ?> |
|---|