aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/LinkDB.php
Commit message (Collapse)AuthorAgeFilesLines
* Fix offset check with link ID = 0ArthurHoaro2017-04-051-2/+2
|
* Update LinkFilter to be able to filter only public linksArthurHoaro2017-01-161-3/+3
| | | | | | No update regarding the UI or the API for now Fixes #758
* Add a persistent 'shorturl' key to all linksArthurHoaro2016-12-121-4/+8
| | | | | | | 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.
* Link ID refactoringArthurHoaro2016-12-121-43/+135
| | | | | | | | | Links now use an incremental unique numeric identifier. This ID is persistent and must never change. ArrayAccess is used to match the link ID with the array keys (see the comment in LinkDB for more details) Key 'created' added, with creation date as a DateTime object. 'updated' is now also a DateTime.
* LinkDB: explicit method visibilityVirtualTam2016-10-201-6/+6
| | | | | | Relates to https://github.com/shaarli/Shaarli/issues/95 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* LinkDB: update datastore method namesVirtualTam2016-10-201-8/+8
| | | | | | Relates to https://github.com/shaarli/Shaarli/issues/95 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* LinkDB: do not prefix privates with an underscoreVirtualTam2016-10-201-67/+67
| | | | | | Relates to #95 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Save the update date in LinkDB and pass it to linklist templatesArthurHoaro2016-08-031-1/+2
| | | | It can be used as a timestamp by templates under the key 'updated_timestamp'.
* Better whitespace handling in tagsArthurHoaro2016-08-021-1/+1
| | | | | | Correct PR #573 to work properly with hidden tags, and add ReferenceLinkDB UT. Fixes #571 - Closes #573
* Better whitespace handling in tags. Fixes #571Chris Kuethe2016-08-021-2/+2
|
* Hashtag systemArthurHoaro2016-06-061-1/+1
| | | | | | * Hashtag are auto-linked with a filter search * Supports unicode * Compatible with markdown (excluded in code blocks)
* Merge pull request #583 from ArthurHoaro/enhance/tag-caseArthur2016-06-031-2/+9
|\ | | | | Fixes #497: ignore case difference between tags
| * Fixes #497: ignore case difference between tagsArthurHoaro2016-05-311-2/+9
| | | | | | | | | | | | | | | | While retrieving all tags, case differences will be ignored. This affects: * tag cloud * tag autocompletion
* | Fixes #480: add an option to urlencode redirector URLArthurHoaro2016-04-091-6/+29
|/ | | | | | | | * 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
* Refactor filter in LinkDBArthurHoaro2016-03-251-5/+59
| | | | | | | | * 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
* Allow crossed search between terms and tagsArthurHoaro2016-02-281-2/+1
| | | | | | | * Partial fix of #449 * Current use case: search term + click on tag. * LinkFilter now returns all links if no filter is given. * Unit tests.
* cleanup: use DateTime to format datesVirtualTam2016-02-171-0/+3
| | | | | | | | | | | | | | | Closes #270 Modifications: - replace custom date parsing by DateTime calls - use proper date formatting for RSS feeds Deletions: - linkdate2timestamp() - linkdate2rfc822 - linkdate2iso8601 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Private/Hidden tagsArthurHoaro2016-02-151-0/+7
| | | | | | | Tags starting with a dot '.' are now private. They can only be seen and searched when logged in. Fixes #315
* Add exclusion in tag searchArthurHoaro2016-02-151-1/+1
| | | | | | | | | | | * 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.
* Introduce the Updater class whichArthurHoaro2016-02-151-6/+4
| | | | | | | * contains methods designed to be run once. * is able to upgrade the datastore or the configuration. * is based on methods names, stored in a text file with ';' separator (updates.txt). * begins with existing function 'mergeDeprecatedConfigFile()' (options.php).
* Bugfix: prevent LinkFilter to work on outdated data.ArthurHoaro2016-01-201-8/+4
|
* Fixes #426 - Do not filter with blank tags.ArthurHoaro2016-01-061-1/+1
|
* Link filter refactoringArthurHoaro2016-01-061-105/+15
| | | | | | | | | | * 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.
* QRCode plugin: use url instead of real_urlArthurHoaro2015-12-221-1/+3
| | | | | | Fixes #414 and avoid usage of redirector in QRCode. Also fixed a bug with URL encoding.
* URL encode links when a redirector is set.ArthurHoaro2015-11-261-3/+17
| | | | | | | | | | | | | | | | | 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
* install: check file/directory permissions for Shaarli resourcesVirtualTam2015-11-241-9/+26
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Url: introduce global helper functions for cleanup and scheme detectionGuillaume Virlet2015-09-081-0/+4
| | | | | | | | | | | | Relates to #314 & #326 Additions: - add global `cleanup_url()` and `get_url_scheme()` functions Modifications: - replace `Url` usage in `index.php` by calls to global functions - fix `Url` tests not being run: PHPUnit expects a single test class per file - move classes to separate files
* CachedPage: move to a proper file, add testsVirtualTam2015-08-131-3/+4
| | | | | | | | | | | | 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>
* LinkDB: prefix private members with an underscoreVirtualTam2015-07-091-62/+62
| | | | | | Relates to #95, #218 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* LinkDB::filterDay(): check input date formatVirtualTam2015-07-091-1/+4
| | | | Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Merge remote-tracking branch 'ArthurHoaro/default-links'nodiscc2015-06-261-6/+10
|\
| * Change fresh install default linkArthurHoaro2015-06-241-6/+10
| | | | | | | | | | | | Fixes #200 Let me know if you want to change anything in the description.
* | Merge remote-tracking branch 'virtualtam/linkdb/remove-globals'nodiscc2015-06-261-12/+19
|\ \
| * | LinkDB: do not access global variablesVirtualTam2015-06-241-12/+19
| |/ | | | | | | | | | | | | | | | | | | | | Relates to #218 Removes "hidden" access to the following variables: - $GLOBALS['config']['datastore'] - PHPPREFIX - PHPSUFFIX Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* / Restore compatability with php 5.3Felix Bartels2015-06-261-1/+1
|/
* Merge remote-tracking branch 'ArthurHoaro/input-escape' into nextnodiscc2015-06-241-0/+5
|\ | | | | | | | | Conflicts: index.php
| * Working on shaarli/Shaarli#224ArthurHoaro2015-06-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | I reviewed character escaping everywhere with the following ideas: * use a single common function to escape user data: `escape` using `htmlspecialchars`. * sanitize fields in `index.php` after reading them from datastore and before sending them to templates. It means no escaping function in Twig templates. 2 reasons: * it reduces risks of security issue for future user made templates * more readable templates * sanitize user configuration fields after loading them.
* | LinkDB: add 'hidePublicLinks' parameter to the constructorVirtualTam2015-06-241-2/+6
|/ | | | | | | Fixes #236 Relates to #237 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* re-add readDb() missing from previous mergenodiscc2015-06-231-0/+7
|
* LinkDB: move to a proper file, add test coverageVirtualTam2015-06-111-0/+412
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>