diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-10 00:34:23 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-10 00:34:23 +0000 |
commit | a7feeb576f491f285cb76cba0b99e01e7a3ae390 (patch) | |
tree | 8efe29cc0c989cbc1f9c4d38f82c46e14ff7ad3d /modules/user/helpers | |
parent | 48e73e90817a9c525ed50dc332d4a4341a8c6295 (diff) |
Big set of changes to comments, with related changes to akismet and
user modules.
* Don't delete vars when we delete a module. This makes
reinstalling a module a lot easier.
* Add user::lookup() as the preferred way to load a user, so that
other modules don't delve into the user module (that'd be a
problem when we swap out user modules)
* Notify site admins if Akismet is not fully configured
* Bundle all server variables into the comment so that if/when we
re-check the comment, we are not using the server info from the
site admin's request.
* Update Akismet to grab request context data from the comment
* Pre-seed comment fields if we have a logged in user. Update
comment::create() API to clarify it for this.
* Delete comment::update(), that's a controller function.
* Add url to User_Model
* Add author_name() author_email() and author_url() to
Comment_Model. It'll return the appropriate values depending
on whether the comment was left by a logged in user or a guest.
* Use resetForm() instead of clearForm() when we reload the
comment form after ajax submit, this way we preserve the
pre-seeded values.
* In the user profile page, ignore blank passwords.
Diffstat (limited to 'modules/user/helpers')
-rw-r--r-- | modules/user/helpers/user.php | 22 | ||||
-rw-r--r-- | modules/user/helpers/user_installer.php | 1 |
2 files changed, 22 insertions, 1 deletions
diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php index cc70d874..377a1036 100644 --- a/modules/user/helpers/user.php +++ b/modules/user/helpers/user.php @@ -31,6 +31,7 @@ class user_Core { $group->input("full_name")->label(t("Full Name"))->id("gFullName")->value($user->full_name); $group->password("password")->label(t("Password"))->id("gPassword"); $group->input("email")->label(t("Email"))->id("gEmail")->value($user->email); + $group->input("url")->label(t("URL"))->id("gUrl")->value($user->url); $group->submit(t("Save")); $form->add_rules_from($user); return $form; @@ -45,6 +46,7 @@ class user_Core { $group->input("full_name")->label(t("Full Name"))->id("gFullName")->value($user->full_name); $group->password("password")->label(t("Password"))->id("gPassword"); $group->input("email")->label(t("Email"))->id("gEmail")->value($user->email); + $group->input("url")->label(t("URL"))->id("gUrl")->value($user->url); $group->submit(t("Modify User")); $form->add_rules_from($user); return $form; @@ -59,6 +61,7 @@ class user_Core { $group->input("full_name")->label(t("Full Name"))->id("gFullName"); $group->password("password")->label(t("Password"))->id("gPassword"); $group->input("email")->label(t("Email"))->id("gEmail"); + $group->input("url")->label(t("URL"))->id("gUrl")->value($user->url); $group->submit(t("Add User")); $user = ORM::factory("user"); $form->add_rules_from($user); @@ -213,7 +216,7 @@ class user_Core { } /** - * Perform the post authentication processing + * Log in as a given user. * @param object $user the user object. */ public static function login($user) { @@ -225,6 +228,10 @@ class user_Core { module::event("user_login", $user); } + /** + * Log out the active user and destroy the session. + * @param object $user the user object. + */ public static function logout() { $user = user::active(); if (!$user->guest) { @@ -238,6 +245,19 @@ class user_Core { } /** + * Look up a user by id. + * @param integer $id the user id + * @return User_Model the user object, or null if the id was invalid. + */ + public static function lookup($id) { + $user = model_cache::get("user", $id); + if ($user->loaded) { + return $user; + } + return null; + } + + /** * Create a hashed password using md5 plus salt. * @param string $password plaintext password * @param string $salt (optional) salt or hash containing salt (randomly generated if omitted) diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php index 731a4a9e..1cbb2502 100644 --- a/modules/user/helpers/user_installer.php +++ b/modules/user/helpers/user_installer.php @@ -33,6 +33,7 @@ class user_installer { `email` varchar(64) default NULL, `admin` BOOLEAN default 0, `guest` BOOLEAN default 0, + `url` varchar(255) default NULL, PRIMARY KEY (`id`), UNIQUE KEY(`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); |