]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - index.php
don't call flattr if flattr is disabled
[github/wallabag/wallabag.git] / index.php
index ef18254a4166f5a58976522dd8b270bad5ab8ae0..adfef71bef24e815cef7eef8152ccd27e5ea2c4a 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -1,84 +1,22 @@
 <?php
 /**
- * poche, a read it later open source system
+ * wallabag, self hostable application allowing you to not miss any content anymore
  *
- * @category   poche
- * @author     Nicolas LÅ“uillet <support@inthepoche.com>
+ * @category   wallabag
+ * @author     Nicolas LÅ“uillet <nicolas@loeuillet.org>
  * @copyright  2013
- * @license    http://www.wtfpl.net/ see COPYING file
+ * @license    http://opensource.org/licenses/MIT see COPYING file
  */
 
-include dirname(__FILE__).'/inc/config.php';
+define ('POCHE', '1.8.1');
+require 'check_essentials.php';
+require 'check_setup.php';
+require_once 'inc/poche/global.inc.php';
 
-$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
-$view   = (isset ($_GET['view'])) ? htmlspecialchars($_GET['view']) : '';
-$id     = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : '';
-$url    = (isset ($_GET['url'])) ? $_GET['url'] : '';
+// Start session
+Session::$sessionName = 'wallabag';
+Session::init();
 
-switch ($action)
-{
-    case 'add':
-        if ($url == '')
-            continue;
-
-        $parametres_url = prepare_url($url);
-        $sql_action     = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
-        $params_action  = array($url, $parametres_url['title'], $parametres_url['content']);
-        break;
-    case 'delete':
-        $sql_action     = "DELETE FROM entries WHERE id=?";
-        $params_action  = array($id);
-        break;
-    default:
-        break;
-}
-
-try
-{
-    # action query
-    if (isset($sql_action))
-    {
-        $query = $db->getHandle()->prepare($sql_action);
-        $query->execute($params_action);
-    }
-}
-catch (Exception $e)
-{
-    die('action query error : '.$e->getMessage());
-}
-
-switch ($view)
-{
-    case 'archive':
-        $sql    = "SELECT * FROM entries WHERE is_read=? ORDER BY id desc";
-        $params = array(-1);
-        break;
-    case 'fav' :
-        $sql    = "SELECT * FROM entries WHERE is_fav=? ORDER BY id desc";
-        $params = array(-1);
-        break;
-    default:
-        $sql    = "SELECT * FROM entries WHERE is_read=? ORDER BY id desc";
-        $params = array(0);
-        $view = 'index';
-        break;
-}
-
-# view query
-try
-{
-    $query  = $db->getHandle()->prepare($sql);
-    $query->execute($params);
-    $entries = $query->fetchAll();
-}
-catch (Exception $e)
-{
-    die('view query error : '.$e->getMessage());
-}
-
-$tpl->assign('title', 'poche, a read it later open source system');
-$tpl->assign('view', $view);
-$tpl->assign('poche_url', get_poche_url());
-$tpl->assign('entries', $entries);
-$tpl->assign('load_all_js', 1);
-$tpl->draw('home');
\ No newline at end of file
+// Let's rock !
+$wallabag = new Poche();
+$wallabag->run();