コード例 #1
0
ファイル: txplib_db.php プロジェクト: bgarrels/textpattern
 function DB()
 {
     global $txpcfg;
     $this->host = $txpcfg['host'];
     $this->db = $txpcfg['db'];
     $this->user = $txpcfg['user'];
     $this->pass = $txpcfg['pass'];
     $this->client_flags = isset($txpcfg['client_flags']) ? $txpcfg['client_flags'] : 0;
     $this->link = @mysql_connect($this->host, $this->user, $this->pass, false, $this->client_flags);
     if (!$this->link) {
         die(db_down());
     }
     $this->version = mysql_get_server_info();
     if (!$this->link) {
         $GLOBALS['connected'] = false;
     } else {
         $GLOBALS['connected'] = true;
     }
     @mysql_select_db($this->db) or die(db_down());
     $version = $this->version;
     // be backwardscompatible
     if (isset($txpcfg['dbcharset']) && (intval($version[0]) >= 5 || preg_match('#^4\\.[1-9]#', $version))) {
         mysql_query("SET NAMES " . $txpcfg['dbcharset']);
     }
 }
コード例 #2
0
ファイル: txplib_db.php プロジェクト: bgarrels/textpattern
 function DB()
 {
     global $txpcfg;
     $this->host = $txpcfg['host'];
     $this->db = $txpcfg['db'];
     $this->user = $txpcfg['user'];
     $this->pass = $txpcfg['pass'];
     $this->link = mysql_connect($this->host, $this->user, $this->pass);
     if (!$this->link) {
         $GLOBALS['connected'] = false;
     } else {
         $GLOBALS['connected'] = true;
     }
     mysql_select_db($this->db) or die(db_down());
 }
コード例 #3
0
ファイル: index.php プロジェクト: joseph-mudloff/pixie-cms
    pixieExit();
    exit;
}
/* Prevent any kind of predefinition of DIRECT_ACCESS or PIXIE_DEBUG */
define('DIRECT_ACCESS', 1);
/* Knock once for yes */
if (!file_exists('config.php') or filesize('config.php') < 10) {
    /* check for config */
    if (file_exists('install/index.php')) {
        header('Location: install/');
        exit;
    }
    /* redirect to installer */
    if (!file_exists('install/index.php')) {
        require_once 'lib/lib_db.php';
        db_down();
        exit;
    }
    /* redirect to an error page if down */
}
ini_set('default_charset', 'utf-8');
/* set default php charset */
require_once 'lib/lib_misc.php';
/* perform basic sanity checks */
bombShelter();
/* check URL size */
if (PIXIE_DEBUG == 'yes') {
    error_reporting(-1);
} else {
    error_reporting(0);
}
コード例 #4
0
ファイル: txplib_db.php プロジェクト: bgarrels/textpattern
 /**
  * Creates a new link.
  */
 public function __construct()
 {
     global $txpcfg, $connected;
     $this->host = $txpcfg['host'];
     $this->db = $txpcfg['db'];
     $this->user = $txpcfg['user'];
     $this->pass = $txpcfg['pass'];
     $this->table_options['type'] = 'MyISAM';
     if (!empty($txpcfg['table_prefix'])) {
         $this->table_prefix = $txpcfg['table_prefix'];
     }
     if (isset($txpcfg['client_flags'])) {
         $this->client_flags = $txpcfg['client_flags'];
     }
     if (isset($txpcfg['dbcharset'])) {
         $this->charset = $txpcfg['dbcharset'];
     }
     $this->link = @mysql_connect($this->host, $this->user, $this->pass, false, $this->client_flags);
     if (!$this->link) {
         die(db_down());
     }
     @mysql_select_db($this->db, $this->link) or die(db_down());
     $version = $this->version = mysql_get_server_info($this->link);
     $connected = true;
     // Be backwards compatible.
     if ($this->charset && (intval($version[0]) >= 5 || preg_match('#^4\\.[1-9]#', $version))) {
         mysql_query("SET NAMES " . $this->charset, $this->link);
         $this->table_options['charset'] = $this->charset;
     }
     $this->default_charset = mysql_client_encoding($this->link);
     // Use "ENGINE" if version of MySQL > (4.0.18 or 4.1.2).
     if (intval($version[0]) >= 5 || preg_match('#^4\\.(0\\.[2-9]|(1[89]))|(1\\.[2-9])#', $version)) {
         $this->table_options['engine'] = 'MyISAM';
         unset($this->table_options['type']);
     }
 }
