From 6425d41eddd44091b2d83ba3c3734cc6990ca581 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 7 Jun 2010 23:12:52 -0700 Subject: Add a "preserve_ids" global query parameter for REST requests that indicates that we shouldn't opportunistically convert ids into REST urls. --- modules/gallery/helpers/item_rest.php | 3 ++- modules/gallery/helpers/items_rest.php | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index c88f92d9..1d19d9f1 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -78,9 +78,10 @@ class item_rest_Core { } $orm->order_by($order_by); + $preserve_ids = isset($p->preserve_ids) ? (bool)$p->preserve_ids : false; $result = array( "url" => $request->url, - "entity" => $item->as_restful_array(), + "entity" => $item->as_restful_array($preserve_ids), "relationships" => rest::relationships("item", $item)); if ($item->is_album()) { $result["members"] = array(); diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php index 9cca9a54..e9773745 100644 --- a/modules/gallery/helpers/items_rest.php +++ b/modules/gallery/helpers/items_rest.php @@ -36,6 +36,8 @@ class items_rest_Core { */ static function get($request) { $items = array(); + $preserve_ids = isset($request->params->preserve_ids) ? + (bool)$request->params->preserve_ids : false; if (isset($request->params->urls)) { foreach (json_decode($request->params->urls) as $url) { if (isset($request->params->type)) { @@ -45,10 +47,10 @@ 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, $preserve_ids); } } else { - $items[] = items_rest::_format_restful_item($item); + $items[] = items_rest::_format_restful_item($item, $preserve_ids); } } } @@ -57,9 +59,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, $preserve_ids); while (($item = $item->parent()) != null) { - array_unshift($items, items_rest::_format_restful_item($item)); + array_unshift($items, items_rest::_format_restful_item($item, $preserve_ids)); }; } @@ -74,9 +76,9 @@ class items_rest_Core { return $item; } - private static function _format_restful_item($item) { + private static function _format_restful_item($item, $preserve_ids) { $item_rest = array("url" => rest::url("item", $item), - "entity" => $item->as_restful_array(), + "entity" => $item->as_restful_array($preserve_ids), "relationships" => rest::relationships("item", $item)); if ($item->type == "album") { $members = array(); -- cgit v1.2.3 From 3dacafb7182dd915c4c6d4e7d75722976e231465 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 9 Jun 2010 20:49:32 -0700 Subject: Revert the "preserve_ids" global query parameter. We decided that it was a bad idea. This reverts commit 6425d41eddd44091b2d83ba3c3734cc6990ca581. --- modules/gallery/helpers/item_rest.php | 3 +- modules/gallery/helpers/items_rest.php | 14 ++++------ modules/gallery/models/item.php | 7 ++--- modules/gallery/tests/Item_Model_Test.php | 4 +-- modules/gallery/tests/Item_Rest_Helper_Test.php | 21 ++++---------- modules/gallery/tests/Items_Rest_Helper_Test.php | 35 ++++++++---------------- 6 files changed, 27 insertions(+), 57 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index 1d19d9f1..c88f92d9 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -78,10 +78,9 @@ class item_rest_Core { } $orm->order_by($order_by); - $preserve_ids = isset($p->preserve_ids) ? (bool)$p->preserve_ids : false; $result = array( "url" => $request->url, - "entity" => $item->as_restful_array($preserve_ids), + "entity" => $item->as_restful_array(), "relationships" => rest::relationships("item", $item)); if ($item->is_album()) { $result["members"] = array(); diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php index e9773745..9cca9a54 100644 --- a/modules/gallery/helpers/items_rest.php +++ b/modules/gallery/helpers/items_rest.php @@ -36,8 +36,6 @@ class items_rest_Core { */ static function get($request) { $items = array(); - $preserve_ids = isset($request->params->preserve_ids) ? - (bool)$request->params->preserve_ids : false; if (isset($request->params->urls)) { foreach (json_decode($request->params->urls) as $url) { if (isset($request->params->type)) { @@ -47,10 +45,10 @@ 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, $preserve_ids); + $items[] = items_rest::_format_restful_item($item); } } else { - $items[] = items_rest::_format_restful_item($item, $preserve_ids); + $items[] = items_rest::_format_restful_item($item); } } } @@ -59,9 +57,9 @@ class items_rest_Core { if (!access::can("view", $item)) { throw new Kohana_404_Exception(); } - $items[] = items_rest::_format_restful_item($item, $preserve_ids); + $items[] = items_rest::_format_restful_item($item); while (($item = $item->parent()) != null) { - array_unshift($items, items_rest::_format_restful_item($item, $preserve_ids)); + array_unshift($items, items_rest::_format_restful_item($item)); }; } @@ -76,9 +74,9 @@ class items_rest_Core { return $item; } - private static function _format_restful_item($item, $preserve_ids) { + private static function _format_restful_item($item) { $item_rest = array("url" => rest::url("item", $item), - "entity" => $item->as_restful_array($preserve_ids), + "entity" => $item->as_restful_array(), "relationships" => rest::relationships("item", $item)); if ($item->type == "album") { $members = array(); diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index a0866934..009457c1 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -923,15 +923,12 @@ class Item_Model extends ORM_MPTT { /** * Same as ORM::as_array() but convert id fields into their RESTful form. - * Convert any item ids into REST urls - * - * @param bool preserve_ids true if we should preserve ids */ - public function as_restful_array($preserve_ids) { + public function as_restful_array($convert_ids=true) { // Convert item ids to rest URLs for consistency $data = $this->as_array(); - if (!$preserve_ids) { + if ($convert_ids) { if ($tmp = $this->parent()) { $data["parent"] = rest::url("item", $tmp); } diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index 3df6197d..f9e6a4e3 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -361,7 +361,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case { $photo = test::random_photo($album); $album->reload(); - $result = $album->as_restful_array(false); + $result = $album->as_restful_array(); $this->assert_same(rest::url("item", item::root()), $result["parent"]); $this->assert_same(rest::url("item", $photo), $result["album_cover"]); $this->assert_true(!array_key_exists("parent_id", $result)); @@ -373,7 +373,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case { $photo = test::random_photo($album); $album->reload(); - $result = $album->as_restful_array(true); + $result = $album->as_restful_array(false); $this->assert_same(item::root()->id, $result["parent_id"]); $this->assert_same($photo->id, $result["album_cover_item_id"]); $this->assert_true(!array_key_exists("parent", $result)); diff --git a/modules/gallery/tests/Item_Rest_Helper_Test.php b/modules/gallery/tests/Item_Rest_Helper_Test.php index 5a80d66b..0b5e0471 100644 --- a/modules/gallery/tests/Item_Rest_Helper_Test.php +++ b/modules/gallery/tests/Item_Rest_Helper_Test.php @@ -28,17 +28,6 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal($album->id, $resolved->id); } - public function get_with_ids_test() { - $photo1 = test::random_photo(item::root()); - $request = new stdClass(); - $request->url = rest::url("item", $photo1); - $request->params = new stdClass(); - $request->params->preserve_ids = 1; - - $response = item_rest::get($request); - $this->assert_equal(item::root()->id, $response["entity"]["parent_id"]); // Spot check - } - public function get_scope_test() { $album1 = test::random_album(); $photo1 = test::random_photo($album1); @@ -52,7 +41,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { $request->params = new stdClass(); $this->assert_equal_array( array("url" => rest::url("item", $album1), - "entity" => $album1->as_restful_array(false), + "entity" => $album1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album1), @@ -67,7 +56,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { $request->params->scope = "direct"; $this->assert_equal_array( array("url" => rest::url("item", $album1), - "entity" => $album1->as_restful_array(false), + "entity" => $album1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album1), @@ -82,7 +71,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { $request->params->scope = "all"; $this->assert_equal_array( array("url" => rest::url("item", $album1), - "entity" => $album1->as_restful_array(false), + "entity" => $album1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album1), @@ -109,7 +98,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { $request->params->name = "foo"; $this->assert_equal_array( array("url" => rest::url("item", $album1), - "entity" => $album1->as_restful_array(false), + "entity" => $album1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album1), @@ -132,7 +121,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { $request->params->type = "album"; $this->assert_equal_array( array("url" => rest::url("item", $album1), - "entity" => $album1->as_restful_array(false), + "entity" => $album1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album1), diff --git a/modules/gallery/tests/Items_Rest_Helper_Test.php b/modules/gallery/tests/Items_Rest_Helper_Test.php index 3efd677d..94bf912a 100644 --- a/modules/gallery/tests/Items_Rest_Helper_Test.php +++ b/modules/gallery/tests/Items_Rest_Helper_Test.php @@ -34,13 +34,13 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal_array( array( array("url" => rest::url("item", $photo1), - "entity" => $photo1->as_restful_array(false), + "entity" => $photo1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $photo1), "members" => array()))), array("url" => rest::url("item", $album2), - "entity" => $album2->as_restful_array(false), + "entity" => $album2->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album2), @@ -67,7 +67,7 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal_array( array( array("url" => rest::url("item", $album2), - "entity" => $album2->as_restful_array(false), + "entity" => $album2->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album2), @@ -94,7 +94,7 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal_array( array( array("url" => rest::url("item", $photo1), - "entity" => $photo1->as_restful_array(false), + "entity" => $photo1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $photo1), @@ -119,13 +119,13 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal_array( array( array("url" => rest::url("item", $photo1), - "entity" => $photo1->as_restful_array(false), + "entity" => $photo1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $photo1), "members" => array()))), array("url" => rest::url("item", $album2), - "entity" => $album2->as_restful_array(false), + "entity" => $album2->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album2), @@ -146,7 +146,7 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { $root = ORM::factory("item", 1); $restful_root = array( "url" => rest::url("item", $root), - "entity" => $root->as_restful_array(false), + "entity" => $root->as_restful_array(), "relationships" => rest::relationships("item", $root)); $restful_root["members"] = array(); foreach ($root->children() as $child) { @@ -155,12 +155,12 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { $request = new stdClass(); $request->params = new stdClass(); - $request->params->ancestors_for = rest::url("item", $photo2); + $request->params->ancestor_for = rest::url("item", $photo2); $this->assert_equal_array( array( $restful_root, array("url" => rest::url("item", $album1), - "entity" => $album1->as_restful_array(false), + "entity" => $album1->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album1), @@ -170,7 +170,7 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { rest::url("item", $album2)), ), array("url" => rest::url("item", $album2), - "entity" => $album2->as_restful_array(false), + "entity" => $album2->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $album2), @@ -178,24 +178,11 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { "members" => array( rest::url("item", $photo2))), array("url" => rest::url("item", $photo2), - "entity" => $photo2->as_restful_array(false), + "entity" => $photo2->as_restful_array(), "relationships" => array( "tags" => array( "url" => rest::url("item_tags", $photo2), "members" => array())))), items_rest::get($request)); } - - public function get_ancestor_with_ids_test() { - $album1 = test::random_album(); - $photo1 = test::random_photo($album1); - - $request = new stdClass(); - $request->params = new stdClass(); - $request->params->ancestors_for = rest::url("item", $photo1); - $request->params->preserve_ids = 1; - - $response = items_rest::get($request); - $this->assert_same(item::root()->id, $response[1]["entity"]["parent_id"]); // Spot check - } } -- cgit v1.2.3 From 58b21e909d8ba628ddb8a19e732989821abb0283 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 10 Jun 2010 18:49:29 -0700 Subject: Change the pattern used to convert the file name to a title. Fixes ticket#1061 --- modules/gallery/helpers/item.php | 2 +- modules/gallery/tests/Item_Helper_Test.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index bbbe1058..15bbe977 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -136,7 +136,7 @@ class item_Core { */ static function convert_filename_to_title($filename) { $title = strtr($filename, "_", " "); - $title = preg_replace("/\..*?$/", "", $title); + $title = preg_replace("/\..{3,4}$/", "", $title); $title = preg_replace("/ +/", " ", $title); return $title; } diff --git a/modules/gallery/tests/Item_Helper_Test.php b/modules/gallery/tests/Item_Helper_Test.php index 4771b11a..00229973 100644 --- a/modules/gallery/tests/Item_Helper_Test.php +++ b/modules/gallery/tests/Item_Helper_Test.php @@ -41,6 +41,11 @@ class Item_Helper_Test extends Gallery_Unit_Test_Case { ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all()); } + public function convert_filename_to_title_test() { + $this->assert_equal("foo", item::convert_filename_to_title("foo.jpg")); + $this->assert_equal("foo.bar", item::convert_filename_to_title("foo.bar.jpg")); + } + public function convert_filename_to_slug_test() { $this->assert_equal("foo", item::convert_filename_to_slug("{[foo]}")); $this->assert_equal("foo-bar", item::convert_filename_to_slug("{[foo!@#!$@#^$@($!(@bar]}")); -- cgit v1.2.3 From 63d95087bf0f24d4e880843cd2841906c6f91b38 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Jun 2010 13:35:12 -0700 Subject: Stop trying to parse the continue url in the logout controller because it requires us to reproduce a bunch of complex routing logic. Instead, just have the logout link generating code generate a link that's visible to guests. --- modules/gallery/controllers/logout.php | 12 ++---------- modules/gallery/helpers/gallery_event.php | 13 ++++++++++++- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/controllers/logout.php b/modules/gallery/controllers/logout.php index fdbadf1b..9caafec8 100644 --- a/modules/gallery/controllers/logout.php +++ b/modules/gallery/controllers/logout.php @@ -22,16 +22,8 @@ class Logout_Controller extends Controller { access::verify_csrf(); auth::logout(); if ($continue_url = Input::instance()->get("continue")) { - $components = explode("/", parse_url($continue_url, PHP_URL_PATH), 4); - $item = url::get_item_from_uri($components[3]); - if (access::can("view", $item)) { - // Don't use url::redirect() because it'll call url::site() and munge the continue url. - header("Location: {$item->relative_url()}"); - } else { - url::redirect(item::root()->abs_url()); - } - } else { - url::redirect(item::root()->abs_url()); + url::redirect($continue_url); } + url::redirect(item::root()->abs_url()); } } \ No newline at end of file diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index ae7131ae..1b688843 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -157,11 +157,22 @@ class gallery_event_Core { ->view("login_current_user.html") ->url(user_profile::url($user->id)) ->label($user->display_name())); + + if (isset($theme->item)) { + if (access::user_can(identity::guest(), "view", $theme->item)) { + $continue_url = $theme->item->abs_url(); + } else { + $continue_url = item::root()->abs_url(); + } + } else { + $continue_url = url::abs_current(); + } + $menu->append(Menu::factory("link") ->id("user_menu_logout") ->css_id("g-logout-link") ->url(url::site("logout?csrf=$csrf&continue=" . - urlencode(url::abs_current()))) + urlencode($continue_url))) ->label(t("Logout"))); } } -- cgit v1.2.3 From c026da85cdbac9e9566045f8de2718cae985f0ec Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Jun 2010 15:10:34 -0700 Subject: Use "continue_url" instead of "continue" for consistency with the reauth code. --- modules/gallery/controllers/logout.php | 2 +- modules/gallery/helpers/gallery_event.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/controllers/logout.php b/modules/gallery/controllers/logout.php index 9caafec8..20fa8074 100644 --- a/modules/gallery/controllers/logout.php +++ b/modules/gallery/controllers/logout.php @@ -21,7 +21,7 @@ class Logout_Controller extends Controller { public function index() { access::verify_csrf(); auth::logout(); - if ($continue_url = Input::instance()->get("continue")) { + if ($continue_url = Input::instance()->get("continue_url")) { url::redirect($continue_url); } url::redirect(item::root()->abs_url()); diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 1b688843..55db47ce 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -171,7 +171,7 @@ class gallery_event_Core { $menu->append(Menu::factory("link") ->id("user_menu_logout") ->css_id("g-logout-link") - ->url(url::site("logout?csrf=$csrf&continue=" . + ->url(url::site("logout?csrf=$csrf&continue_url=" . urlencode($continue_url))) ->label(t("Logout"))); } -- cgit v1.2.3 From dceecabbf1b736604ceb2e08e803b12c99dc4509 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Jun 2010 15:16:47 -0700 Subject: Make login/logout continuation url code consistent. Where necessary, we specify the continue_url in the session, but we store it in the login form so that we can propagate it across the session creation that happens at login time. --- modules/gallery/controllers/login.php | 4 ++-- modules/gallery/helpers/auth.php | 1 + modules/gallery/libraries/MY_Kohana_Exception.php | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/controllers/login.php b/modules/gallery/controllers/login.php index 40125476..19335d88 100644 --- a/modules/gallery/controllers/login.php +++ b/modules/gallery/controllers/login.php @@ -44,10 +44,10 @@ class Login_Controller extends Controller { public function auth_html() { access::verify_csrf(); - $continue_url = Session::instance()->get("continue_url", null); list ($valid, $form) = $this->_auth("login/auth_html"); if ($valid) { - url::redirect($continue_url ? $continue_url : item::root()->abs_url()); + url::redirect($form->continue_url->value ? $form->continue_url_value : + item::root()->abs_url()); } else { $view = new Theme_View("page.html", "other", "login"); $view->page_title = t("Log in to Gallery"); diff --git a/modules/gallery/helpers/auth.php b/modules/gallery/helpers/auth.php index 1a9fe869..48b5fc32 100644 --- a/modules/gallery/helpers/auth.php +++ b/modules/gallery/helpers/auth.php @@ -21,6 +21,7 @@ class auth_Core { static function get_login_form($url) { $form = new Forge($url, "", "post", array("id" => "g-login-form")); $form->set_attr("class", "g-narrow"); + $form->hidden("continue_url")->value(Session::instance()->get("continue_url")); $group = $form->group("login")->label(t("Login")); $group->input("name")->label(t("Username"))->id("g-username")->class(null) ->callback("auth::validate_too_many_failed_logins") diff --git a/modules/gallery/libraries/MY_Kohana_Exception.php b/modules/gallery/libraries/MY_Kohana_Exception.php index e7ebdb1f..df7557ae 100644 --- a/modules/gallery/libraries/MY_Kohana_Exception.php +++ b/modules/gallery/libraries/MY_Kohana_Exception.php @@ -59,7 +59,7 @@ class Kohana_Exception extends Kohana_Exception_Core { private static function _show_themed_error_page(Exception $e) { // Create a text version of the exception $error = Kohana_Exception::text($e); - + // Add this exception to the log Kohana_Log::add('error', $error); @@ -83,8 +83,6 @@ class Kohana_Exception extends Kohana_Exception_Core { if ($view->content->is_guest) { $view->content->login_form = new View("login_ajax.html"); $view->content->login_form->form = auth::get_login_form("login/auth_html"); - // Avoid anti-phishing protection by passing the url as session variable. - Session::instance()->set("continue_url", url::current(true)); } } else { $view->page_title = t("Dang... Something went wrong!"); -- cgit v1.2.3 From 6f443a819b360a89c53004d3bf860fcedd88ae2e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 13 Jun 2010 20:49:50 -0700 Subject: Change single to double quotes. --- modules/gallery/helpers/site_status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/site_status.php b/modules/gallery/helpers/site_status.php index 759eb382..13c42dda 100644 --- a/modules/gallery/helpers/site_status.php +++ b/modules/gallery/helpers/site_status.php @@ -100,7 +100,7 @@ class site_status_Core { } $buf = array(); foreach (ORM::factory("message")->find_all() as $msg) { - $value = str_replace('__CSRF__', access::csrf_token(), $msg->value); + $value = str_replace("__CSRF__", access::csrf_token(), $msg->value); $buf[] = "
  • severity) . "\">$value
  • "; } -- cgit v1.2.3 From 793780daa7665f7f86994235c4263fcb63554eb8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 13 Jun 2010 20:51:11 -0700 Subject: Replace __CSRF__ with the actual csrf token. --- modules/gallery/helpers/message.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/message.php b/modules/gallery/helpers/message.php index 047eb2c7..1f69e2a9 100644 --- a/modules/gallery/helpers/message.php +++ b/modules/gallery/helpers/message.php @@ -78,6 +78,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]
  • "; } if ($buf) { -- cgit v1.2.3