mirror of
https://github.com/moparisthebest/wallabag
synced 2025-02-07 02:30:12 -05:00
show metadata on articles
This commit is contained in:
parent
01992a0114
commit
774d7e1d4e
@ -24,7 +24,7 @@ class Database {
|
|||||||
switch (STORAGE) {
|
switch (STORAGE) {
|
||||||
case 'sqlite':
|
case 'sqlite':
|
||||||
// Check if /db is writeable
|
// 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!');
|
die('An error occured: "db" directory must be writeable for your web server user!');
|
||||||
}
|
}
|
||||||
$db_path = 'sqlite:' . STORAGE_SQLITE;
|
$db_path = 'sqlite:' . STORAGE_SQLITE;
|
||||||
@ -277,6 +277,7 @@ class Database {
|
|||||||
|
|
||||||
public function updateContentAndTitle($id, $title, $body, $user_id)
|
public function updateContentAndTitle($id, $title, $body, $user_id)
|
||||||
{
|
{
|
||||||
|
// metadata not updated
|
||||||
$sql_action = 'UPDATE entries SET content = ?, title = ? WHERE id=? AND user_id=?';
|
$sql_action = 'UPDATE entries SET content = ?, title = ? WHERE id=? AND user_id=?';
|
||||||
$params_action = array($body, $title, $id, $user_id);
|
$params_action = array($body, $title, $id, $user_id);
|
||||||
$query = $this->executeQuery($sql_action, $params_action);
|
$query = $this->executeQuery($sql_action, $params_action);
|
||||||
@ -421,10 +422,10 @@ class Database {
|
|||||||
* @param integer $user_id
|
* @param integer $user_id
|
||||||
* @return integer $id of inserted record
|
* @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 (?, ?, ?, ?, ?, ?)';
|
$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);
|
$params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead, $dateorigin, $author, $language);
|
||||||
|
|
||||||
if ( !$this->executeQuery($sql_action, $params_action) ) {
|
if ( !$this->executeQuery($sql_action, $params_action) ) {
|
||||||
$id = null;
|
$id = null;
|
||||||
|
@ -151,16 +151,17 @@ class Poche
|
|||||||
if ($content['rss']['channel']['item']['updated'] == '') { // ATOM
|
if ($content['rss']['channel']['item']['updated'] == '') { // ATOM
|
||||||
if ($content['rss']['channel']['item']['pubDate'] == '') { // RSS
|
if ($content['rss']['channel']['item']['pubDate'] == '') { // RSS
|
||||||
if($content['rss']['channel']['item']['dc:date'] == '') { // other
|
if($content['rss']['channel']['item']['dc:date'] == '') { // other
|
||||||
$date = '';}
|
$dateorigin = '';}
|
||||||
else {$date = $content['rss']['channel']['item']['dc:date'];}
|
else {$dateorigin = $content['rss']['channel']['item']['dc:date'];}
|
||||||
}
|
}
|
||||||
else {$date = $content['rss']['channel']['item']['pubDate'];}
|
else {$dateorigin = $content['rss']['channel']['item']['pubDate'];}
|
||||||
}
|
}
|
||||||
else {
|
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');
|
$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'] : '';
|
$language = ($content['rss']['channel']['item']['language'] != '') ? $content['rss']['channel']['item']['language'] : '';
|
||||||
|
|
||||||
// clean content from prevent xss attack
|
// clean content from prevent xss attack
|
||||||
@ -172,7 +173,7 @@ class Poche
|
|||||||
$duplicate = NULL;
|
$duplicate = NULL;
|
||||||
$duplicate = $this->store->retrieveOneByURL($url->getUrl(), $this->user->getId());
|
$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 ) {
|
if ( $last_id ) {
|
||||||
Tools::logm('add link ' . $url->getUrl());
|
Tools::logm('add link ' . $url->getUrl());
|
||||||
if (DOWNLOAD_PICTURES) {
|
if (DOWNLOAD_PICTURES) {
|
||||||
|
@ -26,7 +26,10 @@
|
|||||||
<h1>{{ entry.title|raw }}</h1>
|
<h1>{{ entry.title|raw }}</h1>
|
||||||
</header>
|
</header>
|
||||||
<aside class="tags">
|
<aside class="tags">
|
||||||
tags: {% for tag in tags %}<a href="./?view=tag&id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}<a href="./?view=edit-tags&id={{ entry.id|e }}" title="{% trans "Edit tags" %}">✎</a>
|
<p>tags: {% for tag in tags %}<a href="./?view=tag&id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}<a href="./?view=edit-tags&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>
|
</aside>
|
||||||
<article>
|
<article>
|
||||||
{{ content | raw }}
|
{{ content | raw }}
|
||||||
|
Loading…
Reference in New Issue
Block a user