From 4dc451629cc46e24b086d500182e4b053ec80b04 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Oct 2010 17:03:40 -0700 Subject: Allow access to the rest module when the gallery is wholly private. Fixes ticket #1452. --- modules/gallery/helpers/gallery.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index ac51e2a6..2bb55ccb 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -51,6 +51,7 @@ class gallery_Core { if (Router::$controller != "login" && Router::$controller != "combined" && Router::$controller != "digibug" && + Router::$controller != "rest" && identity::active_user()->guest && !access::user_can(identity::guest(), "view", item::root()) && php_sapi_name() != "cli") { -- cgit v1.2.3 From 359a081f151d36066de1c8bbbf17dd525ef044fe Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 7 Nov 2010 22:08:20 -0800 Subject: Add Malay as 'Bahasa Melayu' --- modules/gallery/helpers/locales.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php index d1e72260..7bacd388 100644 --- a/modules/gallery/helpers/locales.php +++ b/modules/gallery/helpers/locales.php @@ -92,6 +92,7 @@ class locales_Core { $l["ko_KR"] = "한국어"; // Korean $l["lt_LT"] = "Lietuvių"; // Lithuanian $l["lv_LV"] = "Latviešu"; // Latvian + $l["ms_MY"] = "Bahasa Melayu"; // Malay $l["mk_MK"] = "Македонски јазик"; // Macedonian $l["nl_NL"] = "Nederlands"; // Dutch $l["no_NO"] = "Norsk bokmål"; // Norwegian -- cgit v1.2.3 From 853a3acc9b5b017b479fa93e29e1d80c0acc1a50 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 8 Nov 2010 11:45:14 -0800 Subject: Implement module::clear_all_vars($module_name) Also switch from using ORM to Database_Builder for the SQL because it's cleaner, and clean up the test. Fixes #1479. --- modules/gallery/helpers/module.php | 22 +++++++++++++++++----- modules/gallery/tests/Var_Test.php | 38 ++++++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 21 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 64d0d1d6..16c7bb72 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -503,13 +503,25 @@ class module_Core { * @param string $name */ static function clear_var($module_name, $name) { - $var = ORM::factory("var") + db::build() + ->delete("vars") ->where("module_name", "=", $module_name) ->where("name", "=", $name) - ->find(); - if ($var->loaded()) { - $var->delete(); - } + ->execute(); + + Cache::instance()->delete("var_cache"); + self::$var_cache = null; + } + + /** + * Remove all variables for this module. + * @param string $module_name + */ + static function clear_all_vars($module_name) { + db::build() + ->delete("vars") + ->where("module_name", "=", $module_name) + ->execute(); Cache::instance()->delete("var_cache"); self::$var_cache = null; diff --git a/modules/gallery/tests/Var_Test.php b/modules/gallery/tests/Var_Test.php index b3492c71..292fe2f1 100644 --- a/modules/gallery/tests/Var_Test.php +++ b/modules/gallery/tests/Var_Test.php @@ -19,31 +19,37 @@ */ class Var_Test extends Gallery_Unit_Test_Case { public function add_parameter_test() { - module::set_var("gallery", "Parameter", "original value"); - $this->assert_equal("original value", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "original value"); + $this->assert_equal("original value", module::get_var("Var_Test", "Parameter")); - module::set_var("gallery", "Parameter", "updated value"); - $this->assert_equal("updated value", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "updated value"); + $this->assert_equal("updated value", module::get_var("Var_Test", "Parameter")); } public function clear_parameter_test() { - module::set_var("gallery", "Parameter", "original value"); - $this->assert_equal("original value", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "original value"); + module::clear_var("Var_Test", "Parameter"); + $this->assert_equal(null, module::get_var("Var_Test", "Parameter")); + } - module::clear_var("gallery", "Parameter"); - $this->assert_equal(null, module::get_var("gallery", "Parameter")); + public function clear_all_module_parameters_test() { + module::set_var("Var_Test", "Parameter1", "original value"); + module::set_var("Var_Test", "Parameter2", "original value"); + module::clear_all_vars("Var_Test"); + $this->assert_equal(null, module::get_var("Var_Test", "Parameter1")); + $this->assert_equal(null, module::get_var("Var_Test", "Parameter2")); } public function incr_parameter_test() { - module::set_var("gallery", "Parameter", "original value"); - module::incr_var("gallery", "Parameter"); - $this->assert_equal("1", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "original value"); + module::incr_var("Var_Test", "Parameter"); + $this->assert_equal("1", module::get_var("Var_Test", "Parameter")); - module::set_var("gallery", "Parameter", "2"); - module::incr_var("gallery", "Parameter", "9"); - $this->assert_equal("11", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "2"); + module::incr_var("Var_Test", "Parameter", "9"); + $this->assert_equal("11", module::get_var("Var_Test", "Parameter")); - module::incr_var("gallery", "NonExistent", "9"); - $this->assert_equal(null, module::get_var("gallery", "NonExistent")); + module::incr_var("Var_Test", "NonExistent", "9"); + $this->assert_equal(null, module::get_var("Var_Test", "NonExistent")); } } \ No newline at end of file -- cgit v1.2.3 From dae835449115b322c0ad057230a34a78d530b9a4 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 8 Nov 2010 19:52:43 -0800 Subject: Updated item::random_query() PHPdoc to include example usage --- modules/gallery/helpers/item.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 092904a5..052b1c8e 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -218,7 +218,13 @@ class item_Core { } /** - * Return a query to get a random Item_Model, with optional filters + * Return a query to get a random Item_Model, with optional filters. + * Usage: item::random_query()->execute(); + * + * Note: You can add your own ->where() clauses but if your Gallery is + * small or your where clauses are over-constrained you may wind up with + * no item. You should try running this a few times in a loop if you + * don't get an item back. */ static function random_query() { // Pick a random number and find the item that's got nearest smaller number. -- cgit v1.2.3 From 86790d4464c9f79e90adbe2cc7c24251371ad416 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 7 Nov 2010 19:57:05 -0800 Subject: Return the admin check as part of the block structure as opposed to printing it directly to the output. I had problems with the admin check messing up the AJAX calls on the module update page. And it went away after this fix. --- modules/gallery/helpers/gallery_theme.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index 0d7cc44a..978c69a6 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -93,7 +93,7 @@ class gallery_theme_Core { } // Redirect to the root album when the admin session expires. - $admin_session_redirect_check = ''; - print $admin_session_redirect_check; if ($session->get("l10n_mode", false)) { - return L10n_Client_Controller::l10n_form(); + $content .= "\n" . L10n_Client_Controller::l10n_form(); } + return $content; } static function credits() { -- cgit v1.2.3 From c1573d8ef2e34429a67a69c3ad947505a5772931 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 18 Nov 2010 13:09:10 -0800 Subject: Use sys_getloadavg() instead of reading /proc/loadavg. Fixes #1491. --- modules/gallery/helpers/gallery_block.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index cb28cbcd..3e2a7313 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -70,12 +70,7 @@ class gallery_block_Core { $block->css_id = "g-platform"; $block->title = t("Platform information"); $block->content = new View("admin_block_platform.html"); - if (@is_readable("/proc/loadavg") && $first_line = current(@file("/proc/loadavg"))) { - $block->content->load_average = - join(" ", array_slice(explode(" ", $first_line), 0, 3)); - } else { - $block->content->load_average = t("Unavailable"); - } + $block->content->load_average = join(" ", sys_getloadavg()); break; case "project_news": -- cgit v1.2.3 From dd2b815ab2f1623540701fa887098a8b9f40de08 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 18 Nov 2010 21:31:13 -0800 Subject: Add Bengali (bn_BD). --- modules/gallery/helpers/locales.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php index 7bacd388..5961f449 100644 --- a/modules/gallery/helpers/locales.php +++ b/modules/gallery/helpers/locales.php @@ -62,11 +62,14 @@ class locales_Core { } // @todo Might want to add a localizable language name as well. + // ref: http://cldr.unicode.org/ + // ref: http://cldr.unicode.org/index/cldr-spec/picking-the-right-language-code private static function _init_language_data() { $l["af_ZA"] = "Afrikaans"; // Afrikaans $l["ar_SA"] = "العربية"; // Arabic $l["be_BY"] = "Беларускі"; // Belarusian $l["bg_BG"] = "български"; // Bulgarian + $l["bn_BD"] = "বাংলা"; // Bengali $l["ca_ES"] = "Catalan"; // Catalan $l["cs_CZ"] = "čeština"; // Czech $l["da_DK"] = "Dansk"; // Danish -- cgit v1.2.3 From 12b77c7ef4bb715df45aa7299872691cc0c4dcef Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 20 Nov 2010 20:54:16 -0800 Subject: Move the sys_getloadavg() call into the template since that's what we're doing for other similar calls --- modules/gallery/helpers/gallery_block.php | 1 - modules/gallery/views/admin_block_platform.html.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index 3e2a7313..86886237 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -70,7 +70,6 @@ class gallery_block_Core { $block->css_id = "g-platform"; $block->title = t("Platform information"); $block->content = new View("admin_block_platform.html"); - $block->content->load_average = join(" ", sys_getloadavg()); break; case "project_news": diff --git a/modules/gallery/views/admin_block_platform.html.php b/modules/gallery/views/admin_block_platform.html.php index 379ab0aa..9a594fa5 100644 --- a/modules/gallery/views/admin_block_platform.html.php +++ b/modules/gallery/views/admin_block_platform.html.php @@ -16,7 +16,7 @@ Database::instance()->query("SELECT version() as v")->current()->v)) ?>
  • - $load_average)) ?> + join(" ", sys_getloadavg()))) ?>
  • module::get_var("gallery", "graphics_toolkit"))) ?> -- cgit v1.2.3 From 5f4ab7fd76d24e3848aa96b3f657fca587d68f72 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 21 Nov 2010 13:01:44 -0800 Subject: Shuffle up the way we figure out which image to rebuild next so that multiple concurrent tasks actually work in parallel and don't stomp on each other. Fixes #1498. --- modules/gallery/helpers/gallery_task.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php index d56edabb..e69ff91a 100644 --- a/modules/gallery/helpers/gallery_task.php +++ b/modules/gallery/helpers/gallery_task.php @@ -71,7 +71,12 @@ class gallery_task_Core { static function rebuild_dirty_images($task) { $errors = array(); try { - $result = graphics::find_dirty_images_query()->select("id")->execute(); + // Choose the dirty images in a random order so that if we run this task multiple times + // concurrently each task is rebuilding different images simultaneously. + $result = graphics::find_dirty_images_query()->select("id") + ->select(new Database_Expression("RAND() as r")) + ->order_by("r", "ASC") + ->execute(); $total_count = $task->get("total_count", $result->count()); $mode = $task->get("mode", "init"); if ($mode == "init") { -- cgit v1.2.3 From 2ed83fcd95deb8fc41b40b7ae4fe4b9cde0003be Mon Sep 17 00:00:00 2001 From: Kriss Andsten Date: Sat, 27 Nov 2010 05:36:25 +0800 Subject: Patch from ticket 1503, making rest/items behaviour consisten with rest/item behaviour. --- modules/gallery/helpers/items_rest.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php index f0b68d63..a5f7a067 100644 --- a/modules/gallery/helpers/items_rest.php +++ b/modules/gallery/helpers/items_rest.php @@ -45,7 +45,7 @@ class items_rest_Core { if (access::can("view", $item)) { if (isset($types)) { if (in_array($item->type, $types)) { - $items[] = items_rest::_format_restful_item($item); + $items[] = items_rest::_format_restful_item($item, $types); } } else { $items[] = items_rest::_format_restful_item($item); @@ -74,14 +74,16 @@ class items_rest_Core { return $item; } - private static function _format_restful_item($item) { + private static function _format_restful_item($item, $types = null) { $item_rest = array("url" => rest::url("item", $item), "entity" => $item->as_restful_array(), "relationships" => rest::relationships("item", $item)); if ($item->type == "album") { $members = array(); foreach ($item->viewable()->children() as $child) { - $members[] = rest::url("item", $child); + if ($types == null || in_array($child->type, $types)) { + $members[] = rest::url("item", $child); + } } $item_rest["members"] = $members; } -- cgit v1.2.3 From d2be26e407aeb620082bcad2d5a45272868b38a1 Mon Sep 17 00:00:00 2001 From: Kriss Andsten Date: Sun, 28 Nov 2010 10:56:58 +0800 Subject: Slightly more invasive version, but cleaner on the eyes. --- modules/gallery/helpers/items_rest.php | 38 ++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php index a5f7a067..da062819 100644 --- a/modules/gallery/helpers/items_rest.php +++ b/modules/gallery/helpers/items_rest.php @@ -25,7 +25,7 @@ class items_rest_Core { * filter the results based on the specified type. Using the type parameter with the * ancestors_for parameter makes no sense and will be ignored. * - * urls=url1,url2,url3 + * urls=["url1","url2","url3"] * return items that match the specified urls. Typically used to return the member detail * * ancestors_for=url @@ -33,23 +33,29 @@ class items_rest_Core { * * type= * limit the type to types in this list. eg, "type=photo,movie" + * + * also limits the types returned in the member collections (same + * behaviour as item_rest) + * + * ignored if ancestors_for is set. */ static function get($request) { $items = array(); + $types = array(); + if (isset($request->params->urls)) { + if (isset($request->params->type)) { + $types = explode(",", $request->params->type); + } + foreach (json_decode($request->params->urls) as $url) { - if (isset($request->params->type)) { - $types = explode(",", $request->params->type); - } $item = rest::resolve($url); - if (access::can("view", $item)) { - if (isset($types)) { - if (in_array($item->type, $types)) { - $items[] = items_rest::_format_restful_item($item, $types); - } - } else { - $items[] = items_rest::_format_restful_item($item); - } + if (!access::can("view", $item)) { + continue; + } + + if (empty($types) || in_array($item->type, $types)) { + $items[] = items_rest::_format_restful_item($item, $types); } } } else if (isset($request->params->ancestors_for)) { @@ -57,9 +63,9 @@ class items_rest_Core { if (!access::can("view", $item)) { throw new Kohana_404_Exception(); } - $items[] = items_rest::_format_restful_item($item); + $items[] = items_rest::_format_restful_item($item, $types); while (($item = $item->parent()) != null) { - array_unshift($items, items_rest::_format_restful_item($item)); + array_unshift($items, items_rest::_format_restful_item($item, $types)); }; } @@ -74,14 +80,14 @@ class items_rest_Core { return $item; } - private static function _format_restful_item($item, $types = null) { + private static function _format_restful_item($item, $types) { $item_rest = array("url" => rest::url("item", $item), "entity" => $item->as_restful_array(), "relationships" => rest::relationships("item", $item)); if ($item->type == "album") { $members = array(); foreach ($item->viewable()->children() as $child) { - if ($types == null || in_array($child->type, $types)) { + if (empty($types) || in_array($child->type, $types)) { $members[] = rest::url("item", $child); } } -- cgit v1.2.3 From f91819441c0f899f34c02264f9cbfdc6281980b9 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 27 Nov 2010 19:48:16 -0800 Subject: Tighten up the phpDoc for get(). --- modules/gallery/helpers/items_rest.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php index da062819..dd190e9d 100644 --- a/modules/gallery/helpers/items_rest.php +++ b/modules/gallery/helpers/items_rest.php @@ -33,11 +33,9 @@ class items_rest_Core { * * type= * limit the type to types in this list. eg, "type=photo,movie" - * - * also limits the types returned in the member collections (same - * behaviour as item_rest) - * - * ignored if ancestors_for is set. + * Also limits the types returned in the member collections (same + * behaviour as item_rest). + * Ignored if ancestors_for is set. */ static function get($request) { $items = array(); @@ -53,8 +51,8 @@ class items_rest_Core { if (!access::can("view", $item)) { continue; } - - if (empty($types) || in_array($item->type, $types)) { + + if (empty($types) || in_array($item->type, $types)) { $items[] = items_rest::_format_restful_item($item, $types); } } -- cgit v1.2.3 From 76b6daefaa4009fdd8de72b8f25259200a66d477 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 27 Nov 2010 20:42:53 -0800 Subject: Clean up phpDoc on get() a little more --- modules/gallery/helpers/item_rest.php | 11 ++++++----- modules/gallery/helpers/items_rest.php | 9 ++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index 10f9e16a..a8bc36ad 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -23,18 +23,19 @@ class item_rest_Core { * query the collection. You can specify them in any combination. * * scope=direct - * only return items that are immediately under this one + * Only return items that are immediately under this one * scope=all - * return items anywhere under this one + * Return items anywhere under this one * * name= - * only return items where the name contains this substring + * Only return items where the name contains this substring * * random=true - * return a single random item + * Return a single random item * * type= - * limit the type to types in this list. eg, "type=photo,movie" + * Limit the type to types in this list, eg: "type=photo,movie". + * Also limits the types returned in the member collections (same behaviour as item_rest). */ static function get($request) { $item = rest::resolve($request->url); diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php index dd190e9d..08aa3279 100644 --- a/modules/gallery/helpers/items_rest.php +++ b/modules/gallery/helpers/items_rest.php @@ -26,15 +26,14 @@ class items_rest_Core { * ancestors_for parameter makes no sense and will be ignored. * * urls=["url1","url2","url3"] - * return items that match the specified urls. Typically used to return the member detail + * Return items that match the specified urls. Typically used to return the member detail * * ancestors_for=url - * return the ancestors of the specified item + * Return the ancestors of the specified item * * type= - * limit the type to types in this list. eg, "type=photo,movie" - * Also limits the types returned in the member collections (same - * behaviour as item_rest). + * Limit the type to types in this list, eg: "type=photo,movie". + * Also limits the types returned in the member collections (same behaviour as item_rest). * Ignored if ancestors_for is set. */ static function get($request) { -- cgit v1.2.3 From eb010554ff963a1f73661bf96d99697abb7dfde4 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Nov 2010 11:27:25 -0800 Subject: Replace self::func() with ::func() for all public APIs and constants to make overloading easier. Fixes #1510. --- modules/gallery/helpers/MY_html.php | 6 ++-- modules/gallery/helpers/MY_remote.php | 2 +- modules/gallery/helpers/access.php | 50 +++++++++++++++---------------- modules/gallery/helpers/auth.php | 4 +-- modules/gallery/helpers/block_manager.php | 20 ++++++------- modules/gallery/helpers/gallery_block.php | 2 +- modules/gallery/helpers/graphics.php | 8 ++--- modules/gallery/helpers/identity.php | 4 +-- modules/gallery/helpers/l10n_client.php | 14 ++++----- modules/gallery/helpers/locales.php | 6 ++-- modules/gallery/helpers/log.php | 16 +++++----- modules/gallery/helpers/message.php | 18 +++++------ modules/gallery/helpers/module.php | 20 ++++++------- modules/gallery/helpers/movie.php | 4 +-- modules/gallery/helpers/site_status.php | 10 +++---- 15 files changed, 92 insertions(+), 92 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/MY_html.php b/modules/gallery/helpers/MY_html.php index cf130401..d15bd816 100644 --- a/modules/gallery/helpers/MY_html.php +++ b/modules/gallery/helpers/MY_html.php @@ -26,7 +26,7 @@ class html extends html_Core { * unescaped HTML which is assumed to be safe. * * Example:
    -   *   
    + *
    *
    */ static function clean($html) { @@ -39,7 +39,7 @@ class html extends html_Core { * only non-malicious HTML. * * Example:
    -   *   
    title) ?> + *
    title) ?> *
    */ static function purify($html) { @@ -86,6 +86,6 @@ class html extends html_Core { * @return the string escaped for use in HTML attributes. */ static function clean_attribute($string) { - return self::clean($string)->for_html_attr(); + return html::clean($string)->for_html_attr(); } } diff --git a/modules/gallery/helpers/MY_remote.php b/modules/gallery/helpers/MY_remote.php index 05341330..a1d2a3d1 100644 --- a/modules/gallery/helpers/MY_remote.php +++ b/modules/gallery/helpers/MY_remote.php @@ -24,7 +24,7 @@ class remote extends remote_Core { /* Read the web page into a buffer */ list ($response_status, $response_headers, $response_body) = - self::do_request($url, 'POST', $extra_headers, $post_data_raw); + remote::do_request($url, 'POST', $extra_headers, $post_data_raw); return array($response_body, $response_status, $response_headers); } diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php index 1a448e4a..0b0dcbc1 100644 --- a/modules/gallery/helpers/access.php +++ b/modules/gallery/helpers/access.php @@ -79,7 +79,7 @@ class access_Core { * @return boolean */ static function can($perm_name, $item) { - return self::user_can(identity::active_user(), $perm_name, $item); + return access::user_can(identity::active_user(), $perm_name, $item); } /** @@ -102,7 +102,7 @@ class access_Core { $resource = $perm_name == "view" ? $item : model_cache::get("access_cache", $item->id, "item_id"); foreach ($user->groups() as $group) { - if ($resource->__get("{$perm_name}_{$group->id}") === self::ALLOW) { + if ($resource->__get("{$perm_name}_{$group->id}") === access::ALLOW) { return true; } } @@ -117,12 +117,12 @@ class access_Core { * @return boolean */ static function required($perm_name, $item) { - if (!self::can($perm_name, $item)) { + if (!access::can($perm_name, $item)) { if ($perm_name == "view") { // Treat as if the item didn't exist, don't leak any information. throw new Kohana_404_Exception(); } else { - self::forbidden(); + access::forbidden(); } } } @@ -138,7 +138,7 @@ class access_Core { static function group_can($group, $perm_name, $item) { $resource = $perm_name == "view" ? $item : model_cache::get("access_cache", $item->id, "item_id"); - return $resource->__get("{$perm_name}_{$group->id}") === self::ALLOW; + return $resource->__get("{$perm_name}_{$group->id}") === access::ALLOW; } /** @@ -168,14 +168,14 @@ class access_Core { return null; } - // For view permissions, if any parent is self::DENY, then those parents lock this one. + // For view permissions, if any parent is access::DENY, then those parents lock this one. // Return $lock = ORM::factory("item") ->where("left_ptr", "<=", $item->left_ptr) ->where("right_ptr", ">=", $item->right_ptr) ->where("items.id", "<>", $item->id) ->join("access_intents", "items.id", "access_intents.item_id") - ->where("access_intents.view_$group->id", "=", self::DENY) + ->where("access_intents.view_$group->id", "=", access::DENY) ->order_by("level", "DESC") ->limit(1) ->find(); @@ -222,7 +222,7 @@ class access_Core { self::_update_access_non_view_cache($group, $perm_name, $album); } - self::update_htaccess_files($album, $group, $perm_name, $value); + access::update_htaccess_files($album, $group, $perm_name, $value); model_cache::clear(); } @@ -414,7 +414,7 @@ class access_Core { static function verify_csrf() { $input = Input::instance(); if ($input->post("csrf", $input->get("csrf", null)) !== Session::instance()->get("csrf")) { - self::forbidden(); + access::forbidden(); } } @@ -437,7 +437,7 @@ class access_Core { * @return string */ static function csrf_form_field() { - return ""; + return ""; } /** @@ -488,7 +488,7 @@ class access_Core { "ALTER TABLE {access_intents} ADD `$field` BINARY DEFAULT NULL"); db::build() ->update("access_intents") - ->set($field, self::DENY) + ->set($field, access::DENY) ->where("item_id", "=", 1) ->execute(); model_cache::clear(); @@ -517,12 +517,12 @@ class access_Core { // DENY and this ALLOW cannot be obeyed. So in that case, back up the tree and find any // non-DEFAULT and non-ALLOW parent and propagate from there. If we can't find a matching // item, then its safe to propagate from here. - if ($access->$field !== self::DENY) { + if ($access->$field !== access::DENY) { $tmp_item = ORM::factory("item") ->where("left_ptr", "<", $item->left_ptr) ->where("right_ptr", ">", $item->right_ptr) ->join("access_intents", "access_intents.item_id", "items.id") - ->where("access_intents.$field", "=", self::DENY) + ->where("access_intents.$field", "=", access::DENY) ->order_by("left_ptr", "DESC") ->limit(1) ->find(); @@ -537,7 +537,7 @@ class access_Core { // that we can tell which permissions have been changed, and which ones need to be updated. db::build() ->update("items") - ->set($field, self::UNKNOWN) + ->set($field, access::UNKNOWN) ->where("left_ptr", ">=", $item->left_ptr) ->where("right_ptr", "<=", $item->right_ptr) ->execute(); @@ -548,20 +548,20 @@ class access_Core { ->where("left_ptr", ">=", $item->left_ptr) ->where("right_ptr", "<=", $item->right_ptr) ->where("type", "=", "album") - ->where("access_intents.$field", "IS NOT", self::INHERIT) + ->where("access_intents.$field", "IS NOT", access::INHERIT) ->order_by("level", "DESC") ->find_all(); foreach ($query as $row) { - if ($row->$field == self::ALLOW) { + if ($row->$field == access::ALLOW) { // Propagate ALLOW for any row that is still UNKNOWN. db::build() ->update("items") ->set($field, $row->$field) - ->where($field, "IS", self::UNKNOWN) // UNKNOWN is NULL so we have to use IS + ->where($field, "IS", access::UNKNOWN) // UNKNOWN is NULL so we have to use IS ->where("left_ptr", ">=", $row->left_ptr) ->where("right_ptr", "<=", $row->right_ptr) ->execute(); - } else if ($row->$field == self::DENY) { + } else if ($row->$field == access::DENY) { // DENY overwrites everything below it db::build() ->update("items") @@ -577,8 +577,8 @@ class access_Core { // the hierarchy, and all of those are safe to change to ALLOW. db::build() ->update("items") - ->set($field, self::ALLOW) - ->where($field, "IS", self::UNKNOWN) // UNKNOWN is NULL so we have to use IS + ->set($field, access::ALLOW) + ->where($field, "IS", access::UNKNOWN) // UNKNOWN is NULL so we have to use IS ->where("left_ptr", ">=", $item->left_ptr) ->where("right_ptr", "<=", $item->right_ptr) ->execute(); @@ -605,12 +605,12 @@ class access_Core { // // @todo To optimize this, we wouldn't need to propagate from the parent, we could just // propagate from here with the parent's intent. - if ($access->$field === self::INHERIT) { + if ($access->$field === access::INHERIT) { $tmp_item = ORM::factory("item") ->join("access_intents", "items.id", "access_intents.item_id") ->where("left_ptr", "<", $item->left_ptr) ->where("right_ptr", ">", $item->right_ptr) - ->where($field, "IS NOT", self::UNKNOWN) // UNKNOWN is NULL so we have to use IS NOT + ->where($field, "IS NOT", access::UNKNOWN) // UNKNOWN is NULL so we have to use IS NOT ->order_by("left_ptr", "DESC") ->limit(1) ->find(); @@ -626,11 +626,11 @@ class access_Core { ->join("items", "items.id", "access_intents.item_id") ->where("left_ptr", ">=", $item->left_ptr) ->where("right_ptr", "<=", $item->right_ptr) - ->where($field, "IS NOT", self::INHERIT) + ->where($field, "IS NOT", access::INHERIT) ->order_by("level", "ASC") ->find_all(); foreach ($query as $row) { - $value = ($row->$field === self::ALLOW) ? true : false; + $value = ($row->$field === access::ALLOW) ? true : false; db::build() ->update("access_caches") ->set($field, $value) @@ -683,7 +683,7 @@ class access_Core { } foreach ($dirs as $dir) { - if ($value === self::DENY) { + if ($value === access::DENY) { $fp = fopen("$dir/.htaccess", "w+"); fwrite($fp, "\n"); fwrite($fp, " RewriteEngine On\n"); diff --git a/modules/gallery/helpers/auth.php b/modules/gallery/helpers/auth.php index 48b5fc32..fa6242b9 100644 --- a/modules/gallery/helpers/auth.php +++ b/modules/gallery/helpers/auth.php @@ -74,13 +74,13 @@ class auth_Core { } static function validate_too_many_failed_logins($name_input) { - if (self::too_many_failures($name_input->value)) { + if (auth::too_many_failures($name_input->value)) { $name_input->add_error("too_many_failed_logins", 1); } } static function validate_too_many_failed_auth_attempts($form_input) { - if (self::too_many_failures(identity::active_user()->name)) { + if (auth::too_many_failures(identity::active_user()->name)) { $form_input->add_error("too_many_failed_auth_attempts", 1); } } diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php index 4dcd6c32..2237b702 100644 --- a/modules/gallery/helpers/block_manager.php +++ b/modules/gallery/helpers/block_manager.php @@ -27,10 +27,10 @@ class block_manager_Core { } static function add($location, $module_name, $block_id) { - $blocks = self::get_active($location); + $blocks = block_manager::get_active($location); $blocks[rand()] = array($module_name, $block_id); - self::set_active($location, $blocks); + block_manager::set_active($location, $blocks); } static function activate_blocks($module_name) { @@ -38,25 +38,25 @@ class block_manager_Core { if (method_exists($block_class, "get_site_list")) { $blocks = call_user_func(array($block_class, "get_site_list")); foreach (array_keys($blocks) as $block_id) { - self::add("site_sidebar", $module_name, $block_id); + block_manager::add("site_sidebar", $module_name, $block_id); } } } static function remove($location, $block_id) { - $blocks = self::get_active($location); + $blocks = block_manager::get_active($location); unset($blocks[$block_id]); - self::set_active($location, $blocks); + block_manager::set_active($location, $blocks); } static function remove_blocks_for_module($location, $module_name) { - $blocks = self::get_active($location); + $blocks = block_manager::get_active($location); foreach ($blocks as $key => $block) { if ($block[0] == $module_name) { unset($blocks[$key]); } } - self::set_active($location, $blocks); + block_manager::set_active($location, $blocks); } static function deactivate_blocks($module_name) { @@ -64,14 +64,14 @@ class block_manager_Core { if (method_exists($block_class, "get_site_list")) { $blocks = call_user_func(array($block_class, "get_site_list")); foreach (array_keys($blocks) as $block_id) { - self::remove_blocks_for_module("site_sidebar", $module_name); + block_manager::remove_blocks_for_module("site_sidebar", $module_name); } } if (method_exists($block_class, "get_admin_list")) { $blocks = call_user_func(array($block_class, "get_admin_list")); foreach (array("dashboard_sidebar", "dashboard_center") as $location) { - self::remove_blocks_for_module($location, $module_name); + block_manager::remove_blocks_for_module($location, $module_name); } } } @@ -99,7 +99,7 @@ class block_manager_Core { } static function get_html($location, $theme=null) { - $active = self::get_active($location); + $active = block_manager::get_active($location); $result = ""; foreach ($active as $id => $desc) { if (method_exists("$desc[0]_block", "get")) { diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index 86886237..1d92d66d 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -82,7 +82,7 @@ class gallery_block_Core { case "block_adder": $block->css_id = "g-block-adder"; $block->title = t("Dashboard content"); - $block->content = self::get_add_block_form(); + $block->content = gallery_block::get_add_block_form(); break; case "language": diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index dd521d84..edba6b76 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -50,7 +50,7 @@ class graphics_Core { $rule->active = true; $rule->save(); - self::mark_dirty($target == "thumb", $target == "resize"); + graphics::mark_dirty($target == "thumb", $target == "resize"); } /** @@ -67,7 +67,7 @@ class graphics_Core { ->where("operation", "=", $operation) ->execute(); - self::mark_dirty($target == "thumb", $target == "resize"); + graphics::mark_dirty($target == "thumb", $target == "resize"); } /** @@ -80,7 +80,7 @@ class graphics_Core { ->where("module_name", "=", $module_name) ->execute(); if (count($status)) { - self::mark_dirty(true, true); + graphics::mark_dirty(true, true); } } @@ -252,7 +252,7 @@ class graphics_Core { $db->execute(); } - $count = self::find_dirty_images_query()->count_records(); + $count = graphics::find_dirty_images_query()->count_records(); if ($count) { site_status::warning( t2("One of your photos is out of date. Click here to fix it", diff --git a/modules/gallery/helpers/identity.php b/modules/gallery/helpers/identity.php index 5ca024e9..e61aaaf4 100644 --- a/modules/gallery/helpers/identity.php +++ b/modules/gallery/helpers/identity.php @@ -61,7 +61,7 @@ class identity_Core { $session = Session::instance(); if (!($user = $session->get("user"))) { - self::set_active_user($user = self::guest()); + identity::set_active_user($user = self::guest()); } // The installer cannot set a user into the session, so it just sets an id which we should @@ -127,7 +127,7 @@ class identity_Core { $session = Session::instance(); $session->set("user", $user); $session->delete("group_ids"); - self::load_user(); + identity::load_user(); } /** diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php index 43cc2036..8c2685a8 100644 --- a/modules/gallery/helpers/l10n_client.php +++ b/modules/gallery/helpers/l10n_client.php @@ -40,14 +40,14 @@ class l10n_client_Core { } static function server_uid($api_key=null) { - $api_key = $api_key == null ? self::api_key() : $api_key; + $api_key = $api_key == null ? l10n_client::api_key() : $api_key; $parts = explode(":", $api_key); return empty($parts) ? 0 : $parts[0]; } private static function _sign($payload, $api_key=null) { - $api_key = $api_key == null ? self::api_key() : $api_key; - return md5($api_key . $payload . self::client_token()); + $api_key = $api_key == null ? l10n_client::api_key() : $api_key; + return md5($api_key . $payload . l10n_client::client_token()); } static function validate_api_key($api_key) { @@ -57,9 +57,9 @@ class l10n_client_Core { list ($response_data, $response_status) = remote::post( $url, array("version" => $version, - "client_token" => self::client_token(), + "client_token" => l10n_client::client_token(), "signature" => $signature, - "uid" => self::server_uid($api_key))); + "uid" => l10n_client::server_uid($api_key))); if (!remote::success($response_status)) { return false; } @@ -215,9 +215,9 @@ class l10n_client_Core { list ($response_data, $response_status) = remote::post( $url, array("data" => $request_data, - "client_token" => self::client_token(), + "client_token" => l10n_client::client_token(), "signature" => $signature, - "uid" => self::server_uid())); + "uid" => l10n_client::server_uid())); if (!remote::success($response_status)) { throw new Exception("@todo TRANSLATIONS_SUBMISSION_FAILED " . $response_status); diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php index 5961f449..565e9da8 100644 --- a/modules/gallery/helpers/locales.php +++ b/modules/gallery/helpers/locales.php @@ -212,7 +212,7 @@ class locales_Core { } private static function _locale_match_score($requested_locale, $qvalue, $adjustment_factor) { - $installed = self::installed(); + $installed = locales::installed(); if (isset($installed[$requested_locale])) { return array($requested_locale, $qvalue); } @@ -227,14 +227,14 @@ class locales_Core { static function set_request_locale() { // 1. Check the session specific preference (cookie) - $locale = self::cookie_locale(); + $locale = locales::cookie_locale(); // 2. Check the user's preference if (!$locale) { $locale = identity::active_user()->locale; } // 3. Check the browser's / OS' preference if (!$locale) { - $locale = self::locale_from_http_request(); + $locale = locales::locale_from_http_request(); } // If we have any preference, override the site's default locale if ($locale) { diff --git a/modules/gallery/helpers/log.php b/modules/gallery/helpers/log.php index 26f70480..37154522 100644 --- a/modules/gallery/helpers/log.php +++ b/modules/gallery/helpers/log.php @@ -30,7 +30,7 @@ class log_Core { * @param string $html an html snippet presented alongside the log message to aid the admin */ static function success($category, $message, $html="") { - self::_add($category, $message, $html, self::SUCCESS); + self::_add($category, $message, $html, log::SUCCESS); } /** @@ -40,7 +40,7 @@ class log_Core { * @param string $html an html snippet presented alongside the log message to aid the admin */ static function info($category, $message, $html="") { - self::_add($category, $message, $html, self::INFO); + self::_add($category, $message, $html, log::INFO); } /** @@ -50,7 +50,7 @@ class log_Core { * @param string $html an html snippet presented alongside the log message to aid the admin */ static function warning($category, $message, $html="") { - self::_add($category, $message, $html, self::WARNING); + self::_add($category, $message, $html, log::WARNING); } /** @@ -60,7 +60,7 @@ class log_Core { * @param string $html an html snippet presented alongside the log message to aid the admin */ static function error($category, $message, $html="") { - self::_add($category, $message, $html, self::ERROR); + self::_add($category, $message, $html, log::ERROR); } /** @@ -92,16 +92,16 @@ class log_Core { */ static function severity_class($severity) { switch($severity) { - case self::SUCCESS: + case log::SUCCESS: return "g-success"; - case self::INFO: + case log::INFO: return "g-info"; - case self::WARNING: + case log::WARNING: return "g-warning"; - case self::ERROR: + case log::ERROR: return "g-error"; } } diff --git a/modules/gallery/helpers/message.php b/modules/gallery/helpers/message.php index 1f69e2a9..64dd703c 100644 --- a/modules/gallery/helpers/message.php +++ b/modules/gallery/helpers/message.php @@ -28,7 +28,7 @@ class message_Core { * @param string $msg a detailed message */ static function success($msg) { - self::_add($msg, self::SUCCESS); + self::_add($msg, message::SUCCESS); } /** @@ -36,7 +36,7 @@ class message_Core { * @param string $msg a detailed message */ static function info($msg) { - self::_add($msg, self::INFO); + self::_add($msg, message::INFO); } /** @@ -44,7 +44,7 @@ class message_Core { * @param string $msg a detailed message */ static function warning($msg) { - self::_add($msg, self::WARNING); + self::_add($msg, message::WARNING); } /** @@ -52,7 +52,7 @@ class message_Core { * @param string $msg a detailed message */ static function error($msg) { - self::_add($msg, self::ERROR); + self::_add($msg, message::ERROR); } /** @@ -79,7 +79,7 @@ class message_Core { $messages = Session::instance()->get_once("messages", array()); foreach ($messages as $msg) { $msg[0] = str_replace("__CSRF__", access::csrf_token(), $msg[0]); - $buf[] = "
  • $msg[0]
  • "; + $buf[] = "
  • $msg[0]
  • "; } if ($buf) { return "
      " . implode("", $buf) . "
    "; @@ -93,16 +93,16 @@ class message_Core { */ static function severity_class($severity) { switch($severity) { - case self::SUCCESS: + case message::SUCCESS: return "g-success"; - case self::INFO: + case message::INFO: return "g-info"; - case self::WARNING: + case message::WARNING: return "g-warning"; - case self::ERROR: + case message::ERROR: return "g-error"; } } diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 16c7bb72..2b446daa 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -35,7 +35,7 @@ class module_Core { * @param integer $version */ static function set_version($module_name, $version) { - $module = self::get($module_name); + $module = module::get($module_name); if (!$module->loaded()) { $module->name = $module_name; $module->active = $module_name == "gallery"; // only gallery is active by default @@ -62,7 +62,7 @@ class module_Core { * not found */ static function info($module_name) { - $module_list = self::available(); + $module_list = module::available(); return isset($module_list->$module_name) ? $module_list->$module_name : false; } @@ -94,10 +94,10 @@ class module_Core { $modules->$module_name = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); $m =& $modules->$module_name; - $m->installed = self::is_installed($module_name); - $m->active = self::is_active($module_name); + $m->installed = module::is_installed($module_name); + $m->active = module::is_active($module_name); $m->code_version = $m->version; - $m->version = self::get_version($module_name); + $m->version = module::get_version($module_name); $m->locked = false; if ($m->active && $m->version != $m->code_version) { @@ -107,7 +107,7 @@ class module_Core { // Lock certain modules $modules->gallery->locked = true; - $identity_module = self::get_var("gallery", "identity_provider", "user"); + $identity_module = module::get_var("gallery", "identity_provider", "user"); $modules->$identity_module->locked = true; $modules->ksort(); self::$available = $modules; @@ -258,7 +258,7 @@ class module_Core { call_user_func_array(array($installer_class, "activate"), array()); } - $module = self::get($module_name); + $module = module::get($module_name); if ($module->loaded()) { $module->active = true; $module->save(); @@ -285,7 +285,7 @@ class module_Core { call_user_func_array(array($installer_class, "deactivate"), array()); } - $module = self::get($module_name); + $module = module::get($module_name); if ($module->loaded()) { $module->active = false; $module->save(); @@ -312,7 +312,7 @@ class module_Core { } graphics::remove_rules($module_name); - $module = self::get($module_name); + $module = module::get($module_name); if ($module->loaded()) { $module->delete(); } @@ -532,6 +532,6 @@ class module_Core { * @param string $module_name */ static function get_version($module_name) { - return self::get($module_name)->version; + return module::get($module_name)->version; } } diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 78358b6b..0895c5f4 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -58,7 +58,7 @@ class movie_Core { } static function extract_frame($input_file, $output_file) { - $ffmpeg = self::find_ffmpeg(); + $ffmpeg = movie::find_ffmpeg(); if (empty($ffmpeg)) { throw new Exception("@todo MISSING_FFMPEG"); } @@ -103,7 +103,7 @@ class movie_Core { * Return the width, height, mime_type and extension of the given movie file. */ static function get_file_metadata($file_path) { - $ffmpeg = self::find_ffmpeg(); + $ffmpeg = movie::find_ffmpeg(); if (empty($ffmpeg)) { throw new Exception("@todo MISSING_FFMPEG"); } diff --git a/modules/gallery/helpers/site_status.php b/modules/gallery/helpers/site_status.php index 13c42dda..85f30dba 100644 --- a/modules/gallery/helpers/site_status.php +++ b/modules/gallery/helpers/site_status.php @@ -101,7 +101,7 @@ class site_status_Core { $buf = array(); foreach (ORM::factory("message")->find_all() as $msg) { $value = str_replace("__CSRF__", access::csrf_token(), $msg->value); - $buf[] = "
  • severity) . "\">$value
  • "; + $buf[] = "
  • severity) . "\">$value
  • "; } if ($buf) { @@ -116,16 +116,16 @@ class site_status_Core { */ static function severity_class($severity) { switch($severity) { - case self::SUCCESS: + case site_status::SUCCESS: return "g-success"; - case self::INFO: + case site_status::INFO: return "g-info"; - case self::WARNING: + case site_status::WARNING: return "g-warning"; - case self::ERROR: + case site_status::ERROR: return "g-error"; } } -- cgit v1.2.3 From 5fb5d10e5aece1726575b8afbac2f7603ea7632e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Nov 2010 12:18:08 -0800 Subject: Delete the temporary "user" value from the session when upconverting the admin account post-install. Fixes #1511. --- modules/gallery/helpers/identity.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/identity.php b/modules/gallery/helpers/identity.php index e61aaaf4..f45f72c3 100644 --- a/modules/gallery/helpers/identity.php +++ b/modules/gallery/helpers/identity.php @@ -61,7 +61,7 @@ class identity_Core { $session = Session::instance(); if (!($user = $session->get("user"))) { - identity::set_active_user($user = self::guest()); + identity::set_active_user($user = identity::guest()); } // The installer cannot set a user into the session, so it just sets an id which we should @@ -69,6 +69,7 @@ class identity_Core { // @todo set the user name into the session instead of 2 and then use it to get the // user object if ($user === 2) { + $session->delete("user"); // delete it so that identity code isn't confused by the integer auth::login(IdentityProvider::instance()->admin_user()); } -- cgit v1.2.3