summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/access.php1
-rw-r--r--modules/gallery/helpers/gallery.php15
-rw-r--r--modules/gallery/helpers/gallery_event.php2
-rw-r--r--modules/gallery/helpers/gallery_rss.php10
-rw-r--r--modules/gallery/helpers/identity.php8
-rw-r--r--modules/gallery/helpers/locales.php1
-rw-r--r--modules/gallery/helpers/module.php12
7 files changed, 37 insertions, 12 deletions
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);
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";
+ }
}
}
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();
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/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/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
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;
+ }
+ }
}
}