$link = array(
'id' => 1,
'title'=>' Shaarli: the personal, minimalist, super-fast, no-database delicious clone',
- 'url'=>'https://github.com/shaarli/Shaarli/wiki',
+ 'url'=>'https://shaarli.readthedocs.io',
'description'=>'Welcome to Shaarli! This is your first public bookmark. To edit or delete me, you must first login.
To learn how to use Shaarli, consult the link "Help/documentation" at the bottom of this page.
return;
}
+ $this->urls = [];
+ $this->ids = [];
$this->links = FileUtils::readFlatDB($this->datastore, []);
$toremove = array();
foreach ($this->links as $key => &$link) {
if (! $this->loggedIn && $link['private'] != 0) {
// Transition for not upgraded databases.
- $toremove[] = $key;
+ unset($this->links[$key]);
continue;
}
}
$link['shorturl'] = smallHash($link['linkdate']);
}
- }
- // If user is not logged in, filter private links.
- foreach ($toremove as $offset) {
- unset($this->links[$offset]);
+ $this->urls[$link['url']] = $key;
+ $this->ids[$link['id']] = $key;
}
-
- $this->reorder();
}
/**
*/
private function write()
{
+ $this->reorder();
FileUtils::writeFlatDB($this->datastore, $this->links);
}
return $a['created'] < $b['created'] ? 1 * $order : -1 * $order;
});
- $this->urls = array();
- $this->ids = array();
+ $this->urls = [];
+ $this->ids = [];
foreach ($this->links as $key => $link) {
$this->urls[$link['url']] = $key;
$this->ids[$link['id']] = $key;