More coding style tweaks
This commit is contained in:
parent
a765d88d17
commit
8f8d87bad8
@ -1,5 +1,5 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/*
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||||
*
|
*
|
||||||
@ -19,19 +19,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class user_homes_event_Core {
|
class user_homes_event_Core {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called when a user logs in. This will setup the session with the
|
* Called when a user logs in. This will setup the session with the
|
||||||
* user home if it exists on the database. This means when the page
|
* user home if it exists on the database. This means when the page
|
||||||
* is refreshed after logging in the direction can occur.
|
* is refreshed after logging in the direction can occur.
|
||||||
*/
|
*/
|
||||||
static function user_login($user) {
|
static function user_login($user) {
|
||||||
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
||||||
if ($home) {
|
if ($home->loaded && $home->home != 0) {
|
||||||
if ($home->home!=0) {
|
Session::instance()->set("redirect_home", $home->home);
|
||||||
$session = Session::instance();
|
|
||||||
$session->set("redirect_home",$home->home);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,15 +40,14 @@ class user_homes_event_Core {
|
|||||||
$session = Session::instance();
|
$session = Session::instance();
|
||||||
$home = $session->get("redirect_home");
|
$home = $session->get("redirect_home");
|
||||||
if ($home) {
|
if ($home) {
|
||||||
// remove from session to ensure redirect does not
|
// Remove from session to ensure redirect does not occur again
|
||||||
// occur again
|
|
||||||
$session->set("redirect_home",null);
|
$session->set("redirect_home",null);
|
||||||
url::redirect("albums/$home");
|
url::redirect("albums/$home");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called just before a user is deleted. This will remove the user from
|
* Called just before a user is deleted. This will remove the user from
|
||||||
* the user_homes directory.
|
* the user_homes directory.
|
||||||
*/
|
*/
|
||||||
static function user_before_delete($user) {
|
static function user_before_delete($user) {
|
||||||
@ -62,7 +57,7 @@ class user_homes_event_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called when admin is adding a user
|
* Called when admin is adding a user
|
||||||
*/
|
*/
|
||||||
static function user_add_form_admin($user, $form) {
|
static function user_add_form_admin($user, $form) {
|
||||||
$form->add_user->dropdown("user_home")
|
$form->add_user->dropdown("user_home")
|
||||||
@ -72,7 +67,7 @@ class user_homes_event_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called after a user has been added
|
* Called after a user has been added
|
||||||
*/
|
*/
|
||||||
static function user_add_form_admin_completed($user, $form) {
|
static function user_add_form_admin_completed($user, $form) {
|
||||||
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
||||||
@ -82,12 +77,11 @@ class user_homes_event_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called when admin is editing a user
|
* Called when admin is editing a user
|
||||||
*/
|
*/
|
||||||
static function user_edit_form_admin($user, $form) {
|
static function user_edit_form_admin($user, $form) {
|
||||||
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
||||||
|
if ($home->loaded) {
|
||||||
if ($home) {
|
|
||||||
$selected = $home->home;
|
$selected = $home->home;
|
||||||
} else {
|
} else {
|
||||||
$selected = 0;
|
$selected = 0;
|
||||||
@ -99,7 +93,7 @@ class user_homes_event_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called after a user had been edited by the admin
|
* Called after a user had been edited by the admin
|
||||||
*/
|
*/
|
||||||
static function user_edit_form_admin_completed($user, $form) {
|
static function user_edit_form_admin_completed($user, $form) {
|
||||||
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
||||||
@ -110,12 +104,12 @@ class user_homes_event_Core {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called when user is editing their own form
|
* Called when user is editing their own form
|
||||||
*/
|
*/
|
||||||
static function user_edit_form($user, $form) {
|
static function user_edit_form($user, $form) {
|
||||||
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
||||||
|
|
||||||
if ($home) {
|
if ($home->loaded) {
|
||||||
$selected = $home->home;
|
$selected = $home->home;
|
||||||
} else {
|
} else {
|
||||||
$selected = 0;
|
$selected = 0;
|
||||||
@ -128,7 +122,7 @@ class user_homes_event_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called after a user had been edited by the user
|
* Called after a user had been edited by the user
|
||||||
*/
|
*/
|
||||||
static function user_edit_form_completed($user, $form) {
|
static function user_edit_form_completed($user, $form) {
|
||||||
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
$home = ORM::factory("user_home")->where("id", $user->id)->find();
|
||||||
@ -138,7 +132,7 @@ class user_homes_event_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates an array of galleries
|
* Creates an array of galleries
|
||||||
*/
|
*/
|
||||||
static function createGalleryArray() {
|
static function createGalleryArray() {
|
||||||
$array[0] = "none";
|
$array[0] = "none";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/*
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||||
*
|
*
|
||||||
@ -24,8 +24,7 @@ class user_homes_installer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* installs the the table of user homes when the
|
* Installs the table of user homes when the module is installed.
|
||||||
* module is installed
|
|
||||||
*/
|
*/
|
||||||
static function activate() {
|
static function activate() {
|
||||||
$db = Database::instance();
|
$db = Database::instance();
|
||||||
@ -35,11 +34,11 @@ class user_homes_installer {
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY(`id`))
|
UNIQUE KEY(`id`))
|
||||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
|
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
|
||||||
|
module::set_version("user_homes", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* drops the table of user homes when the
|
* Drops the table of user homes when the module is uninstalled.
|
||||||
* module is uninstalled
|
|
||||||
*/
|
*/
|
||||||
static function deactivate() {
|
static function deactivate() {
|
||||||
$db = Database::instance();
|
$db = Database::instance();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/*
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user