Exemple #1
0
	/**
	 * Read the wp-config file to connect to the database
	 *	 
	 * @since 1.1
	 * @return void
	 **/
	function dbinit () {
		$db = DB::get();

		// Skip init if a connection exists
		if (defined('ABSPATH') && $db->dbh !== false) return;

		global $table_prefix;

		if (!load_ecarts_wpconfig())
			$this->error();

		chdir(ABSPATH.'wp-content');

		// Establish database connection
		$db->connect(DB_USER,DB_PASSWORD,DB_NAME,DB_HOST);
		if ($db->dbh === false) {
			error_reporting(E_ALL);
			ini_set('display_errors',1);
			trigger_error('Error establishing a database connection',E_USER_ERROR);
			die();
		}

		if (defined('DB_CHARSET')) {
			if (function_exists('mysql_set_charset'))
				mysql_set_charset(DB_CHARSET, $db->dbh);
			else {
				$query = "SET NAMES '".DB_CHARSET."'";
				if (defined('DB_COLLATE')) $query .= " COLLATE '".DB_COLLATE."'";
				$db->query($query);
			}
		}

		if (is_multisite()) ecart_ms_tableprefix();

	}
Exemple #2
0
}

function get_file($path) {

	if ( function_exists('realpath') )
		$path = realpath($path);

	if ( ! $path || ! @is_file($path) )
		return '';

	return @file_get_contents($path);
}


require_once('functions.php');
if (!defined('ABSPATH')) load_ecarts_wpconfig();
if (!defined('WPINC')) define('WPINC', 'wp-includes');
require_once('flow/Scripts.php');

$EcartScripts = new EcartScripts();
ecart_default_scripts($EcartScripts);

$compress = ( isset($_GET['c']) && $_GET['c'] );
$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
$expires_offset = 31536000;
$out = '';

foreach( $load as $handle ) {
	if ( !array_key_exists($handle, $EcartScripts->registered) )
		continue;