aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--application/NetscapeBookmarkUtils.php34
-rw-r--r--application/Updater.php17
-rw-r--r--composer.json2
-rw-r--r--index.php2
-rw-r--r--plugins/piwik/piwik.html15
-rw-r--r--plugins/piwik/piwik.php23
-rw-r--r--tests/NetscapeBookmarkUtils/BookmarkImportTest.php42
-rw-r--r--tests/Updater/UpdaterTest.php41
-rw-r--r--tests/utils/config/configJson.json.php2
-rw-r--r--tpl/default/linklist.html2
-rw-r--r--tpl/default/page.header.html4
12 files changed, 137 insertions, 48 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a87a8ca..44ac06ff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ Theming:
28- Add OpenSearch to feed templates 28- Add OpenSearch to feed templates
29- Add `campaign_` to the URL cleanup pattern list 29- Add `campaign_` to the URL cleanup pattern list
30- Add an AUTHORS file and Makefile target to list authors from Git commit data 30- Add an AUTHORS file and Makefile target to list authors from Git commit data
31- Link imports are now logged in `data/` folder, and can be debug using `dev.debug=true` setting.
31 32
32### Changed 33### Changed
33- Docker: enable nginx URL rewriting for the REST API 34- Docker: enable nginx URL rewriting for the REST API
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php
index e7148d00..ab346f81 100644
--- a/application/NetscapeBookmarkUtils.php
+++ b/application/NetscapeBookmarkUtils.php
@@ -1,7 +1,13 @@
1<?php 1<?php
2 2
3use Psr\Log\LogLevel;
4use Shaarli\Config\ConfigManager;
5use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser;
6use Katzgrau\KLogger\Logger;
7
3/** 8/**
4 * Utilities to import and export bookmarks using the Netscape format 9 * Utilities to import and export bookmarks using the Netscape format
10 * TODO: Not static, use a container.
5 */ 11 */
6class NetscapeBookmarkUtils 12class NetscapeBookmarkUtils
7{ 13{
@@ -85,14 +91,14 @@ class NetscapeBookmarkUtils
85 /** 91 /**
86 * Imports Web bookmarks from an uploaded Netscape bookmark dump 92 * Imports Web bookmarks from an uploaded Netscape bookmark dump
87 * 93 *
88 * @param array $post Server $_POST parameters 94 * @param array $post Server $_POST parameters
89 * @param array $files Server $_FILES parameters 95 * @param array $files Server $_FILES parameters
90 * @param LinkDB $linkDb Loaded LinkDB instance 96 * @param LinkDB $linkDb Loaded LinkDB instance
91 * @param string $pagecache Page cache 97 * @param ConfigManager $conf instance
92 * 98 *
93 * @return string Summary of the bookmark import status 99 * @return string Summary of the bookmark import status
94 */ 100 */
95 public static function import($post, $files, $linkDb, $pagecache) 101 public static function import($post, $files, $linkDb, $conf)
96 { 102 {
97 $filename = $files['filetoupload']['name']; 103 $filename = $files['filetoupload']['name'];
98 $filesize = $files['filetoupload']['size']; 104 $filesize = $files['filetoupload']['size'];
@@ -119,10 +125,20 @@ class NetscapeBookmarkUtils
119 $defaultPrivacy = 0; 125 $defaultPrivacy = 0;
120 126
121 $parser = new NetscapeBookmarkParser( 127 $parser = new NetscapeBookmarkParser(
122 true, // nested tag support 128 true, // nested tag support
123 $defaultTags, // additional user-specified tags 129 $defaultTags, // additional user-specified tags
124 strval(1 - $defaultPrivacy) // defaultPub = 1 - defaultPrivacy 130 strval(1 - $defaultPrivacy), // defaultPub = 1 - defaultPrivacy
131 $conf->get('resource.data_dir') // log path, will be overridden
132 );
133 $logger = new Logger(
134 $conf->get('resource.data_dir'),
135 ! $conf->get('dev.debug') ? LogLevel::INFO : LogLevel::DEBUG,
136 [
137 'prefix' => 'import.',
138 'extension' => 'log',
139 ]
125 ); 140 );
141 $parser->setLogger($logger);
126 $bookmarks = $parser->parseString($data); 142 $bookmarks = $parser->parseString($data);
127 143
128 $importCount = 0; 144 $importCount = 0;
@@ -179,7 +195,7 @@ class NetscapeBookmarkUtils
179 $importCount++; 195 $importCount++;
180 } 196 }
181 197
182 $linkDb->save($pagecache); 198 $linkDb->save($conf->get('resource.page_cache'));
183 return self::importStatus( 199 return self::importStatus(
184 $filename, 200 $filename,
185 $filesize, 201 $filesize,
diff --git a/application/Updater.php b/application/Updater.php
index 27cb2f0a..fd7e2073 100644
--- a/application/Updater.php
+++ b/application/Updater.php
@@ -1,6 +1,7 @@
1<?php 1<?php
2use Shaarli\Config\ConfigJson; 2use Shaarli\Config\ConfigJson;
3use Shaarli\Config\ConfigPhp; 3use Shaarli\Config\ConfigPhp;
4use Shaarli\Config\ConfigManager;
4 5
5/** 6/**
6 * Class Updater. 7 * Class Updater.
@@ -363,6 +364,22 @@ class Updater
363 364
364 return true; 365 return true;
365 } 366 }
367
368 /**
369 * Add 'http://' to Piwik URL the setting is set.
370 *
371 * @return bool true if the update is successful, false otherwise.
372 */
373 public function updateMethodPiwikUrl()
374 {
375 if (! $this->conf->exists('plugins.PIWIK_URL') || startsWith($this->conf->get('plugins.PIWIK_URL'), 'http')) {
376 return true;
377 }
378
379 $this->conf->set('plugins.PIWIK_URL', 'http://'. $this->conf->get('plugins.PIWIK_URL'));
380 $this->conf->write($this->isLoggedIn);
381 return true;
382 }
366} 383}
367 384
368/** 385/**
diff --git a/composer.json b/composer.json
index 57851e53..792c43d3 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,7 @@
11 "keywords": ["bookmark", "link", "share", "web"], 11 "keywords": ["bookmark", "link", "share", "web"],
12 "require": { 12 "require": {
13 "php": ">=5.5", 13 "php": ">=5.5",
14 "shaarli/netscape-bookmark-parser": "1.*", 14 "shaarli/netscape-bookmark-parser": "^2.0",
15 "erusev/parsedown": "1.6", 15 "erusev/parsedown": "1.6",
16 "slim/slim": "^3.0", 16 "slim/slim": "^3.0",
17 "pubsubhubbub/publisher": "dev-master" 17 "pubsubhubbub/publisher": "dev-master"
diff --git a/index.php b/index.php
index 3c2bb1d2..cc7f3ca3 100644
--- a/index.php
+++ b/index.php
@@ -1528,7 +1528,7 @@ function renderPage($conf, $pluginManager, $LINKSDB)
1528 $_POST, 1528 $_POST,
1529 $_FILES, 1529 $_FILES,
1530 $LINKSDB, 1530 $LINKSDB,
1531 $conf->get('resource.page_cache') 1531 $conf
1532 ); 1532 );
1533 echo '<script>alert("'.$status.'");document.location=\'?do=' 1533 echo '<script>alert("'.$status.'");document.location=\'?do='
1534 .Router::$PAGE_IMPORT .'\';</script>'; 1534 .Router::$PAGE_IMPORT .'\';</script>';
diff --git a/plugins/piwik/piwik.html b/plugins/piwik/piwik.html
new file mode 100644
index 00000000..0881d7c8
--- /dev/null
+++ b/plugins/piwik/piwik.html
@@ -0,0 +1,15 @@
1<!-- Piwik -->
2<script type="text/javascript">
3 var _paq = _paq || [];
4 _paq.push(['trackPageView']);
5 _paq.push(['enableLinkTracking']);
6 (function() {
7 var u="%s/";
8 _paq.push(['setTrackerUrl', u+'piwik.php']);
9 _paq.push(['setSiteId', '%s']);
10 var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
11 g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
12 })();
13</script>
14<noscript><p><img src="%s/piwik.php?idsite=%s" style="border:0;" alt="" /></p></noscript>
15<!-- End Piwik Code --> \ No newline at end of file
diff --git a/plugins/piwik/piwik.php b/plugins/piwik/piwik.php
index 7c44909c..4a2b48a1 100644
--- a/plugins/piwik/piwik.php
+++ b/plugins/piwik/piwik.php
@@ -50,22 +50,13 @@ function hook_piwik_render_footer($data, $conf)
50 } 50 }
51 51
52 // Free elements at the end of the page. 52 // Free elements at the end of the page.
53 $data['endofpage'][] = '<!-- Piwik -->' . 53 $data['endofpage'][] = sprintf(
54'<script type="text/javascript">' . 54 file_get_contents(PluginManager::$PLUGINS_PATH . '/piwik/piwik.html'),
55' var _paq = _paq || [];' . 55 $piwikUrl,
56' _paq.push([\'trackPageView\']);' . 56 $piwikSiteid,
57' _paq.push([\'enableLinkTracking\']);' . 57 $piwikUrl,
58' (function() {' . 58 $piwikSiteid
59' var u="//' . $piwikUrl . '/";' . 59 );
60' _paq.push([\'setTrackerUrl\', u+\'piwik.php\']);' .
61' _paq.push([\'setSiteId\', \'' . $piwikSiteid . '\']);' .
62' var d=document, g=d.createElement(\'script\'), s=d.getElementsByTagName(\'script\')[0];' .
63' g.type=\'text/javascript\'; g.async=true; g.defer=true; g.src=u+\'piwik.js\'; s.parentNode.insertBefore(g,s);' .
64' })();' .
65'</script>' .
66'<noscript><p><img src="//' . $piwikUrl . '/piwik.php?idsite=' . $piwikSiteid . '" style="border:0;" alt="" /></p></noscript>' .
67'<!-- End Piwik Code -->';
68 60
69 return $data; 61 return $data;
70} 62}
71
diff --git a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
index 0ca07eac..5925a8e1 100644
--- a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
+++ b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
@@ -2,6 +2,7 @@
2 2
3require_once 'application/NetscapeBookmarkUtils.php'; 3require_once 'application/NetscapeBookmarkUtils.php';
4 4
5use Shaarli\Config\ConfigManager;
5 6
6/** 7/**
7 * Utility function to load a file's metadata in a $_FILES-like array 8 * Utility function to load a file's metadata in a $_FILES-like array
@@ -43,6 +44,11 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
43 protected $pagecache = 'tests'; 44 protected $pagecache = 'tests';
44 45
45 /** 46 /**
47 * @var ConfigManager instance.
48 */
49 protected $conf;
50
51 /**
46 * @var string Save the current timezone. 52 * @var string Save the current timezone.
47 */ 53 */
48 protected static $defaultTimeZone; 54 protected static $defaultTimeZone;
@@ -65,6 +71,8 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
65 // start with an empty datastore 71 // start with an empty datastore
66 file_put_contents(self::$testDatastore, '<?php /* S7QysKquBQA= */ ?>'); 72 file_put_contents(self::$testDatastore, '<?php /* S7QysKquBQA= */ ?>');
67 $this->linkDb = new LinkDB(self::$testDatastore, true, false); 73 $this->linkDb = new LinkDB(self::$testDatastore, true, false);
74 $this->conf = new ConfigManager('tests/utils/config/configJson');
75 $this->conf->set('resource.page_cache', $this->pagecache);
68 } 76 }
69 77
70 public static function tearDownAfterClass() 78 public static function tearDownAfterClass()
@@ -81,7 +89,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
81 $this->assertEquals( 89 $this->assertEquals(
82 'File empty.htm (0 bytes) has an unknown file format.' 90 'File empty.htm (0 bytes) has an unknown file format.'
83 .' Nothing was imported.', 91 .' Nothing was imported.',
84 NetscapeBookmarkUtils::import(NULL, $files, NULL, NULL) 92 NetscapeBookmarkUtils::import(NULL, $files, NULL, $this->conf)
85 ); 93 );
86 $this->assertEquals(0, count($this->linkDb)); 94 $this->assertEquals(0, count($this->linkDb));
87 } 95 }
@@ -94,7 +102,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
94 $files = file2array('no_doctype.htm'); 102 $files = file2array('no_doctype.htm');
95 $this->assertEquals( 103 $this->assertEquals(
96 'File no_doctype.htm (350 bytes) has an unknown file format. Nothing was imported.', 104 'File no_doctype.htm (350 bytes) has an unknown file format. Nothing was imported.',
97 NetscapeBookmarkUtils::import(NULL, $files, NULL, NULL) 105 NetscapeBookmarkUtils::import(NULL, $files, NULL, $this->conf)
98 ); 106 );
99 $this->assertEquals(0, count($this->linkDb)); 107 $this->assertEquals(0, count($this->linkDb));
100 } 108 }
@@ -108,7 +116,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
108 $this->assertEquals( 116 $this->assertEquals(
109 'File internet_explorer_encoding.htm (356 bytes) was successfully processed:' 117 'File internet_explorer_encoding.htm (356 bytes) was successfully processed:'
110 .' 1 links imported, 0 links overwritten, 0 links skipped.', 118 .' 1 links imported, 0 links overwritten, 0 links skipped.',
111 NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->pagecache) 119 NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf)
112 ); 120 );
113 $this->assertEquals(1, count($this->linkDb)); 121 $this->assertEquals(1, count($this->linkDb));
114 $this->assertEquals(0, count_private($this->linkDb)); 122 $this->assertEquals(0, count_private($this->linkDb));
@@ -137,7 +145,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
137 $this->assertEquals( 145 $this->assertEquals(
138 'File netscape_nested.htm (1337 bytes) was successfully processed:' 146 'File netscape_nested.htm (1337 bytes) was successfully processed:'
139 .' 8 links imported, 0 links overwritten, 0 links skipped.', 147 .' 8 links imported, 0 links overwritten, 0 links skipped.',
140 NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->pagecache) 148 NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf)
141 ); 149 );
142 $this->assertEquals(8, count($this->linkDb)); 150 $this->assertEquals(8, count($this->linkDb));
143 $this->assertEquals(2, count_private($this->linkDb)); 151 $this->assertEquals(2, count_private($this->linkDb));
@@ -259,7 +267,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
259 $this->assertEquals( 267 $this->assertEquals(
260 'File netscape_basic.htm (482 bytes) was successfully processed:' 268 'File netscape_basic.htm (482 bytes) was successfully processed:'
261 .' 2 links imported, 0 links overwritten, 0 links skipped.', 269 .' 2 links imported, 0 links overwritten, 0 links skipped.',
262 NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->pagecache) 270 NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf)
263 ); 271 );
264 272
265 $this->assertEquals(2, count($this->linkDb)); 273 $this->assertEquals(2, count($this->linkDb));
@@ -304,7 +312,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
304 $this->assertEquals( 312 $this->assertEquals(
305 'File netscape_basic.htm (482 bytes) was successfully processed:' 313 'File netscape_basic.htm (482 bytes) was successfully processed:'
306 .' 2 links imported, 0 links overwritten, 0 links skipped.', 314 .' 2 links imported, 0 links overwritten, 0 links skipped.',
307 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 315 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
308 ); 316 );
309 $this->assertEquals(2, count($this->linkDb)); 317 $this->assertEquals(2, count($this->linkDb));
310 $this->assertEquals(1, count_private($this->linkDb)); 318 $this->assertEquals(1, count_private($this->linkDb));
@@ -348,7 +356,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
348 $this->assertEquals( 356 $this->assertEquals(
349 'File netscape_basic.htm (482 bytes) was successfully processed:' 357 'File netscape_basic.htm (482 bytes) was successfully processed:'
350 .' 2 links imported, 0 links overwritten, 0 links skipped.', 358 .' 2 links imported, 0 links overwritten, 0 links skipped.',
351 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 359 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
352 ); 360 );
353 $this->assertEquals(2, count($this->linkDb)); 361 $this->assertEquals(2, count($this->linkDb));
354 $this->assertEquals(0, count_private($this->linkDb)); 362 $this->assertEquals(0, count_private($this->linkDb));
@@ -372,7 +380,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
372 $this->assertEquals( 380 $this->assertEquals(
373 'File netscape_basic.htm (482 bytes) was successfully processed:' 381 'File netscape_basic.htm (482 bytes) was successfully processed:'
374 .' 2 links imported, 0 links overwritten, 0 links skipped.', 382 .' 2 links imported, 0 links overwritten, 0 links skipped.',
375 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 383 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
376 ); 384 );
377 $this->assertEquals(2, count($this->linkDb)); 385 $this->assertEquals(2, count($this->linkDb));
378 $this->assertEquals(2, count_private($this->linkDb)); 386 $this->assertEquals(2, count_private($this->linkDb));
@@ -398,7 +406,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
398 $this->assertEquals( 406 $this->assertEquals(
399 'File netscape_basic.htm (482 bytes) was successfully processed:' 407 'File netscape_basic.htm (482 bytes) was successfully processed:'
400 .' 2 links imported, 0 links overwritten, 0 links skipped.', 408 .' 2 links imported, 0 links overwritten, 0 links skipped.',
401 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 409 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
402 ); 410 );
403 $this->assertEquals(2, count($this->linkDb)); 411 $this->assertEquals(2, count($this->linkDb));
404 $this->assertEquals(2, count_private($this->linkDb)); 412 $this->assertEquals(2, count_private($this->linkDb));
@@ -418,7 +426,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
418 $this->assertEquals( 426 $this->assertEquals(
419 'File netscape_basic.htm (482 bytes) was successfully processed:' 427 'File netscape_basic.htm (482 bytes) was successfully processed:'
420 .' 2 links imported, 2 links overwritten, 0 links skipped.', 428 .' 2 links imported, 2 links overwritten, 0 links skipped.',
421 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 429 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
422 ); 430 );
423 $this->assertEquals(2, count($this->linkDb)); 431 $this->assertEquals(2, count($this->linkDb));
424 $this->assertEquals(0, count_private($this->linkDb)); 432 $this->assertEquals(0, count_private($this->linkDb));
@@ -444,7 +452,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
444 $this->assertEquals( 452 $this->assertEquals(
445 'File netscape_basic.htm (482 bytes) was successfully processed:' 453 'File netscape_basic.htm (482 bytes) was successfully processed:'
446 .' 2 links imported, 0 links overwritten, 0 links skipped.', 454 .' 2 links imported, 0 links overwritten, 0 links skipped.',
447 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 455 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
448 ); 456 );
449 $this->assertEquals(2, count($this->linkDb)); 457 $this->assertEquals(2, count($this->linkDb));
450 $this->assertEquals(0, count_private($this->linkDb)); 458 $this->assertEquals(0, count_private($this->linkDb));
@@ -465,7 +473,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
465 $this->assertEquals( 473 $this->assertEquals(
466 'File netscape_basic.htm (482 bytes) was successfully processed:' 474 'File netscape_basic.htm (482 bytes) was successfully processed:'
467 .' 2 links imported, 2 links overwritten, 0 links skipped.', 475 .' 2 links imported, 2 links overwritten, 0 links skipped.',
468 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 476 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
469 ); 477 );
470 $this->assertEquals(2, count($this->linkDb)); 478 $this->assertEquals(2, count($this->linkDb));
471 $this->assertEquals(2, count_private($this->linkDb)); 479 $this->assertEquals(2, count_private($this->linkDb));
@@ -489,7 +497,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
489 $this->assertEquals( 497 $this->assertEquals(
490 'File netscape_basic.htm (482 bytes) was successfully processed:' 498 'File netscape_basic.htm (482 bytes) was successfully processed:'
491 .' 2 links imported, 0 links overwritten, 0 links skipped.', 499 .' 2 links imported, 0 links overwritten, 0 links skipped.',
492 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 500 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
493 ); 501 );
494 $this->assertEquals(2, count($this->linkDb)); 502 $this->assertEquals(2, count($this->linkDb));
495 $this->assertEquals(0, count_private($this->linkDb)); 503 $this->assertEquals(0, count_private($this->linkDb));
@@ -499,7 +507,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
499 $this->assertEquals( 507 $this->assertEquals(
500 'File netscape_basic.htm (482 bytes) was successfully processed:' 508 'File netscape_basic.htm (482 bytes) was successfully processed:'
501 .' 0 links imported, 0 links overwritten, 2 links skipped.', 509 .' 0 links imported, 0 links overwritten, 2 links skipped.',
502 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 510 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
503 ); 511 );
504 $this->assertEquals(2, count($this->linkDb)); 512 $this->assertEquals(2, count($this->linkDb));
505 $this->assertEquals(0, count_private($this->linkDb)); 513 $this->assertEquals(0, count_private($this->linkDb));
@@ -518,7 +526,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
518 $this->assertEquals( 526 $this->assertEquals(
519 'File netscape_basic.htm (482 bytes) was successfully processed:' 527 'File netscape_basic.htm (482 bytes) was successfully processed:'
520 .' 2 links imported, 0 links overwritten, 0 links skipped.', 528 .' 2 links imported, 0 links overwritten, 0 links skipped.',
521 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 529 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
522 ); 530 );
523 $this->assertEquals(2, count($this->linkDb)); 531 $this->assertEquals(2, count($this->linkDb));
524 $this->assertEquals(0, count_private($this->linkDb)); 532 $this->assertEquals(0, count_private($this->linkDb));
@@ -545,7 +553,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
545 $this->assertEquals( 553 $this->assertEquals(
546 'File netscape_basic.htm (482 bytes) was successfully processed:' 554 'File netscape_basic.htm (482 bytes) was successfully processed:'
547 .' 2 links imported, 0 links overwritten, 0 links skipped.', 555 .' 2 links imported, 0 links overwritten, 0 links skipped.',
548 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) 556 NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf)
549 ); 557 );
550 $this->assertEquals(2, count($this->linkDb)); 558 $this->assertEquals(2, count($this->linkDb));
551 $this->assertEquals(0, count_private($this->linkDb)); 559 $this->assertEquals(0, count_private($this->linkDb));
@@ -570,7 +578,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase
570 $this->assertEquals( 578 $this->assertEquals(
571 'File same_date.htm (453 bytes) was successfully processed:' 579 'File same_date.htm (453 bytes) was successfully processed:'
572 .' 3 links imported, 0 links overwritten, 0 links skipped.', 580 .' 3 links imported, 0 links overwritten, 0 links skipped.',
573 NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->pagecache) 581 NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf)
574 ); 582 );
575 $this->assertEquals(3, count($this->linkDb)); 583 $this->assertEquals(3, count($this->linkDb));
576 $this->assertEquals(0, count_private($this->linkDb)); 584 $this->assertEquals(0, count_private($this->linkDb));
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index 448405a3..b522d616 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/Updater/UpdaterTest.php
@@ -574,4 +574,45 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
574 $this->assertTrue($updater->updateMethodEscapeMarkdown()); 574 $this->assertTrue($updater->updateMethodEscapeMarkdown());
575 $this->assertFalse($this->conf->get('security.markdown_escape')); 575 $this->assertFalse($this->conf->get('security.markdown_escape'));
576 } 576 }
577
578 /**
579 * Test updateMethodPiwikUrl with valid data
580 */
581 public function testUpdatePiwikUrlValid()
582 {
583 $sandboxConf = 'sandbox/config';
584 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
585 $this->conf = new ConfigManager($sandboxConf);
586 $url = 'mypiwik.tld';
587 $this->conf->set('plugins.PIWIK_URL', $url);
588 $updater = new Updater([], [], $this->conf, true);
589 $this->assertTrue($updater->updateMethodPiwikUrl());
590 $this->assertEquals('http://'. $url, $this->conf->get('plugins.PIWIK_URL'));
591
592 // reload from file
593 $this->conf = new ConfigManager($sandboxConf);
594 $this->assertEquals('http://'. $url, $this->conf->get('plugins.PIWIK_URL'));
595 }
596
597 /**
598 * Test updateMethodPiwikUrl without setting
599 */
600 public function testUpdatePiwikUrlEmpty()
601 {
602 $updater = new Updater([], [], $this->conf, true);
603 $this->assertTrue($updater->updateMethodPiwikUrl());
604 $this->assertEmpty($this->conf->get('plugins.PIWIK_URL'));
605 }
606
607 /**
608 * Test updateMethodPiwikUrl: valid URL, nothing to do
609 */
610 public function testUpdatePiwikUrlNothingToDo()
611 {
612 $url = 'https://mypiwik.tld';
613 $this->conf->set('plugins.PIWIK_URL', $url);
614 $updater = new Updater([], [], $this->conf, true);
615 $this->assertTrue($updater->updateMethodPiwikUrl());
616 $this->assertEquals($url, $this->conf->get('plugins.PIWIK_URL'));
617 }
577} 618}
diff --git a/tests/utils/config/configJson.json.php b/tests/utils/config/configJson.json.php
index 13d38c66..9c9288f3 100644
--- a/tests/utils/config/configJson.json.php
+++ b/tests/utils/config/configJson.json.php
@@ -24,7 +24,7 @@
24 }, 24 },
25 "resource": { 25 "resource": {
26 "datastore": "tests\/utils\/config\/datastore.php", 26 "datastore": "tests\/utils\/config\/datastore.php",
27 "data_dir": "tests\/utils\/config", 27 "data_dir": "sandbox/",
28 "raintpl_tpl": "tpl/" 28 "raintpl_tpl": "tpl/"
29 }, 29 },
30 "plugins": { 30 "plugins": {
diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html
index 94370203..57ef4567 100644
--- a/tpl/default/linklist.html
+++ b/tpl/default/linklist.html
@@ -34,7 +34,7 @@
34 {if="!empty($search_tags)"} 34 {if="!empty($search_tags)"}
35 value="{$search_tags}" 35 value="{$search_tags}"
36 {/if} 36 {/if}
37 autocomplete="off" data-multiple data-minChars="1" 37 autocomplete="off" data-multiple data-autofirst data-minChars="1"
38 data-list="{loop="$tags"}{$key}, {/loop}" 38 data-list="{loop="$tags"}{$key}, {/loop}"
39 > 39 >
40 <button type="submit" class="search-button"><i class="fa fa-search"></i></button> 40 <button type="submit" class="search-button"><i class="fa fa-search"></i></button>
diff --git a/tpl/default/page.header.html b/tpl/default/page.header.html
index b76fc03e..03ca6843 100644
--- a/tpl/default/page.header.html
+++ b/tpl/default/page.header.html
@@ -2,7 +2,7 @@
2 <div class="pure-u-lg-0 pure-u-1"> 2 <div class="pure-u-lg-0 pure-u-1">
3 <div class="pure-menu"> 3 <div class="pure-menu">
4 <a href="{$titleLink}" class="pure-menu-link"> 4 <a href="{$titleLink}" class="pure-menu-link">
5 <i class="fa fa-home"></i> 5 <img src="img/icon.png" width="16" height="16" class="head-logo" alt="logo" />
6 {$shaarlititle} 6 {$shaarlititle}
7 </a> 7 </a>
8 <a href="#" class="menu-toggle" id="menu-toggle"><s class="bar"></s><s class="bar"></s></a> 8 <a href="#" class="menu-toggle" id="menu-toggle"><s class="bar"></s><s class="bar"></s></a>
@@ -114,7 +114,7 @@
114 {if="!empty($search_tags)"} 114 {if="!empty($search_tags)"}
115 value="{$search_tags}" 115 value="{$search_tags}"
116 {/if} 116 {/if}
117 autocomplete="off" data-multiple data-minChars="1" 117 autocomplete="off" data-multiple data-autofirst data-minChars="1"
118 data-list="{loop="$tags"}{$key}, {/loop}" 118 data-list="{loop="$tags"}{$key}, {/loop}"
119 > 119 >
120 <button type="submit" class="search-button"><i class="fa fa-search"></i></button> 120 <button type="submit" class="search-button"><i class="fa fa-search"></i></button>