Remove all non Identity API methods from Identity.php. Created an MY_Session class to provide the user state changes in the session and a login.php helper that has the login form.

This commit is contained in:
Tim Almdal
2009-10-16 10:06:58 -07:00
parent bc241e44c2
commit 78ee4193b7
41 changed files with 194 additions and 176 deletions

View File

@@ -65,7 +65,7 @@ class Comments_Controller extends REST_Controller {
$form = comment::get_add_form($item);
$valid = $form->validate();
if ($valid) {
if (Identity::active()->guest && !$form->add_comment->inputs["name"]->value) {
if (Session::active_user()->guest && !$form->add_comment->inputs["name"]->value) {
$form->add_comment->inputs["name"]->add_error("missing", 1);
$valid = false;
}
@@ -78,13 +78,13 @@ class Comments_Controller extends REST_Controller {
if ($valid) {
$comment = comment::create(
$item, Identity::active(),
$item, Session::active_user(),
$form->add_comment->text->value,
$form->add_comment->inputs["name"]->value,
$form->add_comment->email->value,
$form->add_comment->url->value);
$active = Identity::active();
$active = Session::active_user();
if ($active->guest) {
$form->add_comment->inputs["name"]->value("");
$form->add_comment->email->value("");
@@ -192,7 +192,7 @@ class Comments_Controller extends REST_Controller {
* @see REST_Controller::form_edit($resource)
*/
public function _form_edit($comment) {
if (!Identity::active()->admin) {
if (!Session::active_user()->admin) {
access::forbidden();
}
print comment::get_edit_form($comment);