1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-23 17:42:15 -05:00

Merge pull request #618 from mariroz/dev

remove duplicates by import; code formatting changes: tabs replaced with spaces
This commit is contained in:
Nicolas Lœuillet 2014-04-08 10:54:17 +02:00
commit 2c534c184d

View File

@ -872,10 +872,10 @@ class Poche
}
}
$i = 0; //counter for articles inserted
$urlsInserted = array(); //urls of articles inserted
foreach ($data as $record) {
$url = trim( isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '') );
if ( $url ) {
if ( $url and !in_array($url, $urlsInserted) ) {
$title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ').'</a> <a href="./?import">'._('click to finish import').'</a><a>');
$body = (isset($record['content']) ? $record['content'] : '');
$isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive'])?intval($record['archive']):0));
@ -883,8 +883,8 @@ class Poche
//insert new record
$id = $this->store->add($url, $title, $body, $this->user->getId(), $isFavorite, $isRead);
if ( $id ) {
//increment no of records inserted
$i++;
$urlsInserted[] = $url; //add
if ( isset($record['tags']) && trim($record['tags']) ) {
//@TODO: set tags
@ -893,6 +893,7 @@ class Poche
}
}
$i = sizeof($urlsInserted);
if ( $i > 0 ) {
$this->messages->add('s', _('Articles inserted: ').$i._('. Please note, that some may be marked as "read".'));
}
@ -942,8 +943,7 @@ class Poche
* export poche entries in json
* @return json all poche entries
*/
public function export()
{
public function export() {
$filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json";
header('Content-Disposition: attachment; filename='.$filename);
@ -959,8 +959,7 @@ class Poche
* @param string $which 'prod' or 'dev'
* @return string latest $which version
*/
private function getPocheVersion($which = 'prod')
{
private function getPocheVersion($which = 'prod') {
$cache_file = CACHE . '/' . $which;
$check_time = time();