Exemple #1
0
 function __construct($module_dir)
 {
     if (is_null($module_dir)) {
         throw new Exception("Module dir cannot be null.");
     }
     $this->module_dir = $module_dir;
     parent::__construct();
 }
Exemple #2
0
 protected function _setupTableName()
 {
     if (!in_array("bolts_database_versions", $this->getAdapter()->listTables())) {
         // table does not exist. we need to create it first.
         $script = new Bolts_Db_Script("default", "create_database_versions");
         if (!$script) {
             throw new Exception("CANT_UPGRADE - Cannot upgrade the database because versions table does not exist and couldn't be created.");
         }
     }
     $this->_name = 'bolts_database_versions';
     parent::_setupTableName();
 }
Exemple #3
0
 function __construct($role_id, $locale_code = "en-us", $config = null, $restricted = null)
 {
     $this->locale_code = $locale_code;
     $this->role_id = $role_id;
     if (is_array($this->role_id)) {
         $all_roles = $this->role_id;
     } else {
         $all_roles = array($this->role_id);
     }
     $roles_table = new Roles();
     foreach ($all_roles as $role) {
         $all_roles = array_merge($all_roles, $roles_table->getAllAncestors($role));
     }
     $this->all_roles = array_unique($all_roles);
     return parent::__construct($config);
 }
Exemple #4
0
 function set($module = "default", $ckey, $value, $is_cached = false)
 {
     if (!$this->keyExists($module, $ckey)) {
         $data = array("ckey" => $ckey, "module" => $module, "value" => $value);
         if ($is_cached) {
             $data['is_cached'] = 1;
         } else {
             $data['is_cached'] = 0;
         }
         parent::insert($data);
     } else {
         $where = $this->getAdapter()->quoteInto("ckey = ?", $ckey);
         $where .= $this->getAdapter()->quoteInto(" and module = ?", $module);
         $data = array("value" => $value);
         if ($is_cached) {
             $data['is_cached'] = 1;
         } else {
             $data['is_cached'] = 0;
         }
         parent::update($data, $where);
     }
 }
Exemple #5
0
 public function update(array $data, $where)
 {
     // md5 password if it's not blank
     if (!empty($data['password'])) {
         $data['password'] = md5($data['password']);
     }
     if (!empty($data['password_hash'])) {
         $data['password'] = $data['password_hash'];
         unset($data['password_hash']);
     }
     //$this->parseTags($data['tags']);
     return parent::update($data, $where);
 }