Commit graph

38 commits

Author SHA1 Message Date
ArthurHoaro f8c5660df8 Tag sort - UT + comment + fix filter and visibility
Before this, linksCountPerTag call without would have ignored visibility parameter
2018-05-29 20:52:30 +02:00
ArthurHoaro 3b67b22225 Move tag renaming code to LinkDB and unit test it 2017-08-05 09:55:20 +02:00
ArthurHoaro 3e395a6bc6 Merge pull request #841 from ArthurHoaro/feature/search-no-tag
Empty tag search will look for not tagged links
2017-05-25 15:54:20 +02:00
ArthurHoaro 7d86f40bdb Empty tag search will look for not tagged links
Fixes #784

From now, searching for tags with an empty value will return only not tagged links,
with the search bar showing `x results [not tagged]`.

Note that using the api, the searchtags request parameter must be set to `false` to get the same result.

  - [ ] Update API doc
2017-05-25 15:51:12 +02:00
Lucas Cimon 6ccd0b218f Adding ability to display subtags in tagcloud 2017-05-24 13:09:35 +02:00
ArthurHoaro b2306b0c78 Move database read/write to FileUtils class + additional unit tests 2017-03-21 20:16:26 +01:00
ArthurHoaro d592daea83 Add a persistent 'shorturl' key to all links
All existing link will keep their permalinks.
New links will have smallhash generated with date+id.

The purpose of this is to avoid collision between links due to their creation date.
2016-12-12 03:03:12 +01:00
ArthurHoaro c3dfd89959 Unit Test for the new ID system 2016-12-12 03:03:12 +01:00
VirtualTam f21abf3292 LinkDB: update datastore method names
Relates to https://github.com/shaarli/Shaarli/issues/95

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2016-10-20 21:33:40 +02:00
VirtualTam 628b97cbdf LinkDB: do not prefix privates with an underscore
Relates to #95

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2016-10-20 21:10:56 +02:00
ArthurHoaro 9866b40814 Better whitespace handling in tags
Correct PR #573 to work properly with hidden tags, and add ReferenceLinkDB UT.

Fixes #571 - Closes #573
2016-08-02 10:34:21 +02:00
Chris Kuethe 32d51093e3 add unit test 2016-08-02 10:22:18 +02:00
Arthur 0c4c7ae818 Merge pull request #558 from ArthurHoaro/hashtag4
Hashtag system
2016-07-09 07:36:23 +02:00
Arthur 649af5b501 Merge pull request #570 from ArthurHoaro/config-manager
Introduce a configuration manager
2016-07-09 07:19:48 +02:00
ArthurHoaro 684e662a58 Replace $GLOBALS configuration with the configuration manager in the whole code base 2016-06-11 09:30:56 +02:00
ArthurHoaro 9ccca40189 Hashtag system
* Hashtag are auto-linked with a filter search
  * Supports unicode
  * Compatible with markdown (excluded in code blocks)
2016-06-06 21:04:43 +02:00
Arthur 92a381f517 Merge pull request #583 from ArthurHoaro/enhance/tag-case
Fixes #497: ignore case difference between tags
2016-06-03 18:30:19 +02:00
ArthurHoaro b1eb5d1d31 Fixes #497: ignore case difference between tags
While retrieving all tags, case differences will be ignored.
This affects:

  * tag cloud
  * tag autocompletion
2016-05-31 09:09:32 +02:00
ArthurHoaro 043eae70c4 Fixes #480: 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
2016-04-09 16:52:32 +02:00
ArthurHoaro 528a6f8a23 Refactor filter in LinkDB
* search type now carried by LinkDB in order to factorize code between different search sources.
  * LinkDB->filter split in 3 method: filterSearch, filterHash, filterDay (we know what type of filter is needed).
  * filterHash now throw a LinkNotFoundException if it doesn't exist: internal implementation choice, still displays a 404.
  * Smallhash regex has been rewritten.
  * Unit tests update
2016-03-25 19:17:59 +01:00
ArthurHoaro 522b278b03 Support text search across link fields. 2016-02-15 21:38:45 +01:00
ArthurHoaro bedd176a54 Improved search: combine AND, exact terms and exclude search. 2016-02-15 21:38:40 +01:00
ArthurHoaro 195acf9f09 Private/Hidden tags
Tags starting with a dot '.' are now private.
They can only be seen and searched when logged in.

Fixes #315
2016-02-15 21:18:43 +01:00
ArthurHoaro 21979ff11c Add exclusion in tag search
* Searching '-mytag' will now exlude all shaares with 'mytag' tag.
  * All tags starting with a '-' are renamed without it (through the Updater).
  * Unit tests.

Minor code changes:

 * LinkDB->filter() can now take no parameters (get all link depending on logged status).
 * tagsStrToArray() is now static and filters blank tags.