コード例 #5
0
 /**
  * Creates a new link.
  */
 public function __construct()
 {
     global $txpcfg, $connected;
     if (strpos($txpcfg['host'], ':') === false) {
         $this->host = $txpcfg['host'];
         $this->port = ini_get("mysqli.default_port");
     } else {
         list($this->host, $this->port) = explode(':', $txpcfg['host'], 2);
         $this->port = intval($this->port);
     }
     if (isset($txpcfg['socket'])) {
         $this->socket = $txpcfg['socket'];
     } else {
         $this->socket = ini_get("mysqli.default_socket");
     }
     $this->db = $txpcfg['db'];
     $this->user = $txpcfg['user'];
     $this->pass = $txpcfg['pass'];
     $this->table_options['type'] = 'MyISAM';
     if (!empty($txpcfg['table_prefix'])) {
         $this->table_prefix = $txpcfg['table_prefix'];
     }
     if (isset($txpcfg['client_flags'])) {
         $this->client_flags = $txpcfg['client_flags'];
     } else {
         $this->client_flags = 0;
     }
     if (isset($txpcfg['dbcharset'])) {
         $this->charset = $txpcfg['dbcharset'];
     }
     $this->link = mysqli_init();
     // Suppress screen output from mysqli_real_connect().
     $error_reporting = error_reporting();
     error_reporting($error_reporting & ~(E_WARNING | E_NOTICE));
     if (!mysqli_real_connect($this->link, $this->host, $this->user, $this->pass, $this->db, $this->port, $this->socket, $this->client_flags)) {
         die(db_down());
     }
     error_reporting($error_reporting);
     $version = $this->version = mysqli_get_server_info($this->link);
     $connected = true;
     // Be backwards compatible.
     if ($this->charset && (intval($version[0]) >= 5 || preg_match('#^4\\.[1-9]#', $version))) {
         mysqli_query($this->link, "SET NAMES " . $this->charset);
         $this->table_options['charset'] = $this->charset;
     }
     $this->default_charset = mysqli_character_set_name($this->link);
     // Use "ENGINE" if version of MySQL > (4.0.18 or 4.1.2).
     if (intval($version[0]) >= 5 || preg_match('#^4\\.(0\\.[2-9]|(1[89]))|(1\\.[2-9])#', $version)) {
         $this->table_options['engine'] = 'MyISAM';
         unset($this->table_options['type']);
     }
 }
コード例 #6
0
ファイル: lib_db.php プロジェクト: joseph-mudloff/pixie-cms
 function DB()
 {
     global $pixieconfig;
     $this->host = $pixieconfig['host'];
     $this->db = $pixieconfig['db'];
     $this->user = $pixieconfig['user'];
     $this->pass = $pixieconfig['pass'];
     $this->link = mysql_connect($this->host, $this->user, $this->pass);
     if (!$this->link) {
         $GLOBALS['connected'] = FALSE;
     } else {
         $GLOBALS['connected'] = TRUE;
     }
     mysql_select_db($this->db) or die(db_down());
     /* Connect to the database */
     if (isset($pixieconfig['site_charset']) && $pixieconfig['site_charset']) {
         $charset = strtolower(str_replace('-', '', $pixieconfig['site_charset']));
         $query_names = "SET NAMES '{$charset}'";
         $set_db_names_charset = mysql_query($query_names);
         /* Set the name character set for database connection */
         $query_char = "SET CHARACTER SET '{$charset}'";
         $set_db_charset = mysql_query($query_char);
         /* Set the character set for database connection */
     }
     $diff = $this->getTzdiff();
     if ($diff >= 0) {
         $diff = "+{$diff}";
     }
     mysql_query("set time_zone = '" . "{$diff}:00'");
 }