mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-23 17:42:15 -05:00
changement de la structure de la bdd sqlite : on stocke le contenu maintenant issue #17
This commit is contained in:
parent
b70971e06b
commit
67e7910439
BIN
db/poche.sqlite
BIN
db/poche.sqlite
Binary file not shown.
19
index.php
19
index.php
@ -44,8 +44,17 @@ switch ($action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $db->getHandle()->prepare('INSERT INTO entries ( url, title ) VALUES (?, ?)');
|
try
|
||||||
$query->execute(array($url, $title));
|
{
|
||||||
|
# insert query
|
||||||
|
$query = $db->getHandle()->prepare('INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)');
|
||||||
|
$query->execute(array($url, $title, $r->articleContent->innerHTML));
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
error_log('insert query error : '.$e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$sql_action = "DELETE FROM entries WHERE id=?";
|
$sql_action = "DELETE FROM entries WHERE id=?";
|
||||||
@ -66,7 +75,7 @@ try
|
|||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
die('query error : '.$e->getMessage());
|
die('action query error : '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($view)
|
switch ($view)
|
||||||
@ -95,7 +104,7 @@ try
|
|||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
die('query error : '.$e->getMessage());
|
die('view query error : '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -136,7 +145,7 @@ catch (Exception $e)
|
|||||||
<div id="entry-<?php echo $entry['id']; ?>" class="entrie mb2">
|
<div id="entry-<?php echo $entry['id']; ?>" class="entrie mb2">
|
||||||
<span class="content">
|
<span class="content">
|
||||||
<h2 class="h6-like">
|
<h2 class="h6-like">
|
||||||
<a href="readityourself.php?url=<?php echo urlencode($entry['url']); ?>"><?php echo $entry['title']; ?>
|
<a href="view.php?id=<?php echo $entry['id']; ?>"><?php echo $entry['title']; ?>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="tools">
|
<div class="tools">
|
||||||
<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>
|
<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>
|
||||||
|
@ -14,7 +14,6 @@ $db = new db(DB_PATH);
|
|||||||
$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
|
$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
|
||||||
$id = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : '';
|
$id = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : '';
|
||||||
|
|
||||||
|
|
||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
case 'toggle_fav' :
|
case 'toggle_fav' :
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
header('Content-type:text/html; charset=utf-8');
|
|
||||||
|
|
||||||
setlocale(LC_ALL, 'fr_FR');
|
|
||||||
date_default_timezone_set('Europe/Paris');
|
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/inc/Readability.php';
|
|
||||||
require_once dirname(__FILE__).'/inc/Encoding.php';
|
|
||||||
require_once dirname(__FILE__).'/inc/rain.tpl.class.php';
|
|
||||||
include dirname(__FILE__).'/inc/functions.php';
|
|
||||||
|
|
||||||
if(isset($_GET['url']) && $_GET['url'] != null && trim($_GET['url']) != "") {
|
|
||||||
// get url link
|
|
||||||
if(strlen(trim($_GET['url'])) > 2048) {
|
|
||||||
echo "Error URL is too large !!";
|
|
||||||
} else {
|
|
||||||
$url = trim($_GET['url']);
|
|
||||||
|
|
||||||
// decode it
|
|
||||||
$url = html_entity_decode($url);
|
|
||||||
|
|
||||||
// if url use https protocol change it to http
|
|
||||||
if (!preg_match('!^https?://!i', $url)) $url = 'http://'.$url;
|
|
||||||
|
|
||||||
// convert page to utf-8
|
|
||||||
$html = Encoding::toUTF8(get_external_file($url,15));
|
|
||||||
|
|
||||||
if(isset($html) and strlen($html) > 0) {
|
|
||||||
|
|
||||||
// send result to readability library
|
|
||||||
$r = new Readability($html, $url);
|
|
||||||
|
|
||||||
if($r->init()) {
|
|
||||||
generate_page($url,$r->articleTitle->innerHTML,$r->articleContent->innerHTML);
|
|
||||||
} else {
|
|
||||||
// return data into an iframe
|
|
||||||
echo "<iframe id='readabilityframe'>".$html."</iframe>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo "Error unable to get link : ".$url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
35
view.php
Executable file
35
view.php
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* poche, a read it later open source system
|
||||||
|
*
|
||||||
|
* @category poche
|
||||||
|
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
|
||||||
|
* @copyright 2013
|
||||||
|
* @license http://www.wtfpl.net/ see COPYING file
|
||||||
|
*/
|
||||||
|
|
||||||
|
header('Content-type:text/html; charset=utf-8');
|
||||||
|
|
||||||
|
include dirname(__FILE__).'/inc/config.php';
|
||||||
|
require_once dirname(__FILE__).'/inc/rain.tpl.class.php';
|
||||||
|
$db = new db(DB_PATH);
|
||||||
|
|
||||||
|
if(isset($_GET['id']) && $_GET['id'] != '') {
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM entries WHERE id=?";
|
||||||
|
$params = array(intval($_GET['id']));
|
||||||
|
|
||||||
|
# view article query
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$query = $db->getHandle()->prepare($sql);
|
||||||
|
$query->execute($params);
|
||||||
|
$entry = $query->fetchAll();
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
die('query error : '.$e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_page($entry[0]['url'], $entry[0]['title'], $entry[0]['content']);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user