X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FNetscapeBookmarkUtils.php;h=e0022fe1a391e333b0d58fcce8e4300fe66f2fa6;hb=f24896b237e40718fb6eaa2869592eb0855a47fd;hp=2a10ff22149f8c89f30458d9e5c907e19847438a;hpb=b2e2aa42e288e0becaa95bf9cc3be679743fc98e;p=github%2Fshaarli%2FShaarli.git diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index 2a10ff22..e0022fe1 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php @@ -1,7 +1,9 @@ ') === false) { + if (preg_match('//i', $data) === 0) { return self::importStatus($filename, $filesize); } @@ -151,13 +158,13 @@ class NetscapeBookmarkUtils if (empty($post['privacy']) || $post['privacy'] == 'default') { // use value from the imported file $private = $bkm['pub'] == '1' ? 0 : 1; - } else if ($post['privacy'] == 'private') { + } elseif ($post['privacy'] == 'private') { // all imported links are private $private = 1; - } else if ($post['privacy'] == 'public') { + } elseif ($post['privacy'] == 'public') { // all imported links are public $private = 0; - } + } $newLink = array( 'title' => $bkm['title'], @@ -184,7 +191,6 @@ class NetscapeBookmarkUtils $linkDb[$existingLink['id']] = $newLink; $importCount++; $overwriteCount++; - $history->updateLink($newLink); continue; } @@ -196,16 +202,19 @@ class NetscapeBookmarkUtils $newLink['shorturl'] = link_small_hash($newLink['created'], $newLink['id']); $linkDb[$newLink['id']] = $newLink; $importCount++; - $history->addLink($newLink); } $linkDb->save($conf->get('resource.page_cache')); + $history->importLinks(); + + $duration = time() - $start; return self::importStatus( $filename, $filesize, $importCount, $overwriteCount, - $skipCount + $skipCount, + $duration ); } }