summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-02-15 06:27:17 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-02-15 06:27:17 -0800
commiteb1cdd037646b3697b64753652669fa9e25a5c8e (patch)
tree2f9dd9bd70329d5997993eced0a9f94a80895b8a
parente41a2d4e5226c45a5201df91ca6633a40b357630 (diff)
parent409121942590e12692eaf4e6e9e8b71bfe5ed60c (diff)
Merge branch 'master' into talmdal_dev
-rw-r--r--installer/install.sql4
-rw-r--r--installer/installer.php2
-rw-r--r--installer/web.php2
-rw-r--r--modules/gallery/config/session.php2
-rw-r--r--modules/gallery/controllers/user_profile.php5
-rw-r--r--modules/gallery/helpers/gallery_event.php3
-rw-r--r--modules/gallery/helpers/gallery_installer.php13
-rw-r--r--modules/gallery/helpers/gallery_theme.php7
-rw-r--r--modules/gallery/helpers/items_rest.php44
-rw-r--r--modules/gallery/libraries/IdentityProvider.php5
-rw-r--r--modules/gallery/libraries/drivers/IdentityProvider.php2
-rw-r--r--modules/gallery/models/item.php12
-rw-r--r--modules/gallery/module.info2
-rw-r--r--modules/gallery/views/permissions_form.html.php2
-rw-r--r--modules/user/helpers/user_installer.php8
-rw-r--r--modules/user/models/user.php2
-rw-r--r--modules/user/views/admin_users.html.php2
-rw-r--r--modules/user/views/admin_users_group.html.php6
-rw-r--r--themes/wind/css/fix-ie.css1
-rw-r--r--themes/wind/css/screen.css15
-rw-r--r--themes/wind/js/ui.init.js10
21 files changed, 116 insertions, 33 deletions
diff --git a/installer/install.sql b/installer/install.sql
index dea324eb..28a9caa5 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -239,7 +239,7 @@ CREATE TABLE {modules} (
UNIQUE KEY `name` (`name`)
) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
-INSERT INTO {modules} VALUES (1,1,'gallery',28);
+INSERT INTO {modules} VALUES (1,1,'gallery',29);
INSERT INTO {modules} VALUES (2,1,'user',3);
INSERT INTO {modules} VALUES (3,1,'comment',2);
INSERT INTO {modules} VALUES (4,1,'organize',1);
@@ -389,7 +389,7 @@ INSERT INTO {vars} VALUES (NULL,'gallery','image_quality','75');
INSERT INTO {vars} VALUES (NULL,'gallery','image_sharpen','15');
INSERT INTO {vars} VALUES (NULL,'gallery','time_format','H:i:s');
INSERT INTO {vars} VALUES (NULL,'gallery','show_credits','1');
-INSERT INTO {vars} VALUES (NULL,'gallery','credits','Powered by <a href=\"%url\">Gallery %version</a>');
+INSERT INTO {vars} VALUES (NULL,'gallery','credits','Powered by <a href=\"%url\">%gallery_version</a>');
INSERT INTO {vars} VALUES (NULL,'gallery','simultaneous_upload_limit','5');
INSERT INTO {vars} VALUES (NULL,'gallery','admin_area_timeout','5400');
INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}');
diff --git a/installer/installer.php b/installer/installer.php
index 57be6cc0..705f1725 100644
--- a/installer/installer.php
+++ b/installer/installer.php
@@ -77,7 +77,7 @@ class installer {
// counterparts.
if (!function_exists("mysql_query")) {
function mysql_connect($host, $user, $pass) {
- list ($host, $port) = explode(":", $host);
+ list ($host, $port) = explode(":", $host . ":");
installer::$mysqli = new mysqli($host, $user, $pass, $port);
// http://php.net/manual/en/mysqli.connect.php says to use mysqli_connect_error() instead of
// $mysqli->connect_error because of bugs before PHP 5.2.9
diff --git a/installer/web.php b/installer/web.php
index 90143afb..0a3cdb6e 100644
--- a/installer/web.php
+++ b/installer/web.php
@@ -38,7 +38,7 @@ if (installer::already_installed()) {
"dbname" => $_POST["dbname"],
"prefix" => $_POST["prefix"],
"type" => function_exists("mysqli_set_charset") ? "mysqli" : "mysql");
- list ($config["host"], $config["port"]) = explode(":", $config["host"]);
+ list ($config["host"], $config["port"]) = explode(":", $config["host"] . ":");
if (!installer::connect($config)) {
$content = render("invalid_db_info.html.php");
diff --git a/modules/gallery/config/session.php b/modules/gallery/config/session.php
index 990fa31f..6905e299 100644
--- a/modules/gallery/config/session.php
+++ b/modules/gallery/config/session.php
@@ -39,7 +39,7 @@ $config['name'] = 'g3sid';
/**
* Session parameters to validate: user_agent, ip_address, expiration.
*/
-$config['validate'] = array('user_agent');
+$config['validate'] = array('user_agent', 'expiration');
/**
* Enable or disable session encryption.
diff --git a/modules/gallery/controllers/user_profile.php b/modules/gallery/controllers/user_profile.php
index 327d2ff1..05373466 100644
--- a/modules/gallery/controllers/user_profile.php
+++ b/modules/gallery/controllers/user_profile.php
@@ -23,7 +23,8 @@ class User_Profile_Controller extends Controller {
$user = identity::lookup_user($id);
$active_user = identity::active_user();
$is_current_active = $active_user->id == $id;
- $display_all = $active_user->admin || ($is_current_active && !$active_user->guest);
+ $can_edit = $is_current_active && !$active_user->guest;
+ $display_all = $active_user->admin || $can_edit;
$v = new Theme_View("page.html", "other", "profile");
$v->page_title = t("%name Profile", array("name" => $user->display_name()));
@@ -32,7 +33,7 @@ class User_Profile_Controller extends Controller {
// @todo modify user_home to supply a link to their album,
$v->content->user = $user;
$v->content->not_current = !$is_current_active;
- $v->content->editable = identity::is_writable() && $display_all;
+ $v->content->editable = identity::is_writable() && $can_edit;
$event_data = (object)array("user" => $user, "display_all" => $display_all, "content" => array());
module::event("show_user_profile", $event_data);
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index faf1c0c6..3f77bc42 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -423,6 +423,9 @@ class gallery_event_Core {
if ($field == "locale") {
$value = locales::display_name($value);
}
+ if ($field == "full_name") {
+ $value = t($value);
+ }
$v->user_profile_data[(string) $label] = $value;
}
}
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index dd53cf43..45d991af 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -284,11 +284,13 @@ class gallery_installer {
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_var("gallery", "show_credits", 1);
- // @todo this string needs to be picked up by l10n_scanner
- module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>");
+ // Mark string for translation
+ $powered_by_string = t("Powered by <a href=\"%url\">%gallery_version</a>",
+ array("locale" => "root"));
+ module::set_var("gallery", "credits", $powered_by_string);
module::set_var("gallery", "simultaneous_upload_limit", 5);
module::set_var("gallery", "admin_area_timeout", 90 * 60);
- module::set_version("gallery", 28);
+ module::set_version("gallery", 29);
}
static function upgrade($version) {
@@ -538,6 +540,11 @@ class gallery_installer {
module::set_var("gallery", "admin_area_timeout", 90 * 60);
module::set_version("gallery", $version = 28);
}
+
+ if ($version == 28) {
+ module::set_var("gallery", "credits", "Powered by <a href=\"%url\">%gallery_version</a>");
+ module::set_version("gallery", $version = 29);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index ec650e1c..d6944323 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -112,9 +112,12 @@ class gallery_theme_Core {
}
static function credits() {
- return "<li class=\"g-first\">" .
+ $version_string = SafeString::of_safe_html(
+ '<bdo dir="ltr">Gallery ' . gallery::VERSION . '</bdo>');
+ return "<li class=\"g-first\">" .
t(module::get_var("gallery", "credits"),
- array("url" => "http://gallery.menalto.com", "version" => gallery::VERSION)) .
+ array("url" => "http://gallery.menalto.com",
+ "gallery_version" => $version_string)) .
"</li>";
}
diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php
new file mode 100644
index 00000000..c4dd4a5f
--- /dev/null
+++ b/modules/gallery/helpers/items_rest.php
@@ -0,0 +1,44 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class items_rest_Core {
+ static function get($request) {
+
+ $items = array();
+ if (isset($request->params->url)) {
+ foreach($request->params->url as $url) {
+ $item = rest::resolve($url);
+ if (access::can("view", $item)) {
+ $members = array();
+ if ($item->type == "album") {
+ foreach ($item->children() as $child) {
+ $members[] = rest::url("item", $child);
+ }
+ }
+ $items[] = array("url" => $url,
+ "entity" => $item->as_restful_array(),
+ "members" => $members,
+ "relationship" => rest::relationships("item", $item));
+ }
+ }
+ }
+
+ return $items;
+ }
+}
diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php
index 3f1666eb..01ea9ad7 100644
--- a/modules/gallery/libraries/IdentityProvider.php
+++ b/modules/gallery/libraries/IdentityProvider.php
@@ -66,6 +66,11 @@ class IdentityProvider_Core {
}
static function change_provider($new_provider) {
+ if (!identity::active_user()->admin && PHP_SAPI != "cli") {
+ // Below, the active user is set to the primary admin.
+ access::forbidden();
+ }
+
$current_provider = module::get_var("gallery", "identity_provider");
if (!empty($current_provider)) {
module::uninstall($current_provider);
diff --git a/modules/gallery/libraries/drivers/IdentityProvider.php b/modules/gallery/libraries/drivers/IdentityProvider.php
index b7b1fbe8..09cdd093 100644
--- a/modules/gallery/libraries/drivers/IdentityProvider.php
+++ b/modules/gallery/libraries/drivers/IdentityProvider.php
@@ -26,7 +26,7 @@ interface IdentityProvider_Driver {
public function guest();
/**
- * Return the admins user.
+ * Return the primary admin user.
*
* @return User_Definition the user object
*/
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index dbd56fa2..283654c7 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -930,8 +930,18 @@ class Item_Model extends ORM_MPTT {
}
unset($data["album_cover_item_id"]);
+ if (access::can("view_fillsize", $this) && $this->is_photo()) {
+ $data["fullsize_url"] = $this->abs_url();
+ }
+
+ if ($tmp = $this->resize_url() && $this->is_photo()) {
+ $data["resize_url"] = $tmp;
+ }
+ $data["thumb_url"] = $this->thumb_url();
+
// Elide some internal-only data that is going to cause confusion in the client.
- foreach (array("relative_path_cache", "relative_url_cache", "left_ptr", "right_ptr") as $key) {
+ foreach (array("relative_path_cache", "relative_url_cache", "left_ptr", "right_ptr",
+ "thumb_dirty", "resize_dirty") as $key) {
unset($data[$key]);
}
return $data;
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index ae300399..39615e1c 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 28
+version = 29
diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php
index f1714119..b486acb7 100644
--- a/modules/gallery/views/permissions_form.html.php
+++ b/modules/gallery/views/permissions_form.html.php
@@ -5,7 +5,7 @@
<tr>
<th> </th>
<? foreach ($groups as $group): ?>
- <th> <?= html::clean($group->name) ?> </th>
+ <th> <?= html::clean(t($group->name)) ?> </th>
<? endforeach ?>
</tr>
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php
index 729f087a..c57ad010 100644
--- a/modules/user/helpers/user_installer.php
+++ b/modules/user/helpers/user_installer.php
@@ -98,25 +98,25 @@ class user_installer {
DEFAULT CHARSET=utf8;");
$everybody = ORM::factory("group");
- $everybody->name = "Everybody";
+ $everybody->name = t("Everybody", array("locale" => "root"));
$everybody->special = true;
$everybody->save();
$registered = ORM::factory("group");
- $registered->name = "Registered Users";
+ $registered->name = t("Registered Users", array("locale" => "root"));
$registered->special = true;
$registered->save();
$guest = ORM::factory("user");
$guest->name = "guest";
- $guest->full_name = "Guest User";
+ $guest->full_name = t("Guest User", array("locale" => "root"));
$guest->password = "";
$guest->guest = true;
$guest->save();
$admin = ORM::factory("user");
$admin->name = "admin";
- $admin->full_name = "Gallery Administrator";
+ $admin->full_name = t("Gallery Administrator", array("locale" => "root"));
$admin->password = "admin";
$admin->email = "unknown@unknown.com";
$admin->admin = true;
diff --git a/modules/user/models/user.php b/modules/user/models/user.php
index 4404ee63..aa752203 100644
--- a/modules/user/models/user.php
+++ b/modules/user/models/user.php
@@ -113,7 +113,7 @@ class User_Model extends ORM implements User_Definition {
* @return string
*/
public function display_name() {
- return empty($this->full_name) ? $this->name : $this->full_name;
+ return empty($this->full_name) ? $this->name : t($this->full_name);
}
/**
diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php
index 270a7207..69d97547 100644
--- a/modules/user/views/admin_users.html.php
+++ b/modules/user/views/admin_users.html.php
@@ -78,7 +78,7 @@
<?= html::clean($user->name) ?>
</td>
<td>
- <?= html::clean($user->full_name) ?>
+ <?= t(html::clean($user->full_name)) ?>
</td>
<td>
<?= html::clean($user->email) ?>
diff --git a/modules/user/views/admin_users_group.html.php b/modules/user/views/admin_users_group.html.php
index 6c6c341e..8317d393 100644
--- a/modules/user/views/admin_users_group.html.php
+++ b/modules/user/views/admin_users_group.html.php
@@ -1,9 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<h4>
- <?= html::clean($group->name) ?>
+ <?= t(html::clean($group->name)) ?>
<? if (!$group->special): ?>
<a href="<?= url::site("admin/users/delete_group_form/$group->id") ?>"
- title="<?= t("Delete the %name group", array("name" => $group->name))->for_html_attr() ?>"
+ title="<?= t("Delete the %name group", array("name" => t(html::clean($group->name))))->for_html_attr() ?>"
class="g-dialog-link g-button g-right">
<span class="ui-icon ui-icon-trash"><?= t("Delete") ?></span></a>
<? else: ?>
@@ -22,7 +22,7 @@
<a href="javascript:remove_user(<?= $user->id ?>, <?= $group->id ?>)"
class="g-button g-right ui-state-default ui-corner-all ui-icon-left"
title="<?= t("Remove %user from %group group",
- array("user" => $user->name, "group" => $group->name))->for_html_attr() ?>">
+ array("user" => $user->name, "group" => t(html::clean($group->name))))->for_html_attr() ?>">
<span class="ui-icon ui-icon-closethick"><?= t("Remove") ?></span>
</a>
<? endif ?>
diff --git a/themes/wind/css/fix-ie.css b/themes/wind/css/fix-ie.css
index 376dac74..4f0d0888 100644
--- a/themes/wind/css/fix-ie.css
+++ b/themes/wind/css/fix-ie.css
@@ -4,6 +4,7 @@
#g-banner {
z-index: 2;
+ zoom: 1;
}
input.submit {
diff --git a/themes/wind/css/screen.css b/themes/wind/css/screen.css
index 630e8bbd..e96b259d 100644
--- a/themes/wind/css/screen.css
+++ b/themes/wind/css/screen.css
@@ -275,6 +275,13 @@ td {
z-index: 1;
}
+/* Search results ~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+#g-content #g-search-results {
+ margin-top: 1em;
+ padding-top: 1em;
+}
+
/* Individual photo content ~~~~~~~~~~~~~~ */
#g-item {
@@ -300,14 +307,10 @@ td {
padding-right: 1.2em;
}
-#g-content #g-search-results {
- margin-top: 1em;
- padding-top: 1em;
-}
-
/* In-line editing ~~~~~~~~~~~~~~~~~~~~~~ */
+
#g-in-place-edit-message {
- background-color: #FFF;
+ background-color: #fff;
}
/** *******************************************************************
diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js
index f9fb8519..64eb6bc3 100644
--- a/themes/wind/js/ui.init.js
+++ b/themes/wind/js/ui.init.js
@@ -43,7 +43,7 @@ $(document).ready(function() {
});
}
- // Album view only
+ // Album and search results views
if ($("#g-album-grid").length) {
// Set equal height for album items and vertically align thumbnails/metadata
$('.g-item').equal_heights().gallery_valign();
@@ -64,7 +64,13 @@ $(document).ready(function() {
$(this).height("auto");
var context_menu = $(this).find(".g-context-menu");
var adj_height = $(this).height() + context_menu.height();
- $(this).height(adj_height);
+ if ($(this).next().height() > $(this).height()) {
+ $(this).height($(this).next().height());
+ } else if ($(this).prev().height() > $(this).height()) {
+ $(this).height($(this).prev().height());
+ } else {
+ $(this).height(adj_height);
+ }
},
function() {
// Reset item height and position