aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornicosomb <nicolas@loeuillet.org>2013-04-12 12:25:58 +0200
committernicosomb <nicolas@loeuillet.org>2013-04-12 12:25:58 +0200
commit67e7910439d364f1f7a4dac1d233a7c1055fb933 (patch)
treea694e1e9ed7c170d87bec6e152105ddd25e87813
parentb70971e06b67786bb61e863cf89b3b061b4f6467 (diff)
downloadwallabag-67e7910439d364f1f7a4dac1d233a7c1055fb933.tar.gz
wallabag-67e7910439d364f1f7a4dac1d233a7c1055fb933.tar.zst
wallabag-67e7910439d364f1f7a4dac1d233a7c1055fb933.zip
changement de la structure de la bdd sqlite : on stocke le contenu maintenant issue #17
-rwxr-xr-xdb/poche.sqlitebin163840 -> 294912 bytes
-rwxr-xr-xindex.php19
-rw-r--r--process.php1
-rwxr-xr-xreadityourself.php43
-rwxr-xr-xview.php35
5 files changed, 49 insertions, 49 deletions
diff --git a/db/poche.sqlite b/db/poche.sqlite
index 6847e957..2aee61f4 100755
--- a/db/poche.sqlite
+++ b/db/poche.sqlite
Binary files differ
diff --git a/index.php b/index.php
index 27144de3..7ae2fb6f 100755
--- a/index.php
+++ b/index.php
@@ -44,8 +44,17 @@ switch ($action)
44 } 44 }
45 } 45 }
46 46
47 $query = $db->getHandle()->prepare('INSERT INTO entries ( url, title ) VALUES (?, ?)'); 47 try
48 $query->execute(array($url, $title)); 48 {
49 # insert query
50 $query = $db->getHandle()->prepare('INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)');
51 $query->execute(array($url, $title, $r->articleContent->innerHTML));
52 }
53 catch (Exception $e)
54 {
55 error_log('insert query error : '.$e->getMessage());
56 }
57
49 break; 58 break;
50 case 'delete': 59 case 'delete':
51 $sql_action = "DELETE FROM entries WHERE id=?"; 60 $sql_action = "DELETE FROM entries WHERE id=?";
@@ -66,7 +75,7 @@ try
66} 75}
67catch (Exception $e) 76catch (Exception $e)
68{ 77{
69 die('query error : '.$e->getMessage()); 78 die('action query error : '.$e->getMessage());
70} 79}
71 80
72switch ($view) 81switch ($view)
@@ -95,7 +104,7 @@ try
95} 104}
96catch (Exception $e) 105catch (Exception $e)
97{ 106{
98 die('query error : '.$e->getMessage()); 107 die('view query error : '.$e->getMessage());
99} 108}
100 109
101?> 110?>
@@ -136,7 +145,7 @@ catch (Exception $e)
136 <div id="entry-<?php echo $entry['id']; ?>" class="entrie mb2"> 145 <div id="entry-<?php echo $entry['id']; ?>" class="entrie mb2">
137 <span class="content"> 146 <span class="content">
138 <h2 class="h6-like"> 147 <h2 class="h6-like">
139 <a href="readityourself.php?url=<?php echo urlencode($entry['url']); ?>"><?php echo $entry['title']; ?> 148 <a href="view.php?id=<?php echo $entry['id']; ?>"><?php echo $entry['title']; ?>
140 </h2> 149 </h2>
141 <div class="tools"> 150 <div class="tools">
142 <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> 151 <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>
diff --git a/process.php b/process.php
index ef258308..0bd20e5d 100644
--- a/process.php
+++ b/process.php
@@ -14,7 +14,6 @@ $db = new db(DB_PATH);
14$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : ''; 14$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
15$id = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : ''; 15$id = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : '';
16 16
17
18switch ($action) 17switch ($action)
19{ 18{
20 case 'toggle_fav' : 19 case 'toggle_fav' :
diff --git a/readityourself.php b/readityourself.php
deleted file mode 100755
index 588baeca..00000000
--- a/readityourself.php
+++ /dev/null
@@ -1,43 +0,0 @@
1<?php
2header('Content-type:text/html; charset=utf-8');
3
4setlocale(LC_ALL, 'fr_FR');
5date_default_timezone_set('Europe/Paris');
6
7require_once dirname(__FILE__).'/inc/Readability.php';
8require_once dirname(__FILE__).'/inc/Encoding.php';
9require_once dirname(__FILE__).'/inc/rain.tpl.class.php';
10include dirname(__FILE__).'/inc/functions.php';
11
12if(isset($_GET['url']) && $_GET['url'] != null && trim($_GET['url']) != "") {
13 // get url link
14 if(strlen(trim($_GET['url'])) > 2048) {
15 echo "Error URL is too large !!";
16 } else {
17 $url = trim($_GET['url']);
18
19 // decode it
20 $url = html_entity_decode($url);
21
22 // if url use https protocol change it to http
23 if (!preg_match('!^https?://!i', $url)) $url = 'http://'.$url;
24
25 // convert page to utf-8
26 $html = Encoding::toUTF8(get_external_file($url,15));
27
28 if(isset($html) and strlen($html) > 0) {
29
30 // send result to readability library
31 $r = new Readability($html, $url);
32
33 if($r->init()) {
34 generate_page($url,$r->articleTitle->innerHTML,$r->articleContent->innerHTML);
35 } else {
36 // return data into an iframe
37 echo "<iframe id='readabilityframe'>".$html."</iframe>";
38 }
39 } else {
40 echo "Error unable to get link : ".$url;
41 }
42 }
43} \ No newline at end of file
diff --git a/view.php b/view.php
new file mode 100755
index 00000000..aba1b7ec
--- /dev/null
+++ b/view.php
@@ -0,0 +1,35 @@
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
11header('Content-type:text/html; charset=utf-8');
12
13include dirname(__FILE__).'/inc/config.php';
14require_once dirname(__FILE__).'/inc/rain.tpl.class.php';
15$db = new db(DB_PATH);
16
17if(isset($_GET['id']) && $_GET['id'] != '') {
18
19 $sql = "SELECT * FROM entries WHERE id=?";
20 $params = array(intval($_GET['id']));
21
22 # view article query
23 try
24 {
25 $query = $db->getHandle()->prepare($sql);
26 $query->execute($params);
27 $entry = $query->fetchAll();
28 }
29 catch (Exception $e)
30 {
31 die('query error : '.$e->getMessage());
32 }
33
34 generate_page($entry[0]['url'], $entry[0]['title'], $entry[0]['content']);
35} \ No newline at end of file