/** * Initialize MantellaSession class: init database authorization, renew session * * @param void * @return void */ public static function init($preset) { self::$settings['dblink'] = DBM::get(trim($preset['connection'])); self::$settings['table'] = trim($preset['table']); $tmp = explode(",", trim($preset['fields'])); for ($i = 0; $i < count($tmp); $i++) { self::$settings['fields'][] = trim($tmp[$i]); } self::$settings['login'] = explode("|", trim($preset['login'])); self::$settings['secret'] = trim($preset['password']); self::$settings['encode'] = empty($preset['encoding']) ? null : trim($preset['encoding']); if (isset($_SESSION[self::SESSION_NAME])) { self::$session = $_SESSION[self::SESSION_NAME]; } self::$initialized = TRUE; }
/** * Return database connection, or FALSE if database connection not assigned/connected * * @param void * @return MantellaDB|boolean */ private function getDB() { $db = DBM::get($this->DATABASE); return $db && $db->isConnected() ? $db : false; }
/** * Create a new model instance. * * @param void * @return void */ public function __construct() { if ($this->DATABASE) { $this->_DBLINK = DBM::get($this->DATABASE); } if (is_string($this->VALIDATORS_ERRORS)) { $this->VALIDATORS_ERRORS = LNG::get($this->VALIDATORS_ERRORS); } }