diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index bdd64d2..bc18152 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -422,10 +422,10 @@ class Database { * @param integer $user_id * @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 (?, ?, ?, ?, ?, ?, ?, ?, ?)'; - $params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead, $dateorigin, $author, $language); + $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, $format); if ( !$this->executeQuery($sql_action, $params_action) ) { $id = null; diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index e3ae8d0..3dd698e 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -148,21 +148,11 @@ class Poche $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'); $body = $content['rss']['channel']['item']['description']; // TODO : convert date - if ($content['rss']['channel']['item']['updated'] == '') { // ATOM - 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']; - } + $dateorigin = ($content['rss']['channel']['item']['dc:date'] != '') ? $content['rss']['channel']['item']['dc:date'] : ''; - $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'] : ''; + $author = ($content['rss']['channel']['item']['author'] != '') ? $content['rss']['channel']['item']['author'] : _('Unknown'); + $language = ($content['rss']['channel']['item']['dc_language'] != '') ? Tools::code2ToName($content['rss']['channel']['item']['language']) : _('Unknown'); + $format = ($content['rss']['channel']['item']['dc_format'] != '') ? $content['rss']['channel']['item']['dc_format'] : ''; // clean content from prevent xss attack $purifier = $this->_getPurifier(); @@ -173,7 +163,7 @@ class Poche $duplicate = NULL; $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 ) { Tools::logm('add link ' . $url->getUrl()); if (DOWNLOAD_PICTURES) { diff --git a/install/mysql.sql b/install/mysql.sql index 50c54ad..0949ef7 100644 --- a/install/mysql.sql +++ b/install/mysql.sql @@ -14,8 +14,9 @@ CREATE TABLE IF NOT EXISTS `entries` ( `content` blob NOT NULL, `user_id` int(11) NOT NULL, `dateorigin` DATETIME, - `author` TEXT, - `language` TEXT, + `author` TEXT, + `language` TEXT, + `format` TEXT, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/install/poche.sqlite b/install/poche.sqlite index 3b3f61f..9ab8b0f 100755 Binary files a/install/poche.sqlite and b/install/poche.sqlite differ diff --git a/install/postgres.sql b/install/postgres.sql index 537597e..ba89d1f 100644 --- a/install/postgres.sql +++ b/install/postgres.sql @@ -14,7 +14,8 @@ CREATE TABLE IF NOT EXISTS entries ( user_id integer NOT NULL, dateorigin DATETIME, author TEXT, - language TEXT + language TEXT, + format TEXT ); CREATE TABLE IF NOT EXISTS users (