/** * Class constructor * * @access public */ public function __construct() { parent::__construct(); $this->_title = 'Add New User'; if ($this->_user['settings']) { $this->_new_user = new User(); $roles =& Roles::load(); $this->_roles = $roles->_roles; if (VPost::new_user(false)) { $this->create(); } } }
/** * Class constructor * * @access public */ public function __construct() { parent::__construct(); if (VGet::id() && $this->_user['settings']) { $this->_title = 'Edit User'; $this->_roles =& Roles::load(); $this->_roles = $this->_roles->_roles; } else { $this->_title = 'Profile'; } $this->get_user(); $this->get_pictures(); if (VPost::update_profile(false)) { $this->update(); } }
/** * Class constructor * * @access public */ public function __construct() { $this->_db =& Database::load(); $this->_roles =& Roles::load(); session_start(); }
/** * Update all roles at one time * * @access private */ private function update() { if (VPost::update_roles(false)) { try { $setting =& Roles::load(); $to_read['table'] = 'setting'; $to_read['columns'] = array('SETTING_ID'); $to_read['condition_columns'][':t'] = 'setting_type'; $to_read['condition_select_types'][':t'] = '='; $to_read['condition_values'][':t'] = 'role'; $to_read['value_types'][':t'] = 'str'; $to_read['condition_types'][':n'] = 'AND'; $to_read['condition_columns'][':n'] = 'setting_name'; $to_read['condition_select_types'][':n'] = '='; $to_read['value_types'][':n'] = 'str'; foreach ($setting->_roles as $role) { if (!in_array($role, array('administrator', 'editor', 'author'))) { $name = 'auth_' . $role; $array = VPost::$name(array()); $auth = array('dashboard' => false, 'post' => false, 'media' => false, 'album_photo' => false, 'comments' => false, 'delete_content' => false, 'settings' => false); foreach ($auth as $key => &$value) { if (in_array($key, $array)) { $value = true; } } $to_read['condition_values'][':n'] = $role; $role = $this->_db->read($to_read); $role = new Setting($role[0]['SETTING_ID']); $role->_data = json_encode($auth); $role->update('_data', 'str'); } } $result = true; } catch (Exception $e) { $result = $e->getMessage(); } $this->_action_msg = ActionMessages::updated($result); } }