]> git.wh0rd.org - tt-rss.git/blobdiff - index.php
modify includes to init session before translations are applied
[tt-rss.git] / index.php
index 5b5560a9a548a2552edf4746db213bf56f960ec7..36d87558f9c024ffaace4a71cd90da92733e925a 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,16 +1,39 @@
 <?php
-       set_include_path(get_include_path() . PATH_SEPARATOR . "include");
+       if (!file_exists("config.php")) {
+               print "<b>Fatal Error</b>: You forgot to copy
+               <b>config.php-dist</b> to <b>config.php</b> and edit it.\n";
+               exit;
+       }
+
+       set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
+               get_include_path());
 
-       require_once "functions.php";
        require_once "sessions.php";
+       require_once "functions.php";
        require_once "sanity_check.php";
        require_once "version.php";
        require_once "config.php";
        require_once "db-prefs.php";
+       require_once "lib/Mobile_Detect.php";
+
+       $mobile = new Mobile_Detect();
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
 
-       init_connection($link);
+       if (!init_connection($link)) return;
+
+       global $pluginhost;
+
+       if (!$_REQUEST['mobile']) {
+               if ($mobile->isTablet() && $pluginhost->get_plugin("digest")) {
+                       header('Location: backend.php?op=digest');
+                       exit;
+               } else if ($mobile->isMobile()) {
+                       header('Location: mobile/index.php');
+                       exit;
+               }
+       }
+
 
        login_sequence($link);
 
@@ -33,6 +56,9 @@
        <?php print_theme_includes($link) ?>
        <?php print_user_stylesheet($link) ?>
 
+       <script type="text/javascript">
+       </script>
+
        <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
 
        <script type="text/javascript" src="lib/prototype.js"></script>
        <script type="text/javascript" src="lib/dojo/tt-rss-layer.js"></script>
 
        <script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>
-       <script type="text/javascript" charset="utf-8" src="js/tt-rss.js?<?php echo $dt_add ?>"></script>
-       <script type="text/javascript" charset="utf-8" src="js/functions.js?<?php echo $dt_add ?>"></script>
-       <script type="text/javascript" charset="utf-8" src="js/feedlist.js?<?php echo $dt_add ?>"></script>
-       <script type="text/javascript" charset="utf-8" src="js/viewfeed.js?<?php echo $dt_add ?>"></script>
        <script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script>
 
+       <script type="text/javascript">
+       <?php
+               require 'lib/jsmin.php';
+
+               global $pluginhost;
+
+               foreach ($pluginhost->get_plugins() as $n => $p) {
+                       if (method_exists($p, "get_js")) {
+                               echo JSMin::minify($p->get_js());
+                       }
+               }
+
+               foreach (array("tt-rss", "functions", "feedlist", "viewfeed", "FeedTree") as $js) {
+                       if (!isset($_GET['debug'])) {
+                               echo JSMin::minify(file_get_contents("js/$js.js"));
+                       } else {
+                               echo file_get_contents("js/$js.js");
+                       }
+               }
+       ?>
+       </script>
+
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 
        <script type="text/javascript">
 </div>
 
 <div id="header">
-       <?php if (!SINGLE_USER_MODE) { ?>
+       <?php if (!$_SESSION["hide_hello"]) { ?>
                        <?php echo __('Hello,') ?> <b><?php echo $_SESSION["name"] ?></b> |
        <?php } ?>
        <a href="prefs.php"><?php echo __('Preferences') ?></a>
                                <?php echo __('Comments?') ?></a>
        <?php } ?>
 
-       <?php if (!SINGLE_USER_MODE) { ?>
+       <?php if (!$_SESSION["hide_logout"]) { ?>
                        | <a href="backend.php?op=logout"><?php echo __('Logout') ?></a>
        <?php } ?>
 
                alt="new_version_icon"/>
 </div>
 
-<div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)">
-       <?php include "help/3.php" ?>
-</div>
-
 <div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
 <div id="cmdline" style="display : none"></div>
 <div id="auxDlg" style="display : none"></div>
                </select>
 
                <button dojoType="dijit.form.Button" name="update"
-                       onclick="scheduleFeedUpdate()">
+                       onclick="viewCurrentFeed()">
                        <?php echo __('Update') ?></button>
 
                <button dojoType="dijit.form.Button"
                                        <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
                                        <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
                                        <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
+                                       <?php if ($pluginhost->get_plugin("digest")) { ?>
                                        <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcDigest')"><?php echo __('Switch to digest...') ?></div>
-                                       <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagCloud')"><?php echo __('Show tag cloud...') ?></div>
+                                       <?php } ?>
+                                               <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagCloud')"><?php echo __('Show tag cloud...') ?></div>
                                        <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagSelect')"><?php echo __('Select by tags...') ?></div>
                                        <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...') ?></div>
                                        <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...') ?></div>
                                        <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
-                                       <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAbout')"><?php echo __('About...') ?></div>
                                </div>
                        </div>
                </div>