2016-02-15 20:40:39 +01:00
ArthurHoaro 822bffced8 Link filter refactoring
* introduce class LinkFilter to handle link filter operation (and lighten LinkDB).
  * handle 'private only' in filtering.
  * update template to prefill search fields with current search terms.
  * coding style.
  * unit test (mostly move from LinkDB to LinkFilter).

PS: preparation for #358 #315 and 'AND' search.
2016-01-06 19:53:04 +01:00
VirtualTam 4bf35ba56b application: refactor version checks, move to ApplicationUtils
Relates to #372

Modifications:
 - move checkUpdate() to ApplicationUtils
 - reduce file I/O operations during version checks
 - apply coding conventions
 - add test coverage

Tools:
 - create a sandbox directory for tests

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-11-26 23:19:37 +01:00
ArthurHoaro 90e5bd65c9 URL encode links when a redirector is set.
Fixes #328 - URL encode links when a redirector is set

  * WARNING - template edit - new variable available : "real_url"
  Contains the final real url (redirected or any other change on original URL)

  * Don't redirect shaares link in RSS/Atom.
  * Affects links shaared in description.
  * Move text2clickable and keepMultipleSpaces to Utils.php + unit test

UPDATE:

* keepMultipleSpaces renamed to space2nbsp
* space2nbsp improved to handle single space at line beginning
* links in text description aren't 'nofollow' anymore
2015-11-26 20:14:38 +01:00
VirtualTam 2e28269bae install: check file/directory permissions for Shaarli resources
Relates to #40
Relates to #372

Additions:
 - FileUtils: IOException
 - ApplicationUtils:
   - check if Shaarli resources are accessible with sufficient permissions
   - basic test coverage
 - index.php:
   - check access permissions and redirect to an error page if needed:
     - before running the first installation

Modifications:
 - LinkDB:
   - factorize datastore write code
   - check if the datastore
     (exists AND is writeable) OR (doesn't exist AND its parent dir is writable)
   - raise an IOException if needed

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-11-24 01:12:35 +01:00
VirtualTam 01e48f269d CachedPage: move to a proper file, add tests
Modifications
 - rename `pageCache` to `CachedPage`
 - move utilities to `Cache`
 - do not access globals
 - apply coding rules
 - update LinkDB and test code
 - add test coverage

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-08-13 23:48:06 +02:00
VirtualTam d1e2f8e52c PHP: ensure 5.3 compatibility, refactor timezone utilities
Relates to #250

Modifications
 - supported version
   - bump required version from 5.1.0 to 5.3.x
   - update README
   - add PHP 5.3 to Travis environments
 - rewrite array declarations: explicitely use array() instead of []
 - move checkPHPVersion to application/Utils.php
 - move timezone functions to application/TimeZone.php
   - cleanup code
   - improve test coverage

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-07-13 13:06:06 +02:00
VirtualTam 07b6fa750b LinkDB: prefix private members with an underscore
Relates to #95, #218

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-07-09 21:46:01 +02:00
VirtualTam 9186ab9594 LinkDB::filterDay(): check input date format
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-07-09 00:44:19 +02:00
VirtualTam 0037fbe1e0 LinkDBTest: only check that the datastore is created and non-empty
Fixes #252
Relates to #238

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-06-28 14:53:26 +02:00
nodiscc d72ae3d7e8 Merge remote-tracking branch 'ArthurHoaro/default-links' 2015-06-26 22:03:25 +02:00
VirtualTam 9c8752a206 LinkDB: do not access global variables
Relates to #218

Removes "hidden" access to the following variables:
 - $GLOBALS['config']['datastore']
 - PHPPREFIX
 - PHPSUFFIX

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-06-24 23:26:52 +02:00
ArthurHoaro 30e6f1ca2f Fixes unit tests: checking datastore filesize instead of hash.
date() makes the hash validation worthless because it changes at every generation.
2015-06-24 11:58:01 +02:00
VirtualTam 9f15ca9ee7 LinkDB: add 'hidePublicLinks' parameter to the constructor
Fixes #236
Relates to #237

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-06-24 00:26:59 +02:00
VirtualTam ca74886f30 LinkDB: move to a proper file, add test coverage
Relates to #71

LinkDB
 - move to application/LinkDB.php
 - code cleanup
   - indentation
   - whitespaces
   - formatting
 - comment cleanup
   - add missing documentation
   - unify formatting

Test coverage for LinkDB
 - constructor
 - public / private access
 - link-related methods

Shaarli utilities (LinkDB dependencies)
 - move startsWith() and endsWith() functions to application/Utils.php
 - add test coverage

Dev utilities
 - Composer: add PHPUnit to dev dependencies
 - Makefile:
    - update lint targets
    - add test targets
    - generate coverage reports

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2015-06-11 00:45:45 +02:00