]> git.immae.eu Git - github/wallabag/wallabag.git/blame - index.php
first commit
[github/wallabag/wallabag.git] / index.php
CommitLineData
1a268ba7
NL
1<?php
2/**
3 * poche, a read it later open source system
4 *
5 * @category poche
6 * @author Nicolas Lœuillet <nicolas@loeuillet.org>
7 * @copyright 2013
8 * @license http://www.wtfpl.net/ see COPYING file
9 */
10
11/**
12 * TODO
13 * gestion des erreurs sqlite (duplicate tout ça)
14 * gérer si url vide
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
18 * bookmarklet
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
23 * tri des liens
24 */
25
26try
27{
28 $db_handle = new PDO('sqlite:poche.sqlite');
29 $db_handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
30}
31catch (Exception $e)
32{
33 die('error : '.$e->getMessage());
34}
35
36$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
37
38switch ($action) {
39 case 'add':
40 $url = (isset ($_GET['url'])) ? htmlspecialchars($_GET['url']) : '';
41 $title = $url;
42 $query = $db_handle->prepare('INSERT INTO entries ( url, title ) VALUES (?, ?)');
43 $query->execute(array($url, $title));
44 break;
45 case 'archive':
46 break;
47 case 'fav' :
48 break;
49 case 'delete':
50 break;
51 default:
52 break;
53}
54?>
55<!DOCTYPE html>
56<!--[if lte IE 6]> <html class="no-js ie6 ie67 ie678" lang="en"> <![endif]-->
57<!--[if lte IE 7]> <html class="no-js ie7 ie67 ie678" lang="en"> <![endif]-->
58<!--[if IE 8]> <html class="no-js ie8 ie678" lang="en"> <![endif]-->
59<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
60<html>
61 <head>
62 <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
63 <meta charset="utf-8">
64 <meta http-equiv="X-UA-Compatible" content="IE=10">
65 <title>poche : queue</title>
66 <link rel="stylesheet" href="css/knacss.css" media="all">
67 <link rel="stylesheet" href="css/style.css" media="all">
68 </head>
69 <body>
70 <header>
71 <h1>poche, a read it later open source system</h1>
72 </header>
73 <div id="main" class="w800p">
74 <ul id="links">
75 <li><a href="index.php">home</a></li>
76 <li><a href="#">favorites</a></li>
77 <li><a href="#">archive</a></li>
78 <li><a href="javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('http://localhost/poche/index.php?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">bookmarklet</a></li>
79 </ul>
80 <?php
81 $query = $db_handle->prepare("SELECT * FROM entries WHERE read=?");
82 $query->execute(array('FALSE'));
83 $entries = $query->fetchAll();
84 ?>
85 <ul id="entries">
86 <?php
87 foreach ($entries as $entry) {
88 echo '<li><a href="readityourself.php?url='.urlencode($entry['url']).'">' . $entry['title'] . '</a> <a href="#" title="toggle delete" class="tool">&#10003;</a> <a href="#" title="toggle favorite" class="tool">&#9734;</a> <a href="#" title="toggle mark as read" class="tool">&#10799;</a></li>';
89 }
90 ?>
91 </ul>
92 </div>
93 <footer class="mr2 mt3">
94 <p class="smaller">poche 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>
95 </footer>
96 </body>
97</html>