1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-08-13 16:54:00 -04:00

show metadata on articles

This commit is contained in:
Thomas Citharel 2014-08-25 21:48:21 +02:00
parent 01992a0114
commit 774d7e1d4e
3 changed files with 15 additions and 10 deletions

View File

@ -24,7 +24,7 @@ class Database {
switch (STORAGE) {
case 'sqlite':
// Check if /db is writeable
if ( !is_writable(STORAGE_SQLITE) || !is_writable(dirname(STORAGE_SQLITE))) {
if ( !is_writable(STORAGE_SQLITE) || !is_writable(dirname(STORAGE_SQLITE))) {
die('An error occured: "db" directory must be writeable for your web server user!');
}
$db_path = 'sqlite:' . STORAGE_SQLITE;
@ -277,6 +277,7 @@ class Database {
public function updateContentAndTitle($id, $title, $body, $user_id)
{
// metadata not updated
$sql_action = 'UPDATE entries SET content = ?, title = ? WHERE id=? AND user_id=?';
$params_action = array($body, $title, $id, $user_id);
$query = $this->executeQuery($sql_action, $params_action);
@ -421,10 +422,10 @@ class Database {
* @param integer $user_id
* @return integer $id of inserted record
*/
public function add($url, $title, $content, $user_id, $isFavorite=0, $isRead=0)
public function add($url, $title, $content, $dateorigin, $author, $language, $user_id, $isFavorite=0, $isRead=0)
{
$sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read ) VALUES (?, ?, ?, ?, ?, ?)';
$params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead);
$sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read, dateorigin, author, language ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
$params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead, $dateorigin, $author, $language);
if ( !$this->executeQuery($sql_action, $params_action) ) {
$id = null;

View File

@ -151,16 +151,17 @@ class Poche
if ($content['rss']['channel']['item']['updated'] == '') { // ATOM
if ($content['rss']['channel']['item']['pubDate'] == '') { // RSS
if($content['rss']['channel']['item']['dc:date'] == '') { // other
$date = '';}
else {$date = $content['rss']['channel']['item']['dc:date'];}
$dateorigin = '';}
else {$dateorigin = $content['rss']['channel']['item']['dc:date'];}
}
else {$date = $content['rss']['channel']['item']['pubDate'];}
else {$dateorigin = $content['rss']['channel']['item']['pubDate'];}
}
else {
$date = $content['rss']['channel']['item']['updated'];
$dateorigin = $content['rss']['channel']['item']['updated'];
}
$author = ($content['rss']['channel']['item']['author'] != '') ? $content['rss']['channel']['item']['author'] : _('Unknown author');
// TODO : convert language with Tools::code2ToName() function
$language = ($content['rss']['channel']['item']['language'] != '') ? $content['rss']['channel']['item']['language'] : '';
// clean content from prevent xss attack
@ -172,7 +173,7 @@ class Poche
$duplicate = NULL;
$duplicate = $this->store->retrieveOneByURL($url->getUrl(), $this->user->getId());
$last_id = $this->store->add($url->getUrl(), $title, $body, $this->user->getId());
$last_id = $this->store->add($url->getUrl(), $title, $body, $dateorigin, $author, $language, $this->user->getId());
if ( $last_id ) {
Tools::logm('add link ' . $url->getUrl());
if (DOWNLOAD_PICTURES) {

View File

@ -26,7 +26,10 @@
<h1>{{ entry.title|raw }}</h1>
</header>
<aside class="tags">
tags: {% for tag in tags %}<a href="./?view=tag&amp;id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}<a href="./?view=edit-tags&amp;id={{ entry.id|e }}" title="{% trans "Edit tags" %}">✎</a>
<p>tags: {% for tag in tags %}<a href="./?view=tag&amp;id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}<a href="./?view=edit-tags&amp;id={{ entry.id|e }}" title="{% trans "Edit tags" %}">✎</a></p>
<p>Date : {{ entry.dateorigin|raw }}</p>
<p>Author : {{ entry.author|raw }}</p>
<p>Language : {{ entry.language|raw }}</p>
</aside>
<article>
{{ content | raw }}