예제 #1
0
파일: ConfigTest.php 프로젝트: ibou77/elgg
 public function testGetConnectionConfigWithMultipleReadOldStyle()
 {
     $ans = array(0 => array('host' => 0, 'user' => 'user0', 'password' => 'xxxx0', 'database' => 'elgg0'), 1 => array('host' => 1, 'user' => 'user1', 'password' => 'xxxx1', 'database' => 'elgg1'));
     $CONFIG = new \stdClass();
     $CONFIG->db['read'][0] = new \stdClass();
     $CONFIG->db['read'][0]->dbhost = $ans[0]['host'];
     $CONFIG->db['read'][0]->dbuser = $ans[0]['user'];
     $CONFIG->db['read'][0]->dbpass = $ans[0]['password'];
     $CONFIG->db['read'][0]->dbname = $ans[0]['database'];
     $CONFIG->db['read'][1] = new \stdClass();
     $CONFIG->db['read'][1]->dbhost = $ans[1]['host'];
     $CONFIG->db['read'][1]->dbuser = $ans[1]['user'];
     $CONFIG->db['read'][1]->dbpass = $ans[1]['password'];
     $CONFIG->db['read'][1]->dbname = $ans[1]['database'];
     $conf = new \Elgg\Database\Config($CONFIG);
     $connConf = $conf->getConnectionConfig(\Elgg\Database\Config::READ);
     $this->assertEquals($ans[$connConf['host']], $connConf);
 }
예제 #2
0
파일: thumbnail.php 프로젝트: n8b/VMN
        header("HTTP/1.1 304 Not Modified");
        exit;
    }
}
$base_dir = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
// Get DB settings
require_once $base_dir . '/engine/settings.php';
require_once $base_dir . '/vendor/autoload.php';
global $CONFIG;
if (isset($CONFIG->dataroot)) {
    $data_root = $CONFIG->dataroot;
}
if (!isset($data_root)) {
    $db_config = new \Elgg\Database\Config($CONFIG);
    if ($db_config->isDatabaseSplit()) {
        $read_settings = $db_config->getConnectionConfig(\Elgg\Database\Config::READ);
    } else {
        $read_settings = $db_config->getConnectionConfig(\Elgg\Database\Config::READ_WRITE);
    }
    $mysql_dblink = @mysql_connect($read_settings["host"], $read_settings["user"], $read_settings["password"], true);
    if ($mysql_dblink) {
        if (@mysql_select_db($read_settings["database"], $mysql_dblink)) {
            $q = "SELECT name, value FROM {$db_config->getTablePrefix()}datalists WHERE name = 'dataroot'";
            $result = mysql_query($q, $mysql_dblink);
            if ($result) {
                $row = mysql_fetch_object($result);
                while ($row) {
                    if ($row->name == 'dataroot') {
                        $data_root = $row->value;
                    }
                    $row = mysql_fetch_object($result);
예제 #3
0
}
$base_dir = dirname(dirname(dirname(__FILE__)));
// Get DB settings
require_once $base_dir . '/engine/settings.php';
require_once $base_dir . '/vendor/autoload.php';
global $CONFIG;
$size = "medium";
if (!empty($_GET['size'])) {
    $size = strtolower($_GET['size']);
    if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar'))) {
        $size = "medium";
    }
}
$conf = new \Elgg\Database\Config($CONFIG);
if ($conf->isDatabaseSplit()) {
    $read_connection = $conf->getConnectionConfig(\Elgg\Database\Config::READ);
} else {
    $read_connection = $conf->getConnectionConfig(\Elgg\Database\Config::READ_WRITE);
}
$mysql_dblink = @mysql_connect($read_connection['host'], $read_connection['user'], $read_connection['password'], true);
if ($mysql_dblink) {
    if (@mysql_select_db($read_connection['database'], $mysql_dblink)) {
        $q = "SELECT name, value FROM {$CONFIG->dbprefix}datalists WHERE name in ('dataroot', 'path')";
        $result = mysql_query($q, $mysql_dblink);
        if ($result) {
            $row = mysql_fetch_object($result);
            while ($row) {
                if ($row->name == 'dataroot') {
                    $data_root = $row->value;
                } elseif ($row->name == 'path') {
                    $elgg_path = $row->value;