diff options
Diffstat (limited to 'application/LinkDB.php')
-rw-r--r-- | application/LinkDB.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index e429ab4f..1e13286a 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -22,6 +22,7 @@ | |||
22 | * Can be absolute or relative. | 22 | * Can be absolute or relative. |
23 | * Relative URLs are permalinks (e.g.'?m-ukcw') | 23 | * Relative URLs are permalinks (e.g.'?m-ukcw') |
24 | * - real_url Absolute processed URL. | 24 | * - real_url Absolute processed URL. |
25 | * - shorturl Permalink smallhash | ||
25 | * | 26 | * |
26 | * Implements 3 interfaces: | 27 | * Implements 3 interfaces: |
27 | * - ArrayAccess: behaves like an associative array; | 28 | * - ArrayAccess: behaves like an associative array; |
@@ -264,6 +265,7 @@ You use the community supported version of the original Shaarli project, by Seba | |||
264 | 'created'=> new DateTime(), | 265 | 'created'=> new DateTime(), |
265 | 'tags'=>'opensource software' | 266 | 'tags'=>'opensource software' |
266 | ); | 267 | ); |
268 | $link['shorturl'] = link_small_hash($link['created'], $link['id']); | ||
267 | $this->links[1] = $link; | 269 | $this->links[1] = $link; |
268 | 270 | ||
269 | $link = array( | 271 | $link = array( |
@@ -273,8 +275,9 @@ You use the community supported version of the original Shaarli project, by Seba | |||
273 | 'description'=>'Shhhh! I\'m a private link only YOU can see. You can delete me too.', | 275 | 'description'=>'Shhhh! I\'m a private link only YOU can see. You can delete me too.', |
274 | 'private'=>1, | 276 | 'private'=>1, |
275 | 'created'=> new DateTime('1 minute ago'), | 277 | 'created'=> new DateTime('1 minute ago'), |
276 | 'tags'=>'secretstuff' | 278 | 'tags'=>'secretstuff', |
277 | ); | 279 | ); |
280 | $link['shorturl'] = link_small_hash($link['created'], $link['id']); | ||
278 | $this->links[0] = $link; | 281 | $this->links[0] = $link; |
279 | 282 | ||
280 | // Write database to disk | 283 | // Write database to disk |
@@ -335,10 +338,11 @@ You use the community supported version of the original Shaarli project, by Seba | |||
335 | // To be able to load links before running the update, and prepare the update | 338 | // To be able to load links before running the update, and prepare the update |
336 | if (! isset($link['created'])) { | 339 | if (! isset($link['created'])) { |
337 | $link['id'] = $link['linkdate']; | 340 | $link['id'] = $link['linkdate']; |
338 | $link['created'] = DateTime::createFromFormat('Ymd_His', $link['linkdate']); | 341 | $link['created'] = DateTime::createFromFormat(self::LINK_DATE_FORMAT, $link['linkdate']); |
339 | if (! empty($link['updated'])) { | 342 | if (! empty($link['updated'])) { |
340 | $link['updated'] = DateTime::createFromFormat('Ymd_His', $link['updated']); | 343 | $link['updated'] = DateTime::createFromFormat(self::LINK_DATE_FORMAT, $link['updated']); |
341 | } | 344 | } |
345 | $link['shorturl'] = smallHash($link['linkdate']); | ||
342 | } | 346 | } |
343 | } | 347 | } |
344 | 348 | ||
@@ -558,7 +562,7 @@ You use the community supported version of the original Shaarli project, by Seba | |||
558 | * | 562 | * |
559 | * @param int $id Persistent ID of a link. | 563 | * @param int $id Persistent ID of a link. |
560 | * | 564 | * |
561 | * @return int Real offset in local array, or null if doesn't exists. | 565 | * @return int Real offset in local array, or null if doesn't exist. |
562 | */ | 566 | */ |
563 | protected function getLinkOffset($id) | 567 | protected function getLinkOffset($id) |
564 | { | 568 | { |