From 5b60d5b87ddb0a7b1e6c8c5cf34e99e47e665e36 Mon Sep 17 00:00:00 2001 From: ozhozh Date: Tue, 25 May 2010 15:40:25 +0000 Subject: [PATCH] Define more global constants at init git-svn-id: http://yourls.googlecode.com/svn/trunk@353 12232710-3e20-11de-b438-597f59cd7555 --- includes/load-yourls.php | 60 ++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/includes/load-yourls.php b/includes/load-yourls.php index a6c6b82..036742a 100644 --- a/includes/load-yourls.php +++ b/includes/load-yourls.php @@ -34,28 +34,66 @@ yourls_die('

Your config.php does not contain all the required constant definitions.

Please check config-sample.php and update your config accordingly, there are new stuffs!

'); // Define constants that have not been user defined in config.php + +// physical path of YOURLS root if( !defined('YOURLS_ABSPATH') ) - define('YOURLS_ABSPATH', str_replace('\\', '/', dirname(dirname(__FILE__))) ); // physical path of YOURLS root + define('YOURLS_ABSPATH', str_replace('\\', '/', dirname(dirname(__FILE__))) ); + +// physical path of includes directory +if( !defined('YOURLS_INC') ) + define('YOURLS_INC', str_replace('\\', '/', YOURLS_ABSPATH.'/includes' ) ); + +// physical path of user directory +if( !defined('YOURLS_USERDIR') ) + define('YOURLS_USERDIR', str_replace('\\', '/', YOURLS_ABSPATH.'/user' ) ); + +// physical path of plugins directory +if( !defined('YOURLS_PLUGINDIR') ) + define('YOURLS_PLUGINDIR', str_replace('\\', '/', YOURLS_USERDIR.'/plugins' ) ); + +// physical path of pages directory +if( !defined('YOURLS_PAGEDIR') ) + define('YOURLS_ABSPATH', str_replace('\\', '/', YOURLS_ABSPATH.'/pages' ) ); + +// table to store URLs if( !defined('YOURLS_DB_TABLE_URL') ) - define('YOURLS_DB_TABLE_URL', YOURLS_DB_PREFIX.'url'); // table to store URLs + define('YOURLS_DB_TABLE_URL', YOURLS_DB_PREFIX.'url'); + +// table to store options if( !defined('YOURLS_DB_TABLE_OPTIONS') ) - define('YOURLS_DB_TABLE_OPTIONS', YOURLS_DB_PREFIX.'options'); // table to store options + define('YOURLS_DB_TABLE_OPTIONS', YOURLS_DB_PREFIX.'options'); + +// table to store hits, for stats if( !defined('YOURLS_DB_TABLE_LOG') ) - define('YOURLS_DB_TABLE_LOG', YOURLS_DB_PREFIX.'log'); // table to store hits, for stats + define('YOURLS_DB_TABLE_LOG', YOURLS_DB_PREFIX.'log'); + +// minimum delay in sec before a same IP can add another URL. Note: logged in users are not throttled down. if( !defined('YOURLS_FLOOD_DELAY_SECONDS') ) - define('YOURLS_FLOOD_DELAY_SECONDS', 15 ); // minimum delay in sec before a same IP can add another URL. Note: logged in users are not throttled down. + define('YOURLS_FLOOD_DELAY_SECONDS', 15 ); + +// comma separated list of IPs that can bypass flood check. if( !defined('YOURLS_FLOOD_IP_WHITELIST') ) - define('YOURLS_FLOOD_IP_WHITELIST', '' ); // comma separated list of IPs that can bypass flood check. + define('YOURLS_FLOOD_IP_WHITELIST', '' ); + +// life span of an auth cookie in seconds (60*60*24*7 = 7 days) if( !defined('YOURLS_COOKIE_LIFE') ) - define( 'YOURLS_COOKIE_LIFE', 60*60*24*7 ); // life span of an auth cookie in seconds (60*60*24*7 = 7 days) + define( 'YOURLS_COOKIE_LIFE', 60*60*24*7 ); + +// life span of a nonce in seconds if( !defined('YOURLS_NONCE_LIFE') ) - define( 'YOURLS_NONCE_LIFE', 3600 ); // life span of a nonce in seconds + define( 'YOURLS_NONCE_LIFE', 3600 ); + +// if set to true, disable stat logging (no use for it, too busy servers, ...) if( !defined('YOURLS_NOSTATS') ) - define( 'YOURLS_NOSTATS', false ); // if set to true, disable stat logging (no use for it, too busy servers, ...) + define( 'YOURLS_NOSTATS', false ); + +// if set to true, force https:// in the admin area if( !defined('YOURLS_ADMIN_SSL') ) - define( 'YOURLS_ADMIN_SSL', false ); // if set to true, force https:// in the admin area + define( 'YOURLS_ADMIN_SSL', false ); + +// if set to true, verbose debug infos. Will break things. Don't enable. if( !defined('YOURLS_DEBUG') ) - define( 'YOURLS_DEBUG', false ); // if set to true, verbose debug infos. Will break things. Don't enable. + define( 'YOURLS_DEBUG', false ); // Error reporting if (defined('YOURLS_DEBUG') && YOURLS_DEBUG == true) { -- 2.45.0