]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - includes/load-yourls.php
Simpler config: no DB naming, just a table prefix (eg "yourls_")
[Github/YOURLS.git] / includes / load-yourls.php
1 <?php\r
2 // This file initialize everything\r
3 \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
9 \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
13 \r
14 // Define tables\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
21 \r
22 // Create the YOURLS object $ydb that will contain everything we globally need\r
23 if ( function_exists( 'yourls_db_connect' ) ) {\r
24         global $ydb;\r
25         yourls_db_connect();\r
26 }\r
27 \r
28 // Read option right from start\r
29 yourls_get_all_options();\r
30 \r
31 \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
36         }\r
37 }