| 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 | function rss_home_dir() { |
|---|
| 29 | if (!defined('GREGARIUS_HOME')) { |
|---|
| 30 | define('GREGARIUS_HOME',dirname(__FILE__) . "/"); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | return GREGARIUS_HOME; |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | function rss_require($file,$once=true) { |
|---|
| 37 | $required_file = dirname(__FILE__) . '/'. $file; |
|---|
| 38 | if ($once) { |
|---|
| 39 | require_once($required_file); |
|---|
| 40 | } else { |
|---|
| 41 | require($required_file); |
|---|
| 42 | } |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 46 | // my-hacks support |
|---|
| 47 | // |
|---|
| 48 | |
|---|
| 49 | if (file_exists(dirname(__FILE__) . '/rss_extra.php')) { |
|---|
| 50 | rss_require('rss_extra.php'); |
|---|
| 51 | } |
|---|
| 52 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 53 | // Bootstrap |
|---|
| 54 | // |
|---|
| 55 | rss_require('core.php'); |
|---|
| 56 | rss_bootstrap(); |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 60 | // Base includes |
|---|
| 61 | // |
|---|
| 62 | rss_require('util.php'); |
|---|
| 63 | rss_require('cls/rss.php'); |
|---|
| 64 | rss_require('cls/config.php'); |
|---|
| 65 | rss_require('themes.php'); |
|---|
| 66 | rss_require('plugins.php'); |
|---|
| 67 | rss_require('cls/user.php'); |
|---|
| 68 | |
|---|
| 69 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 70 | // Error reporting |
|---|
| 71 | // |
|---|
| 72 | |
|---|
| 73 | if (getConfig('rss.meta.debug')) { |
|---|
| 74 | error_reporting(E_ALL); |
|---|
| 75 | } else { |
|---|
| 76 | error_reporting(0); |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | if (!isset($GLOBALS['rss'])) { |
|---|
| 80 | rss_require('cls/rss.php'); |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 84 | // Classes |
|---|
| 85 | // |
|---|
| 86 | |
|---|
| 87 | _pf('parsing classes:'); |
|---|
| 88 | rss_require('cls/errorhandler.php'); |
|---|
| 89 | _pf(' ... errorhandler.php'); |
|---|
| 90 | rss_require('cls/items.php'); |
|---|
| 91 | _pf(' ... items.php'); |
|---|
| 92 | rss_require("cls/channels.php"); |
|---|
| 93 | _pf(' ... channels.php'); |
|---|
| 94 | rss_require('cls/sidemenu.php'); |
|---|
| 95 | _pf(' ... sidemenu.php'); |
|---|
| 96 | rss_require("cls/header.php"); |
|---|
| 97 | _pf(' ... header.php'); |
|---|
| 98 | rss_require("cls/nav.php"); |
|---|
| 99 | _pf(' ... nav.php'); |
|---|
| 100 | |
|---|
| 101 | _pf('parsing remaining files...'); |
|---|
| 102 | |
|---|
| 103 | rss_require('extlib/rss_fetch.inc'); |
|---|
| 104 | rss_require('extlib/rss_utils.inc'); |
|---|
| 105 | rss_require('extlib/kses.php'); |
|---|
| 106 | rss_require('extlib/Sajax.php'); |
|---|
| 107 | rss_require('tags.php'); |
|---|
| 108 | |
|---|
| 109 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 110 | // Localization |
|---|
| 111 | _pf('Loading l10n...'); |
|---|
| 112 | |
|---|
| 113 | require_once('cls/l10n.php'); |
|---|
| 114 | $GLOBALS['rssl10n'] = new RSSl10n(); |
|---|
| 115 | $lang = $GLOBALS['rssl10n']->getLocale(); |
|---|
| 116 | _pf('done'); |
|---|
| 117 | |
|---|
| 118 | // Theme specific l10n handling |
|---|
| 119 | list($theme,$media) = getActualTheme(); |
|---|
| 120 | |
|---|
| 121 | if (file_exists(RSS_THEME_DIR."/$theme/intl/$lang.php")) { |
|---|
| 122 | rss_require(RSS_THEME_DIR."/$theme/intl/$lang.php"); |
|---|
| 123 | } |
|---|
| 124 | elseif ($lang != "en" && file_exists(RSS_THEME_DIR."/$theme/intl/en.php")) { |
|---|
| 125 | rss_require(RSS_THEME_DIR."/$theme/intl/en.php"); |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | // |
|---|
| 130 | if (file_exists(getThemePath(GREGARIUS_HOME)."overrides.php")) { |
|---|
| 131 | rss_require(getThemePath('')."overrides.php"); |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | /* |
|---|
| 135 | // Load the right locale |
|---|
| 136 | if (defined('OVERRIDE_LOCALE')) { |
|---|
| 137 | setlocale(LC_TIME,constant("OVERRIDE_LOCALE")); |
|---|
| 138 | } |
|---|
| 139 | elseif (isset($_SERVER["WINDIR"]) && defined("LOCALE_WINDOWS")) { |
|---|
| 140 | setlocale(LC_TIME,constant("LOCALE_WINDOWS")); |
|---|
| 141 | } |
|---|
| 142 | elseif (defined("LOCALE_LINUX")) { |
|---|
| 143 | setlocale(LC_TIME,constant("LOCALE_LINUX")); |
|---|
| 144 | } |
|---|
| 145 | else { |
|---|
| 146 | //last chance, we try to guess it |
|---|
| 147 | $mylocale=strtolower(getConfig('rss.output.lang')); |
|---|
| 148 | $mylocale.="_".strtoupper($mylocale); |
|---|
| 149 | if (!setlocale(LC_TIME,$mylocale)) { |
|---|
| 150 | // very last resort: try to load the system locale |
|---|
| 151 | setlocale(LC_TIME,""); |
|---|
| 152 | } |
|---|
| 153 | } |
|---|
| 154 | */ |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | _pf('done'); |
|---|
| 158 | ?> |
|---|