mirror of
https://github.com/moparisthebest/wallabag
synced 2025-01-30 23:00:20 -05:00
corrections and adding format field
This commit is contained in:
parent
774d7e1d4e
commit
2868115988
@ -422,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, $dateorigin, $author, $language, $user_id, $isFavorite=0, $isRead=0)
|
public function add($url, $title, $content, $dateorigin, $author, $language, $format, $user_id, $isFavorite=0, $isRead=0)
|
||||||
{
|
{
|
||||||
$sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read, dateorigin, author, language ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
$sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read, dateorigin, author, language, format ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||||
$params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead, $dateorigin, $author, $language);
|
$params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead, $dateorigin, $author, $language, $format);
|
||||||
|
|
||||||
if ( !$this->executeQuery($sql_action, $params_action) ) {
|
if ( !$this->executeQuery($sql_action, $params_action) ) {
|
||||||
$id = null;
|
$id = null;
|
||||||
|
@ -148,21 +148,11 @@ class Poche
|
|||||||
$title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled');
|
$title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled');
|
||||||
$body = $content['rss']['channel']['item']['description'];
|
$body = $content['rss']['channel']['item']['description'];
|
||||||
// TODO : convert date
|
// TODO : convert date
|
||||||
if ($content['rss']['channel']['item']['updated'] == '') { // ATOM
|
$dateorigin = ($content['rss']['channel']['item']['dc:date'] != '') ? $content['rss']['channel']['item']['dc:date'] : '';
|
||||||
if ($content['rss']['channel']['item']['pubDate'] == '') { // RSS
|
|
||||||
if($content['rss']['channel']['item']['dc:date'] == '') { // other
|
|
||||||
$dateorigin = '';}
|
|
||||||
else {$dateorigin = $content['rss']['channel']['item']['dc:date'];}
|
|
||||||
}
|
|
||||||
else {$dateorigin = $content['rss']['channel']['item']['pubDate'];}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$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');
|
||||||
// TODO : convert language with Tools::code2ToName() function
|
$language = ($content['rss']['channel']['item']['dc_language'] != '') ? Tools::code2ToName($content['rss']['channel']['item']['language']) : _('Unknown');
|
||||||
$language = ($content['rss']['channel']['item']['language'] != '') ? $content['rss']['channel']['item']['language'] : '';
|
$format = ($content['rss']['channel']['item']['dc_format'] != '') ? $content['rss']['channel']['item']['dc_format'] : '';
|
||||||
|
|
||||||
// clean content from prevent xss attack
|
// clean content from prevent xss attack
|
||||||
$purifier = $this->_getPurifier();
|
$purifier = $this->_getPurifier();
|
||||||
@ -173,7 +163,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, $dateorigin, $author, $language, $this->user->getId());
|
$last_id = $this->store->add($url->getUrl(), $title, $body, $dateorigin, $author, $language, $format, $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) {
|
||||||
|
@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS `entries` (
|
|||||||
`dateorigin` DATETIME,
|
`dateorigin` DATETIME,
|
||||||
`author` TEXT,
|
`author` TEXT,
|
||||||
`language` TEXT,
|
`language` TEXT,
|
||||||
|
`format` TEXT,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
Binary file not shown.
@ -14,7 +14,8 @@ CREATE TABLE IF NOT EXISTS entries (
|
|||||||
user_id integer NOT NULL,
|
user_id integer NOT NULL,
|
||||||
dateorigin DATETIME,
|
dateorigin DATETIME,
|
||||||
author TEXT,
|
author TEXT,
|
||||||
language TEXT
|
language TEXT,
|
||||||
|
format TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS users (
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
|
Loading…
Reference in New Issue
Block a user