37 Commits

Author SHA1 Message Date
྅༻ Ǭɀħ ༄༆ཉ
2edfa136e1
Inline documentation (#3329)
Now 100% complete
2022-05-06 18:39:37 +02:00
྅༻ Ǭɀħ ༄༆ཉ
6da30dfab0
Add missing inline documentation (#3325) 2022-05-05 21:36:13 +02:00
྅༻ Ǭɀħ ༄༆ཉ
347971f25d
Remove global $ydb calls and prefer helper function (#2762)
Fixes #2698

Changes : 
- Replace all global $ydb; and $ydb->... with yourls_get_db()-> in code and tests
- Add tests
- Introduce yourls_set_db()
2020-10-11 19:02:15 +02:00
྅༻ Ǭɀħ ༄༆ཉ
b347c36b33
Fix that fucking encoding problem (#2690)
This commit's changelog

- less encode/decode
- update jQuery & remove old ones
- No encoding in JS
- Also, 4 spaces in JS too, duh
- IDN domain functions
- Use mb_ functions to preverse IDN domains
- Support for UTF8MB4
- update install procedure
- update upgrade procedure. Note: The log table will be left untouched by the upgrade, it's impossible to make a convenient upgrade script for thousands of rows. The only problem will be if someone uses UTF8 short URLs (eg `http://sho.rt/éé💩`)
- Handle normalization of IDN domains & tests
- Fix warning on 7.2 and 7.3
- Deal with encoding in bookmarklets
- Enclose upgrade queries in a transaction
- Force no caching upon install or upgrade. Note: Strange behavior: if YOURLS hosted on an IDN domain, browser (FF at least) caches the redirection from admin/index.php to admin/install.php
- Support for IDN YOURLS hosting
- Tests for IDN YOURLS hosting
- Fix code (that will never get run again)
- Don't cache ajax requests
- Remove unnecessary function call
- Add comment doc block
- More IDN sanitizing tests
- IDN : Screw the "open dots". Who's going to type domain。com instead of domain.com anyway? Seriously. (although these do pass on my dev box)
- Deprecate yourls_lowercase_scheme_domain()
- Update doc to reflect DB change
2020-10-10 16:09:36 +02:00
Paul Goodchild
19da8de9ec
Begin functions cleaning, starting with GEO. (#2670)
* cleanup geo functions
* add support for CloudFlare's Country GEO header without the need for IP resolution and database
* ensure flag URL always returns a string, instead of false on failure as the result is always used as a string (without validation)
* add helper yours_get_db() so we don't need to use "global $ydb" throughout and it ensures that ydb is always initialised correctly and hasn't ever been changed to something incompatible.
* simplify debug get log
* tidy up code and phpdocs for functions-plugins
* cleanup & phpdocs for parts of functions.php
Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>
2020-05-06 16:24:52 +02:00
྅༻ Ǭɀħ ༄༆ཉ
84c48cd58a
Make tests independent from each others
This merge commit is about testing the plugin API with a dummy plugin, not a real one that will affect YOURLS behavior.

- Provide dummy plugin to test the API
- Simplify logic of tests in NextDecimal_Tests to only test what is supposed to be tested.
- Enhance documentation comments
- Cleanup after tests
- Specific error message if misconfig
- Unit test debug functions

Co-authored-by: Léo Colombaro <git@colombaro.fr>
2020-03-31 18:00:05 +02:00
ozh
daf8269850 More checks at init for need to install 2017-09-06 21:58:28 +02:00
ozh
c0c91a02d2 Connect to DB before getting attribute
Attempt to fix the "PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute'" thrown on PHP 5.4. It could be that issuing PDO::getAttribute() before being connected to the DB prevents exception from being caught
2017-09-03 21:53:03 +02:00
ozh
d587030ea7 No more need for is dead or alive functions
[skip ci]
2017-08-31 20:06:15 +02:00
ozh
74d1d25e51 Smarter test for DB dead or alive
[skip ci]
2017-08-21 22:13:11 +02:00
ozh
499b296a6f Logger object & ezSQL get_row() compat
[skip ci]
2017-08-21 15:19:55 +02:00
ozh
d74f160a8e Var $option (and low level functions) in YDB
Keep $option low level functions and var in YDB, so new \Option don't start from zero each time and actually read value from $ydb instead of getting from DB each time.

Also, enforce utf8 at connection, is this a good idea? Test units will tell, later.

Also, more stuff here and there.
2017-08-19 22:15:20 +02:00
ozh
e4468d1748 1st pass at removing ezSQL. And an Options object.
Work in progress. This won't work for now.
2017-08-18 19:56:01 +02:00
ozh
af5991c825 Move requires in their own function (for UT) 2014-02-09 13:13:06 +01:00
ozh
eaff89f8bd Check if DB server is dead 2014-02-07 11:16:44 +01:00
ozh
0ff874774a Move function to db file. Comply to debug mode. 2014-02-04 16:12:12 +01:00
ozh
3b03a3ea79 Introduce function yourls_debug_log() 2013-12-26 15:40:47 +01:00
ozh
bc601d2e75 Remove temp comment block 2013-08-28 15:07:27 +02:00
ozh
63236a87ba Accept 'host:port' notation for PDO, MySQL & MySQLi. Should work. 2013-08-28 15:01:13 +02:00
ozh
44a861bc16 Get ip:port for PDO/MySQL(i) 2013-08-28 11:07:53 +02:00
ozh
2b7c0da3f6 Improve support for non standard DB port 2013-08-28 11:07:52 +02:00
ozh
6b3b2b7213 Get ip:port for PDO/MySQL(i) 2013-08-28 09:21:24 +02:00
ozh
26fc3f4819 Improve support for non standard DB port 2013-08-23 20:30:12 +02:00
ozh
156d2cba2f More foolproof driver set 2013-05-03 22:49:47 +02:00
ozh
550f531dfd Merge branch 'issue1348' of https://github.com/ozh/YOURLS into ozh-issue1348
Conflicts:
	includes/class-mysql.php
	includes/functions.php
2013-04-30 22:39:06 +02:00
Diftraku
ef362ed465 Disable overzealous autoloading 2013-04-25 23:13:45 +03:00
ozh
582d060ec3 Add mysql, mysqli and PDO support
- new log message queue
- Include all files first, then do stuff
- Allow to completely replace the DB class

PDO seems to work.

Checked: install YOURLS, add/remove/edit link, stats.

Change load order

- Include all files first, then do stuff
- Allow to completely replace the DB class

Code cleanup & new log message queue
2013-04-21 12:09:31 +02:00
LeoColomb
3daf6593d8 Fix end of line 2013-04-07 12:52:52 +02:00
Ozh
fc458e33ec Added missing function from previous ezSQL lib
git-svn-id: http://yourls.googlecode.com/svn/trunk@855 12232710-3e20-11de-b438-597f59cd7555
2013-02-08 22:17:35 +00:00
Ozh
3ad4b76c98 Update ezSQL to latest version - remove notices.
git-svn-id: http://yourls.googlecode.com/svn/trunk@848 12232710-3e20-11de-b438-597f59cd7555
2013-02-07 16:22:38 +00:00
ozhozh
e106be25e5 Removed closing PHP tag on include files
git-svn-id: http://yourls.googlecode.com/svn/trunk@753 12232710-3e20-11de-b438-597f59cd7555
2012-08-29 14:57:35 +00:00
ozhozh
4023e50bcc - Stricter coding
- new close() method

git-svn-id: http://yourls.googlecode.com/svn/trunk@208 12232710-3e20-11de-b438-597f59cd7555
2009-09-27 16:51:26 +00:00
ozhozh
8f6fabba4b 1.4-alpha massive commit:
- now using a global object $ydb for everything related to DB and other globally needed stuff
- change in DB schema: now storing URLs with their keyword as used in shorturl, allowing for any keyword length
- change in DB schema: new table for storing various options including next_id, dropping table of the same name
- change in DB schema: new table for storing hits (for stats)
- added an upgrader from 1.3 to 1.4
- improved the installer, with .htaccess file creation


git-svn-id: http://yourls.googlecode.com/svn/trunk@103 12232710-3e20-11de-b438-597f59cd7555
2009-09-02 20:26:34 +00:00
ozhozh
932cabe9d5 Change in DB logic & functions: now refer to a global $ydb object created by class-mysql.php
git-svn-id: http://yourls.googlecode.com/svn/trunk@94 12232710-3e20-11de-b438-597f59cd7555
2009-08-27 20:40:16 +00:00
ozhozh
cc791bd560 Adding mysql_version() to MySQL class
git-svn-id: http://yourls.googlecode.com/svn/trunk@93 12232710-3e20-11de-b438-597f59cd7555
2009-08-27 19:44:56 +00:00
ozhozh
165b042d6e 1.3 RC1 massive commit
- check for MySQL server running
- More HTML template tags
- Bookmarklet & Tools page
- 1st attempt at filtering XSS hacks when adding new URL
- Hide SQL errors
- 1st code cleanup in admin/index.php to separate code and display
- default bigger font
- favicon
- no more ### ugly comments, all //
- stricter coding to prevent notices with undefined indexes
- hide PHP notices, unless YOURLS_DEBUG constant set to true

git-svn-id: http://yourls.googlecode.com/svn/trunk@77 12232710-3e20-11de-b438-597f59cd7555
2009-08-22 14:54:51 +00:00
ozhozh
2f6b480e8b Initial commit (importing from http://svn.planetozh.com/ozhin)
git-svn-id: http://yourls.googlecode.com/svn/trunk@3 12232710-3e20-11de-b438-597f59cd7555
2009-05-11 20:30:26 +00:00