where) { $this->where[] = ' AND ' . $condition; } else { $this->where[] = $condition; } } public function isReadOnlyMode ($table = null) { if ('searches' == $table) { return false; } if (Zend_Registry::isRegistered ('inhibit_read_only_mode')) { return false; } if (! isset ($this->read_only)) { $this->push (); { $this->read_only = (bool) Setting_Model::get (Setting_Model::S_READ_ONLY, false); } $this->pop (); } return $this->read_only; } public function update ($table = '', $set = NULL, $where = NULL) { if (! $this->isReadOnlyMode ($table)) { return parent::update ($table, $set, $where); } } public function insert ($table = '', $set = NULL) { if (! $this->isReadOnlyMode ($table)) { return parent::insert ($table, $set); } } public function delete ($table = '', $where = NULL) { if (! $this->isReadOnlyMode ($table)) { return parent::delete ($table, $where); } } public function inhibitReadOnlyMode () { Zend_Registry::set ('inhibit_read_only_mode', 1); } public function createZendDbAdapter () { $config = array ( 'host' => Kohana::config('database.default.connection.host'), 'username' => Kohana::config('database.default.connection.user'), 'password' => Kohana::config('database.default.connection.pass'), 'dbname' => Kohana::config('database.default.connection.database'), 'port' => Kohana::config('database.default.connection.port'), ); return new Zend_Db_Adapter_Mysqli ($config); } }