# Classes
public $out;
- function __construct($opt = '') {
+ function __construct($opt = []) {
# Args defaults
if ($opt==='') $opt = [];
* Create globals Db and Table
*/
public static function init($conf) {
- global $Db, $Table;
- if (isset($Table)) self::bye("Table.init(): GLOBALS['Table'] already exists !");
- if (isset($Db)) self::bye("Db.init(): GLOBALS['Db'] already exists !");
-
- #
- # Db
- #
- $Db = new self();
#
# Params
- $Db->pinit();
+ self::pinit();
#
# Load conf
- $db = $Db->conf_search_db($conf);
- if ($Db->p('localFile')) {
- foreach ($Db->localFile($db['name']) as $k=>$v) {
+ $db = self::conf_search_db($conf);
+ if (self::p('localFile')) {
+ foreach (self::localFile($db['name']) as $k=>$v) {
if (empty($db[$k])) $db[$k] = $v;
}
}
+ #
+ # Db
+ #
+ global $Db, $Table;
+ if (isset($Table)) self::bye("Table.init(): GLOBALS['Table'] already exists !");
+ if (isset($Db)) self::bye("Db.init(): GLOBALS['Db'] already exists !");
+ $Db = new self();
#
# Connection
$Db->__construct($db);