aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rwxr-xr-xindex.php88
1 files changed, 7 insertions, 81 deletions
diff --git a/index.php b/index.php
index 8c695cd3..ef18254a 100755
--- a/index.php
+++ b/index.php
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11include dirname(__FILE__).'/inc/config.php'; 11include dirname(__FILE__).'/inc/config.php';
12$db = new db(DB_PATH);
13 12
14$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : ''; 13$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
15$view = (isset ($_GET['view'])) ? htmlspecialchars($_GET['view']) : ''; 14$view = (isset ($_GET['view'])) ? htmlspecialchars($_GET['view']) : '';
@@ -19,15 +18,12 @@ $url = (isset ($_GET['url'])) ? $_GET['url'] : '';
19switch ($action) 18switch ($action)
20{ 19{
21 case 'add': 20 case 'add':
22
23 if ($url == '') 21 if ($url == '')
24 continue; 22 continue;
25 23
26 $parametres_url = prepare_url($url); 24 $parametres_url = prepare_url($url);
27 25 $sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
28 $sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
29 $params_action = array($url, $parametres_url['title'], $parametres_url['content']); 26 $params_action = array($url, $parametres_url['title'], $parametres_url['content']);
30
31 break; 27 break;
32 case 'delete': 28 case 'delete':
33 $sql_action = "DELETE FROM entries WHERE id=?"; 29 $sql_action = "DELETE FROM entries WHERE id=?";
@@ -80,79 +76,9 @@ catch (Exception $e)
80 die('view query error : '.$e->getMessage()); 76 die('view query error : '.$e->getMessage());
81} 77}
82 78
83?> 79$tpl->assign('title', 'poche, a read it later open source system');
84<!DOCTYPE html> 80$tpl->assign('view', $view);
85<!--[if lte IE 6]> <html class="no-js ie6 ie67 ie678" lang="en"> <![endif]--> 81$tpl->assign('poche_url', get_poche_url());
86<!--[if lte IE 7]> <html class="no-js ie7 ie67 ie678" lang="en"> <![endif]--> 82$tpl->assign('entries', $entries);
87<!--[if IE 8]> <html class="no-js ie8 ie678" lang="en"> <![endif]--> 83$tpl->assign('load_all_js', 1);
88<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> 84$tpl->draw('home'); \ No newline at end of file
89<html>
90 <head>
91 <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
92 <meta charset="utf-8">
93 <meta http-equiv="X-UA-Compatible" content="IE=10">
94 <title>poche, a read it later open source system</title>
95 <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico" />
96 <link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/apple-touch-icon-144x144-precomposed.png">
97 <link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/apple-touch-icon-72x72-precomposed.png">
98 <link rel="apple-touch-icon-precomposed" href="img/apple-touch-icon-precomposed.png">
99 <link rel="stylesheet" href="css/knacss.css" media="all">
100 <link rel="stylesheet" href="css/style.css" media="all">
101 </head>
102 <body>
103 <header>
104 <h1><img src="img/logo.png" alt="logo poche" />poche</h1>
105 </header>
106 <div id="main">
107 <ul id="links">
108 <li><a href="index.php" <?php echo (($view == 'index') ? 'class="current"' : ''); ?>>home</a></li>
109 <li><a href="?view=fav" <?php echo (($view == 'fav') ? 'class="current"' : ''); ?>>favorites</a></li>
110 <li><a href="?view=archive" <?php echo (($view == 'archive') ? 'class="current"' : ''); ?>>archive</a></li>
111 <li><a style="cursor: move" 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>
112 </ul>
113 <div id="content">
114 <?php
115 foreach ($entries as $entry)
116 {
117 ?>
118 <div id="entry-<?php echo $entry['id']; ?>" class="entrie mb2">
119 <span class="content">
120 <h2 class="h6-like">
121 <a href="view.php?id=<?php echo $entry['id']; ?>"><?php echo $entry['title']; ?>
122 </h2>
123 <div class="tools">
124 <a title="toggle mark as read" class="tool archive <?php echo ( ($entry['is_read'] == '0') ? 'archive-off' : '' ); ?>" onclick="toggle_archive(this, <?php echo $entry['id']; ?>)"><span></span></a>
125 <a title="toggle favorite" class="tool fav <?php echo ( ($entry['is_fav'] == '0') ? 'fav-off' : '' ); ?>" onclick="toggle_favorite(this, <?php echo $entry['id']; ?>)"><span></span></a>
126 <a href="?action=delete&id=<?php echo $entry['id']; ?>" title="toggle delete" onclick="return confirm('Are you sure?')" class="tool delete"><span></span></a>
127 </div>
128 </span>
129 </div>
130 <?php
131 }
132 ?>
133 </div>
134 </div>
135 <footer class="mr2 mt3 smaller">
136 <p>powered by <a href="http://inthepoche.com">poche</a><br />follow us on <a href="https://twitter.com/getpoche" title="follow us on twitter">twitter</a></p>
137 </footer>
138 <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
139 <script type="text/javascript" src="js/jquery.masonry.min.js"></script>
140 <script type="text/javascript" src="js/poche.js"></script>
141 <script type="text/javascript">
142 $( window ).load( function()
143 {
144 var columns = 3,
145 setColumns = function() { columns = $( window ).width() > 640 ? 3 : $( window ).width() > 320 ? 2 : 1; };
146
147 setColumns();
148 $( window ).resize( setColumns );
149
150 $( '#content' ).masonry(
151 {
152 itemSelector: '.entrie',
153 columnWidth: function( containerWidth ) { return containerWidth / columns; }
154 });
155 });
156 </script>
157 </body>
158</html>