3 * poche, a read it later open source system
6 * @author Nicolas Lœuillet <nicolas@loeuillet.org>
8 * @license http://www.wtfpl.net/ see COPYING file
13 * gestion des erreurs sqlite (duplicate tout ça)
15 * traiter les variables passées en get
16 * récupérer le titre de la page pochée (cf readityourself.php)
17 * actions archive, fav et delete à traiter
19 * améliorer présentation des liens
20 * améliorer présentation d'un article
21 * aligner verticalement les icones d'action
22 * afficher liens mis en favoris et archivés
28 $db_handle = new PDO('sqlite:poche.sqlite');
29 $db_handle->setAttribute(PDO
::ATTR_ERRMODE
, PDO
::ERRMODE_EXCEPTION
);
33 die('database error : '.$e->getMessage());
36 $action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
37 $view = (isset ($_GET['view'])) ? htmlspecialchars($_GET['view']) : '';
38 $id = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : '';
42 $url = (isset ($_GET['url'])) ? htmlspecialchars($_GET['url']) : '';
44 $query = $db_handle->prepare('INSERT INTO entries ( url, title ) VALUES (?, ?)');
45 $query->execute(array($url, $title));
48 $sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
49 $params_action = array($id);
51 case 'toggle_archive' :
52 $sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?";
53 $params_action = array($id);
64 if (isset($sql_action)) {
65 $query = $db_handle->prepare($sql_action);
66 $query->execute($params_action);
71 die('query error : '.$e->getMessage());
76 $sql = "SELECT * FROM entries WHERE is_read=?";
80 $sql = "SELECT * FROM entries WHERE is_fav=?";
84 $sql = "SELECT * FROM entries WHERE is_read=?";
92 $query = $db_handle->prepare($sql);
93 $query->execute($params);
94 $entries = $query->fetchAll();
98 die('query error : '.$e->getMessage());
103 if(isset($_SERVER['HTTPS'])) {
104 if($_SERVER['HTTPS'] != "off") {
109 return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
113 <!--[if lte IE
6]> <html
class="no-js ie6 ie67 ie678" lang
="en"> <![endif]-->
114 <!--[if lte IE
7]> <html
class="no-js ie7 ie67 ie678" lang
="en"> <![endif]-->
115 <!--[if IE
8]> <html
class="no-js ie8 ie678" lang
="en"> <![endif]-->
116 <!--[if gt IE
8]><!--> <html
class="no-js" lang
="en"> <!--<![endif]-->
119 <meta name
="viewport" content
="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
120 <meta charset
="utf-8">
121 <meta http
-equiv
="X-UA-Compatible" content
="IE=10">
122 <title
>poche
: queue
</title
>
123 <link rel
="stylesheet" href
="css/knacss.css" media
="all">
124 <link rel
="stylesheet" href
="css/style.css" media
="all">
128 <h1
>poche
, a read it later open source system
</h1
>
130 <div id
="main" class="w800p">
132 <li
><a href
="index.php">home
</a
></li
>
133 <li
><a href
="?view=fav">favorites
</a
></li
>
134 <li
><a href
="?view=archive">archive
</a
></li
>
135 <li
><a title
="i am a bookmarklet, use me !" href
="javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('<?php echo url()?>?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it
!</a
></li
>
139 foreach ($entries as $entry) {
140 echo '<li><a href="readityourself.php?url='.urlencode($entry['url']).'">' . $entry['title'] . '</a> <a href="?action=toggle_archive&id='.$entry['id'].'" title="toggle mark as read" class="tool">✓</a> <a href="?action=toggle_fav&id='.$entry['id'].'" title="toggle favorite" class="tool">'.(($entry['is_fav'] == 0) ? '☆' : '★' ).'</a> <a href="#" title="toggle delete" class="tool">⨯</a></li>';
145 <footer
class="mr2 mt3">
146 <p
class="smaller"><a href
="http://github.com/nicosomb/poche">poche
</a
> is a read it later open source system
, based on
<a href
="http://www.memiks.fr/readityourself/">ReadItYourself
</a
>. poche is developed by
<a href
="http://nicolas.loeuillet.org">Nicolas Lœuillet
</a
> under the
<a href
="http://www.wtfpl.net/">Do What the Fuck You Want to
Public License
</a
></p
>