summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-09-07 18:53:25 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-09-07 18:53:25 -0700
commit5a26dd542a3cb4974870bcfeec4864d1daa616c4 (patch)
treedede0baa9ba893a4987bffc7ddaf925694e5ddde
parentb6fa33faf789749f4de3f4eadf8832748372c980 (diff)
parentd398651c080c18e4f1bf623548091465dac1d528 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
-rw-r--r--.htaccess1
-rw-r--r--installer/cli.php2
-rw-r--r--lib/gallery.common.js3
-rw-r--r--modules/comment/helpers/comment_rss.php10
-rw-r--r--modules/g2_import/views/admin_g2_import.html.php13
-rw-r--r--modules/gallery/controllers/items.php9
-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
-rw-r--r--modules/gallery/libraries/Gallery_I18n.php6
-rw-r--r--modules/gallery/libraries/drivers/IdentityProvider.php12
-rw-r--r--modules/gallery/models/item.php2
-rw-r--r--modules/gallery/tests/controller_auth_data.txt1
-rw-r--r--modules/gallery/tests/xss_data.txt90
-rw-r--r--modules/gallery/views/admin_maintenance.html.php15
-rw-r--r--modules/gallery/views/admin_maintenance_task.html.php20
-rw-r--r--modules/notification/helpers/notification.php156
-rw-r--r--modules/notification/helpers/notification_installer.php8
-rw-r--r--modules/notification/module.info2
-rw-r--r--modules/tag/helpers/tag_rss.php3
-rw-r--r--modules/tag/views/tag_block.html.php5
-rw-r--r--modules/user/helpers/group.php8
-rw-r--r--modules/user/libraries/drivers/IdentityProvider/Gallery.php7
-rw-r--r--themes/admin_wind/css/screen.css3
-rw-r--r--themes/wind/views/page.html.php4
-rw-r--r--themes/wind/views/photo.html.php15
30 files changed, 259 insertions, 185 deletions
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.
#
# <IfModule mod_rewrite.c>
+# Options +FollowSymLinks
# RewriteEngine On
# RewriteBase /
# RewriteCond %{REQUEST_FILENAME} !-f
diff --git a/installer/cli.php b/installer/cli.php
index e7c81ac3..fe82395a 100644
--- a/installer/cli.php
+++ b/installer/cli.php
@@ -32,7 +32,7 @@ if (installer::already_installed()) {
$errors = installer::check_environment();
if ($errors) {
- oops(implode("errors", "\n"));
+ oops(implode($errors, "\n"));
}
$config = parse_cli_params();
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/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/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") ?>
</p>
- <code>
- &lt;IfModule mod_rewrite.c&gt;<br/>
- RewriteEngine On<br/>
- RewriteBase <?= html::clean(g2_import::$g2_base_url) ?><br/>
- RewriteRule ^(.*)$ <?= url::site("g2/map?path=\$1") ?> [QSA,L,R=301]<br/>
- &lt;/IfModule&gt;<br/>
- </code>
+ <textarea rows="2">&lt;IfModule mod_rewrite.c&gt;
+ Options +FollowSymLinks
+ RewriteEngine On
+ RewriteBase <?= html::clean(g2_import::$g2_base_url) ?>
+ RewriteRule ^(.*)$ <?= url::site("g2/map?path=\$1") ?> [QSA,L,R=301]
+&lt;/IfModule&gt;</textarea>
</div>
<? endif ?>
</div>
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/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;
+ }
+ }
}
}
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;
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/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");
}
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"))
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) ?>
</td>
<td>
- <a href="<?= url::site("admin/maintenance/cancel/$task->id?csrf=$csrf") ?>"
- class="g-button g-right ui-icon-left ui-state-default ui-corner-all">
- <?= t("cancel") ?>
- </a>
<? if ($task->state == "stalled"): ?>
<a class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all"
href="<?= url::site("admin/maintenance/resume/$task->id?csrf=$csrf") ?>">
<?= t("resume") ?>
</a>
<? endif ?>
+ <? if ($task->get_log()): ?>
+ <a href="<?= url::site("admin/maintenance/show_log/$task->id?csrf=$csrf") ?>" class="g-dialog-link g-button ui-state-default ui-corner-all">
+ <?= t("view log") ?>
+ </a>
+ <? endif ?>
+ <a href="<?= url::site("admin/maintenance/cancel/$task->id?csrf=$csrf") ?>"
+ class="g-button ui-icon-left ui-state-default ui-corner-all">
+ <?= t("cancel") ?>
+ </a>
</td>
</tr>
<? endforeach ?>
@@ -183,7 +188,7 @@
</a>
<? if ($task->get_log()): ?>
<a href="<?= url::site("admin/maintenance/show_log/$task->id?csrf=$csrf") ?>" class="g-dialog-link g-button ui-state-default ui-corner-all">
- <?= t("browse log") ?>
+ <?= t("view log") ?>
</a>
<? endif ?>
<? else: ?>
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! <a>Retry</a> 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);
+ }
+ }
}
});
}
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
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;
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 @@
<div id="g-tag-cloud" ref="<?= url::site("tags") ?>">
<?= $cloud ?>
</div>
-<?= $form ?> \ No newline at end of file
+<?= $form ?>
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();
}
diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css
index 81b1a896..eda79b97 100644
--- a/themes/admin_wind/css/screen.css
+++ b/themes/admin_wind/css/screen.css
@@ -191,7 +191,8 @@ th {
.g-unavailable {
border-color: #999;
- opacity: 0.4;
+ color: black;
+ opacity: .6;
}
.g-info td {
diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php
index 4938ed60..e620d652 100644
--- a/themes/wind/views/page.html.php
+++ b/themes/wind/views/page.html.php
@@ -105,9 +105,9 @@
// containing that photo. For now, we just do it for
// the immediate parent so that when you go back up a
// level you're on the right page. ?>
- <a href="<?= $parent->url($parent == $theme->item()->parent() ?
+ <a href="<?= $parent->url($parent->id == $theme->item()->parent_id ?
"show={$theme->item()->id}" : null) ?>">
- <!-- limit the title length to something reasonable (defaults to 15) -->
+ <? // limit the title length to something reasonable (defaults to 15) ?>
<?= html::purify(text::limit_chars($parent->title,
module::get_var("gallery", "visible_title_length"))) ?>
</a>
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 @@
<!-- Use javascript to show the full size as an overlay on the current page -->
<script type="text/javascript">
$(document).ready(function() {
+ full_dims = [<?= $theme->item()->width ?>, <?= $theme->item()->height ?>];
$(".g-fullsize-link").click(function() {
- $.gallery_show_full_size(<?= html::js_string($theme->item()->file_url()) ?>, "<?= $theme->item()->width ?>", "<?= $theme->item()->height ?>");
+ $.gallery_show_full_size(<?= html::js_string($theme->item()->file_url()) ?>, full_dims[0], full_dims[1]);
return false;
});
+
+ // After the image is rotated or replaced we have to reload the image dimensions
+ // so that the full size view isn't distorted.
+ gallery_image_replaced_hook = function(data, thumb) {
+ $.ajax({
+ url: "<?= url::site("items/dimensions/" . $theme->item()->id) ?>",
+ dataType: "json",
+ success: function(data, textStatus) {
+ full_dims = data.full;
+ }
+ });
+ }
});
</script>
<? endif ?>