define('IMPORT_LIMIT', 5);
}
if (!defined('IMPORT_DELAY')) {
define('IMPORT_LIMIT', 5);
}
if (!defined('IMPORT_DELAY')) {
$read = 0;
foreach (array('ol','ul') as $list) {
foreach ($html->find($list) as $ul) {
$read = 0;
foreach (array('ol','ul') as $list) {
foreach ($html->find($list) as $ul) {
- foreach ($ul->find('li') as $li) {
- $tmpEntry = array();
- $a = $li->find('a');
- $tmpEntry['url'] = $a[0]->href;
- $tmpEntry['tags'] = $a[0]->tags;
- $tmpEntry['is_read'] = $read;
- if ($tmpEntry['url']) {
- $data[] = $tmpEntry;
- }
- }
- # the second <ol/ul> is for read links
- $read = ((sizeof($data) && $read)?0:1);
+ foreach ($ul->find('li') as $li) {
+ $tmpEntry = array();
+ $a = $li->find('a');
+ $tmpEntry['url'] = $a[0]->href;
+ $tmpEntry['tags'] = $a[0]->tags;
+ $tmpEntry['is_read'] = $read;
+ if ($tmpEntry['url']) {
+ $data[] = $tmpEntry;
+ }
+ }
+ # the second <ol/ul> is for read links
+ $read = ((sizeof($data) && $read)?0:1);
foreach ($data as $record) {
$url = trim( isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '') );
foreach ($data as $record) {
$url = trim( isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '') );
$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));
$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));
//insert new record
$id = $this->store->add($url, $title, $body, $this->user->getId(), $isFavorite, $isRead);
if ( $id ) {
//insert new record
$id = $this->store->add($url, $title, $body, $this->user->getId(), $isFavorite, $isRead);
if ( $id ) {
if ( $i > 0 ) {
$this->messages->add('s', _('Articles inserted: ').$i._('. Please note, that some may be marked as "read".'));
}
if ( $i > 0 ) {
$this->messages->add('s', _('Articles inserted: ').$i._('. Please note, that some may be marked as "read".'));
}
- $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'));
- $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined'));
+ $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'));
+ $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined'));
- //clean content to prevent xss attack
- $title = $purifier->purify($title);
- $body = $purifier->purify($body);
+ //clean content to prevent xss attack
+ $title = $purifier->purify($title);
+ $body = $purifier->purify($body);
- $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId());
+ $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId());
- $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json";
- header('Content-Disposition: attachment; filename='.$filename);
+ $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json";
+ header('Content-Disposition: attachment; filename='.$filename);
$entries = $this->store->retrieveAll($this->user->getId());
echo $this->tpl->render('export.twig', array(
$entries = $this->store->retrieveAll($this->user->getId());
echo $this->tpl->render('export.twig', array(
- if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
- echo 'This is a server using Windows!';
- // alternative to /dev/urandom for Windows
- $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20);
- } else {
- $token = substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15);
- }
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ echo 'This is a server using Windows!';
+ // alternative to /dev/urandom for Windows
+ $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20);
+ } else {
+ $token = substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15);
+ }
}
else {
$token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20);
}
else {
$token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20);