aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--application/FeedBuilder.php2
-rw-r--r--application/LinkDB.php12
-rw-r--r--application/LinkFilter.php2
-rw-r--r--application/LinkUtils.php13
-rw-r--r--application/NetscapeBookmarkUtils.php1
-rw-r--r--application/Updater.php3
-rw-r--r--application/Utils.php6
-rw-r--r--index.php56
-rw-r--r--plugins/isso/isso.php4
-rw-r--r--tests/FeedBuilderTest.php10
-rw-r--r--tests/LinkDBTest.php22
-rw-r--r--tests/NetscapeBookmarkUtils/BookmarkImportTest.php26
-rw-r--r--tests/Updater/UpdaterTest.php8
-rw-r--r--tests/plugins/PluginIssoTest.php21
-rw-r--r--tests/utils/ReferenceLinkDB.php20
15 files changed, 115 insertions, 91 deletions
diff --git a/application/FeedBuilder.php b/application/FeedBuilder.php
index bfdf2fd3..fedd90e6 100644
--- a/application/FeedBuilder.php
+++ b/application/FeedBuilder.php
@@ -143,7 +143,7 @@ class FeedBuilder
143 */ 143 */
144 protected function buildItem($link, $pageaddr) 144 protected function buildItem($link, $pageaddr)
145 { 145 {
146 $link['guid'] = $pageaddr .'?'. smallHash($link['created']->format('Ymd_His')); 146 $link['guid'] = $pageaddr .'?'. $link['shorturl'];
147 // Check for both signs of a note: starting with ? and 7 chars long. 147 // Check for both signs of a note: starting with ? and 7 chars long.
148 if ($link['url'][0] === '?' && strlen($link['url']) === 7) { 148 if ($link['url'][0] === '?' && strlen($link['url']) === 7) {
149 $link['url'] = $pageaddr . $link['url']; 149 $link['url'] = $pageaddr . $link['url'];
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 {
diff --git a/application/LinkFilter.php b/application/LinkFilter.php
index 7bab46ba..daa6d9cc 100644
--- a/application/LinkFilter.php
+++ b/application/LinkFilter.php
@@ -120,7 +120,7 @@ class LinkFilter
120 { 120 {
121 $filtered = array(); 121 $filtered = array();
122 foreach ($this->links as $key => $l) { 122 foreach ($this->links as $key => $l) {
123 if ($smallHash == smallHash($l['created']->format('Ymd_His'))) { 123 if ($smallHash == $l['shorturl']) {
124 // Yes, this is ugly and slow 124 // Yes, this is ugly and slow
125 $filtered[$key] = $l; 125 $filtered[$key] = $l;
126 return $filtered; 126 return $filtered;
diff --git a/application/LinkUtils.php b/application/LinkUtils.php
index 9d9ae3cb..cf58f808 100644
--- a/application/LinkUtils.php
+++ b/application/LinkUtils.php
@@ -169,3 +169,16 @@ function space2nbsp($text)
169function format_description($description, $redirector = '', $indexUrl = '') { 169function format_description($description, $redirector = '', $indexUrl = '') {
170 return nl2br(space2nbsp(hashtag_autolink(text2clickable($description, $redirector), $indexUrl))); 170 return nl2br(space2nbsp(hashtag_autolink(text2clickable($description, $redirector), $indexUrl)));
171} 171}
172
173/**
174 * Generate a small hash for a link.
175 *
176 * @param DateTime $date Link creation date.
177 * @param int $id Link ID.
178 *
179 * @return string the small hash generated from link data.
180 */
181function link_small_hash($date, $id)
182{
183 return smallHash($date->format(LinkDB::LINK_DATE_FORMAT) . $id);
184}
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php
index 8a939adb..e7148d00 100644
--- a/application/NetscapeBookmarkUtils.php
+++ b/application/NetscapeBookmarkUtils.php
@@ -174,6 +174,7 @@ class NetscapeBookmarkUtils
174 $newLinkDate->setTimezone(new DateTimeZone(date_default_timezone_get())); 174 $newLinkDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
175 $newLink['created'] = $newLinkDate; 175 $newLink['created'] = $newLinkDate;
176 $newLink['id'] = $linkDb->getNextId(); 176 $newLink['id'] = $linkDb->getNextId();
177 $newLink['shorturl'] = link_small_hash($newLink['created'], $newLink['id']);
177 $linkDb[$newLink['id']] = $newLink; 178 $linkDb[$newLink['id']] = $newLink;
178 $importCount++; 179 $importCount++;
179 } 180 }
diff --git a/application/Updater.php b/application/Updater.php
index 16c8c376..f0d02814 100644
--- a/application/Updater.php
+++ b/application/Updater.php
@@ -223,6 +223,9 @@ class Updater
223 * Since this update is very sensitve (changing the whole database), the datastore will be 223 * Since this update is very sensitve (changing the whole database), the datastore will be
224 * automatically backed up into the file datastore.<datetime>.php. 224 * automatically backed up into the file datastore.<datetime>.php.
225 * 225 *
226 * LinkDB also adds the field 'shorturl' with the precedent format (linkdate smallhash),
227 * which will be saved by this method.
228 *
226 * @return bool true if the update is successful, false otherwise. 229 * @return bool true if the update is successful, false otherwise.
227 */ 230 */
228 public function updateMethodDatastoreIds() 231 public function updateMethodDatastoreIds()
diff --git a/application/Utils.php b/application/Utils.php
index 0166ee2a..0a5b476e 100644
--- a/application/Utils.php
+++ b/application/Utils.php
@@ -31,7 +31,11 @@ function logm($logFile, $clientIp, $message)
31 * - are NOT cryptographically secure (they CAN be forged) 31 * - are NOT cryptographically secure (they CAN be forged)
32 * 32 *
33 * In Shaarli, they are used as a tinyurl-like link to individual entries, 33 * In Shaarli, they are used as a tinyurl-like link to individual entries,
34 * e.g. smallHash('20111006_131924') --> yZH23w 34 * built once with the combination of the date and item ID.
35 * e.g. smallHash('20111006_131924' . 142) --> eaWxtQ
36 *
37 * @warning before v0.8.1, smallhashes were built only with the date,
38 * and their value has been preserved.
35 * 39 *
36 * @param string $text Create a hash from this text. 40 * @param string $text Create a hash from this text.
37 * 41 *
diff --git a/index.php b/index.php
index 05f06452..fdbdfaa2 100644
--- a/index.php
+++ b/index.php
@@ -566,21 +566,17 @@ function showDailyRSS($conf) {
566 /* Some Shaarlies may have very few links, so we need to look 566 /* Some Shaarlies may have very few links, so we need to look
567 back in time until we have enough days ($nb_of_days). 567 back in time until we have enough days ($nb_of_days).
568 */ 568 */
569 $ids = array();
570 foreach ($LINKSDB as $id => $value) {
571 $ids[] = $id;
572 }
573 $nb_of_days = 7; // We take 7 days. 569 $nb_of_days = 7; // We take 7 days.
574 $today = date('Ymd'); 570 $today = date('Ymd');
575 $days = array(); 571 $days = array();
576 572
577 foreach ($ids as $id) { 573 foreach ($LINKSDB as $link) {
578 $day = $LINKSDB[$id]['created']->format('Ymd'); // Extract day (without time) 574 $day = $link['created']->format('Ymd'); // Extract day (without time)
579 if (strcmp($day, $today) < 0) { 575 if (strcmp($day, $today) < 0) {
580 if (empty($days[$day])) { 576 if (empty($days[$day])) {
581 $days[$day] = array(); 577 $days[$day] = array();
582 } 578 }
583 $days[$day][] = $id; 579 $days[$day][] = $link;
584 } 580 }
585 581
586 if (count($days) > $nb_of_days) { 582 if (count($days) > $nb_of_days) {
@@ -600,23 +596,18 @@ function showDailyRSS($conf) {
600 echo '<copyright>'. $pageaddr .'</copyright>'. PHP_EOL; 596 echo '<copyright>'. $pageaddr .'</copyright>'. PHP_EOL;
601 597
602 // For each day. 598 // For each day.
603 foreach ($days as $day => $ids) { 599 foreach ($days as $day => $links) {
604 $dayDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $day.'_000000'); 600 $dayDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $day.'_000000');
605 $absurl = escape(index_url($_SERVER).'?do=daily&day='.$day); // Absolute URL of the corresponding "Daily" page. 601 $absurl = escape(index_url($_SERVER).'?do=daily&day='.$day); // Absolute URL of the corresponding "Daily" page.
606 602
607 // Build the HTML body of this RSS entry.
608 $links = array();
609
610 // We pre-format some fields for proper output. 603 // We pre-format some fields for proper output.
611 foreach ($ids as $id) { 604 foreach ($links as &$link) {
612 $l = $LINKSDB[$id]; 605 $link['formatedDescription'] = format_description($link['description'], $conf->get('redirector.url'));
613 $l['formatedDescription'] = format_description($l['description'], $conf->get('redirector.url')); 606 $link['thumbnail'] = thumbnail($conf, $link['url']);
614 $l['thumbnail'] = thumbnail($conf, $l['url']); 607 $link['timestamp'] = $link['created']->getTimestamp();
615 $l['timestamp'] = $l['created']->getTimestamp(); 608 if (startsWith($link['url'], '?')) {
616 if (startsWith($l['url'], '?')) { 609 $link['url'] = index_url($_SERVER) . $link['url']; // make permalink URL absolute
617 $l['url'] = index_url($_SERVER) . $l['url']; // make permalink URL absolute
618 } 610 }
619 $links[$id] = $l;
620 } 611 }
621 612
622 // Then build the HTML for this day: 613 // Then build the HTML for this day:
@@ -675,7 +666,6 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
675 666
676 $taglist = explode(' ',$link['tags']); 667 $taglist = explode(' ',$link['tags']);
677 uasort($taglist, 'strcasecmp'); 668 uasort($taglist, 'strcasecmp');
678 $linksToDisplay[$key]['shorturl'] = smallHash($link['created']->format('Ymd_His'));
679 $linksToDisplay[$key]['taglist']=$taglist; 669 $linksToDisplay[$key]['taglist']=$taglist;
680 $linksToDisplay[$key]['formatedDescription'] = format_description($link['description'], $conf->get('redirector.url')); 670 $linksToDisplay[$key]['formatedDescription'] = format_description($link['description'], $conf->get('redirector.url'));
681 $linksToDisplay[$key]['thumbnail'] = thumbnail($conf, $link['url']); 671 $linksToDisplay[$key]['thumbnail'] = thumbnail($conf, $link['url']);
@@ -829,7 +819,7 @@ function renderPage($conf, $pluginManager)
829 // Get only links which have a thumbnail. 819 // Get only links which have a thumbnail.
830 foreach($links as $link) 820 foreach($links as $link)
831 { 821 {
832 $permalink='?'.escape(smallHash($link['created']->format('Ymd_His'))); 822 $permalink='?'.$link['shorturl'];
833 $thumb=lazyThumbnail($conf, $link['url'],$permalink); 823 $thumb=lazyThumbnail($conf, $link['url'],$permalink);
834 if ($thumb!='') // Only output links which have a thumbnail. 824 if ($thumb!='') // Only output links which have a thumbnail.
835 { 825 {
@@ -1249,7 +1239,7 @@ function renderPage($conf, $pluginManager)
1249 } 1239 }
1250 1240
1251 // lf_id should only be present if the link exists. 1241 // lf_id should only be present if the link exists.
1252 $id = !empty($_POST['lf_id']) ? (int) escape($_POST['lf_id']) : $LINKSDB->getNextId(); 1242 $id = !empty($_POST['lf_id']) ? intval(escape($_POST['lf_id'])) : $LINKSDB->getNextId();
1253 // Linkdate is kept here to: 1243 // Linkdate is kept here to:
1254 // - use the same permalink for notes as they're displayed when creating them 1244 // - use the same permalink for notes as they're displayed when creating them
1255 // - let users hack creation date of their posts 1245 // - let users hack creation date of their posts
@@ -1257,11 +1247,11 @@ function renderPage($conf, $pluginManager)
1257 $linkdate = escape($_POST['lf_linkdate']); 1247 $linkdate = escape($_POST['lf_linkdate']);
1258 if (isset($LINKSDB[$id])) { 1248 if (isset($LINKSDB[$id])) {
1259 // Edit 1249 // Edit
1260 $created = DateTime::createFromFormat('Ymd_His', $linkdate); 1250 $created = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $linkdate);
1261 $updated = new DateTime(); 1251 $updated = new DateTime();
1262 } else { 1252 } else {
1263 // New link 1253 // New link
1264 $created = DateTime::createFromFormat('Ymd_His', $linkdate); 1254 $created = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $linkdate);
1265 $updated = null; 1255 $updated = null;
1266 } 1256 }
1267 1257
@@ -1288,7 +1278,8 @@ function renderPage($conf, $pluginManager)
1288 'private' => (isset($_POST['lf_private']) ? 1 : 0), 1278 'private' => (isset($_POST['lf_private']) ? 1 : 0),
1289 'created' => $created, 1279 'created' => $created,
1290 'updated' => $updated, 1280 'updated' => $updated,
1291 'tags' => str_replace(',', ' ', $tags) 1281 'tags' => str_replace(',', ' ', $tags),
1282 'shorturl' => link_small_hash($created, $id),
1292 ); 1283 );
1293 1284
1294 // If title is empty, use the URL as title. 1285 // If title is empty, use the URL as title.
@@ -1311,7 +1302,7 @@ function renderPage($conf, $pluginManager)
1311 $returnurl = !empty($_POST['returnurl']) ? $_POST['returnurl'] : '?'; 1302 $returnurl = !empty($_POST['returnurl']) ? $_POST['returnurl'] : '?';
1312 $location = generateLocation($returnurl, $_SERVER['HTTP_HOST'], array('addlink', 'post', 'edit_link')); 1303 $location = generateLocation($returnurl, $_SERVER['HTTP_HOST'], array('addlink', 'post', 'edit_link'));
1313 // Scroll to the link which has been edited. 1304 // Scroll to the link which has been edited.
1314 $location .= '#' . smallHash($created->format('Ymd_His')); 1305 $location .= '#' . $link['shorturl'];
1315 // After saving the link, redirect to the page the user was on. 1306 // After saving the link, redirect to the page the user was on.
1316 header('Location: '. $location); 1307 header('Location: '. $location);
1317 exit; 1308 exit;
@@ -1325,7 +1316,7 @@ function renderPage($conf, $pluginManager)
1325 $link = $LINKSDB[(int) escape($_POST['lf_id'])]; 1316 $link = $LINKSDB[(int) escape($_POST['lf_id'])];
1326 $returnurl = ( isset($_POST['returnurl']) ? $_POST['returnurl'] : '?' ); 1317 $returnurl = ( isset($_POST['returnurl']) ? $_POST['returnurl'] : '?' );
1327 // Scroll to the link which has been edited. 1318 // Scroll to the link which has been edited.
1328 $returnurl .= '#'.smallHash($link['created']->format('Ymd_His')); 1319 $returnurl .= '#'. $link['shorturl'];
1329 $returnurl = generateLocation($returnurl, $_SERVER['HTTP_HOST'], array('addlink', 'post', 'edit_link')); 1320 $returnurl = generateLocation($returnurl, $_SERVER['HTTP_HOST'], array('addlink', 'post', 'edit_link'));
1330 header('Location: '.$returnurl); // After canceling, redirect to the page the user was on. 1321 header('Location: '.$returnurl); // After canceling, redirect to the page the user was on.
1331 exit; 1322 exit;
@@ -1341,7 +1332,7 @@ function renderPage($conf, $pluginManager)
1341 // - we are protected from XSRF by the token. 1332 // - we are protected from XSRF by the token.
1342 1333
1343 // FIXME! We keep `lf_linkdate` for consistency before a proper API. To be removed. 1334 // FIXME! We keep `lf_linkdate` for consistency before a proper API. To be removed.
1344 $id = isset($_POST['lf_id']) ? (int) escape($_POST['lf_id']) : (int) escape($_POST['lf_linkdate']); 1335 $id = isset($_POST['lf_id']) ? intval(escape($_POST['lf_id'])) : intval(escape($_POST['lf_linkdate']));
1345 1336
1346 $pluginManager->executeHooks('delete_link', $LINKSDB[$id]); 1337 $pluginManager->executeHooks('delete_link', $LINKSDB[$id]);
1347 1338
@@ -1387,7 +1378,7 @@ function renderPage($conf, $pluginManager)
1387 $id = (int) escape($_GET['edit_link']); 1378 $id = (int) escape($_GET['edit_link']);
1388 $link = $LINKSDB[$id]; // Read database 1379 $link = $LINKSDB[$id]; // Read database
1389 if (!$link) { header('Location: ?'); exit; } // Link not found in database. 1380 if (!$link) { header('Location: ?'); exit; } // Link not found in database.
1390 $link['linkdate'] = $link['created']->format('Ymd_His'); 1381 $link['linkdate'] = $link['created']->format(LinkDB::LINK_DATE_FORMAT);
1391 $data = array( 1382 $data = array(
1392 'link' => $link, 1383 'link' => $link,
1393 'link_is_new' => false, 1384 'link_is_new' => false,
@@ -1414,7 +1405,7 @@ function renderPage($conf, $pluginManager)
1414 if (! $link) 1405 if (! $link)
1415 { 1406 {
1416 $link_is_new = true; 1407 $link_is_new = true;
1417 $linkdate = strval(date('Ymd_His')); 1408 $linkdate = strval(date(LinkDB::LINK_DATE_FORMAT));
1418 // Get title if it was provided in URL (by the bookmarklet). 1409 // Get title if it was provided in URL (by the bookmarklet).
1419 $title = empty($_GET['title']) ? '' : escape($_GET['title']); 1410 $title = empty($_GET['title']) ? '' : escape($_GET['title']);
1420 // Get description if it was provided in URL (by the bookmarklet). [Bronco added that] 1411 // Get description if it was provided in URL (by the bookmarklet). [Bronco added that]
@@ -1438,7 +1429,7 @@ function renderPage($conf, $pluginManager)
1438 } 1429 }
1439 1430
1440 if ($url == '') { 1431 if ($url == '') {
1441 $url = '?' . smallHash($linkdate); 1432 $url = '?' . smallHash($linkdate . $LINKSDB->getNextId());
1442 $title = 'Note: '; 1433 $title = 'Note: ';
1443 } 1434 }
1444 $url = escape($url); 1435 $url = escape($url);
@@ -1453,7 +1444,7 @@ function renderPage($conf, $pluginManager)
1453 'private' => $private 1444 'private' => $private
1454 ); 1445 );
1455 } else { 1446 } else {
1456 $link['linkdate'] = $link['created']->format('Ymd_His'); 1447 $link['linkdate'] = $link['created']->format(LinkDB::LINK_DATE_FORMAT);
1457 } 1448 }
1458 1449
1459 $data = array( 1450 $data = array(
@@ -1668,7 +1659,6 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1668 $taglist = explode(' ', $link['tags']); 1659 $taglist = explode(' ', $link['tags']);
1669 uasort($taglist, 'strcasecmp'); 1660 uasort($taglist, 'strcasecmp');
1670 $link['taglist'] = $taglist; 1661 $link['taglist'] = $taglist;
1671 $link['shorturl'] = smallHash($link['created']->format('Ymd_His'));
1672 // Check for both signs of a note: starting with ? and 7 chars long. 1662 // Check for both signs of a note: starting with ? and 7 chars long.
1673 if ($link['url'][0] === '?' && 1663 if ($link['url'][0] === '?' &&
1674 strlen($link['url']) === 7) { 1664 strlen($link['url']) === 7) {
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php
index c44f3c09..ce16645f 100644
--- a/plugins/isso/isso.php
+++ b/plugins/isso/isso.php
@@ -43,9 +43,7 @@ function hook_isso_render_linklist($data, $conf)
43 $link = reset($data['links']); 43 $link = reset($data['links']);
44 $issoHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html'); 44 $issoHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html');
45 45
46 // FIXME! KO thread unique si même date 46 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']);
47 $linkDate = $link['created']->format('Ymd_His');
48 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $linkDate, $linkDate);
49 $data['plugin_end_zone'][] = $isso; 47 $data['plugin_end_zone'][] = $isso;
50 48
51 // Hackish way to include this CSS file only when necessary. 49 // Hackish way to include this CSS file only when necessary.
diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php
index ea1dde25..06a44506 100644
--- a/tests/FeedBuilderTest.php
+++ b/tests/FeedBuilderTest.php
@@ -86,7 +86,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase
86 // Test first link (note link) 86 // Test first link (note link)
87 $link = reset($data['links']); 87 $link = reset($data['links']);
88 $this->assertEquals(41, $link['id']); 88 $this->assertEquals(41, $link['id']);
89 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114651'), $link['created']); 89 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
90 $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); 90 $this->assertEquals('http://host.tld/?WDWyig', $link['guid']);
91 $this->assertEquals('http://host.tld/?WDWyig', $link['url']); 91 $this->assertEquals('http://host.tld/?WDWyig', $link['url']);
92 $this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']); 92 $this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']);
@@ -140,7 +140,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase
140 $this->assertEquals(1, count($data['links'])); 140 $this->assertEquals(1, count($data['links']));
141 $link = array_shift($data['links']); 141 $link = array_shift($data['links']);
142 $this->assertEquals(41, $link['id']); 142 $this->assertEquals(41, $link['id']);
143 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114651'), $link['created']); 143 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
144 } 144 }
145 145
146 /** 146 /**
@@ -157,7 +157,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase
157 $this->assertEquals(1, count($data['links'])); 157 $this->assertEquals(1, count($data['links']));
158 $link = array_shift($data['links']); 158 $link = array_shift($data['links']);
159 $this->assertEquals(41, $link['id']); 159 $this->assertEquals(41, $link['id']);
160 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114651'), $link['created']); 160 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
161 } 161 }
162 162
163 /** 163 /**
@@ -174,7 +174,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase
174 // First link is a permalink 174 // First link is a permalink
175 $link = array_shift($data['links']); 175 $link = array_shift($data['links']);
176 $this->assertEquals(41, $link['id']); 176 $this->assertEquals(41, $link['id']);
177 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114651'), $link['created']); 177 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
178 $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); 178 $this->assertEquals('http://host.tld/?WDWyig', $link['guid']);
179 $this->assertEquals('http://host.tld/?WDWyig', $link['url']); 179 $this->assertEquals('http://host.tld/?WDWyig', $link['url']);
180 $this->assertContains('Direct link', $link['description']); 180 $this->assertContains('Direct link', $link['description']);
@@ -182,7 +182,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase
182 // Second link is a direct link 182 // Second link is a direct link
183 $link = array_shift($data['links']); 183 $link = array_shift($data['links']);
184 $this->assertEquals(8, $link['id']); 184 $this->assertEquals(8, $link['id']);
185 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114633'), $link['created']); 185 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114633'), $link['created']);
186 $this->assertEquals('http://host.tld/?RttfEw', $link['guid']); 186 $this->assertEquals('http://host.tld/?RttfEw', $link['guid']);
187 $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']); 187 $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']);
188 $this->assertContains('Direct link', $link['description']); 188 $this->assertContains('Direct link', $link['description']);
diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php
index bedc680e..1f62a34a 100644
--- a/tests/LinkDBTest.php
+++ b/tests/LinkDBTest.php
@@ -191,7 +191,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
191 'url'=>'http://dum.my', 191 'url'=>'http://dum.my',
192 'description'=>'One more', 192 'description'=>'One more',
193 'private'=>0, 193 'private'=>0,
194 'created'=> DateTime::createFromFormat('Ymd_His', '20150518_190000'), 194 'created'=> DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150518_190000'),
195 'tags'=>'unit test' 195 'tags'=>'unit test'
196 ); 196 );
197 $testDB[$link['id']] = $link; 197 $testDB[$link['id']] = $link;
@@ -447,17 +447,17 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
447 */ 447 */
448 public function testReorderLinksDesc() 448 public function testReorderLinksDesc()
449 { 449 {
450 self::$publicLinkDB->reorder('ASC'); 450 self::$privateLinkDB->reorder('ASC');
451 $linkIdToTest = 42; 451 $linkIds = array(42, 4, 1, 0, 7, 6, 8, 41);
452 foreach (self::$publicLinkDB as $key => $value) { 452 $cpt = 0;
453 $this->assertEquals($linkIdToTest, $key); 453 foreach (self::$privateLinkDB as $key => $value) {
454 break; 454 $this->assertEquals($linkIds[$cpt++], $key);
455 } 455 }
456 self::$publicLinkDB->reorder('DESC'); 456 self::$privateLinkDB->reorder('DESC');
457 $linkIdToTest = 41; 457 $linkIds = array_reverse($linkIds);
458 foreach (self::$publicLinkDB as $key => $value) { 458 $cpt = 0;
459 $this->assertEquals($linkIdToTest, $key); 459 foreach (self::$privateLinkDB as $key => $value) {
460 break; 460 $this->assertEquals($linkIds[$cpt++], $key);
461 } 461 }
462 } 462 }
463} 463}
diff --git a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
index 96895b00..0ca07eac 100644
--- a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
+++ b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
@@ -116,7 +116,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
116 $this->assertEquals( 116 $this->assertEquals(
117 array( 117 array(
118 'id' => 0, 118 'id' => 0,
119 'created' => DateTime::createFromFormat('Ymd_His', '20160618_203944'), 119 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160618_203944'),
120 'title' => 'Hg Init a Mercurial tutorial by Joel Spolsky', 120 'title' => 'Hg Init a Mercurial tutorial by Joel Spolsky',
121 'url' => 'http://hginit.com/', 121 'url' => 'http://hginit.com/',
122 'description' => '', 122 'description' => '',
@@ -145,7 +145,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
145 $this->assertEquals( 145 $this->assertEquals(
146 array( 146 array(
147 'id' => 0, 147 'id' => 0,
148 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235541'), 148 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235541'),
149 'title' => 'Nested 1', 149 'title' => 'Nested 1',
150 'url' => 'http://nest.ed/1', 150 'url' => 'http://nest.ed/1',
151 'description' => '', 151 'description' => '',
@@ -158,7 +158,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
158 $this->assertEquals( 158 $this->assertEquals(
159 array( 159 array(
160 'id' => 1, 160 'id' => 1,
161 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235542'), 161 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235542'),
162 'title' => 'Nested 1-1', 162 'title' => 'Nested 1-1',
163 'url' => 'http://nest.ed/1-1', 163 'url' => 'http://nest.ed/1-1',
164 'description' => '', 164 'description' => '',
@@ -171,7 +171,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
171 $this->assertEquals( 171 $this->assertEquals(
172 array( 172 array(
173 'id' => 2, 173 'id' => 2,
174 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235547'), 174 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235547'),
175 'title' => 'Nested 1-2', 175 'title' => 'Nested 1-2',
176 'url' => 'http://nest.ed/1-2', 176 'url' => 'http://nest.ed/1-2',
177 'description' => '', 177 'description' => '',
@@ -184,7 +184,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
184 $this->assertEquals( 184 $this->assertEquals(
185 array( 185 array(
186 'id' => 3, 186 'id' => 3,
187 'created' => DateTime::createFromFormat('Ymd_His', '20160202_202222'), 187 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160202_202222'),
188 'title' => 'Nested 2-1', 188 'title' => 'Nested 2-1',
189 'url' => 'http://nest.ed/2-1', 189 'url' => 'http://nest.ed/2-1',
190 'description' => 'First link of the second section', 190 'description' => 'First link of the second section',
@@ -197,7 +197,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
197 $this->assertEquals( 197 $this->assertEquals(
198 array( 198 array(
199 'id' => 4, 199 'id' => 4,
200 'created' => DateTime::createFromFormat('Ymd_His', '20160119_230227'), 200 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160119_230227'),
201 'title' => 'Nested 2-2', 201 'title' => 'Nested 2-2',
202 'url' => 'http://nest.ed/2-2', 202 'url' => 'http://nest.ed/2-2',
203 'description' => 'Second link of the second section', 203 'description' => 'Second link of the second section',
@@ -210,7 +210,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
210 $this->assertEquals( 210 $this->assertEquals(
211 array( 211 array(
212 'id' => 5, 212 'id' => 5,
213 'created' => DateTime::createFromFormat('Ymd_His', '20160202_202222'), 213 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160202_202222'),
214 'title' => 'Nested 3-1', 214 'title' => 'Nested 3-1',
215 'url' => 'http://nest.ed/3-1', 215 'url' => 'http://nest.ed/3-1',
216 'description' => '', 216 'description' => '',
@@ -223,7 +223,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
223 $this->assertEquals( 223 $this->assertEquals(
224 array( 224 array(
225 'id' => 6, 225 'id' => 6,
226 'created' => DateTime::createFromFormat('Ymd_His', '20160119_230227'), 226 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160119_230227'),
227 'title' => 'Nested 3-2', 227 'title' => 'Nested 3-2',
228 'url' => 'http://nest.ed/3-2', 228 'url' => 'http://nest.ed/3-2',
229 'description' => '', 229 'description' => '',
@@ -236,7 +236,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
236 $this->assertEquals( 236 $this->assertEquals(
237 array( 237 array(
238 'id' => 7, 238 'id' => 7,
239 'created' => DateTime::createFromFormat('Ymd_His', '20160229_111541'), 239 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160229_111541'),
240 'title' => 'Nested 2', 240 'title' => 'Nested 2',
241 'url' => 'http://nest.ed/2', 241 'url' => 'http://nest.ed/2',
242 'description' => '', 242 'description' => '',
@@ -269,7 +269,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
269 array( 269 array(
270 'id' => 0, 270 'id' => 0,
271 // Old link - UTC+4 (note that TZ in the import file is ignored). 271 // Old link - UTC+4 (note that TZ in the import file is ignored).
272 'created' => DateTime::createFromFormat('Ymd_His', '20001010_135536'), 272 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20001010_135536'),
273 'title' => 'Secret stuff', 273 'title' => 'Secret stuff',
274 'url' => 'https://private.tld', 274 'url' => 'https://private.tld',
275 'description' => "Super-secret stuff you're not supposed to know about", 275 'description' => "Super-secret stuff you're not supposed to know about",
@@ -282,7 +282,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
282 $this->assertEquals( 282 $this->assertEquals(
283 array( 283 array(
284 'id' => 1, 284 'id' => 1,
285 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235548'), 285 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235548'),
286 'title' => 'Public stuff', 286 'title' => 'Public stuff',
287 'url' => 'http://public.tld', 287 'url' => 'http://public.tld',
288 'description' => '', 288 'description' => '',
@@ -313,7 +313,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
313 array( 313 array(
314 'id' => 0, 314 'id' => 0,
315 // Note that TZ in the import file is ignored. 315 // Note that TZ in the import file is ignored.
316 'created' => DateTime::createFromFormat('Ymd_His', '20001010_135536'), 316 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20001010_135536'),
317 'title' => 'Secret stuff', 317 'title' => 'Secret stuff',
318 'url' => 'https://private.tld', 318 'url' => 'https://private.tld',
319 'description' => "Super-secret stuff you're not supposed to know about", 319 'description' => "Super-secret stuff you're not supposed to know about",
@@ -326,7 +326,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
326 $this->assertEquals( 326 $this->assertEquals(
327 array( 327 array(
328 'id' => 1, 328 'id' => 1,
329 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235548'), 329 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235548'),
330 'title' => 'Public stuff', 330 'title' => 'Public stuff',
331 'url' => 'http://public.tld', 331 'url' => 'http://public.tld',
332 'description' => '', 332 'description' => '',
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index b8a050b0..4948fe52 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/Updater/UpdaterTest.php
@@ -352,20 +352,20 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
352 $this->assertEquals('Naming conventions... #private', $linkDB[0]['description']); 352 $this->assertEquals('Naming conventions... #private', $linkDB[0]['description']);
353 $this->assertEquals('samba cartoon web', $linkDB[0]['tags']); 353 $this->assertEquals('samba cartoon web', $linkDB[0]['tags']);
354 $this->assertTrue($linkDB[0]['private']); 354 $this->assertTrue($linkDB[0]['private']);
355 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20121206_142300'), $linkDB[0]['created']); 355 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_142300'), $linkDB[0]['created']);
356 356
357 $this->assertTrue(isset($linkDB[1])); 357 $this->assertTrue(isset($linkDB[1]));
358 $this->assertFalse(isset($linkDB[1]['linkdate'])); 358 $this->assertFalse(isset($linkDB[1]['linkdate']));
359 $this->assertEquals(1, $linkDB[1]['id']); 359 $this->assertEquals(1, $linkDB[1]['id']);
360 $this->assertEquals('UserFriendly - Samba', $linkDB[1]['title']); 360 $this->assertEquals('UserFriendly - Samba', $linkDB[1]['title']);
361 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20121206_172539'), $linkDB[1]['created']); 361 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_172539'), $linkDB[1]['created']);
362 362
363 $this->assertTrue(isset($linkDB[2])); 363 $this->assertTrue(isset($linkDB[2]));
364 $this->assertFalse(isset($linkDB[2]['linkdate'])); 364 $this->assertFalse(isset($linkDB[2]['linkdate']));
365 $this->assertEquals(2, $linkDB[2]['id']); 365 $this->assertEquals(2, $linkDB[2]['id']);
366 $this->assertEquals('Geek and Poke', $linkDB[2]['title']); 366 $this->assertEquals('Geek and Poke', $linkDB[2]['title']);
367 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20121206_182539'), $linkDB[2]['created']); 367 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_182539'), $linkDB[2]['created']);
368 $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20121206_190301'), $linkDB[2]['updated']); 368 $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_190301'), $linkDB[2]['updated']);
369 } 369 }
370 370
371 /** 371 /**
diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php
index ea86a05c..6b7904dd 100644
--- a/tests/plugins/PluginIssoTest.php
+++ b/tests/plugins/PluginIssoTest.php
@@ -52,8 +52,9 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
52 'title' => $str, 52 'title' => $str,
53 'links' => array( 53 'links' => array(
54 array( 54 array(
55 'id' => 12,
55 'url' => $str, 56 'url' => $str,
56 'created' => DateTime::createFromFormat('Ymd_His', $date), 57 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date),
57 ) 58 )
58 ) 59 )
59 ); 60 );
@@ -66,7 +67,14 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
66 67
67 // plugin data 68 // plugin data
68 $this->assertEquals(1, count($data['plugin_end_zone'])); 69 $this->assertEquals(1, count($data['plugin_end_zone']));
69 $this->assertNotFalse(strpos($data['plugin_end_zone'][0], $date)); 70 $this->assertNotFalse(strpos(
71 $data['plugin_end_zone'][0],
72 'data-isso-id="'. $data['links'][0]['id'] .'"'
73 ));
74 $this->assertNotFalse(strpos(
75 $data['plugin_end_zone'][0],
76 'data-title="'. $data['links'][0]['id'] .'"'
77 ));
70 $this->assertNotFalse(strpos($data['plugin_end_zone'][0], 'embed.min.js')); 78 $this->assertNotFalse(strpos($data['plugin_end_zone'][0], 'embed.min.js'));
71 } 79 }
72 80
@@ -85,12 +93,14 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
85 'title' => $str, 93 'title' => $str,
86 'links' => array( 94 'links' => array(
87 array( 95 array(
96 'id' => 12,
88 'url' => $str, 97 'url' => $str,
89 'created' => DateTime::createFromFormat('Ymd_His', $date1), 98 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date1),
90 ), 99 ),
91 array( 100 array(
101 'id' => 13,
92 'url' => $str . '2', 102 'url' => $str . '2',
93 'created' => DateTime::createFromFormat('Ymd_His', $date2), 103 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date2),
94 ), 104 ),
95 ) 105 )
96 ); 106 );
@@ -114,8 +124,9 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
114 'title' => $str, 124 'title' => $str,
115 'links' => array( 125 'links' => array(
116 array( 126 array(
127 'id' => 12,
117 'url' => $str, 128 'url' => $str,
118 'created' => DateTime::createFromFormat('Ymd_His', $date), 129 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date),
119 ) 130 )
120 ), 131 ),
121 'search_term' => $str 132 'search_term' => $str
diff --git a/tests/utils/ReferenceLinkDB.php b/tests/utils/ReferenceLinkDB.php
index 6b16c9e8..36d58c68 100644
--- a/tests/utils/ReferenceLinkDB.php
+++ b/tests/utils/ReferenceLinkDB.php
@@ -21,7 +21,7 @@ class ReferenceLinkDB
21 '?WDWyig', 21 '?WDWyig',
22 'Stallman has a beard and is part of the Free Software Foundation (or not). Seriously, read this. #hashtag', 22 'Stallman has a beard and is part of the Free Software Foundation (or not). Seriously, read this. #hashtag',
23 0, 23 0,
24 DateTime::createFromFormat('Ymd_His', '20150310_114651'), 24 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'),
25 'sTuff', 25 'sTuff',
26 null, 26 null,
27 'WDWyig' 27 'WDWyig'
@@ -33,7 +33,7 @@ class ReferenceLinkDB
33 '?WDWyig', 33 '?WDWyig',
34 'Used to test links reordering.', 34 'Used to test links reordering.',
35 0, 35 0,
36 DateTime::createFromFormat('Ymd_His', '20100310_101010'), 36 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20100310_101010'),
37 'ut' 37 'ut'
38 ); 38 );
39 39
@@ -43,9 +43,9 @@ class ReferenceLinkDB
43 'https://static.fsf.org/nosvn/faif-2.0.pdf', 43 'https://static.fsf.org/nosvn/faif-2.0.pdf',
44 'Richard Stallman and the Free Software Revolution. Read this. #hashtag', 44 'Richard Stallman and the Free Software Revolution. Read this. #hashtag',
45 0, 45 0,
46 DateTime::createFromFormat('Ymd_His', '20150310_114633'), 46 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114633'),
47 'free gnu software stallman -exclude stuff hashtag', 47 'free gnu software stallman -exclude stuff hashtag',
48 DateTime::createFromFormat('Ymd_His', '20160803_093033') 48 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160803_093033')
49 ); 49 );
50 50
51 $this->addLink( 51 $this->addLink(
@@ -54,7 +54,7 @@ class ReferenceLinkDB
54 'http://mediagoblin.org/', 54 'http://mediagoblin.org/',
55 'A free software media publishing platform #hashtagOther', 55 'A free software media publishing platform #hashtagOther',
56 0, 56 0,
57 DateTime::createFromFormat('Ymd_His', '20130614_184135'), 57 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20130614_184135'),
58 'gnu media web .hidden hashtag', 58 'gnu media web .hidden hashtag',
59 null, 59 null,
60 'IuWvgA' 60 'IuWvgA'
@@ -66,7 +66,7 @@ class ReferenceLinkDB
66 'https://dvcs.w3.org/hg/markup-validator/summary', 66 'https://dvcs.w3.org/hg/markup-validator/summary',
67 'Mercurial repository for the W3C Validator #private', 67 'Mercurial repository for the W3C Validator #private',
68 1, 68 1,
69 DateTime::createFromFormat('Ymd_His', '20141125_084734'), 69 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20141125_084734'),
70 'css html w3c web Mercurial' 70 'css html w3c web Mercurial'
71 ); 71 );
72 72
@@ -76,7 +76,7 @@ class ReferenceLinkDB
76 'http://ars.userfriendly.org/cartoons/?id=20121206', 76 'http://ars.userfriendly.org/cartoons/?id=20121206',
77 'Naming conventions... #private', 77 'Naming conventions... #private',
78 0, 78 0,
79 DateTime::createFromFormat('Ymd_His', '20121206_142300'), 79 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_142300'),
80 'dev cartoon web' 80 'dev cartoon web'
81 ); 81 );
82 82
@@ -86,7 +86,7 @@ class ReferenceLinkDB
86 'http://ars.userfriendly.org/cartoons/?id=20010306', 86 'http://ars.userfriendly.org/cartoons/?id=20010306',
87 'Tropical printing', 87 'Tropical printing',
88 0, 88 0,
89 DateTime::createFromFormat('Ymd_His', '20121206_172539'), 89 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_172539'),
90 'samba cartoon web' 90 'samba cartoon web'
91 ); 91 );
92 92
@@ -96,7 +96,7 @@ class ReferenceLinkDB
96 'http://geek-and-poke.com/', 96 'http://geek-and-poke.com/',
97 '', 97 '',
98 1, 98 1,
99 DateTime::createFromFormat('Ymd_His', '20121206_182539'), 99 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_182539'),
100 'dev cartoon tag1 tag2 tag3 tag4 ' 100 'dev cartoon tag1 tag2 tag3 tag4 '
101 ); 101 );
102 } 102 }
@@ -115,7 +115,7 @@ class ReferenceLinkDB
115 'tags' => $tags, 115 'tags' => $tags,
116 'created' => $date, 116 'created' => $date,
117 'updated' => $updated, 117 'updated' => $updated,
118 'shorturl' => $shorturl ? $shorturl : smallHash($date->format('Ymd_His') . $id), 118 'shorturl' => $shorturl ? $shorturl : smallHash($date->format(LinkDB::LINK_DATE_FORMAT) . $id),
119 ); 119 );
120 $this->_links[$id] = $link; 120 $this->_links[$id] = $link;
121 121