aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--css/style.css142
-rwxr-xr-xindex.php64
2 files changed, 138 insertions, 68 deletions
diff --git a/css/style.css b/css/style.css
index 812ccca7..41ea0d00 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1,3 +1,4 @@
1/*** GENERAL ***/
1body { 2body {
2 color: #222222; 3 color: #222222;
3 font: 20px/1.3em Palatino,Georgia,serif; 4 font: 20px/1.3em Palatino,Georgia,serif;
@@ -5,41 +6,15 @@ body {
5 margin: 10px; 6 margin: 10px;
6} 7}
7 8
8body.article {
9 color: #222222;
10 font: 20px/1.3em Palatino,Georgia,serif;
11 background-color: #F1F1F1;
12}
13 9
14a, a:hover, a:visited { 10a, a:hover, a:visited {
15 color: #000; 11 color: #000;
16} 12}
13
17header { 14header {
18 text-align: center; 15 text-align: center;
19} 16}
20 17
21#article header {
22 text-align: left;
23 border-bottom: 1px solid #222222;
24}
25
26#article header a {
27 text-decoration: none;
28}
29
30#article article {
31 border-bottom: 1px solid #222222;
32}
33
34.vieworiginal a {
35 color: #888888;
36 text-decoration: none;
37}
38
39#main, #article {
40 margin: 0 auto;
41}
42
43#main ul#links { 18#main ul#links {
44 padding: 0; 19 padding: 0;
45 list-style-type: none; 20 list-style-type: none;
@@ -57,6 +32,10 @@ header {
57 color: #F1F1F1; 32 color: #F1F1F1;
58} 33}
59 34
35#main, #article {
36 margin: 0 auto;
37}
38
60#links a, .backhome a{ 39#links a, .backhome a{
61 text-decoration: none; 40 text-decoration: none;
62 padding: 5px 10px; 41 padding: 5px 10px;
@@ -68,6 +47,59 @@ header {
68 color: #F1F1F1; 47 color: #F1F1F1;
69} 48}
70 49
50footer {
51 text-align: right;
52}
53
54/*** ***/
55/*** GRID DISPLAY ***/
56
57#content {
58 width: 800px;
59 margin: 0 auto;
60}
61
62#entries {
63 -moz-column-count: 3;
64 -moz-column-gap: 20px;
65 -webkit-column-count: 3;
66 -webkit-column-gap: 20px;
67 column-count: 3;
68 column-gap: 20px;
69 width: 800px;
70}
71
72#entries span.content {
73 display: inline-block;
74 margin-bottom: 0px;
75 width: 100%;
76}
77
78@media only screen and (max-width : 599px),
79only screen and (max-device-width : 599px){
80 #entries {
81 -moz-column-count: 2;
82 -moz-column-gap: 10px;
83 -webkit-column-count: 2;
84 -webkit-column-gap: 10px;
85 column-count: 2;
86 column-gap: 10px;
87 width: 400px;
88 }
89
90 #content {
91 width: 400px;
92 }
93}
94
95/*** ***/
96/*** LINKS DISPLAY ***/
97
98#main a.tool {
99 text-decoration: none;
100 cursor: pointer;
101}
102
71#main #entries { 103#main #entries {
72 margin-top: 20px; 104 margin-top: 20px;
73} 105}
@@ -82,6 +114,7 @@ header {
82 border-radius: 2px; 114 border-radius: 2px;
83 -webkit-box-shadow: 0px 0px 2px -1px #000; 115 -webkit-box-shadow: 0px 0px 2px -1px #000;
84 box-shadow: 0px 0px 2px -1px #000; 116 box-shadow: 0px 0px 2px -1px #000;
117 list-style-type: none;
85} 118}
86 119
87#main #entries .entrie h2 a { 120#main #entries .entrie h2 a {
@@ -100,10 +133,57 @@ header {
100 margin-left: -20px; 133 margin-left: -20px;
101} 134}
102 135
103#main a.tool { 136#main #entries .entrie .tools a.tool span {
137 display: inline-block;
138 width: 16px;
139 height: 16px;
140}
141
142a.fav span {
143 background: url('../img/fav-on.png') no-repeat;
144}
145
146a.fav-off span {
147 background: url('../img/fav-off.png') no-repeat;
148}
149
150a.archive span {
151 background: url('../img/archive-on.png') no-repeat;
152}
153
154a.archive-off span {
155 background: url('../img/archive-off.png') no-repeat;
156}
157
158a.delete span {
159 background: url('../img/delete.png') no-repeat;
160}
161
162/*** ***/
163/*** ARTICLE PAGE ***/
164
165body.article {
166 color: #222222;
167 font: 20px/1.3em Palatino,Georgia,serif;
168 background-color: #F1F1F1;
169}
170
171#article header {
172 text-align: left;
173 border-bottom: 1px solid #222222;
174}
175
176#article header a {
104 text-decoration: none; 177 text-decoration: none;
105} 178}
106 179
107footer { 180#article article {
108 text-align: right; 181 border-bottom: 1px solid #222222;
109} \ No newline at end of file 182}
183
184.vieworiginal a {
185 color: #888888;
186 text-decoration: none;
187}
188
189/*** ***/ \ No newline at end of file
diff --git a/index.php b/index.php
index 1e402896..f46ddf10 100755
--- a/index.php
+++ b/index.php
@@ -8,19 +8,8 @@
8 * @license http://www.wtfpl.net/ see COPYING file 8 * @license http://www.wtfpl.net/ see COPYING file
9 */ 9 */
10 10
11require_once dirname(__FILE__).'/inc/Readability.php'; 11include dirname(__FILE__).'/inc/config.php';
12require_once dirname(__FILE__).'/inc/Encoding.php'; 12$db = new db(DB_PATH);
13include dirname(__FILE__).'/inc/functions.php';
14
15try
16{
17 $db_handle = new PDO('sqlite:db/poche.sqlite');
18 $db_handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
19}
20catch (Exception $e)
21{
22 die('database error : '.$e->getMessage());
23}
24 13
25$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : ''; 14$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
26$view = (isset ($_GET['view'])) ? htmlspecialchars($_GET['view']) : ''; 15$view = (isset ($_GET['view'])) ? htmlspecialchars($_GET['view']) : '';
@@ -55,17 +44,9 @@ switch ($action)
55 } 44 }
56 } 45 }
57 46
58 $query = $db_handle->prepare('INSERT INTO entries ( url, title ) VALUES (?, ?)'); 47 $query = $db->getHandle()->prepare('INSERT INTO entries ( url, title ) VALUES (?, ?)');
59 $query->execute(array($url, $title)); 48 $query->execute(array($url, $title));
60 break; 49 break;
61 case 'toggle_fav' :
62 $sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
63 $params_action = array($id);
64 break;
65 case 'toggle_archive' :
66 $sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?";
67 $params_action = array($id);
68 break;
69 case 'delete': 50 case 'delete':
70 $sql_action = "DELETE FROM entries WHERE id=?"; 51 $sql_action = "DELETE FROM entries WHERE id=?";
71 $params_action = array($id); 52 $params_action = array($id);
@@ -79,7 +60,7 @@ try
79 # action query 60 # action query
80 if (isset($sql_action)) 61 if (isset($sql_action))
81 { 62 {
82 $query = $db_handle->prepare($sql_action); 63 $query = $db->getHandle()->prepare($sql_action);
83 $query->execute($params_action); 64 $query->execute($params_action);
84 } 65 }
85} 66}
@@ -108,7 +89,7 @@ switch ($view)
108# view query 89# view query
109try 90try
110{ 91{
111 $query = $db_handle->prepare($sql); 92 $query = $db->getHandle()->prepare($sql);
112 $query->execute($params); 93 $query->execute($params);
113 $entries = $query->fetchAll(); 94 $entries = $query->fetchAll();
114} 95}
@@ -140,30 +121,37 @@ catch (Exception $e)
140 <header> 121 <header>
141 <h1><img src="img/logo.png" alt="logo poche" />poche</h1> 122 <h1><img src="img/logo.png" alt="logo poche" />poche</h1>
142 </header> 123 </header>
143 <div id="main" class="w960p"> 124 <div id="main">
144 <ul id="links"> 125 <ul id="links">
145 <li><a href="index.php" <?php echo (($view == 'index') ? 'class="current"' : ''); ?>>home</a></li> 126 <li><a href="index.php" <?php echo (($view == 'index') ? 'class="current"' : ''); ?>>home</a></li>
146 <li><a href="?view=fav" <?php echo (($view == 'fav') ? 'class="current"' : ''); ?>>favorites</a></li> 127 <li><a href="?view=fav" <?php echo (($view == 'fav') ? 'class="current"' : ''); ?>>favorites</a></li>
147 <li><a href="?view=archive" <?php echo (($view == 'archive') ? 'class="current"' : ''); ?>>archive</a></li> 128 <li><a href="?view=archive" <?php echo (($view == 'archive') ? 'class="current"' : ''); ?>>archive</a></li>
148 <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> 129 <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>
149 </ul> 130 </ul>
150 <div id="entries"> 131 <div id="content">
132 <ul id="entries">
151 <?php 133 <?php
152 $i = 0; 134 $i = 1;
153 foreach ($entries as $entry) 135 foreach ($entries as $entry)
154 { 136 {
155 if ($i == 0) { 137 ?>
156 echo '<section class="line grid3">'; 138 <li id="entry-<?php echo $entry['id']; ?>" class="entrie mb2">
157 } 139 <span class="content">
158 echo '<aside class="mod entrie mb2"><h2 class="h6-like"><a href="readityourself.php?url='.urlencode($entry['url']).'">' . $entry['title'] . '</h2><div class="tools"><a href="?action=toggle_archive&id='.$entry['id'].'" title="toggle mark as read" class="tool">&#10003;</a> <a href="?action=toggle_fav&id='.$entry['id'].'" title="toggle favorite" class="tool">'.(($entry['is_fav'] == 0) ? '&#9734;' : '&#9733;' ).'</a> <a href="?action=delete&id='.$entry['id'].'" title="toggle delete" onclick="return confirm(\'Are you sure?\')" class="tool">&#10799;</a></div></aside>'; 140 <h2 class="h6-like">
159 141 <a href="readityourself.php?url=<?php echo urlencode($entry['url']); ?>"><?php echo $entry['title']; ?>
160 $i++; 142 </h2>
161 if ($i == 3) { 143 <div class="tools">
162 echo '</section>'; 144 <a title="toggle mark as read" class="tool archive <?php echo ( ($entry['is_read'] == '0') ? 'archive-off' : '' ); ?>" onclick="toggle_archive(<?php echo $entry['id']; ?>)"><span></span></a>
163 $i = 0; 145 <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>
164 } 146 <a href="?action=delete&id=<?php echo $entry['id']; ?>" title="toggle delete" onclick="return confirm('Are you sure?')" class="tool delete"><span></span></a>
147 </div>
148 </span>
149 </li>
150 <?php
151 $i++;
165 } 152 }
166 ?> 153 ?>
154 </ul>
167 </div> 155 </div>
168 </div> 156 </div>
169 <footer class="mr2 mt3 smaller"> 157 <footer class="mr2 mt3 smaller">
@@ -172,5 +160,7 @@ catch (Exception $e)
172 Logo by <a href="http://www.iconfinder.com/icondetails/43256/128/jeans_monotone_pocket_icon">Brightmix</a>.<br /> 160 Logo by <a href="http://www.iconfinder.com/icondetails/43256/128/jeans_monotone_pocket_icon">Brightmix</a>.<br />
173 poche is developed by <a href="http://nicolas.loeuillet.org">Nicolas LÅ“uillet</a> under the <a href="http://www.wtfpl.net/">WTFPL</a>.</p> 161 poche is developed by <a href="http://nicolas.loeuillet.org">Nicolas LÅ“uillet</a> under the <a href="http://www.wtfpl.net/">WTFPL</a>.</p>
174 </footer> 162 </footer>
163 <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
164 <script type="text/javascript" src="js/poche.js"></script>
175 </body> 165 </body>
176</html> 166</html>