function DBConn()
{
- GLOBAL $G_dbauth;
+ $this->db = DBConn::$dbcnnx;
+ }
+
+ static function &create()
+ {
+ GLOBAL $G_dbauth, $G_false;
+ $ret = &$G_false;
+
if (DBConn::$dbcnnx == FALSE) {
if (!(DBConn::$dbcnnx = @pg_connect ($G_dbauth))) {
- echo "DB connection failed.";
- exit;
+ return ($ret);
}
}
- $this->db = DBConn::$dbcnnx;
- return;
+ $ret = new DBConn();
+
+ return $ret;
}
function db()
{
var $item;
var $item_n;
- function BriskDB()
+ function BriskDB($dbconn)
+ {
+ $this->dbconn = $dbconn;
+ }
+
+ static function &create()
{
GLOBAL $DOCUMENT_ROOT, $G_dbpfx, $G_false;
+
+ $dbconn = $G_false;
+ $ret = $G_false;
+
log_main("BriskDB create:start");
- $this->dbconn = new DBConn();
+ do {
+ if (($dbconn = DBConn::create()) == FALSE)
+ break;
+
+ $ret = new BriskDB($dbconn);
+ } while (0);
log_main("BriskDB create:end");
+ return ($ret);
}
function users_load()
$chals->rem($login);
$ret = LoginDBItem::LoginDBItemFromRecord($user_obj);
- return ($ret);
- //O break;
+ break;
}
}
} // end for ($e = 0 ...
for ($i = 0 ; $i < $olddb->count() ; $i++) {
$user_sql = sprintf("INSERT INTO %susers ( login, pass, email, type) VALUES ('%s', '%s', '%s', %d);",
- $G_dbpfx, escsql($olddb->item[$i]->login), escsql($olddb->item[$i]->pass),
+ $G_dbpfx, escsql(strtolower($olddb->item[$i]->login)), escsql($olddb->item[$i]->pass),
escsql($olddb->item[$i]->email), $olddb->item[$i]->type & USER_FLAG_TY_ALL);
// if ( ! (($user_pg = pg_exec($dbconn,$order_add_sql)) != FALSE && pg_affected_rows($order_pg) == 1) ) {