示例#1
0
 /**
 dcCore constructor inits everything related to Dotclear. It takes arguments
 to init database connection.
 
 @param	driver	<b>string</b>	Database driver name
 @param	host		<b>string</b>	Database hostname
 @param	db		<b>string</b>	Database name
 @param	user		<b>string</b>	Database username
 @param	password	<b>string</b>	Database password
 @param	prefix	<b>string</b>	DotClear tables prefix
 @param	persist	<b>boolean</b>	Persistent database connection
 */
 public function __construct($driver, $host, $db, $user, $password, $prefix, $persist)
 {
     $this->con = dbLayer::init($driver, $host, $db, $user, $password, $persist);
     # define weak_locks for mysql
     if ($this->con instanceof mysqlConnection) {
         mysqlConnection::$weak_locks = true;
     }
     $this->prefix = $prefix;
     $this->error = new dcError();
     $this->auth = $this->authInstance();
     $this->session = new sessionDB($this->con, $this->prefix . 'session', DC_SESSION_NAME, '', null, DC_ADMIN_SSL);
     $this->url = new urlHandler();
     $this->plugins = new dcModules($this);
     $this->rest = new dcRestServer($this);
     $this->addFormater('xhtml', create_function('$s', 'return $s;'));
     $this->addFormater('wiki', array($this, 'wikiTransform'));
 }
示例#2
0
 /**
 dcCore constructor inits everything related to Dotclear. It takes arguments
 to init database connection.
 
 @param	driver	<b>string</b>	Database driver name
 @param	host		<b>string</b>	Database hostname
 @param	db		<b>string</b>	Database name
 @param	user		<b>string</b>	Database username
 @param	password	<b>string</b>	Database password
 @param	prefix	<b>string</b>	DotClear tables prefix
 @param	persist	<b>boolean</b>	Persistent database connection
 */
 public function __construct($driver, $host, $db, $user, $password, $prefix, $persist)
 {
     if (defined('DC_START_TIME')) {
         $this->stime = DC_START_TIME;
     } else {
         $this->stime = microtime(true);
     }
     $this->con = dbLayer::init($driver, $host, $db, $user, $password, $persist);
     # define weak_locks for mysql
     if ($this->con instanceof mysqlConnection) {
         mysqlConnection::$weak_locks = true;
     } elseif ($this->con instanceof mysqliConnection) {
         mysqliConnection::$weak_locks = true;
     }
     # define searchpath for postgresql
     if ($this->con instanceof pgsqlConnection) {
         $searchpath = explode('.', $prefix, 2);
         if (count($searchpath) > 1) {
             $prefix = $searchpath[1];
             $sql = 'SET search_path TO ' . $searchpath[0] . ',public;';
             $this->con->execute($sql);
         }
     }
     $this->prefix = $prefix;
     $ttl = DC_SESSION_TTL;
     if (!is_null($ttl)) {
         if (substr(trim($ttl), 0, 1) != '-') {
             // Clearbricks requires negative session TTL
             $ttl = '-' . trim($ttl);
         }
     }
     $this->error = new dcError();
     $this->auth = $this->authInstance();
     $this->session = new sessionDB($this->con, $this->prefix . 'session', DC_SESSION_NAME, '', null, DC_ADMIN_SSL, $ttl);
     $this->url = new dcUrlHandlers();
     $this->plugins = new dcPlugins($this);
     $this->rest = new dcRestServer($this);
     $this->meta = new dcMeta($this);
     $this->log = new dcLog($this);
 }
 /**
 dcCore constructor inits everything related to Dotclear. It takes arguments
 to init database connection.
 
 @param	driver	<b>string</b>	Database driver name
 @param	host		<b>string</b>	Database hostname
 @param	db		<b>string</b>	Database name
 @param	user		<b>string</b>	Database username
 @param	password	<b>string</b>	Database password
 @param	prefix	<b>string</b>	DotClear tables prefix
 @param	persist	<b>boolean</b>	Persistent database connection
 */
 public function __construct($driver, $host, $db, $user, $password, $prefix, $persist)
 {
     $this->con = dbLayer::init($driver, $host, $db, $user, $password, $persist);
     # define weak_locks for mysql
     if ($this->con instanceof mysqlConnection) {
         mysqlConnection::$weak_locks = true;
     }
     $this->prefix = $prefix;
     $this->error = new dcError();
     $this->auth = $this->authInstance();
     $this->session = new sessionDB($this->con, $this->prefix . 'session', BP_SESSION_NAME, '', null, false);
     $this->url = new urlHandler();
     $this->rest = new dcRestServer($this);
     # Create the Hyla_Tpl object
     $this->tpl = new Hyla_Tpl();
     $this->tpl->setL10nCallback('T_');
 }