From 1f621d9827040d9730946a5804dd3d7269198ccc Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Wed, 1 Sep 2010 21:24:41 -0700
Subject: Refine the patch for #1216. If the admin user changes their email
address update the sendmail from and reply_to fields in advanced settings.
Also change this if the identity provider has changed.
---
modules/gallery/helpers/gallery_event.php | 9 +++++++++
1 file changed, 9 insertions(+)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index df5394c9..66b250e9 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -63,6 +63,8 @@ class gallery_event_Core {
->update("logs")
->set("user_id", $admin->id)
->execute();
+ module::set_var("gallery", "email_from", $admin->email);
+ module::set_var("gallery", "email_reply_to", $admin->email);
}
static function group_created($group) {
@@ -547,4 +549,11 @@ class gallery_event_Core {
$data->content[] = (object) array("title" => t("User information"), "view" => $v);
}
+
+ static function user_change_email_form_completed($user, $form) {
+ if ($user->admin) {
+ module::set_var("gallery", "email_from", $user->email);
+ module::set_var("gallery", "email_reply_to", $user->email);
+ }
+ }
}
--
cgit v1.2.3
From 80e9fcaf47af6a041db385f18b0be00c15708da7 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 1 Sep 2010 22:00:26 -0700
Subject: Don't use $.remove() to get rid of items from the uploadify queue;
that breaks uploadify and causes it to be unable to upload any new items.
Fixes ticket #1324.
---
modules/gallery/views/form_uploadify.html.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/views/form_uploadify.html.php b/modules/gallery/views/form_uploadify.html.php
index 36f5f284..893bb3b9 100644
--- a/modules/gallery/views/form_uploadify.html.php
+++ b/modules/gallery/views/form_uploadify.html.php
@@ -60,7 +60,7 @@
$("#g-add-photos-status ul").append(
"" + fileObj.name + " - " +
= t("Completed")->for_js() ?> + "");
- setTimeout(function() { $("#q" + queueID).slideUp("slow") }, 5000);
+ setTimeout(function() { $("#q" + queueID).slideUp("slow").remove() }, 5000);
success_count++;
update_status();
return true;
@@ -87,8 +87,8 @@
.replace("__TYPE__", errorObj.type));
}
$("#g-add-photos-status ul").append(
- "" + fileObj.name + msg + "");
- $("#g-uploadify" + queueID).remove();
+ "" + fileObj.name + msg + "");
+ $("#g-uploadify").uploadifyCancel(queueID);
error_count++;
update_status();
},
--
cgit v1.2.3
From 70c8572ea1b421458241b9b3b1cc85cb6bf35057 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 1 Sep 2010 22:19:44 -0700
Subject: Make RENAME TABLE operations idempotent so that in case there's a
failure of some kind we can restart the upgrade and it'll continue. Fixes
ticket #1325.
---
modules/gallery/helpers/gallery_installer.php | 4 +++-
modules/rest/helpers/rest_installer.php | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index d5264fcc..fa5113bf 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -550,7 +550,9 @@ class gallery_installer {
}
if ($version == 26) {
- $db->query("RENAME TABLE {failed_logins} TO {failed_auths}");
+ if (in_array("failed_logins", Database::instance()->list_tables())) {
+ $db->query("RENAME TABLE {failed_logins} TO {failed_auths}");
+ }
module::set_version("gallery", $version = 27);
}
diff --git a/modules/rest/helpers/rest_installer.php b/modules/rest/helpers/rest_installer.php
index c2694a29..3c7fea4b 100644
--- a/modules/rest/helpers/rest_installer.php
+++ b/modules/rest/helpers/rest_installer.php
@@ -35,7 +35,9 @@ class rest_installer {
static function upgrade($version) {
$db = Database::instance();
if ($version == 1) {
- $db->query("RENAME TABLE {user_access_tokens} TO {user_access_keys}");
+ if (in_array("user_access_tokens", Database::instance()->list_tables())) {
+ $db->query("RENAME TABLE {user_access_tokens} TO {user_access_keys}");
+ }
module::set_version("rest", $version = 2);
}
--
cgit v1.2.3
From 04f6646b0637d9cb221159b4931b184449a4dc1d Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Wed, 1 Sep 2010 23:19:43 -0700
Subject: Hopefully the third and final patch for #1216. Set the default from
and reply-to addresses to an empty string. The first time the user model is
saved, set the sendmail from and reply-to addresses. Requires an update to
gallery version 38.
---
modules/gallery/helpers/gallery_event.php | 11 +++++++----
modules/gallery/helpers/gallery_installer.php | 20 +++++++++++++++++---
modules/gallery/libraries/Sendmail.php | 7 +++----
modules/gallery/module.info | 2 +-
4 files changed, 28 insertions(+), 12 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 66b250e9..8344c11c 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -550,10 +550,13 @@ class gallery_event_Core {
}
- static function user_change_email_form_completed($user, $form) {
- if ($user->admin) {
- module::set_var("gallery", "email_from", $user->email);
- module::set_var("gallery", "email_reply_to", $user->email);
+ static function user_updated($original_user, $updated_user) {
+ if ($updated_user->admin) {
+ $email = module::get_var("gallery", "email_from", "");
+ if (empty($email)) {
+ module::set_var("gallery", "email_from", $updated_user->email);
+ module::set_var("gallery", "email_reply_to", $updated_user->email);
+ }
}
}
}
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index d5264fcc..c6f19ad0 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -304,12 +304,12 @@ class gallery_installer {
module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");
// Sendmail configuration
- module::set_var("gallery", "email_from", "admin@example.com");
- module::set_var("gallery", "email_reply_to", "public@example.com");
+ module::set_var("gallery", "email_from", "");
+ module::set_var("gallery", "email_reply_to", "");
module::set_var("gallery", "email_line_length", 70);
module::set_var("gallery", "email_header_separator", serialize("\n"));
- module::set_version("gallery", 37);
+ module::set_version("gallery", 38);
}
static function upgrade($version) {
@@ -611,6 +611,20 @@ class gallery_installer {
module::set_var("gallery", "email_header_separator", serialize("\n"));
module::set_version("gallery", $version = 37);
}
+
+ // Changed our minds and decided that the initial value should be empty
+ // But don't just reset it blindly, only do it if the value is version 37 default
+ if ($version == 37) {
+ $email = module::get_var("gallery", "email_from", "");
+ if ($email == "admin@example.com") {
+ module::set_var("gallery", "email_from", "");
+ }
+ $email = module::get_var("gallery", "email_reply_to", "");
+ if ($email == "admin@example.com") {
+ module::set_var("gallery", "email_reply_to", "");
+ }
+ module::set_version("gallery", $version = 38);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/libraries/Sendmail.php b/modules/gallery/libraries/Sendmail.php
index 0fa554b4..a93be736 100644
--- a/modules/gallery/libraries/Sendmail.php
+++ b/modules/gallery/libraries/Sendmail.php
@@ -35,12 +35,11 @@ class Sendmail_Core {
public function __construct() {
$this->headers = array();
- $domain = Input::instance()->server("HTTP_HOST");
- $this->from(module::get_var("gallery", "email_from", "admin@$domain"));
- $this->reply_to(module::get_var("gallery", "email_reply_to", "public@$domain"));
+ $this->from(module::get_var("gallery", "email_from", ""));
+ $this->reply_to(module::get_var("gallery", "email_reply_to", ""));
$this->line_length(module::get_var("gallery", "email_line_length", 70));
$separator = module::get_var("gallery", "email_header_separator", null);
- $this->header_separator(empty($separator) ? "\n" : deserialize($separator));
+ $this->header_separator(empty($separator) ? "\n" : unserialize($separator));
}
public function __get($key) {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 901158b5..cc3b2723 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 37
+version = 38
--
cgit v1.2.3
From 4a7fc1a9815099d64b17133da238ef4470071328 Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Wed, 1 Sep 2010 23:21:56 -0700
Subject: Fix up the test so it works with the changes for ticket #1216. Also
note the name change to the first test. Form a php reflection point of view
Sendmail_Test (class name) == sendmail_test (method name) so the method gets
treated as a constructor instead of a test method.
---
modules/gallery/tests/Sendmail_Test.php | 30 +++++++++++-------------------
1 file changed, 11 insertions(+), 19 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/tests/Sendmail_Test.php b/modules/gallery/tests/Sendmail_Test.php
index 92974e5c..aee6abf5 100644
--- a/modules/gallery/tests/Sendmail_Test.php
+++ b/modules/gallery/tests/Sendmail_Test.php
@@ -19,24 +19,18 @@
*/
class Sendmail_Test extends Gallery_Unit_Test_Case {
public function setup() {
- Kohana_Config::instance()->set("sendmail.from", "from@gallery3.com");
+ module::set_var("gallery", "email_from", "from@gallery3.com");
+ module::set_var("gallery", "email_reply_to", "reply_to@gallery3.com");
}
- public function sendmail_test() {
- $domain = Input::instance()->server("HTTP_HOST");
+ public function sendmail_basic_test() {
$expected = "To: receiver@someemail.com\r\n" .
"From: from@gallery3.com\n" .
- "Reply-To: public@$domain\r\n" .
+ "Reply-To: reply_to@gallery3.com\r\n" .
"Subject: Test Email Unit test\r\n\r\n" .
"The mail message body";
$result = Sendmail_For_Test::factory()
->to("receiver@someemail.com")
- /*
- * @todo figure out why this test fails so badly, when the following
- * line is not supplied. It doesn't seem to be set by setup method
- * as you would expect.
- */
- ->from("from@gallery3.com")
->subject("Test Email Unit test")
->message("The mail message body")
->send()
@@ -46,16 +40,15 @@ class Sendmail_Test extends Gallery_Unit_Test_Case {
}
public function sendmail_reply_to_test() {
- $domain = Input::instance()->server("HTTP_HOST");
$expected = "To: receiver@someemail.com\r\n" .
- "From: admin@$domain\n" .
- "Reply-To: reply-to@gallery3.com\r\n" .
+ "From: from@gallery3.com\n" .
+ "Reply-To: reply_to@gallery3.com\r\n" .
"Subject: Test Email Unit test\r\n\r\n" .
"The mail message body";
$result = Sendmail_For_Test::factory()
->to("receiver@someemail.com")
->subject("Test Email Unit test")
- ->reply_to("reply-to@gallery3.com")
+ ->reply_to("reply_to@gallery3.com")
->message("The mail message body")
->send()
->send_text;
@@ -63,10 +56,9 @@ class Sendmail_Test extends Gallery_Unit_Test_Case {
}
public function sendmail_html_message_test() {
- $domain = Input::instance()->server("HTTP_HOST");
$expected = "To: receiver@someemail.com\r\n" .
- "From: admin@$domain\n" .
- "Reply-To: public@$domain\n" .
+ "From: from@gallery3.com\n" .
+ "Reply-To: reply_to@gallery3.com\n" .
"MIME-Version: 1.0\n" .
"Content-Type: text/html; charset=UTF-8\r\n" .
"Subject: Test Email Unit test\r\n\r\n" .
@@ -85,8 +77,8 @@ class Sendmail_Test extends Gallery_Unit_Test_Case {
public function sendmail_wrapped_message_test() {
$domain = Input::instance()->server("HTTP_HOST");
$expected = "To: receiver@someemail.com\r\n" .
- "From: admin@$domain\n" .
- "Reply-To: public@$domain\r\n" .
+ "From: from@gallery3.com\n" .
+ "Reply-To: reply_to@gallery3.com\r\n" .
"Subject: Test Email Unit test\r\n\r\n" .
"This is a long message that needs to go\n" .
"over forty characters If we get lucky we\n" .
--
cgit v1.2.3
From 7477f0119c39a71e05d3e6b2caad8418a7d41c83 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 1 Sep 2010 23:39:01 -0700
Subject: Explain wtf we're doing in user_updated.
---
modules/gallery/helpers/gallery_event.php | 2 ++
1 file changed, 2 insertions(+)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 8344c11c..5e44caef 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -551,6 +551,8 @@ class gallery_event_Core {
}
static function user_updated($original_user, $updated_user) {
+ // If no default from/reply-to email address is set, adopt the value from the first admin to
+ // set their own email address so that we at least have a valid address for the Gallery.
if ($updated_user->admin) {
$email = module::get_var("gallery", "email_from", "");
if (empty($email)) {
--
cgit v1.2.3
From 23b566e5921d5b8bd5a957ecd2d601e556f658a0 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 1 Sep 2010 23:52:19 -0700
Subject: One more adjustment for ticket #1216. The packaging process forces
the default email address for admin to be unknown@unknown.com and when that
happens the gallery_event::user_updated() event listener fires and sets the
default values. This is hard to work around, so let's just roll with it and
use unknown@unknown.com as our default placeholder.
So now, if an admin sets their email address and the current values
are unknown@unknown.com we adopt the admin's email address for the
site's mail_from/reply_to fields.
---
installer/install.sql | 8 ++++----
modules/gallery/helpers/gallery_event.php | 7 ++++---
2 files changed, 8 insertions(+), 7 deletions(-)
(limited to 'modules')
diff --git a/installer/install.sql b/installer/install.sql
index 7440cc8f..7a40918d 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -244,7 +244,7 @@ CREATE TABLE {modules} (
KEY `weight` (`weight`)
) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',37,1);
+INSERT INTO {modules} VALUES (1,1,'gallery',38,1);
INSERT INTO {modules} VALUES (2,1,'user',3,2);
INSERT INTO {modules} VALUES (3,1,'comment',3,3);
INSERT INTO {modules} VALUES (4,1,'organize',2,4);
@@ -417,15 +417,15 @@ INSERT INTO {vars} VALUES (NULL,'gallery','date_time_format','Y-M-d H:i:s');
INSERT INTO {vars} VALUES (NULL,'gallery','favicon_url','lib/images/favicon.ico');
INSERT INTO {vars} VALUES (NULL,'gallery','date_format','Y-M-d');
INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:3:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}');
-INSERT INTO {vars} VALUES (NULL,'gallery','email_from','admin@example.com');
-INSERT INTO {vars} VALUES (NULL,'gallery','email_reply_to','public@example.com');
+INSERT INTO {vars} VALUES (NULL,'gallery','email_from','unknown@unknown.com');
+INSERT INTO {vars} VALUES (NULL,'gallery','email_reply_to','unknown@unknown.com');
INSERT INTO {vars} VALUES (NULL,'gallery','choose_default_tookit','1');
INSERT INTO {vars} VALUES (NULL,'gallery','email_line_length','70');
INSERT INTO {vars} VALUES (NULL,'gallery','email_header_separator','s:1:\"\n\";');
+INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0');
INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:4:{i:9;a:2:{i:0;s:7:\"gallery\";i:1;s:8:\"language\";}i:10;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:11;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:12;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}');
INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user');
-INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0');
INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5');
INSERT INTO {vars} VALUES (NULL,'rest','allow_guest_access','0');
INSERT INTO {vars} VALUES (NULL,'slideshow','max_scale','0');
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 5e44caef..ec7d1882 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -551,11 +551,12 @@ class gallery_event_Core {
}
static function user_updated($original_user, $updated_user) {
- // If no default from/reply-to email address is set, adopt the value from the first admin to
- // set their own email address so that we at least have a valid address for the Gallery.
+ // If the default from/reply-to email address is set to the install time placeholder value
+ // of unknown@unknown.com then adopt the value from the first admin to set their own email
+ // address so that we at least have a valid address for the Gallery.
if ($updated_user->admin) {
$email = module::get_var("gallery", "email_from", "");
- if (empty($email)) {
+ if ($email == "unknown@unknown.com") {
module::set_var("gallery", "email_from", $updated_user->email);
module::set_var("gallery", "email_reply_to", $updated_user->email);
}
--
cgit v1.2.3
From 2a86446249c4782287e1e6e472f422b851c2fb47 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Thu, 2 Sep 2010 00:50:02 -0700
Subject: Handle the case of a completely private Gallery separately and just
put up a login page, very similar to the way that the maintenance mode login
page works. Fixes ticket #1056.
---
modules/gallery/helpers/gallery.php | 16 ++++++++++++++++
modules/gallery/hooks/init_gallery.php | 1 +
2 files changed, 17 insertions(+)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 3f83b23d..924ee76a 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -36,6 +36,22 @@ class gallery_Core {
}
}
+ /**
+ * If the gallery is only available to registered users and the user is not logged in, present
+ * the login page.
+ */
+ static function private_gallery() {
+ if (Router::$controller != "login" &&
+ Router::$controller != "combined" &&
+ identity::active_user()->guest &&
+ !access::user_can(identity::guest(), "view", item::root())) {
+ Session::instance()->set("continue_url", url::abs_current());
+ Router::$controller = "login";
+ Router::$controller_path = MODPATH . "gallery/controllers/login.php";
+ Router::$method = "html";
+ }
+ }
+
/**
* This function is called when the Gallery is fully initialized. We relay it to modules as the
* "gallery_ready" event. Any module that wants to perform an action at the start of every
diff --git a/modules/gallery/hooks/init_gallery.php b/modules/gallery/hooks/init_gallery.php
index 64e44b56..10a74733 100644
--- a/modules/gallery/hooks/init_gallery.php
+++ b/modules/gallery/hooks/init_gallery.php
@@ -38,6 +38,7 @@ Event::add("system.ready", array("module", "load_modules"));
Event::add("system.ready", array("gallery", "ready"));
Event::add("system.post_routing", array("url", "parse_url"));
Event::add("system.post_routing", array("gallery", "maintenance_mode"));
+Event::add("system.post_routing", array("gallery", "private_gallery"));
Event::add("system.shutdown", array("gallery", "shutdown"));
// @todo once we convert to Kohana 2.4 this doesn't have to be here
--
cgit v1.2.3
From 511826a33cbbf03bf1e3cb151f1a181b8e6723e8 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Thu, 2 Sep 2010 01:10:15 -0700
Subject: Don't show the "(## errors)" part of the status message if there
haven't been any errors.
---
modules/gallery/controllers/uploader.php | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/controllers/uploader.php b/modules/gallery/controllers/uploader.php
index fb496f60..168e8b2d 100644
--- a/modules/gallery/controllers/uploader.php
+++ b/modules/gallery/controllers/uploader.php
@@ -103,11 +103,14 @@ class Uploader_Controller extends Controller {
}
public function status($success_count, $error_count) {
- // The "errors" won't be properly pluralized :-/
- print t2("Uploaded %count photo (%error errors)",
- "Uploaded %count photos (%error errors)",
- $success_count,
- array("error" => $error_count));
+ if ($error_count) {
+ // The "errors" won't be properly pluralized :-/
+ print t2("Uploaded %count photo (%error errors)",
+ "Uploaded %count photos (%error errors)",
+ $success_count,
+ array("error" => $error_count));
+ } else {
+ print t2("Uploaded %count photo", "Uploaded %count photos", $success_count);}
}
public function finish() {
--
cgit v1.2.3
From 32d18920680ee63dc75c3a2b710ef805b31c127c Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Thu, 2 Sep 2010 22:53:06 -0700
Subject: Follow on to 2a86446249c4782287e1e6e472f422b851c2fb47; fix a bug
where guest access to admin pages fails because we try to go to the login
page but you can't do that from the admin theme. Thanks to mamouneyya for
catching this.
http://github.com/gallery/gallery3/commit/2a86446249c4782287e1e6e472f422b851c2fb47
---
modules/gallery/helpers/gallery.php | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 924ee76a..9430231c 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -45,10 +45,17 @@ class gallery_Core {
Router::$controller != "combined" &&
identity::active_user()->guest &&
!access::user_can(identity::guest(), "view", item::root())) {
- Session::instance()->set("continue_url", url::abs_current());
- Router::$controller = "login";
- Router::$controller_path = MODPATH . "gallery/controllers/login.php";
- Router::$method = "html";
+ if (Router::$controller == "admin") {
+ // At this point we're in the admin theme and it doesn't have a themed login page, so
+ // we can't just swap in the login controller and have it work. So redirect back to the
+ // root item where we'll run this code again with the site theme.
+ url::redirect(item::root()->abs_url());
+ } else {
+ Session::instance()->set("continue_url", url::abs_current());
+ Router::$controller = "login";
+ Router::$controller_path = MODPATH . "gallery/controllers/login.php";
+ Router::$method = "html";
+ }
}
}
--
cgit v1.2.3
From db75ac642a6ff62e814929af99e7c9af4d492706 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 4 Sep 2010 13:40:39 -0700
Subject: Use the title of the root album as the site title for all RSS feeds.
Fixes ticket #1307.
---
modules/comment/helpers/comment_rss.php | 10 ++++++++--
modules/gallery/helpers/gallery_rss.php | 10 ++++++++--
modules/tag/helpers/tag_rss.php | 3 ++-
3 files changed, 18 insertions(+), 5 deletions(-)
(limited to 'modules')
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
index 26d98d21..cc4180bf 100644
--- a/modules/comment/helpers/comment_rss.php
+++ b/modules/comment/helpers/comment_rss.php
@@ -57,13 +57,19 @@ class comment_rss_Core {
"thumb_height" => $item->thumb_height,
"thumb_width" => $item->thumb_width,
"item_uri" => url::abs_site("{$item->type}s/$item->id"),
- "title" => html::purify($item->title),
+ "title" => (
+ ($item->id == item::root()->id) ?
+ html::purify($item->title) :
+ t("%site_title - %item_title",
+ array("site_title" => item::root()->title,
+ "item_title" => $item->title))),
"author" => html::clean($comment->author_name())),
ArrayObject::ARRAY_AS_PROPS);
}
$feed->max_pages = ceil($comments->count_all() / $limit);
- $feed->title = htmlspecialchars(t("Recent Comments"));
+ $feed->title = html::purify(t("%site_title - Recent Comments",
+ array("site_title" => item::root()->title)));
$feed->uri = url::abs_site("albums/" . (empty($id) ? "1" : $id));
$feed->description = t("Recent comments");
diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php
index bec34912..fb617934 100644
--- a/modules/gallery/helpers/gallery_rss.php
+++ b/modules/gallery/helpers/gallery_rss.php
@@ -40,7 +40,7 @@ class gallery_rss_Core {
->order_by("created", "DESC");
$feed->max_pages = ceil($all_items->find_all()->count() / $limit);
- $feed->title = t("Recent updates");
+ $feed->title = t("%site_title - Recent updates", array("site_title" => item::root()->title));
$feed->description = t("Recent updates");
return $feed;
@@ -53,7 +53,13 @@ class gallery_rss_Core {
->descendants($limit, $offset, array(array("type", "=", "photo")));
$feed->max_pages = ceil(
$item->viewable()->descendants_count(array(array("type", "=", "photo"))) / $limit);
- $feed->title = html::purify($item->title);
+ if ($item->id == item::root()->id) {
+ $feed->title = html::purify($item->title);
+ } else {
+ $feed->title = t("%site_title - %item_title",
+ array("site_title" => item::root()->title,
+ "item_title" => $item->title));
+ }
$feed->description = nl2br(html::purify($item->description));
return $feed;
diff --git a/modules/tag/helpers/tag_rss.php b/modules/tag/helpers/tag_rss.php
index ea3865be..f60bd908 100644
--- a/modules/tag/helpers/tag_rss.php
+++ b/modules/tag/helpers/tag_rss.php
@@ -38,7 +38,8 @@ class tag_rss_Core {
$feed = new stdClass();
$feed->items = $tag->items($limit, $offset, "photo");
$feed->max_pages = ceil($tag->count / $limit);
- $feed->title = $tag->name;
+ $feed->title = t("%site_title - %tag_name",
+ array("site_title" => item::root()->title, "tag_name" => $tag->name));
$feed->description = t("Photos related to %tag_name", array("tag_name" => $tag->name));
return $feed;
--
cgit v1.2.3
From c51b6ab38d7f16d64127fd3a73df38166a698f0f Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 4 Sep 2010 15:54:07 -0700
Subject: Fix full size dimensions after rotating an image on the photo view
page.
The photo view page caches the dimensions of the full size and then
renders it in Javascript. But after rotation, those dimensions are no
longer valid. Create a new function on the items controller that
returns the appropriate dimensions, then add a hook on
$.gallery_replace_image and implement the hook on the photo view page
to have it make an async call to get the new dimensions.
Fixes ticket #1317
---
lib/gallery.common.js | 3 +++
modules/gallery/controllers/items.php | 9 +++++++++
themes/wind/views/photo.html.php | 15 ++++++++++++++-
3 files changed, 26 insertions(+), 1 deletion(-)
(limited to 'modules')
diff --git a/lib/gallery.common.js b/lib/gallery.common.js
index a8b237bf..69452f39 100644
--- a/lib/gallery.common.js
+++ b/lib/gallery.common.js
@@ -121,6 +121,9 @@
// Ajax handler for replacing an image, used in Ajax thumbnail rotation
$.gallery_replace_image = function(data, thumb) {
$(thumb).attr({src: data.src, width: data.width, height: data.height});
+ if (typeof gallery_image_replaced_hook == 'function') {
+ gallery_image_replaced_hook(data, thumb);
+ }
};
// Initialize context menus
diff --git a/modules/gallery/controllers/items.php b/modules/gallery/controllers/items.php
index f205bf86..39b0f638 100644
--- a/modules/gallery/controllers/items.php
+++ b/modules/gallery/controllers/items.php
@@ -31,4 +31,13 @@ class Items_Controller extends Controller {
access::required("view", $item);
url::redirect($item->abs_url());
}
+
+ // Return the width/height dimensinons for the given item
+ public function dimensions($id) {
+ $item = ORM::factory("item", $id);
+ access::required("view", $item);
+ json::reply(array("thumb" => array((int)$item->thumb_width, (int)$item->thumb_height),
+ "resize" => array((int)$item->resize_width, (int)$item->resize_height),
+ "full" => array((int)$item->width, (int)$item->height)));
+ }
}
diff --git a/themes/wind/views/photo.html.php b/themes/wind/views/photo.html.php
index f8b5511c..cb830e23 100644
--- a/themes/wind/views/photo.html.php
+++ b/themes/wind/views/photo.html.php
@@ -4,10 +4,23 @@
endif ?>
--
cgit v1.2.3
From ca0c3b3e7f154ffceee944049247e15cf0190e48 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 5 Sep 2010 21:25:46 -0700
Subject: Force "Options +FollowSymLinks" since that's a requirement for
mod_rewrite to work. This is surprisingly obscure in the docs. Thanks to
bromide for turning this up in http://gallery.menalto.com/node/97791!
---
.htaccess | 1 +
modules/gallery/helpers/access.php | 1 +
2 files changed, 2 insertions(+)
(limited to 'modules')
diff --git a/.htaccess b/.htaccess
index 5e9b96d6..bea9a10a 100644
--- a/.htaccess
+++ b/.htaccess
@@ -60,6 +60,7 @@
# putting this block into your Apache config files.
#
#
+# Options +FollowSymLinks
# RewriteEngine On
# RewriteBase /
# RewriteCond %{REQUEST_FILENAME} !-f
diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php
index f1ea00c0..86ea9572 100644
--- a/modules/gallery/helpers/access.php
+++ b/modules/gallery/helpers/access.php
@@ -694,6 +694,7 @@ class access_Core {
@mkdir(VARPATH . "security_test");
try {
if ($fp = @fopen(VARPATH . "security_test/.htaccess", "w+")) {
+ fwrite($fp, "Options +FollowSymLinks\n");
fwrite($fp, "RewriteEngine On\n");
fwrite($fp, "RewriteRule verify $success_url [L]\n");
fclose($fp);
--
cgit v1.2.3
From 46b30ce949d6371bc3d2bcfe42221c599c7a85e3 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 5 Sep 2010 22:00:28 -0700
Subject: Add Setswana (tn_ZA). Fixes ticket #1336.
---
modules/gallery/helpers/locales.php | 1 +
1 file changed, 1 insertion(+)
(limited to 'modules')
diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php
index aacb37ca..1f5473ff 100644
--- a/modules/gallery/helpers/locales.php
+++ b/modules/gallery/helpers/locales.php
@@ -103,6 +103,7 @@ class locales_Core {
$l["sl_SI"] = "Slovenščina"; // Slovenian
$l["sr_CS"] = "Srpski"; // Serbian
$l["sv_SE"] = "Svenska"; // Swedish
+ $l["tn_ZA"] = "Setswana"; // Setswana
$l["tr_TR"] = "Türkçe"; // Turkish
$l["uk_UA"] = "українська"; // Ukrainian
$l["vi_VN"] = "Tiếng Việt"; // Vietnamese
--
cgit v1.2.3
From b3b6021b0a70979a1084111ae43c1170a7592b37 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 12:41:27 -0700
Subject: Don't bomb on the race condition when we're trying to create the
gallery/_cache row and it already exists. Fixes ticket #1338.
---
modules/gallery/helpers/module.php | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index ca6651f1..736b6854 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -448,7 +448,17 @@ class module_Core {
$cache->module_name = "gallery";
$cache->name = "_cache";
$cache->value = serialize(self::$var_cache);
- $cache->save();
+ try {
+ $cache->save();
+ } catch (Database_Exception $e) {
+ // There's a potential race condition here. Don't fail if that happens because it's
+ // bound to be transient and not a huge deal, but at least put something in the logs.
+ if (stristr($e->getMessage(), "duplicate entry")) {
+ Kohana_Log::add("error", "Failed to cache vars");
+ } else {
+ throw $e;
+ }
+ }
}
}
--
cgit v1.2.3
From 2d948cb39fd2da6a5f966a10cbeb4f5d5caec5a3 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 14:05:48 -0700
Subject: change the Setswana locale from tn_ZA to tn_BW since it's mostly
Botswana anyway according to @sagemaniac in
http://gallery.menalto.com/node/97840
---
modules/gallery/helpers/locales.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php
index 1f5473ff..624ff9cb 100644
--- a/modules/gallery/helpers/locales.php
+++ b/modules/gallery/helpers/locales.php
@@ -103,7 +103,7 @@ class locales_Core {
$l["sl_SI"] = "Slovenščina"; // Slovenian
$l["sr_CS"] = "Srpski"; // Serbian
$l["sv_SE"] = "Svenska"; // Swedish
- $l["tn_ZA"] = "Setswana"; // Setswana
+ $l["tn_BW"] = "Setswana"; // Setswana
$l["tr_TR"] = "Türkçe"; // Turkish
$l["uk_UA"] = "українська"; // Ukrainian
$l["vi_VN"] = "Tiếng Việt"; // Vietnamese
--
cgit v1.2.3
From fc856b6abaa24d27cba5273147da11fc2446c1ba Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 14:08:05 -0700
Subject: Add retry logic to the task framework. We retry 4 times with
increasing backoff and if that fails, we put up a manual "retry" link. Fixes
ticket #1270.
---
.../gallery/views/admin_maintenance_task.html.php | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
(limited to 'modules')
diff --git a/modules/gallery/views/admin_maintenance_task.html.php b/modules/gallery/views/admin_maintenance_task.html.php
index 76756b66..013ac01f 100644
--- a/modules/gallery/views/admin_maintenance_task.html.php
+++ b/modules/gallery/views/admin_maintenance_task.html.php
@@ -3,6 +3,7 @@
var target_value;
var animation = null;
var delta = 1;
+ var consecutive_error_count = 0;
animate_progress_bar = function() {
var current_value = parseInt($(".g-progress-bar div").css("width").replace("%", ""));
if (target_value > current_value) {
@@ -26,12 +27,15 @@
$.fn.gallery_hover_init();
}
+ var FAILED_MSG = = t("Something went wrong...sorry! Retry or check the task log for details")->for_js() ?>;
+ var ERROR_MSG = = t("Something went wrong! Trying again in a moment... (__COUNT__)")->for_js() ?>;
update = function() {
$.ajax({
url: = html::js_string(url::site("admin/maintenance/run/$task->id?csrf=$csrf")) ?>,
dataType: "json",
success: function(data) {
target_value = data.task.percent_complete;
+ consecutive_error_count = 0;
if (!animation) {
animate_progress_bar();
}
@@ -42,6 +46,22 @@
} else {
setTimeout(update, 100);
}
+ },
+ error: function(req, textStatus, errorThrown) {
+ if (textStatus == "timeout" || textStatus == "parsererror") {
+ consecutive_error_count++;
+ if (consecutive_error_count == 5) {
+ $("#g-status").html(FAILED_MSG);
+ $("#g-pause-button").hide();
+ $("#g-done-button").show();
+ consecutive_error_count = 0; // in case of a manual retry
+ $("#g-status a").attr("href", "javascript:update()");
+ } else {
+ $("#g-status").html(ERROR_MSG.replace("__COUNT__", consecutive_error_count));
+ // Give a little time to back off before retrying
+ setTimeout(update, 1500 * consecutive_error_count);
+ }
+ }
}
});
}
--
cgit v1.2.3
From cb22f23be64096234197cdb1c97d7a42ba504aa4 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 14:16:26 -0700
Subject: Show the "view log" button for tasks that are running, in case
they're paused/abandoned for some reason and we want to know more details.
---
modules/gallery/views/admin_maintenance.html.php | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php
index 4bfc57f0..c28def1d 100644
--- a/modules/gallery/views/admin_maintenance.html.php
+++ b/modules/gallery/views/admin_maintenance.html.php
@@ -109,16 +109,21 @@
= html::clean($task->owner()->name) ?>
|
- id?csrf=$csrf") ?>"
- class="g-button g-right ui-icon-left ui-state-default ui-corner-all">
- = t("cancel") ?>
-
if ($task->state == "stalled"): ?>
id?csrf=$csrf") ?>">
= t("resume") ?>
endif ?>
+ if ($task->get_log()): ?>
+ id?csrf=$csrf") ?>" class="g-dialog-link g-button ui-state-default ui-corner-all">
+ = t("view log") ?>
+
+ endif ?>
+ id?csrf=$csrf") ?>"
+ class="g-button ui-icon-left ui-state-default ui-corner-all">
+ = t("cancel") ?>
+
|
endforeach ?>
@@ -183,7 +188,7 @@
if ($task->get_log()): ?>
id?csrf=$csrf") ?>" class="g-dialog-link g-button ui-state-default ui-corner-all">
- = t("browse log") ?>
+ = t("view log") ?>
endif ?>
else: ?>
--
cgit v1.2.3
From 883d8f1e23ba000320daf535d97a2e388cc42cd1 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 15:06:37 -0700
Subject: Whitespace.
---
modules/gallery/libraries/Gallery_I18n.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/libraries/Gallery_I18n.php b/modules/gallery/libraries/Gallery_I18n.php
index f8068eec..6cb36f07 100644
--- a/modules/gallery/libraries/Gallery_I18n.php
+++ b/modules/gallery/libraries/Gallery_I18n.php
@@ -44,7 +44,7 @@ function t($message, $options=array()) {
*/
function t2($singular, $plural, $count, $options=array()) {
return Gallery_I18n::instance()->translate(array("one" => $singular, "other" => $plural),
- array_merge($options, array("count" => $count)));
+ array_merge($options, array("count" => $count)));
}
class Gallery_I18n_Core {
@@ -175,7 +175,7 @@ class Gallery_I18n_Core {
->execute() as $row) {
$translations[$row->key] = unserialize($row->translation);
}
-
+
// Override incoming with outgoing...
foreach (db::build()
->select("key", "translation")
@@ -184,7 +184,7 @@ class Gallery_I18n_Core {
->execute() as $row) {
$translations[$row->key] = unserialize($row->translation);
}
-
+
$cache->set($cache_key, $translations, array("translation"), 0);
}
return $translations;
--
cgit v1.2.3
From ec2c9dad64ecb8aca6ab71461e76715f39071c9f Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 15:20:04 -0700
Subject: Verified checkpoint.
---
modules/gallery/tests/controller_auth_data.txt | 1 +
modules/gallery/tests/xss_data.txt | 90 ++++++++++++--------------
2 files changed, 43 insertions(+), 48 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt
index 8b776fb9..212577c7 100644
--- a/modules/gallery/tests/controller_auth_data.txt
+++ b/modules/gallery/tests/controller_auth_data.txt
@@ -17,6 +17,7 @@ modules/gallery/controllers/logout.php index
modules/gallery/controllers/quick.php form_edit DIRTY_CSRF
modules/gallery/controllers/upgrader.php index DIRTY_AUTH
modules/gallery/controllers/uploader.php start DIRTY_AUTH
+modules/gallery/controllers/uploader.php status DIRTY_AUTH
modules/gallery/controllers/uploader.php finish DIRTY_AUTH
modules/gallery/controllers/user_profile.php show DIRTY_AUTH
modules/gallery/controllers/user_profile.php contact DIRTY_AUTH
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index 3eae3d07..4405dad3 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -88,15 +88,15 @@ modules/gallery/views/admin_maintenance.html.php 87 DIRTY_ATTR $tas
modules/gallery/views/admin_maintenance.html.php 88 DIRTY gallery::date_time($task->updated)
modules/gallery/views/admin_maintenance.html.php 91 DIRTY $task->name
modules/gallery/views/admin_maintenance.html.php 106 DIRTY $task->status
-modules/gallery/views/admin_maintenance.html.php 157 DIRTY_ATTR text::alternate("g-odd","g-even")
-modules/gallery/views/admin_maintenance.html.php 157 DIRTY_ATTR $task->state=="success"?"g-success":"g-error"
-modules/gallery/views/admin_maintenance.html.php 158 DIRTY_ATTR $task->state=="success"?"g-success":"g-error"
-modules/gallery/views/admin_maintenance.html.php 159 DIRTY gallery::date_time($task->updated)
-modules/gallery/views/admin_maintenance.html.php 162 DIRTY $task->name
-modules/gallery/views/admin_maintenance.html.php 174 DIRTY $task->status
+modules/gallery/views/admin_maintenance.html.php 162 DIRTY_ATTR text::alternate("g-odd","g-even")
+modules/gallery/views/admin_maintenance.html.php 162 DIRTY_ATTR $task->state=="success"?"g-success":"g-error"
+modules/gallery/views/admin_maintenance.html.php 163 DIRTY_ATTR $task->state=="success"?"g-success":"g-error"
+modules/gallery/views/admin_maintenance.html.php 164 DIRTY gallery::date_time($task->updated)
+modules/gallery/views/admin_maintenance.html.php 167 DIRTY $task->name
+modules/gallery/views/admin_maintenance.html.php 179 DIRTY $task->status
modules/gallery/views/admin_maintenance_show_log.html.php 8 DIRTY_JS url::site("admin/maintenance/save_log/$task->id?csrf=$csrf")
modules/gallery/views/admin_maintenance_show_log.html.php 13 DIRTY $task->name
-modules/gallery/views/admin_maintenance_task.html.php 55 DIRTY $task->name
+modules/gallery/views/admin_maintenance_task.html.php 75 DIRTY $task->name
modules/gallery/views/admin_modules.html.php 51 DIRTY access::csrf_form_field()
modules/gallery/views/admin_modules.html.php 60 DIRTY_ATTR text::alternate("g-odd","g-even")
modules/gallery/views/admin_modules.html.php 63 DIRTY form::checkbox($data,'1',module::is_active($module_name))
@@ -109,7 +109,7 @@ modules/gallery/views/admin_sidebar.html.php 50 DIRTY $avail
modules/gallery/views/admin_sidebar.html.php 58 DIRTY $active
modules/gallery/views/admin_sidebar_blocks.html.php 4 DIRTY_ATTR $ref
modules/gallery/views/admin_sidebar_blocks.html.php 4 DIRTY $text
-modules/gallery/views/admin_theme_options.html.php 36 DIRTY $form
+modules/gallery/views/admin_theme_options.html.php 5 DIRTY $form
modules/gallery/views/admin_themes.html.php 3 DIRTY_JS url::site("admin/themes/choose")
modules/gallery/views/admin_themes.html.php 5 DIRTY_JS $csrf
modules/gallery/views/admin_themes.html.php 22 DIRTY $themes[$site]->name
@@ -168,10 +168,13 @@ modules/gallery/views/error_admin.html.php 284 DIRTY $var
modules/gallery/views/error_admin.html.php 285 DIRTY_ATTR $env_id
modules/gallery/views/error_admin.html.php 291 DIRTY $key
modules/gallery/views/error_admin.html.php 295 DIRTY Kohana_Exception::safe_dump($value,$key)
-modules/gallery/views/form_uploadify.html.php 9 DIRTY_JS url::file("lib/uploadify/uploadify.swf")
-modules/gallery/views/form_uploadify.html.php 10 DIRTY_JS url::site("uploader/add_photo/{$album->id}")
-modules/gallery/views/form_uploadify.html.php 14 DIRTY_JS url::file("lib/uploadify/cancel.png")
-modules/gallery/views/form_uploadify.html.php 15 DIRTY_JS $simultaneous_upload_limit
+modules/gallery/views/form_uploadify.html.php 16 DIRTY_JS url::site("uploader/status/_S/_E")
+modules/gallery/views/form_uploadify.html.php 24 DIRTY_JS $flash_minimum_version
+modules/gallery/views/form_uploadify.html.php 28 DIRTY_JS url::file("lib/uploadify/uploadify.swf")
+modules/gallery/views/form_uploadify.html.php 29 DIRTY_JS url::site("uploader/add_photo/{$album->id}")
+modules/gallery/views/form_uploadify.html.php 33 DIRTY_JS url::file("lib/uploadify/cancel.png")
+modules/gallery/views/form_uploadify.html.php 34 DIRTY_JS $simultaneous_upload_limit
+modules/gallery/views/form_uploadify.html.php 160 DIRTY_ATTR request::protocol()
modules/gallery/views/in_place_edit.html.php 2 DIRTY form::open($action,array("method"=>"post","id"=>"g-in-place-edit-form","class"=>"g-short-form"))
modules/gallery/views/in_place_edit.html.php 3 DIRTY access::csrf_form_field()
modules/gallery/views/in_place_edit.html.php 6 DIRTY form::input("input",$form["input"]," class=\"textbox\"")
@@ -207,17 +210,6 @@ modules/gallery/views/menu_dialog.html.php 5 DIRTY_JS $menu-
modules/gallery/views/menu_link.html.php 3 DIRTY $menu->css_id?"id='{$menu->css_id}'":""
modules/gallery/views/menu_link.html.php 4 DIRTY_ATTR $menu->css_class
modules/gallery/views/menu_link.html.php 5 DIRTY_JS $menu->url
-modules/gallery/views/move_browse.html.php 5 DIRTY_JS url::site("move/show_sub_tree/{$source->id}/__TARGETID__")
-modules/gallery/views/move_browse.html.php 40 DIRTY $tree
-modules/gallery/views/move_browse.html.php 44 DIRTY access::csrf_form_field()
-modules/gallery/views/move_tree.html.php 2 DIRTY $parent->thumb_img(array(),25);
-modules/gallery/views/move_tree.html.php 4 DIRTY_JS $parent->id
-modules/gallery/views/move_tree.html.php 6 DIRTY_JS $parent->id
-modules/gallery/views/move_tree.html.php 8 DIRTY_ATTR $parent->id
-modules/gallery/views/move_tree.html.php 10 DIRTY_ATTR $child->id
-modules/gallery/views/move_tree.html.php 11 DIRTY $child->thumb_img(array(),25);
-modules/gallery/views/move_tree.html.php 13 DIRTY_JS $child->id
-modules/gallery/views/move_tree.html.php 15 DIRTY_JS $child->id
modules/gallery/views/movieplayer.html.php 2 DIRTY html::anchor($item->file_url(true),"",$attrs)
modules/gallery/views/movieplayer.html.php 5 DIRTY_JS $attrs["id"]
modules/gallery/views/movieplayer.html.php 7 DIRTY_JS url::abs_file("lib/flowplayer.swf")
@@ -281,18 +273,19 @@ modules/notification/views/item_updated.html.php 20 DIRTY_JS $item-
modules/notification/views/item_updated.html.php 20 DIRTY $item->abs_url()
modules/notification/views/user_profile_notification.html.php 5 DIRTY_ATTR $subscription->id
modules/notification/views/user_profile_notification.html.php 6 DIRTY_JS $subscription->url
-modules/organize/views/organize_dialog.html.php 90 DIRTY_JS $domain
-modules/organize/views/organize_dialog.html.php 91 DIRTY_JS $access_key
-modules/organize/views/organize_dialog.html.php 92 DIRTY_JS request::protocol()
-modules/organize/views/organize_dialog.html.php 93 DIRTY_JS $file_filter
-modules/organize/views/organize_dialog.html.php 94 DIRTY_JS $sort_order
-modules/organize/views/organize_dialog.html.php 95 DIRTY_JS $sort_fields
-modules/organize/views/organize_dialog.html.php 96 DIRTY_JS $album->id
-modules/organize/views/organize_dialog.html.php 97 DIRTY_JS $rest_uri
-modules/organize/views/organize_dialog.html.php 98 DIRTY_JS $controller_uri
-modules/organize/views/organize_dialog.html.php 104 DIRTY_JS $flash_minimum_version="10.0.0"
-modules/organize/views/organize_dialog.html.php 122 DIRTY_JS $swf_uri
-modules/organize/views/organize_dialog.html.php 136 DIRTY_ATTR request::protocol()
+modules/organize/views/organize_dialog.html.php 86 DIRTY_JS $domain
+modules/organize/views/organize_dialog.html.php 87 DIRTY_JS $access_key
+modules/organize/views/organize_dialog.html.php 88 DIRTY_JS request::protocol()
+modules/organize/views/organize_dialog.html.php 89 DIRTY_JS $file_filter
+modules/organize/views/organize_dialog.html.php 90 DIRTY_JS $sort_order
+modules/organize/views/organize_dialog.html.php 91 DIRTY_JS $sort_fields
+modules/organize/views/organize_dialog.html.php 92 DIRTY_JS $album->id
+modules/organize/views/organize_dialog.html.php 93 DIRTY_JS $selected_id
+modules/organize/views/organize_dialog.html.php 94 DIRTY_JS $rest_uri
+modules/organize/views/organize_dialog.html.php 95 DIRTY_JS $controller_uri
+modules/organize/views/organize_dialog.html.php 101 DIRTY_JS $flash_minimum_version="10.0.0"
+modules/organize/views/organize_dialog.html.php 119 DIRTY_JS $swf_uri
+modules/organize/views/organize_dialog.html.php 132 DIRTY_ATTR request::protocol()
modules/recaptcha/views/admin_recaptcha.html.php 11 DIRTY $form
modules/recaptcha/views/admin_recaptcha.html.php 23 DIRTY_JS $public_key
modules/recaptcha/views/form_recaptcha.html.php 7 DIRTY_JS $public_key
@@ -385,10 +378,10 @@ themes/admin_wind/views/pager.html.php 37 DIRTY_JS str_re
themes/wind/views/album.html.php 16 DIRTY_ATTR $child->id
themes/wind/views/album.html.php 16 DIRTY_ATTR $item_class
themes/wind/views/album.html.php 18 DIRTY_JS $child->url()
-themes/wind/views/album.html.php 19 DIRTY $child->thumb_img(array("class"=>"g-thumbnail"))
-themes/wind/views/album.html.php 23 DIRTY_ATTR $item_class
-themes/wind/views/album.html.php 24 DIRTY_JS $child->url()
-themes/wind/views/album.html.php 42 DIRTY $theme->paginator()
+themes/wind/views/album.html.php 20 DIRTY $child->thumb_img(array("class"=>"g-thumbnail"))
+themes/wind/views/album.html.php 25 DIRTY_ATTR $item_class
+themes/wind/views/album.html.php 26 DIRTY_JS $child->url()
+themes/wind/views/album.html.php 44 DIRTY $theme->paginator()
themes/wind/views/block.html.php 3 DIRTY_ATTR $anchor
themes/wind/views/block.html.php 5 DIRTY_ATTR $css_id
themes/wind/views/block.html.php 6 DIRTY $title
@@ -410,16 +403,17 @@ themes/wind/views/page.html.php 44 DIRTY $thumb
themes/wind/views/page.html.php 81 DIRTY $header_text
themes/wind/views/page.html.php 83 DIRTY_JS item::root()->url()
themes/wind/views/page.html.php 87 DIRTY $theme->user_menu()
-themes/wind/views/page.html.php 108 DIRTY_JS $parent->url($parent==$theme->item()->parent()?"show={$theme->item()->id}":null)
-themes/wind/views/page.html.php 126 DIRTY $content
-themes/wind/views/page.html.php 132 DIRTY newView("sidebar.html")
-themes/wind/views/page.html.php 139 DIRTY $footer_text
+themes/wind/views/page.html.php 108 DIRTY_JS $parent->url($parent->id==$theme->item()->parent_id?"show={$theme->item()->id}":null)
+themes/wind/views/page.html.php 129 DIRTY $content
+themes/wind/views/page.html.php 135 DIRTY newView("sidebar.html")
+themes/wind/views/page.html.php 142 DIRTY $footer_text
themes/wind/views/paginator.html.php 33 DIRTY_JS $first_page_url
themes/wind/views/paginator.html.php 42 DIRTY_JS $previous_page_url
themes/wind/views/paginator.html.php 70 DIRTY_JS $next_page_url
themes/wind/views/paginator.html.php 79 DIRTY_JS $last_page_url
-themes/wind/views/photo.html.php 8 DIRTY_JS $theme->item()->width
-themes/wind/views/photo.html.php 8 DIRTY_JS $theme->item()->height
-themes/wind/views/photo.html.php 18 DIRTY $theme->paginator()
-themes/wind/views/photo.html.php 23 DIRTY_JS $item->file_url()
-themes/wind/views/photo.html.php 25 DIRTY $item->resize_img(array("id"=>"g-item-id-{$item->id}","class"=>"g-resize"))
+themes/wind/views/photo.html.php 7 DIRTY_JS $theme->item()->width
+themes/wind/views/photo.html.php 7 DIRTY_JS $theme->item()->height
+themes/wind/views/photo.html.php 17 DIRTY_JS url::site("items/dimensions/".$theme->item()->id)
+themes/wind/views/photo.html.php 31 DIRTY $theme->paginator()
+themes/wind/views/photo.html.php 36 DIRTY_JS $item->file_url()
+themes/wind/views/photo.html.php 38 DIRTY $item->resize_img(array("id"=>"g-item-id-{$item->id}","class"=>"g-resize"))
--
cgit v1.2.3
From cc399bf4f07fd7060536f442373a1e9c0ea4a5aa Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 16:20:37 -0700
Subject: Track the language of the user receiving the notification and send
the email in that user's language. Incidentally, send one email per
recipient, else we're leaking email addresses which is bad for community
sites. Bump notification module to v2 in the process.
Fixes ticket #1287.
---
modules/notification/helpers/notification.php | 156 ++++++++++-----------
.../helpers/notification_installer.php | 8 ++
modules/notification/module.info | 2 +-
3 files changed, 81 insertions(+), 85 deletions(-)
(limited to 'modules')
diff --git a/modules/notification/helpers/notification.php b/modules/notification/helpers/notification.php
index e4212203..0564d336 100644
--- a/modules/notification/helpers/notification.php
+++ b/modules/notification/helpers/notification.php
@@ -67,7 +67,7 @@ class notification {
}
static function get_subscribers($item) {
- $subscriber_ids = array();
+ $subscriber_ids = array();
foreach (ORM::factory("subscription")
->select("user_id")
->join("items", "subscriptions.item_id", "items.id")
@@ -86,88 +86,76 @@ class notification {
$subscribers = array();
foreach ($users as $user) {
if (access::user_can($user, "view", $item) && !empty($user->email)) {
- $subscribers[$user->email] = 1;
+ $subscribers[$user->email] = $user->locale;
}
}
- return array_keys($subscribers);
+ return $subscribers;
}
static function send_item_updated($original, $item) {
- $subscribers = self::get_subscribers($item);
- if (!$subscribers) {
- return;
+ foreach (self::get_subscribers($item) as $email => $locale) {
+ $v = new View("item_updated.html");
+ $v->original = $original;
+ $v->item = $item;
+ $v->subject = $item->is_album() ?
+ t("Album \"%title\" updated", array("title" => $original->title, "locale" => $locale)) :
+ ($item->is_photo() ?
+ t("Photo \"%title\" updated", array("title" => $original->title, "locale" => $locale))
+ : t("Movie \"%title\" updated", array("title" => $original->title, "locale" => $locale)));
+ self::_notify($email, $locale, $item, $v->render(), $v->subject);
}
-
- $v = new View("item_updated.html");
- $v->original = $original;
- $v->item = $item;
- $v->subject = $item->is_album() ?
- t("Album \"%title\" updated", array("title" => $original->title)) :
- ($item->is_photo() ?
- t("Photo \"%title\" updated", array("title" => $original->title))
- : t("Movie \"%title\" updated", array("title" => $original->title)));
-
- self::_notify($subscribers, $item, $v->render(), $v->subject);
}
static function send_item_add($item) {
- $subscribers = self::get_subscribers($item);
- if (!$subscribers) {
- return;
- }
-
$parent = $item->parent();
- $v = new View("item_added.html");
- $v->item = $item;
- $v->subject = $item->is_album() ?
- t("Album \"%title\" added to \"%parent_title\"",
- array("title" => $item->title, "parent_title" => $parent->title)) :
- ($item->is_photo() ?
- t("Photo \"%title\" added to \"%parent_title\"",
- array("title" => $item->title, "parent_title" => $parent->title)) :
- t("Movie \"%title\" added to \"%parent_title\"",
- array("title" => $item->title, "parent_title" => $parent->title)));
-
- self::_notify($subscribers, $item, $v->render(), $v->subject);
+ foreach (self::get_subscribers($item) as $email => $locale) {
+ $v = new View("item_added.html");
+ $v->item = $item;
+ $v->subject = $item->is_album() ?
+ t("Album \"%title\" added to \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale)) :
+ ($item->is_photo() ?
+ t("Photo \"%title\" added to \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale)) :
+ t("Movie \"%title\" added to \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale)));
+ self::_notify($email, $locale, $item, $v->render(), $v->subject);
+ }
}
static function send_item_deleted($item) {
- $subscribers = self::get_subscribers($item);
- if (!$subscribers) {
- return;
- }
-
$parent = $item->parent();
- $v = new View("item_deleted.html");
- $v->item = $item;
- $v->subject = $item->is_album() ?
- t("Album \"%title\" removed from \"%parent_title\"",
- array("title" => $item->title, "parent_title" => $parent->title)) :
- ($item->is_photo() ?
- t("Photo \"%title\" removed from \"%parent_title\"",
- array("title" => $item->title, "parent_title" => $parent->title))
- : t("Movie \"%title\" removed from \"%parent_title\"",
- array("title" => $item->title, "parent_title" => $parent->title)));
-
- self::_notify($subscribers, $item, $v->render(), $v->subject);
+ foreach (self::get_subscribers($item) as $email => $locale) {
+ $v = new View("item_deleted.html");
+ $v->item = $item;
+ $v->subject = $item->is_album() ?
+ t("Album \"%title\" removed from \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale)) :
+ ($item->is_photo() ?
+ t("Photo \"%title\" removed from \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title, "locale" => $locale))
+ : t("Movie \"%title\" removed from \"%parent_title\"",
+ array("title" => $item->title, "parent_title" => $parent->title,
+ "locale" => $locale)));
+ self::_notify($email, $locale, $item, $v->render(), $v->subject);
+ }
}
static function send_comment_published($comment) {
$item = $comment->item();
- $subscribers = self::get_subscribers($item);
- if (!$subscribers) {
- return;
- }
-
- $v = new View("comment_published.html");
- $v->comment = $comment;
- $v->subject = $item->is_album() ?
- t("A new comment was published for album \"%title\"", array("title" => $item->title)) :
+ foreach (self::get_subscribers($item) as $email => $locale) {
+ $v = new View("comment_published.html");
+ $v->comment = $comment;
+ $v->subject = $item->is_album() ?
+ t("A new comment was published for album \"%title\"",
+ array("title" => $item->title, "locale" => $locale)) :
($item->is_photo() ?
- t("A new comment was published for photo \"%title\"", array("title" => $item->title))
- : t("A new comment was published for movie \"%title\"", array("title" => $item->title)));
-
- self::_notify($subscribers, $item, $v->render(), $v->subject);
+ t("A new comment was published for photo \"%title\"",
+ array("title" => $item->title, "locale" => $locale))
+ : t("A new comment was published for movie \"%title\"",
+ array("title" => $item->title, "locale" => $locale)));
+ self::_notify($email, $locale, $item, $v->render(), $v->subject);
+ }
}
static function send_pending_notifications() {
@@ -191,13 +179,16 @@ class notification {
$pending->delete();
} else {
$text = "";
+ $locale = null;
foreach ($result as $pending) {
$text .= $pending->text;
+ $locale = $pending->locale;
$pending->delete();
}
Sendmail::factory()
->to($email)
- ->subject(t("Multiple events have occurred")) // @todo fix this terrible subject line
+ ->subject(t("New activity for %site_name",
+ array("site_name" => item::root()->title, "locale" => $locale)))
->header("Mime-Version", "1.0")
->header("Content-Type", "text/html; charset=UTF-8")
->message($text)
@@ -206,25 +197,22 @@ class notification {
}
}
- private static function _notify($subscribers, $item, $text, $subject) {
- if (!empty($subscribers)) {
- if (!batch::in_progress()) {
- Sendmail::factory()
- ->to($subscribers)
- ->subject($subject)
- ->header("Mime-Version", "1.0")
- ->header("Content-Type", "text/html; charset=UTF-8")
- ->message($text)
- ->send();
- } else {
- foreach ($subscribers as $subscriber) {
- $pending = ORM::factory("pending_notification");
- $pending->subject = $subject;
- $pending->text = $text;
- $pending->email = $subscriber;
- $pending->save();
- }
- }
+ private static function _notify($email, $locale, $item, $text, $subject) {
+ if (!batch::in_progress()) {
+ Sendmail::factory()
+ ->to($email)
+ ->subject($subject)
+ ->header("Mime-Version", "1.0")
+ ->header("Content-Type", "text/html; charset=UTF-8")
+ ->message($text)
+ ->send();
+ } else {
+ $pending = ORM::factory("pending_notification");
+ $pending->subject = $subject;
+ $pending->text = $text;
+ $pending->email = $email;
+ $pending->locale = $locale;
+ $pending->save();
}
}
}
diff --git a/modules/notification/helpers/notification_installer.php b/modules/notification/helpers/notification_installer.php
index d082d80f..78f72194 100644
--- a/modules/notification/helpers/notification_installer.php
+++ b/modules/notification/helpers/notification_installer.php
@@ -39,6 +39,14 @@ class notification_installer {
module::set_version("notification", 1);
}
+ static function upgrade($version) {
+ $db = Database::instance();
+ if ($version == 1) {
+ $db->query("ALTER TABLE {pending_notifications} ADD COLUMN `locale` char(10) default NULL");
+ module::set_version("notification", $version = 2);
+ }
+ }
+
static function uninstall() {
$db = Database::instance();
$db->query("DROP TABLE IF EXISTS {subscriptions};");
diff --git a/modules/notification/module.info b/modules/notification/module.info
index 31684ccf..8c5e1162 100644
--- a/modules/notification/module.info
+++ b/modules/notification/module.info
@@ -1,3 +1,3 @@
name = "Notification"
description = "Send notifications to users when changes are made to watched albums."
-version = 1
+version = 2
--
cgit v1.2.3
From 8a36c24f39e7a6111f7872ec443e6efa63580c82 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 18:20:46 -0700
Subject: Fix some broken identity APIs: - add_user_to_group and
remove_user_from_group should take Group_Definition instances to be
consistent - add_user_to_group and remove_user_from_group in
drivers/IdentityProvider.php should not be static
---
modules/gallery/helpers/identity.php | 8 ++++----
modules/gallery/libraries/drivers/IdentityProvider.php | 12 ++++++------
modules/user/helpers/group.php | 8 ++++----
modules/user/libraries/drivers/IdentityProvider/Gallery.php | 7 ++-----
4 files changed, 16 insertions(+), 19 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/identity.php b/modules/gallery/helpers/identity.php
index 5de05948..5ca024e9 100644
--- a/modules/gallery/helpers/identity.php
+++ b/modules/gallery/helpers/identity.php
@@ -233,14 +233,14 @@ class identity_Core {
/**
* @see IdentityProvider_Driver::add_user_to_group.
*/
- static function add_user_to_group($user, $group_id) {
- return IdentityProvider::instance()->add_user_to_group($user, $group_id);
+ static function add_user_to_group($user, $group) {
+ return IdentityProvider::instance()->add_user_to_group($user, $group);
}
/**
* @see IdentityProvider_Driver::remove_user_to_group.
*/
- static function remove_user_from_group($user, $group_id) {
- return IdentityProvider::instance()->remove_user_from_group($user, $group_id);
+ static function remove_user_from_group($user, $group) {
+ return IdentityProvider::instance()->remove_user_from_group($user, $group);
}
}
\ No newline at end of file
diff --git a/modules/gallery/libraries/drivers/IdentityProvider.php b/modules/gallery/libraries/drivers/IdentityProvider.php
index 3e85a57b..ac2473f5 100644
--- a/modules/gallery/libraries/drivers/IdentityProvider.php
+++ b/modules/gallery/libraries/drivers/IdentityProvider.php
@@ -116,17 +116,17 @@ interface IdentityProvider_Driver {
/**
* Add the user to the specified group
- * @param User_Definition the user to add to the group
- * @param int the group_id
+ * @param User_Definition the user to add
+ * @param Group_Definition the target group
*/
- static function add_user_to_group($user, $group_id);
+ public function add_user_to_group($user, $group);
/**
* Remove the user to the specified group
- * @param User_Definition the user to add to the group
- * @param int the group id
+ * @param User_Definition the user to remove
+ * @param Group_Definition the owning group
*/
- static function remove_user_from_group($user, $group_id);
+ public function remove_user_from_group($user, $group);
} // End Identity Driver Definition
interface Group_Definition {}
diff --git a/modules/user/helpers/group.php b/modules/user/helpers/group.php
index c84910f1..88bfac35 100644
--- a/modules/user/helpers/group.php
+++ b/modules/user/helpers/group.php
@@ -68,13 +68,13 @@ class group_Core {
*/
private static function _lookup_by_field($field_name, $value) {
try {
- $user = model_cache::get("group", $value, $field_name);
- if ($user->loaded()) {
- return $user;
+ $group = model_cache::get("group", $value, $field_name);
+ if ($group->loaded()) {
+ return $group;
}
} catch (Exception $e) {
if (strpos($e->getMessage(), "MISSING_MODEL") === false) {
- throw $e;
+ throw $e;
}
}
return null;
diff --git a/modules/user/libraries/drivers/IdentityProvider/Gallery.php b/modules/user/libraries/drivers/IdentityProvider/Gallery.php
index 1ed7dd4f..44433ad7 100644
--- a/modules/user/libraries/drivers/IdentityProvider/Gallery.php
+++ b/modules/user/libraries/drivers/IdentityProvider/Gallery.php
@@ -148,9 +148,7 @@ class IdentityProvider_Gallery_Driver implements IdentityProvider_Driver {
/**
* @see IdentityProvider_Driver::add_user_to_group.
*/
- static function add_user_to_group($user, $group_id) {
- $group = self::lookup_group($group_id);
-
+ public function add_user_to_group($user, $group) {
$group->add($user);
$group->save();
}
@@ -158,8 +156,7 @@ class IdentityProvider_Gallery_Driver implements IdentityProvider_Driver {
/**
* @see IdentityProvider_Driver::remove_user_to_group.
*/
- static function remove_user_from_group($user, $group_id) {
- $group = self::lookup_group_by_name($group_id);
+ public function remove_user_from_group($user, $group_id) {
$group->remove($user);
$group->save();
}
--
cgit v1.2.3
From 886b88fccf5de7fb3b17e1f3a2acd539268d1e8b Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 18:49:37 -0700
Subject: Revert "change the Setswana locale from tn_ZA to tn_BW since it's
mostly"
This reverts commit 2d948cb39fd2da6a5f966a10cbeb4f5d5caec5a3.
Valiant said that tn_ZA is right:
http://gallery.menalto.com/node/97840#comment-352865
---
modules/gallery/helpers/locales.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php
index 624ff9cb..1f5473ff 100644
--- a/modules/gallery/helpers/locales.php
+++ b/modules/gallery/helpers/locales.php
@@ -103,7 +103,7 @@ class locales_Core {
$l["sl_SI"] = "Slovenščina"; // Slovenian
$l["sr_CS"] = "Srpski"; // Serbian
$l["sv_SE"] = "Svenska"; // Swedish
- $l["tn_BW"] = "Setswana"; // Setswana
+ $l["tn_ZA"] = "Setswana"; // Setswana
$l["tr_TR"] = "Türkçe"; // Turkish
$l["uk_UA"] = "українська"; // Ukrainian
$l["vi_VN"] = "Tiếng Việt"; // Vietnamese
--
cgit v1.2.3
From 2f810ec12624eefa3eb47ad7174dbbe03936135d Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 19:28:34 -0700
Subject: Add "web_url" with the url to the web version of the item. Fixes
ticket #1341.
---
modules/gallery/models/item.php | 2 ++
1 file changed, 2 insertions(+)
(limited to 'modules')
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 1db766e9..34c22021 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -975,6 +975,8 @@ class Item_Model extends ORM_MPTT {
}
unset($data["album_cover_item_id"]);
+ $data["web_url"] = $this->abs_url();
+
if (access::can("view_full", $this) && !$this->is_album()) {
$data["file_url"] = rest::url("data", $this, "full");
}
--
cgit v1.2.3
From 2f94dfc67c809ae356e5d3e1a5ab21c7ba0a2a27 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 19:40:36 -0700
Subject: Add "Options +FollowSymLinks" to the example mod_rewrite rules and
put it in a textarea for easy copying.
---
modules/g2_import/views/admin_g2_import.html.php | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
(limited to 'modules')
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index 05cbab71..8ec4b5ce 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -99,13 +99,12 @@
= t("Once your migration is complete, put this block at the top of your gallery2/.htaccess file and all Gallery 2 urls will be redirected to Gallery 3") ?>
-
- <IfModule mod_rewrite.c>
- RewriteEngine On
- RewriteBase = html::clean(g2_import::$g2_base_url) ?>
- RewriteRule ^(.*)$ = url::site("g2/map?path=\$1") ?> [QSA,L,R=301]
- </IfModule>
-
+
endif ?>
--
cgit v1.2.3
From fa1fe47b6a0a377929a70748406eae589ecf2a00 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 6 Sep 2010 22:13:41 -0700
Subject: Use the absolute site url when logging out of the admin site else we
wind up with weird url doubling effects. Fixes ticket #1342.
---
modules/gallery/helpers/gallery_event.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index ec7d1882..0ba98025 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -210,7 +210,7 @@ class gallery_event_Core {
->label($user->display_name()));
if (Router::$controller == "admin") {
- $continue_url = url::site("");
+ $continue_url = url::abs_site("");
} else if (isset($theme->item)) {
if (access::user_can(identity::guest(), "view", $theme->item)) {
$continue_url = $theme->item->abs_url();
--
cgit v1.2.3
From d398651c080c18e4f1bf623548091465dac1d528 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Tue, 7 Sep 2010 00:34:41 -0700
Subject: Disable selectFirst in the autocomplete box, which makes it a little
harder to select pre-existing tags, but avoids the problem where we force the
user to pick from existing tags. Fixes ticket #1339
---
modules/tag/views/tag_block.html.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'modules')
diff --git a/modules/tag/views/tag_block.html.php b/modules/tag/views/tag_block.html.php
index 8b887282..cc204c72 100644
--- a/modules/tag/views/tag_block.html.php
+++ b/modules/tag/views/tag_block.html.php
@@ -7,7 +7,8 @@
max: 30,
multiple: true,
multipleSeparator: ',',
- cacheLength: 1
+ cacheLength: 1,
+ selectFirst: false,
}
);
$("#g-add-tag-form").ajaxForm({
@@ -24,4 +25,4 @@
">
= $cloud ?>
-= $form ?>
\ No newline at end of file
+= $form ?>
--
cgit v1.2.3
From b6fa33faf789749f4de3f4eadf8832748372c980 Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Tue, 7 Sep 2010 18:53:17 -0700
Subject: Create a setLocation javascript callback which is called everytime
with the full url of the current album(non-REST). When the dialog is closed
the window location is set to this value and the page gets loaded
appropriately.
---
modules/organize/lib/Gallery3WebClient.swf | Bin 148799 -> 148920 bytes
modules/organize/views/organize_dialog.html.php | 6 +++++-
2 files changed, 5 insertions(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/organize/lib/Gallery3WebClient.swf b/modules/organize/lib/Gallery3WebClient.swf
index b82c8a42..71daa2f9 100644
Binary files a/modules/organize/lib/Gallery3WebClient.swf and b/modules/organize/lib/Gallery3WebClient.swf differ
diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php
index b76813ad..769d6e9a 100644
--- a/modules/organize/views/organize_dialog.html.php
+++ b/modules/organize/views/organize_dialog.html.php
@@ -19,13 +19,17 @@
- ">
- = t("Welcome to the Gallery upgrader. One click and you're done!") ?>
-
+
+
">
+ = t("Welcome to the Gallery upgrader. One click and you're done!") ?>
+
+
+
+ if ($done): ?>
+
+ = t("Upgrade all") ?>
+
+ else: ?>
+
+ endif ?>
+
">
| = t("Module name") ?> |
@@ -68,7 +99,7 @@
foreach ($available as $id => $module): ?>
if ($module->active): ?>
-
" >
+
= in_array($id, $failed) ? "failed" : "" ?>" >
|
= t($module->name) ?>
|
@@ -85,18 +116,6 @@
endforeach ?>
- if ($done): ?>
-
- = t("Upgrade all") ?>
-
- else: ?>
-
- endif ?>
-
if (@$inactive): ?>
">
= t("The following modules are inactive and don't require an upgrade.") ?>
--
cgit v1.2.3
From cbb6967405569606de3b67e1f1dcde2ed8d6bb03 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 8 Sep 2010 20:59:40 -0700
Subject: Detect out-of-date modules and put up a message for site admins.
Fixes ticket #1353.
---
modules/gallery/controllers/admin_modules.php | 5 +++++
modules/gallery/controllers/upgrader.php | 3 +++
modules/gallery/helpers/module.php | 4 ++++
3 files changed, 12 insertions(+)
(limited to 'modules')
diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php
index f5af9a5a..650b7e9e 100644
--- a/modules/gallery/controllers/admin_modules.php
+++ b/modules/gallery/controllers/admin_modules.php
@@ -95,12 +95,17 @@ class Admin_Modules_Controller extends Admin_Controller {
$activated_names[] = t($info->name);
}
} catch (Exception $e) {
+ message::warning(t("An error occurred while installing the %module_name module",
+ array("module_name" => $info->name)));
Kohana_Log::add("error", (string)$e);
}
}
module::event("module_change", $changes);
+ // If modules need upgrading, this will get recreated
+ site_status::clear("upgrade_now");
+
// @todo this type of collation is questionable from an i18n perspective
if ($activated_names) {
message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php
index a3cfac48..6613d671 100644
--- a/modules/gallery/controllers/upgrader.php
+++ b/modules/gallery/controllers/upgrader.php
@@ -83,6 +83,9 @@ class Upgrader_Controller extends Controller {
}
}
+ // If the upgrade failed, this will get recreated
+ site_status::clear("upgrade_now");
+
if (php_sapi_name() == "cli") {
print "Upgrade complete\n";
} else {
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index be9c4249..7863520e 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -99,6 +99,10 @@ class module_Core {
$m->code_version = $m->version;
$m->version = self::get_version($module_name);
$m->locked = false;
+
+ if ($m->active && $m->version != $m->code_version) {
+ site_status::warning(t("Some of your modules are out of date. Upgrade now!", array("upgrader_url" => url::site("upgrader"))), "upgrade_now");
+ }
}
// Lock certain modules
--
cgit v1.2.3
From fe3dd6b55d4a820a2b33de5a883c2f64112cfbd4 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 8 Sep 2010 21:12:20 -0700
Subject: Add information about disabling XCache during the import process.
Fixes ticket #1352.
---
modules/g2_import/views/admin_g2_import.html.php | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
(limited to 'modules')
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index 8ec4b5ce..7a6f88ce 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -8,8 +8,6 @@
= t("Notes") ?>
-
- = t("The import process is a work in progress with some known issues:") ?>
-
@@ -22,7 +20,7 @@
= t("Deactivating the notification, search and exif modules during your import will make it go faster.") ?>
-
- = t("The eAccelerator PHP performance extension is known to cause issues. If you're using eAccelerator and having problems, please disable it while you do your import. One way to do that is to put
php_value eaccelerator.enable 0 in gallery3/.htaccess") ?>
+ = t("The eAccelerator and XCache PHP performance extensions are known to cause issues. If you're using either of those and are having problems, please disable them while you do your import. Add the following lines: %lines
to gallery3/.htaccess and remove them when the import is done.", array("lines" => "\n\n php_value eaccelerator.enable 0\n php_value xcache.cacher off\n php_value xcache.optimizer off\n\n")) ?>
--
cgit v1.2.3
From 5cd34160af2fa1d4499d98aaa807712995082a20 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 8 Sep 2010 21:34:16 -0700
Subject: Remove unnecessary g2_import CSS (which we were loading on every page
-- doh!) and replace it with a new "enumeration" list style in the admin_wind
CSS. Reshuffle the page a little bit to make it look cleaner.
---
modules/g2_import/css/g2_import.css | 30 -------
modules/g2_import/helpers/g2_import_theme.php | 28 ------
modules/g2_import/views/admin_g2_import.html.php | 107 ++++++++++++-----------
themes/admin_wind/css/screen.css | 5 ++
4 files changed, 60 insertions(+), 110 deletions(-)
delete mode 100644 modules/g2_import/css/g2_import.css
delete mode 100644 modules/g2_import/helpers/g2_import_theme.php
(limited to 'modules')
diff --git a/modules/g2_import/css/g2_import.css b/modules/g2_import/css/g2_import.css
deleted file mode 100644
index d53564d7..00000000
--- a/modules/g2_import/css/g2_import.css
+++ /dev/null
@@ -1,30 +0,0 @@
-#g-admin-g2-import-notes {
- padding-bottom: 20px;
-}
-
-#g-admin-g2-import-details {
- padding-top: 20px;
-}
-
-#g-admin-g2-import-details .g-warning {
- margin-top: 4px;
-}
-
-#g-admin-g2-import-details .g-info {
- padding: 2px;
- border: 1px solid #999;
- margin-bottom: 10px;
-}
-
-#g-admin-g2-import-notes p,
-#g-admin-g2-import-details .g-info p {
- padding: 0;
- margin: 0;
-}
-
-#g-admin-g2-import-notes ul li,
-#g-admin-g2-import .g-info ul li {
- padding-left: 0;
- margin-left: 20px;
- list-style-type: disc;
-}
diff --git a/modules/g2_import/helpers/g2_import_theme.php b/modules/g2_import/helpers/g2_import_theme.php
deleted file mode 100644
index 788253f9..00000000
--- a/modules/g2_import/helpers/g2_import_theme.php
+++ /dev/null
@@ -1,28 +0,0 @@
-css("g2_import.css");
- }
-
- static function admin_head($theme) {
- $theme->css("g2_import.css");
- }
-}
\ No newline at end of file
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index 7a6f88ce..a1ee53f6 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -6,27 +6,10 @@
-
-
= t("Notes") ?>
-
-
- -
- = t("Gallery 3 does not support per-user / per-item permissions. Review permissions after your import is done.") ?>
-
- -
- = t("The only supported file formats are JPG, PNG and GIF, FLV and MP4. Other formats will be skipped.") ?>
-
- -
- = t("Deactivating the notification, search and exif modules during your import will make it go faster.") ?>
-
- -
- = t("The eAccelerator and XCache PHP performance extensions are known to cause issues. If you're using either of those and are having problems, please disable them while you do your import. Add the following lines:
%lines
to gallery3/.htaccess and remove them when the import is done.", array("lines" => "\n\n php_value eaccelerator.enable 0\n php_value xcache.cacher off\n php_value xcache.optimizer off\n\n")) ?>
-
-
-
-
= $form ?>
+
+
if (g2_import::is_initialized()): ?>
= t("Import") ?>
@@ -51,59 +34,79 @@
"url" => html::mark_clean(url::site("admin/theme_options")))) ?>
endif ?>
-
-
-
+
= t("Your Gallery 2 has the following importable data in it") ?>
-
-
- -
- = t2("1 user", "%count users", $g2_stats["users"]) ?>
-
- -
- = t2("1 group", "%count groups", $g2_stats["groups"]) ?>
-
- -
- = t2("1 album", "%count albums", $g2_stats["albums"]) ?>
-
+
+ -
+ = t2("1 user", "%count users", $g2_stats["users"]) ?>
+
+ -
+ = t2("1 group", "%count groups", $g2_stats["groups"]) ?>
+
+ -
+ = t2("1 album", "%count albums", $g2_stats["albums"]) ?>
+
+ -
+ = t2("1 photo", "%count photos", $g2_stats["photos"]) ?>
+
+ -
+ = t2("1 movie", "%count movies", $g2_stats["movies"]) ?>
+
+ -
+ = t2("1 comment", "%count comments", $g2_stats["comments"]) ?>
+
+ -
+ = t2("1 tagged photo/movie/album",
+ "%count tagged photos/movies/albums", $g2_stats["tags"]) ?>
+
+
+
+
+
+
+ ">
+ = t("Begin import!") ?>
+
+
+
+
+
+
+
= t("Notes") ?>
+
-
- = t2("1 photo", "%count photos", $g2_stats["photos"]) ?>
+ = t("Gallery 3 does not support per-user / per-item permissions. Review permissions after your import is done.") ?>
-
- = t2("1 movie", "%count movies", $g2_stats["movies"]) ?>
+ = t("The only supported file formats are JPG, PNG and GIF, FLV and MP4. Other formats will be skipped.") ?>
-
- = t2("1 comment", "%count comments", $g2_stats["comments"]) ?>
+ = t("Deactivating the notification, search and exif modules during your import will make it go faster.") ?>
-
- = t2("1 tagged photo/movie/album",
- "%count tagged photos/movies/albums", $g2_stats["tags"]) ?>
+ = t("The eAccelerator and XCache PHP performance extensions are known to cause issues. If you're using either of those and are having problems, please disable them while you do your import. Add the following lines:
%lines
to gallery3/.htaccess and remove them when the import is done.", array("lines" => "\n\n php_value eaccelerator.enable 0\n php_value xcache.cacher off\n php_value xcache.optimizer off\n\n")) ?>
-
-
- ">
- = t("Begin import!") ?>
-
-
-
-
= t("Migrating from Gallery 2") ?>
-
- = t("Once your migration is complete, put this block at the top of your gallery2/.htaccess file and all Gallery 2 urls will be redirected to Gallery 3") ?>
-
+
+
+
= t("Migrating from Gallery 2") ?>
+
+ = t("Once your migration is complete, put this block at the top of your gallery2/.htaccess file and all Gallery 2 urls will be redirected to Gallery 3") ?>
+
-
+ endif ?>
- endif ?>
diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css
index eda79b97..0d891149 100644
--- a/themes/admin_wind/css/screen.css
+++ b/themes/admin_wind/css/screen.css
@@ -222,6 +222,11 @@ th {
background-color: #fff;
}
+ul.enumeration li {
+ list-style-type: disc;
+ margin-left: 20px;
+}
+
/*** ******************************************************************
* 3) Page layout containers
*********************************************************************/
--
cgit v1.2.3
From 36f3a0387ddc484ebe867cf284aaf05f6ce6e5e1 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 8 Sep 2010 21:39:35 -0700
Subject: Tighten up the "your gallery2 has xxx in it" info display.
---
modules/g2_import/views/admin_g2_import.html.php | 36 ++++++++----------------
1 file changed, 11 insertions(+), 25 deletions(-)
(limited to 'modules')
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index a1ee53f6..564bea9f 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -36,31 +36,17 @@
endif ?>
- = t("Your Gallery 2 has the following importable data in it") ?>
-
- -
- = t2("1 user", "%count users", $g2_stats["users"]) ?>
-
- -
- = t2("1 group", "%count groups", $g2_stats["groups"]) ?>
-
- -
- = t2("1 album", "%count albums", $g2_stats["albums"]) ?>
-
- -
- = t2("1 photo", "%count photos", $g2_stats["photos"]) ?>
-
- -
- = t2("1 movie", "%count movies", $g2_stats["movies"]) ?>
-
- -
- = t2("1 comment", "%count comments", $g2_stats["comments"]) ?>
-
- -
- = t2("1 tagged photo/movie/album",
- "%count tagged photos/movies/albums", $g2_stats["tags"]) ?>
-
-
+ = t("Your Gallery 2 has the following importable data in it:") ?>
+
+ = t2("1 user", "%count users", $g2_stats["users"]) ?>,
+ = t2("1 group", "%count groups", $g2_stats["groups"]) ?>,
+ = t2("1 album", "%count albums", $g2_stats["albums"]) ?>,
+ = t2("1 photo", "%count photos", $g2_stats["photos"]) ?>,
+ = t2("1 movie", "%count movies", $g2_stats["movies"]) ?>,
+ = t2("1 comment", "%count comments", $g2_stats["comments"]) ?>,
+ = t2("1 tagged photo/movie/album",
+ "%count tagged photos/movies/albums", $g2_stats["tags"]) ?>
+
--
cgit v1.2.3
From 91d4ffa68068dd194f3b789ab6cbc8f1aabe7627 Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Thu, 9 Sep 2010 20:36:18 -0700
Subject: Change the color of the text in the close button to match the
foreground color not the border color.
---
modules/organize/lib/Gallery3WebClient.swf | Bin 148920 -> 148926 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
(limited to 'modules')
diff --git a/modules/organize/lib/Gallery3WebClient.swf b/modules/organize/lib/Gallery3WebClient.swf
index 71daa2f9..356a1a2f 100644
Binary files a/modules/organize/lib/Gallery3WebClient.swf and b/modules/organize/lib/Gallery3WebClient.swf differ
--
cgit v1.2.3
From d698a19e0e9acdcb81c5245d1f681546b604a1f3 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Fri, 10 Sep 2010 08:40:30 -0700
Subject: Transfer deleted files to the active user. Or at least say that's
what we're going to do, we actually transfer them to one of the admins
---
modules/user/views/admin_users_delete_user.html.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/user/views/admin_users_delete_user.html.php b/modules/user/views/admin_users_delete_user.html.php
index 4b79a305..44777ae5 100644
--- a/modules/user/views/admin_users_delete_user.html.php
+++ b/modules/user/views/admin_users_delete_user.html.php
@@ -1,7 +1,7 @@
- = t("Really delete %name? Any photos, movies or albums owned by this user will transfer ownership to %new_owner.", array("name" => $user->display_name(), "new_owner" => identity::admin_user()->display_name())) ?>
+ = t("Really delete %name? Any photos, movies or albums owned by this user will transfer ownership to %new_owner.", array("name" => $user->display_name(), "new_owner" => identity::active_user()->display_name())) ?>
= $form ?>
--
cgit v1.2.3
From 5892712b237cb1e585b2cc7a6820d2cf3a8c1a34 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Fri, 10 Sep 2010 23:01:47 -0700
Subject: If the user is not an admin, don't 403 -- instead just redirect them
to the root album. Fixes ticket #1356.
---
modules/gallery/controllers/reauthenticate.php | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/controllers/reauthenticate.php b/modules/gallery/controllers/reauthenticate.php
index 0486c0fe..53a96374 100644
--- a/modules/gallery/controllers/reauthenticate.php
+++ b/modules/gallery/controllers/reauthenticate.php
@@ -19,12 +19,19 @@
*/
class Reauthenticate_Controller extends Controller {
public function index() {
+ $is_ajax = Session::instance()->get_once("is_ajax_request", request::is_ajax());
if (!identity::active_user()->admin) {
- access::forbidden();
+ if ($is_ajax) {
+ // We should never be able to get here since Admin_Controller::_reauth_check() won't work
+ // for non-admins.
+ access::forbidden();
+ } else {
+ url::redirect(item::root()->abs_url());
+ }
}
+
// On redirects from the admin controller, the ajax request indicator is lost,
// so we store it in the session.
- $is_ajax = Session::instance()->get_once("is_ajax_request", request::is_ajax());
if ($is_ajax) {
$v = new View("reauthenticate.html");
$v->form = self::_form();
--
cgit v1.2.3
From a88b3f580812e7670933a6d695c89ef93f0142d4 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 00:47:48 -0700
Subject: Implement IdentityProvider_Gallery_Driver::admin_user() properly such
that it's not hardcoded to return the user with id 2. Create
user::admin_user() which finds an appropriate admin and returns it. Fixes
#1358.
---
modules/user/helpers/user.php | 14 ++++++++++++++
.../user/libraries/drivers/IdentityProvider/Gallery.php | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php
index 55153263..be50d6d1 100644
--- a/modules/user/helpers/user.php
+++ b/modules/user/helpers/user.php
@@ -35,6 +35,20 @@ class user_Core {
return model_cache::get("user", 1);
}
+ /**
+ * Return an admin user. Prefer the currently logged in user, if possible.
+ *
+ * @return User_Model
+ */
+ static function admin_user() {
+ $active = identity::active_user();
+ if ($active->admin) {
+ return $active;
+ }
+
+ return ORM::factory("user")->where("admin", "=", 1)->order_by("id", "ASC")->find();
+ }
+
/**
* Is the password provided correct?
*
diff --git a/modules/user/libraries/drivers/IdentityProvider/Gallery.php b/modules/user/libraries/drivers/IdentityProvider/Gallery.php
index 44433ad7..73ac9bd0 100644
--- a/modules/user/libraries/drivers/IdentityProvider/Gallery.php
+++ b/modules/user/libraries/drivers/IdentityProvider/Gallery.php
@@ -32,7 +32,7 @@ class IdentityProvider_Gallery_Driver implements IdentityProvider_Driver {
* @see IdentityProvider_Driver::guest.
*/
public function admin_user() {
- return self::lookup_user(2);
+ return user::admin_user();
}
/**
--
cgit v1.2.3
From 67f45cfa781ef4b446676e199470e421f5463812 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 01:46:45 -0700
Subject: Add CSRF protection to the upgrader. And update the CLI output so
that it tells you which modules failed to upgrade properly. Fixes ticket
#1359.
---
modules/gallery/controllers/upgrader.php | 21 ++++++++++++++++++---
modules/gallery/views/upgrader.html.php | 2 +-
2 files changed, 19 insertions(+), 4 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php
index 6613d671..b2646874 100644
--- a/modules/gallery/controllers/upgrader.php
+++ b/modules/gallery/controllers/upgrader.php
@@ -54,8 +54,16 @@ class Upgrader_Controller extends Controller {
// @todo this may screw up some module installers, but we don't have a better answer at
// this time.
$_SERVER["HTTP_HOST"] = "example.com";
- } else if (!identity::active_user()->admin && !Session::instance()->get("can_upgrade", false)) {
- access::forbidden();
+ } else {
+ if (!identity::active_user()->admin && !Session::instance()->get("can_upgrade", false)) {
+ access::forbidden();
+ }
+
+ try {
+ access::verify_csrf();
+ } catch (Exception $e) {
+ url::redirect("upgrader");
+ }
}
$available = module::available();
@@ -87,7 +95,14 @@ class Upgrader_Controller extends Controller {
site_status::clear("upgrade_now");
if (php_sapi_name() == "cli") {
- print "Upgrade complete\n";
+ if ($failed) {
+ print "Upgrade completed ** WITH FAILURES **\n";
+ print "The following modules were not successfully upgraded:\n";
+ print " " . implode($failed, "\n ") . "\n";
+ print "Try getting newer versions or deactivating those modules\n";
+ } else {
+ print "Upgrade complete\n";
+ }
} else {
url::redirect("upgrader?failed=" . join(",", $failed));
}
diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php
index c2d8a552..554cf30d 100644
--- a/modules/gallery/views/upgrader.html.php
+++ b/modules/gallery/views/upgrader.html.php
@@ -84,7 +84,7 @@
else: ?>
--
cgit v1.2.3
From 509b647c65d0b56760952ff886eed06625f4ac5f Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 01:48:26 -0700
Subject: upgrader/index does not require CSRF
---
modules/gallery/tests/controller_auth_data.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt
index 212577c7..03032fd9 100644
--- a/modules/gallery/tests/controller_auth_data.txt
+++ b/modules/gallery/tests/controller_auth_data.txt
@@ -15,7 +15,7 @@ modules/gallery/controllers/login.php html
modules/gallery/controllers/login.php auth_html DIRTY_AUTH
modules/gallery/controllers/logout.php index DIRTY_AUTH
modules/gallery/controllers/quick.php form_edit DIRTY_CSRF
-modules/gallery/controllers/upgrader.php index DIRTY_AUTH
+modules/gallery/controllers/upgrader.php index DIRTY_CSRF|DIRTY_AUTH
modules/gallery/controllers/uploader.php start DIRTY_AUTH
modules/gallery/controllers/uploader.php status DIRTY_AUTH
modules/gallery/controllers/uploader.php finish DIRTY_AUTH
--
cgit v1.2.3
From 34a71e7cd34bc184abbf9060ec4b316ba1c66bc5 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 01:48:44 -0700
Subject: Verified.
---
modules/gallery/tests/xss_data.txt | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index 8d26092b..6821c963 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -42,7 +42,7 @@ modules/digibug/views/digibug_form.html.php 4 DIRTY form::
modules/digibug/views/digibug_form.html.php 6 DIRTY form::hidden($key,$value)
modules/exif/views/exif_dialog.html.php 14 DIRTY $details[$i]["caption"]
modules/exif/views/exif_dialog.html.php 21 DIRTY $details[$i]["caption"]
-modules/g2_import/views/admin_g2_import.html.php 30 DIRTY $form
+modules/g2_import/views/admin_g2_import.html.php 9 DIRTY $form
modules/gallery/views/admin_advanced_settings.html.php 21 DIRTY_ATTR text::alternate("g-odd","g-even")
modules/gallery/views/admin_advanced_settings.html.php 22 DIRTY $var->module_name
modules/gallery/views/admin_block_log_entries.html.php 4 DIRTY_ATTR log::severity_class($entry->severity)
@@ -248,14 +248,15 @@ modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $permi
modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $item->id
modules/gallery/views/quick_delete_confirm.html.php 11 DIRTY $form
modules/gallery/views/reauthenticate.html.php 9 DIRTY $form
-modules/gallery/views/upgrader.html.php 59 DIRTY_ATTR $done?"muted":""
-modules/gallery/views/upgrader.html.php 63 DIRTY_ATTR $done?"muted":""
-modules/gallery/views/upgrader.html.php 71 DIRTY_ATTR $module->version==$module->code_version?"current":"upgradeable"
-modules/gallery/views/upgrader.html.php 72 DIRTY_ATTR $id
-modules/gallery/views/upgrader.html.php 76 DIRTY $module->version
-modules/gallery/views/upgrader.html.php 79 DIRTY $module->code_version
-modules/gallery/views/upgrader.html.php 101 DIRTY_ATTR $done?"muted":""
-modules/gallery/views/upgrader.html.php 104 DIRTY_ATTR $done?"muted":""
+modules/gallery/views/upgrader.html.php 76 DIRTY_ATTR $done?"muted":""
+modules/gallery/views/upgrader.html.php 94 DIRTY_ATTR $done?"muted":""
+modules/gallery/views/upgrader.html.php 102 DIRTY_ATTR $module->version==$module->code_version?"current":"upgradeable"
+modules/gallery/views/upgrader.html.php 102 DIRTY_ATTR in_array($id,$failed)?"failed":""
+modules/gallery/views/upgrader.html.php 103 DIRTY_ATTR $id
+modules/gallery/views/upgrader.html.php 107 DIRTY $module->version
+modules/gallery/views/upgrader.html.php 110 DIRTY $module->code_version
+modules/gallery/views/upgrader.html.php 120 DIRTY_ATTR $done?"muted":""
+modules/gallery/views/upgrader.html.php 123 DIRTY_ATTR $done?"muted":""
modules/gallery/views/user_languages_block.html.php 2 DIRTY form::dropdown("g-select-session-locale",$installed_locales,$selected)
modules/gallery/views/user_profile.html.php 34 DIRTY_ATTR $user->avatar_url(40,$theme->url(,true))
modules/gallery/views/user_profile.html.php 43 DIRTY $info->view
@@ -338,15 +339,17 @@ modules/tag/views/tag_cloud.html.php 6 DIRTY_JS $tag->
modules/user/views/admin_users.html.php 3 DIRTY_JS url::site("admin/users/add_user_to_group/__USERID__/__GROUPID__?csrf=$csrf")
modules/user/views/admin_users.html.php 26 DIRTY_JS url::site("admin/users/group/__GROUPID__")
modules/user/views/admin_users.html.php 36 DIRTY_JS url::site("admin/users/remove_user_from_group/__USERID__/__GROUPID__?csrf=$csrf")
-modules/user/views/admin_users.html.php 71 DIRTY_ATTR $user->id
-modules/user/views/admin_users.html.php 71 DIRTY_ATTR text::alternate("g-odd","g-even")
-modules/user/views/admin_users.html.php 71 DIRTY_ATTR $user->admin?"g-admin":""
modules/user/views/admin_users.html.php 72 DIRTY_ATTR $user->id
-modules/user/views/admin_users.html.php 73 DIRTY_ATTR $user->avatar_url(20,$theme->url(,true))
-modules/user/views/admin_users.html.php 87 DIRTY ($user->last_login==0)?"":gallery::date($user->last_login)
-modules/user/views/admin_users.html.php 123 DIRTY_ATTR $group->id
-modules/user/views/admin_users.html.php 123 DIRTY_ATTR ($group->special?"g-default-group":"")
-modules/user/views/admin_users.html.php 125 DIRTY $v
+modules/user/views/admin_users.html.php 72 DIRTY_ATTR text::alternate("g-odd","g-even")
+modules/user/views/admin_users.html.php 72 DIRTY_ATTR $user->admin?"g-admin":""
+modules/user/views/admin_users.html.php 73 DIRTY_ATTR $user->id
+modules/user/views/admin_users.html.php 74 DIRTY_ATTR $user->avatar_url(20,$theme->url(,true))
+modules/user/views/admin_users.html.php 88 DIRTY ($user->last_login==0)?"":gallery::date($user->last_login)
+modules/user/views/admin_users.html.php 91 DIRTY db::build()->from("items")->where("owner_id","=",$user->id)->count_records()
+modules/user/views/admin_users.html.php 127 DIRTY_ATTR $group->id
+modules/user/views/admin_users.html.php 127 DIRTY_ATTR ($group->special?"g-default-group":"")
+modules/user/views/admin_users.html.php 129 DIRTY $v
+modules/user/views/admin_users_delete_user.html.php 6 DIRTY $form
modules/user/views/admin_users_group.html.php 24 DIRTY_JS $user->id
modules/user/views/admin_users_group.html.php 24 DIRTY_JS $group->id
modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $width
--
cgit v1.2.3
From cef7ca9cf27dc7bcdbc92e754cfe9ae3a30ae3b0 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 10:26:48 -0700
Subject: Change tag url form to be /tag/{name} from /tags/show/{id}. This is
a much friendlier url format. Fixes ticket #1363.
---
modules/tag/controllers/tag.php | 49 ++++++++++++++++++++++++++++++++++++++++
modules/tag/controllers/tags.php | 28 -----------------------
modules/tag/models/tag.php | 2 +-
3 files changed, 50 insertions(+), 29 deletions(-)
create mode 100644 modules/tag/controllers/tag.php
(limited to 'modules')
diff --git a/modules/tag/controllers/tag.php b/modules/tag/controllers/tag.php
new file mode 100644
index 00000000..0e924f3d
--- /dev/null
+++ b/modules/tag/controllers/tag.php
@@ -0,0 +1,49 @@
+where("name", "=", $tag_name)->find();
+ $page_size = module::get_var("gallery", "page_size", 9);
+ $page = (int) Input::instance()->get("page", "1");
+ $children_count = $tag->items_count();
+ $offset = ($page-1) * $page_size;
+ $max_pages = max(ceil($children_count / $page_size), 1);
+
+ // Make sure that the page references a valid offset
+ if ($page < 1) {
+ url::redirect($album->abs_url());
+ } else if ($page > $max_pages) {
+ url::redirect($album->abs_url("page=$max_pages"));
+ }
+
+ $template = new Theme_View("page.html", "collection", "tag");
+ $template->set_global("page", $page);
+ $template->set_global("max_pages", $max_pages);
+ $template->set_global("page_size", $page_size);
+ $template->set_global("tag", $tag);
+ $template->set_global("children", $tag->items($page_size, $offset));
+ $template->set_global("children_count", $children_count);
+ $template->content = new View("dynamic.html");
+ $template->content->title = t("Tag: %tag_name", array("tag_name" => $tag->name));
+
+ print $template;
+ }
+}
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php
index bc657644..aa39b6cd 100644
--- a/modules/tag/controllers/tags.php
+++ b/modules/tag/controllers/tags.php
@@ -18,34 +18,6 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Tags_Controller extends Controller {
- public function show($tag_id) {
- $tag = ORM::factory("tag", $tag_id);
- $page_size = module::get_var("gallery", "page_size", 9);
- $page = (int) Input::instance()->get("page", "1");
- $children_count = $tag->items_count();
- $offset = ($page-1) * $page_size;
- $max_pages = max(ceil($children_count / $page_size), 1);
-
- // Make sure that the page references a valid offset
- if ($page < 1) {
- url::redirect($album->abs_url());
- } else if ($page > $max_pages) {
- url::redirect($album->abs_url("page=$max_pages"));
- }
-
- $template = new Theme_View("page.html", "collection", "tag");
- $template->set_global("page", $page);
- $template->set_global("max_pages", $max_pages);
- $template->set_global("page_size", $page_size);
- $template->set_global("tag", $tag);
- $template->set_global("children", $tag->items($page_size, $offset));
- $template->set_global("children_count", $children_count);
- $template->content = new View("dynamic.html");
- $template->content->title = t("Tag: %tag_name", array("tag_name" => $tag->name));
-
- print $template;
- }
-
public function index() {
// Far from perfection, but at least require view permission for the root album
$album = ORM::factory("item", 1);
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php
index e8bd69c5..269a0f39 100644
--- a/modules/tag/models/tag.php
+++ b/modules/tag/models/tag.php
@@ -124,7 +124,7 @@ class Tag_Model extends ORM {
* @param string $query the query string (eg "page=3")
*/
public function url($query=null) {
- $url = url::site("tags/show/$this->id");
+ $url = url::site("tag/{$this->name}");
if ($query) {
$url .= "?$query";
}
--
cgit v1.2.3
From 14ae1fde25eb8b22a2fc92453ba12c8e74aba433 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 10:41:47 -0700
Subject: Use the actual csrf token, not the placeholder (url::site doesn't
replace that). Fixes ticket #1361
---
modules/gallery/views/upgrader.html.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php
index 554cf30d..1ec49c77 100644
--- a/modules/gallery/views/upgrader.html.php
+++ b/modules/gallery/views/upgrader.html.php
@@ -84,7 +84,7 @@
else: ?>
--
cgit v1.2.3
From c9c4f96100c5c8304f337f720da2e96b0a4d524a Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 21:35:51 -0700
Subject: Tune timeouts to work better on large installs.
---
modules/exif/helpers/exif_task.php | 4 ++--
modules/search/helpers/search_task.php | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'modules')
diff --git a/modules/exif/helpers/exif_task.php b/modules/exif/helpers/exif_task.php
index a754865a..5963d03f 100644
--- a/modules/exif/helpers/exif_task.php
+++ b/modules/exif/helpers/exif_task.php
@@ -50,7 +50,7 @@ class exif_task_Core {
->where("exif_records.item_id", "IS", null)
->or_where("exif_records.dirty", "=", 1)
->close()
- ->find_all() as $item) {
+ ->find_all(100) as $item) {
// The query above can take a long time, so start the timer after its done
// to give ourselves a little time to actually process rows.
if (!isset($start)) {
@@ -60,7 +60,7 @@ class exif_task_Core {
exif::extract($item);
$completed++;
- if (microtime(true) - $start > 1.5) {
+ if (microtime(true) - $start > .75) {
break;
}
}
diff --git a/modules/search/helpers/search_task.php b/modules/search/helpers/search_task.php
index 08f75d66..48a6688b 100644
--- a/modules/search/helpers/search_task.php
+++ b/modules/search/helpers/search_task.php
@@ -47,7 +47,7 @@ class search_task_Core {
->join("search_records", "items.id", "search_records.item_id", "left")
->where("search_records.item_id", "IS", null)
->or_where("search_records.dirty", "=", 1)
- ->find_all() as $item) {
+ ->find_all(100) as $item) {
// The query above can take a long time, so start the timer after its done
// to give ourselves a little time to actually process rows.
if (!isset($start)) {
@@ -57,7 +57,7 @@ class search_task_Core {
search::update($item);
$completed++;
- if (microtime(true) - $start > 1.5) {
+ if (microtime(true) - $start > .75) {
break;
}
}
--
cgit v1.2.3
From bfd92ac6f2d563106bc5906cc9fddb35bca44b58 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 21:38:38 -0700
Subject: Use $theme->item() instead of $theme->item, otherwise
isset($theme->item) may return true even when we don't have an actual
Item_Model in there.
---
modules/gallery/helpers/gallery_event.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 0ba98025..81659b38 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -209,11 +209,12 @@ class gallery_event_Core {
->url(user_profile::url($user->id))
->label($user->display_name()));
+ $item = $theme->item();
if (Router::$controller == "admin") {
$continue_url = url::abs_site("");
- } else if (isset($theme->item)) {
+ } else if ($item) {
if (access::user_can(identity::guest(), "view", $theme->item)) {
- $continue_url = $theme->item->abs_url();
+ $continue_url = $item->abs_url();
} else {
$continue_url = item::root()->abs_url();
}
--
cgit v1.2.3
From b4fb11f8d5f06aed612ea9d9c9699ce31e55b957 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 21:40:57 -0700
Subject: Only call $theme->item() if we're in a non admin theme.
---
modules/gallery/helpers/gallery_event.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 81659b38..5b1db987 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -209,10 +209,9 @@ class gallery_event_Core {
->url(user_profile::url($user->id))
->label($user->display_name()));
- $item = $theme->item();
if (Router::$controller == "admin") {
$continue_url = url::abs_site("");
- } else if ($item) {
+ } else if ($item = $theme->item()) {
if (access::user_can(identity::guest(), "view", $theme->item)) {
$continue_url = $item->abs_url();
} else {
--
cgit v1.2.3
From cc4a54a3d65d5a6772cbf2d9670a0af0d6d52542 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 11 Sep 2010 22:18:53 -0700
Subject: Fix bug introduced in b6fa33faf789749f4de3f4eadf8832748372c980.
Don't try to use $(this).data("reload.location") if it hasn't been set, which
can happen if Flash isn't available. Fixes #1362
---
modules/organize/views/organize_dialog.html.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php
index 769d6e9a..3ea1143d 100644
--- a/modules/organize/views/organize_dialog.html.php
+++ b/modules/organize/views/organize_dialog.html.php
@@ -19,7 +19,11 @@