aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/UtilsTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Optimize and cleanup importsVirtualTam2019-01-131-1/+1
| | | | Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* lint: apply phpcbf to tests/VirtualTam2018-12-021-3/+6
| | | | Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Move session ID check to SessionManagerVirtualTam2017-10-221-58/+0
| | | | | | | | | | Relates to https://github.com/shaarli/Shaarli/issues/324 Changed: - `is_session_id_valid()` -> `SessionManager::checkId()` - update tests Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Shaarli's translationArthurHoaro2017-10-221-15/+15
| | | | | | | | | * translation system and unit tests * Translations everywhere Dont use translation merge It is not available with PHP builtin gettext, so it would have lead to inconsistency.
* Adds a taglist view with edit/delete buttonsArthurHoaro2017-05-251-0/+112
| | | | | | * The tag list can be sort alphabetically or by most used tag * Edit/Delete are perform using AJAX, or fallback to 'do=changetag' page * New features aren't backported to vintage theme
* Use raw bytes for upload size hidden inputArthurHoaro2017-04-101-1/+12
|
* UtilsTest: PHP 5.5 compatibilityArthurHoaro2017-04-031-8/+8
|
* Fix a warning generated in return_bytes function and refactor itArthurHoaro2017-04-031-0/+80
| | | | | | It was multiplying a string containing a letter. Moved function to Utils.php and display a human readable limit size
* Improve datetime displayArthurHoaro2017-03-061-11/+35
| | | | | | | | | | Use php-intl extension to display datetimes a bit more nicely, depending on the locale. What changes: * the day is no longer displayed * day number and month are ordered according to the locale * the timezone is more readable (UTC+1 instead of CET)
* Improve autoLocale() detectionArthurHoaro2017-03-061-0/+20
| | | | | | - Creates arrays_combination function to cover all cases - add the underscore separator in the regex - add `utf8` encoding in addition to `UTF-8`
* Fixes presence of empty tags for private tags and in search resultsArthurHoaro2017-01-031-1/+13
| | | | | | | * Private tags: make sure empty tags are properly filtered * Search results: * Use preg_split instead of function combination * Add normalize_spaces to remove extra whitespaces displaying empty tags search
* Prepare settings for the API in the admin page and during the installArthurHoaro2016-12-121-0/+17
| | | | | | | | API settings: - api.enabled - api.secret The API settings will be initialized (and the secret generated) with an update method.
* Hashtag systemArthurHoaro2016-06-061-37/+0
| | | | | | * Hashtag are auto-linked with a filter search * Supports unicode * Compatible with markdown (excluded in code blocks)
* fix: use PHP_EOL for carriage returns in file logsVirtualTam2016-01-181-1/+1
| | | | | | Relates to #436 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Logging: improve formatting to enable fail2ban parsingVirtualTam2016-01-161-1/+1
| | | | | | | | | | Fixes #436 Modifications: - remove calls to strval() on safe data - update the date format: 'Y/m/d_H:i:s' => 'Y/m/d H:i:s' Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Logging: move logm() from index.php to application/Utils.phpVirtualTam2016-01-161-0/+66
| | | | | | | | | | | Relates to #436 Modifications: - inject dependencies to global variables ($_SERVER, $GLOBALS) - apply coding conventions - add test coverage Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* URL encode links when a redirector is set.ArthurHoaro2015-11-261-0/+37
| | | | | | | | | | | | | | | | | 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
* application: move checkPHPVersion from Utils to ApplicationUtilsVirtualTam2015-11-241-31/+0
| | | | | | Relates to #372 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* cleanup: remove the executable bit from source scriptsVirtualTam2015-11-111-0/+0
| | | | Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Fixes #356ArthurHoaro2015-11-041-0/+2
| | | | | * adding a link should return added link's hash * allow redirection relative urls in generateLocation
* Session ID: extend the regex to match possible hash representationsVirtualTam2015-09-061-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Improves #306 Relates to #335 & #336 Duplicated by #339 Issues: - PHP regenerates the session ID if it is not compliant - the regex checking the session ID does not cover all cases - different algorithms: md5, sha1, sha256, etc. - bit representations: 4, 5, 6 Fix: - `index.php`: - remove `uniqid()` usage - call `session_regenerate_id()` if an invalid cookie is detected - regex: support all possible characters - '[a-zA-Z,-]{2,128}' - tests: add coverage for all algorithms & bit representations See: - http://php.net/manual/en/session.configuration.php#ini.session.hash-function - https://secure.php.net/manual/en/session.configuration.php#ini.session.hash-bits-per-character - http://php.net/manual/en/function.session-id.php - http://php.net/manual/en/function.session-regenerate-id.php - http://php.net/manual/en/function.hash-algos.php Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* Allow uppercase letters in PHP sessionid formatArthurHoaro2015-09-021-1/+1
| | | | | | Fixes shaarli/Shaarli#335 - Wrong login/password since v0.5.2 Regression introduced in 06b6660a7e8891c6e1c47815cf50ee5b2ef5f270
* Avoid Full Path Disclosure error on session error.ArthurHoaro2015-08-221-1/+18
| | | | | * Add a function to validate session ID. * Generate a new session ID if an invalid token is passed.
* PHP: ensure 5.3 compatibility, refactor timezone utilitiesVirtualTam2015-07-131-1/+33
| | | | | | | | | | | | | | | | | 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>
* Prevent redirection loop everytime we rely on HTTP_REFERER:ArthurHoaro2015-07-121-1/+26
| | | | | | | | | | | | | | | * search tag * delete tag * pagination * display privates only * delete link * new/edit/cancel link return page Move location generation to Utils.php + unit tests. Fixes #256 ninja
* LinkDB::filterDay(): check input date formatVirtualTam2015-07-091-0/+19
| | | | Signed-off-by: VirtualTam <virtualtam@flibidi.net>
* LinkDB: move to a proper file, add test coverageVirtualTam2015-06-111-0/+78
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>