array (userinfo) * We can't simplify this because some auth schemes (like LDAP) automatically (or it's at least cheaper to) return all the information * Functions like get_user_info allow selection of specifics (in functions_db) * * @param string Field to order by (id_user, fullname or registered) * * @return array An array of user information */ function get_users ($order = "fullname") { switch ($order) { case "id_user": case "registered": case "last_connect": case "fullname": break; default: $order = "fullname"; } $output = array(); $result = get_db_all_rows_in_table ("tusuario", $order); if ($result !== false) { foreach ($result as $row) { $output[$row["id_user"]] = $row; } } return $output; } /** * Sets the last login for a user * * @param string User id */ function process_user_contact ($id_user) { return process_sql_update ("tusuario", array ("last_connect" => get_system_time ()), array ("id_user" => $id_user)); } /** * Create a new user * * @return bool false */ function create_user ($id_user, $password, $user_info) { $values = $user_info; $values["id_user"] = $id_user; $values["password"] = md5 ($password); $values["last_connect"] = 0; $values["registered"] = get_system_time (); return process_sql_insert ("tusuario", $values); } /** * Deletes the user * * @param string User id */ function delete_user ($id_user) { $sql = "DELETE FROM tusuario_perfil WHERE id_usuario = '".$id_user."'"; $result = process_sql ($sql); if ($result === false) { return false; } $sql = "DELETE FROM tusuario WHERE id_user = '".$id_user."'"; $result = process_sql ($sql); if ($result === false) { return false; } return true; } function update_user_password ($user, $password_new) { return process_sql_update ('tusuario', array ('password' => md5 ($password_new)), array ('id_user' => $user)); } function update_user ($id_user, $values) { if (! is_array ($values)) return false; return process_sql_update ("tusuario", $values, array ("id_user" => $id_user)); } //Reference the global use authorization error to last auth error. $config["auth_error"] = &$mysql_cache["auth_error"]; ?>