X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=abf658a32cf4be4dff13a07dbd8015fd311402d2;hb=c775c8436b30fffde88e69a8c8f6bd488d66a585;hp=0e6cfe5f2a6ac16daa8fb8edfab1f6391d319536;hpb=85682e2df73b78942ccce1ed691bdfd72f2f9f00;p=github%2Fwallabag%2Fwallabag.git diff --git a/index.php b/index.php index 0e6cfe5f..abf658a3 100755 --- a/index.php +++ b/index.php @@ -8,19 +8,8 @@ * @license http://www.wtfpl.net/ see COPYING file */ -require_once dirname(__FILE__).'/inc/Readability.php'; -require_once dirname(__FILE__).'/inc/Encoding.php'; -include dirname(__FILE__).'/inc/functions.php'; - -try -{ - $db_handle = new PDO('sqlite:db/poche.sqlite'); - $db_handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -} -catch (Exception $e) -{ - die('database error : '.$e->getMessage()); -} +include dirname(__FILE__).'/inc/config.php'; +$db = new db(DB_PATH); $action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : ''; $view = (isset ($_GET['view'])) ? htmlspecialchars($_GET['view']) : ''; @@ -34,6 +23,13 @@ switch ($action) continue; $url = html_entity_decode(trim($url)); + + // We remove the annoying parameters added by FeedBurner and GoogleFeedProxy (?utm_source=...) + // from shaarli, by sebsauvage + $i=strpos($url,'&utm_source='); if ($i!==false) $url=substr($url,0,$i); + $i=strpos($url,'?utm_source='); if ($i!==false) $url=substr($url,0,$i); + $i=strpos($url,'#xtor=RSS-'); if ($i!==false) $url=substr($url,0,$i); + $title = $url; if (!preg_match('!^https?://!i', $url)) $url = 'http://' . $url; @@ -48,17 +44,9 @@ switch ($action) } } - $query = $db_handle->prepare('INSERT INTO entries ( url, title ) VALUES (?, ?)'); + $query = $db->getHandle()->prepare('INSERT INTO entries ( url, title ) VALUES (?, ?)'); $query->execute(array($url, $title)); break; - case 'toggle_fav' : - $sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?"; - $params_action = array($id); - break; - case 'toggle_archive' : - $sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?"; - $params_action = array($id); - break; case 'delete': $sql_action = "DELETE FROM entries WHERE id=?"; $params_action = array($id); @@ -72,7 +60,7 @@ try # action query if (isset($sql_action)) { - $query = $db_handle->prepare($sql_action); + $query = $db->getHandle()->prepare($sql_action); $query->execute($params_action); } } @@ -94,13 +82,14 @@ switch ($view) default: $sql = "SELECT * FROM entries WHERE is_read=? ORDER BY id desc"; $params = array(0); + $view = 'index'; break; } # view query try { - $query = $db_handle->prepare($sql); + $query = $db->getHandle()->prepare($sql); $query->execute($params); $entries = $query->fetchAll(); } @@ -121,10 +110,10 @@ catch (Exception $e) poche, a read it later open source system - - - - + + + + @@ -132,34 +121,41 @@ catch (Exception $e)

logo pochepoche

-
+
-
+
+
-