diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-15 06:27:17 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-15 06:27:17 -0800 |
commit | eb1cdd037646b3697b64753652669fa9e25a5c8e (patch) | |
tree | 2f9dd9bd70329d5997993eced0a9f94a80895b8a /modules | |
parent | e41a2d4e5226c45a5201df91ca6633a40b357630 (diff) | |
parent | 409121942590e12692eaf4e6e9e8b71bfe5ed60c (diff) |
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/config/session.php | 2 | ||||
-rw-r--r-- | modules/gallery/controllers/user_profile.php | 5 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_event.php | 3 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 13 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_theme.php | 7 | ||||
-rw-r--r-- | modules/gallery/helpers/items_rest.php | 44 | ||||
-rw-r--r-- | modules/gallery/libraries/IdentityProvider.php | 5 | ||||
-rw-r--r-- | modules/gallery/libraries/drivers/IdentityProvider.php | 2 | ||||
-rw-r--r-- | modules/gallery/models/item.php | 12 | ||||
-rw-r--r-- | modules/gallery/module.info | 2 | ||||
-rw-r--r-- | modules/gallery/views/permissions_form.html.php | 2 | ||||
-rw-r--r-- | modules/user/helpers/user_installer.php | 8 | ||||
-rw-r--r-- | modules/user/models/user.php | 2 | ||||
-rw-r--r-- | modules/user/views/admin_users.html.php | 2 | ||||
-rw-r--r-- | modules/user/views/admin_users_group.html.php | 6 |
15 files changed, 94 insertions, 21 deletions
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 ?> |