/**
  * Register User
  *
  * Add user to the db
  *
  * @access	private
  * @param	string	table, where
  */
 function register_user($userdata)
 {
     /* Filter array keys */
     $allowed = array('group_id', 'username', 'email', 'password', 'join_date');
     $userdata = filter_input_data($allowed, $userdata);
     /* Hash the password */
     $userdata['password'] = $this->hash_password($userdata['password']);
     $this->db->set($userdata);
     $this->db->insert($this->table);
     return $this->db->insert_id();
 }
示例#2
0
 /**
  * Insert Node
  *
  * @access	private
  * @return	mixed
  */
 function insert($data, $parent_path = FALSE, $node_type = 'root')
 {
     $allowed = array('user_id', 'title', 'url_title', 'description');
     $data = filter_input_data($allowed, $data);
     $this->db->insert($this->c_table, $data);
     $node_id = $this->db->insert_id();
     $path = $parent_path ? $parent_path . '.' . $node_id . '.' : $node_id . '.';
     $t_data = array('materialized_path' => $path, 'node_id' => $node_id, 'node_type' => $node_type);
     $this->db->insert($this->table, $t_data);
     return $node_id;
 }