Fixes : add an option to urlencode redirector URL

* New config: `$GLOBALS['config']['REDIRECTOR_URLENCODE']` (default `true`).
  * Parameter added to LinkDB constructor.
  * Fixes a bug with urlencode and escaped url.
  * In `index.php`, LinkDB is now instanciate once for `importFile()` and `showDaily()`.
  * TU
This commit is contained in:
ArthurHoaro 2016-03-24 19:40:12 +01:00
parent 9486a2e929
commit 043eae70c4
3 changed files with 47 additions and 25 deletions

View file

@ -338,6 +338,13 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
$db = new LinkDB(self::$testDatastore, false, false, $redirector);
foreach($db as $link) {
$this->assertStringStartsWith($redirector, $link['real_url']);
$this->assertNotFalse(strpos($link['real_url'], urlencode('://')));
}
$db = new LinkDB(self::$testDatastore, false, false, $redirector, false);
foreach($db as $link) {
$this->assertStringStartsWith($redirector, $link['real_url']);
$this->assertFalse(strpos($link['real_url'], urlencode('://')));
}
}