2 // This file initialize everything
\r
4 // Include everything except auth functions
\r
5 require_once (dirname(__FILE__).'/version.php');
\r
6 require_once (dirname(__FILE__).'/functions.php');
\r
7 require_once (dirname(__FILE__).'/functions-baseconvert.php');
\r
8 require_once (dirname(__FILE__).'/class-mysql.php');
\r
10 // Check if config.php was properly updated for 1.4
\r
11 if( !defined('YOURLS_DB_PREFIX') )
\r
12 die('<p>Your <tt>config.php</tt> does not contain all the required constant definitions. Please check <tt>config-sample.php</tt> and update your config accordingly, there are new stuffs!</p>');
\r
15 if( !defined('YOURLS_DB_TABLE_URL') )
\r
16 define('YOURLS_DB_TABLE_URL', YOURLS_DB_PREFIX.'url');
\r
17 if( !defined('YOURLS_DB_TABLE_OPTIONS') )
\r
18 define('YOURLS_DB_TABLE_OPTIONS', YOURLS_DB_PREFIX.'options');
\r
19 if( !defined('YOURLS_DB_TABLE_LOG') )
\r
20 define('YOURLS_DB_TABLE_LOG', YOURLS_DB_PREFIX.'log');
\r
22 // Create the YOURLS object $ydb that will contain everything we globally need
\r
23 if ( function_exists( 'yourls_db_connect' ) ) {
\r
25 yourls_db_connect();
\r
28 // Read option right from start
\r
29 yourls_get_all_options();
\r
32 // Check if upgrade is needed. Note: this is bypassable with define('YOURLS_NO_VERSION_CHECK', true)
\r
33 if ( !defined('YOURLS_NO_VERSION_CHECK') || YOURLS_NO_VERSION_CHECK != true ) {
\r
34 if ( yourls_upgrade_is_needed() ) {
\r
35 yourls_redirect( YOURLS_SITE .'/admin/upgrade.php' );
\r