summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gallery.common.css5
-rw-r--r--modules/comment/views/comments.html.php2
-rw-r--r--modules/gallery/css/gallery.css34
-rw-r--r--modules/gallery/helpers/gallery_event.php3
-rw-r--r--modules/gallery/libraries/Gallery_I18n.php29
-rw-r--r--modules/gallery/views/permissions_form.html.php2
-rw-r--r--modules/gallery/views/upgrader.html.php2
-rw-r--r--modules/gallery/views/user_profile.html.php84
-rw-r--r--modules/gallery/views/user_profile_info.html.php2
-rw-r--r--modules/organize/views/organize_tree.html.php11
-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
14 files changed, 106 insertions, 86 deletions
diff --git a/lib/gallery.common.css b/lib/gallery.common.css
index 553eb496..98b4ee40 100644
--- a/lib/gallery.common.css
+++ b/lib/gallery.common.css
@@ -743,6 +743,11 @@ div#g-action-status {
margin-right: .4em;
}
+.rtl #g-admin-comment-button {
+ right: inherit;
+ left: 0;
+}
+
/* RTL Superfish ~~~~~~~~~~~~~~~~~~~~~~~~~ */
.rtl .sf-menu a {
diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php
index 58ff1765..8e2a9e51 100644
--- a/modules/comment/views/comments.html.php
+++ b/modules/comment/views/comments.html.php
@@ -1,6 +1,6 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<a href="<?= url::site("form/add/comments/{$item->id}") ?>" id="g-admin-comment-button"
- class="g-button ui-corner-all ui-icon-left ui-state-default right">
+ class="g-button ui-corner-all ui-icon-left ui-state-default">
<span class="ui-icon ui-icon-comment"></span>
<?= t("Add a comment") ?>
</a>
diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css
index e06c4dd9..f3e5ec6d 100644
--- a/modules/gallery/css/gallery.css
+++ b/modules/gallery/css/gallery.css
@@ -55,6 +55,34 @@
margin: 0;
}
+/* User profile ~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+#g-user-profile h1 {
+ margin: 1em 0;
+}
+
+#g-user-profile .g-avatar {
+ margin-right: .6em;
+}
+
+#g-user-profile .g-block {
+ margin-top: 0;
+}
+
+#g-user-profile .g-block-content {
+ margin-top: 0;
+}
+
+#g-user-profile th,
+#g-user-profile td {
+ border: none;
+}
+
+#g-user-profile th {
+ white-space: nowrap;
+ width: 1%;
+}
+
/** *******************************************************************
* 2) Admin
**********************************************************************/
@@ -96,4 +124,8 @@
.rtl #g-block-admin .g-left {
margin-left: 1em;
margin-right: 0;
-} \ No newline at end of file
+}
+
+.rtl #g-user-profile .g-avatar {
+ margin-left: .6em;
+}
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 3f77bc42..faf1c0c6 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -423,9 +423,6 @@ 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/libraries/Gallery_I18n.php b/modules/gallery/libraries/Gallery_I18n.php
index 160543c9..ac0588e3 100644
--- a/modules/gallery/libraries/Gallery_I18n.php
+++ b/modules/gallery/libraries/Gallery_I18n.php
@@ -73,12 +73,26 @@ class Gallery_I18n_Core {
public function locale($locale=null) {
if ($locale) {
$this->_config['default_locale'] = $locale;
- // Attempt to set PHP's locale as well (for number formatting, collation, etc.)
- // TODO: See G2 for better fallack code.
- $locale_prefs = array($locale);
- $locale_prefs[] = 'en_US';
- $new_locale = setlocale(LC_ALL, $locale_prefs);
- if (is_string($new_locale) && strpos($new_locale, 'tr') === 0) {
+ $php_locale = setlocale(LC_ALL, 0);
+ list ($php_locale, $unused) = explode('.', $php_locale . '.');
+ if ($php_locale != $locale) {
+ // Attempt to set PHP's locale as well (for number formatting, collation, etc.)
+ $locale_prefs = array($locale);
+ // Try appending some character set names; some systems (like FreeBSD) need this.
+ // Some systems require a format with hyphen (eg. Gentoo) and others without (eg. FreeBSD).
+ $charsets = array('utf8', 'UTF-8', 'UTF8', 'ISO8859-1', 'ISO-8859-1');
+ if (substr($locale, 0, 2) != 'en') {
+ $charsets = array_merge($charsets, array(
+ 'EUC', 'Big5', 'euc', 'ISO8859-2', 'ISO8859-5', 'ISO8859-7',
+ 'ISO8859-9', 'ISO-8859-2', 'ISO-8859-5', 'ISO-8859-7', 'ISO-8859-9'));
+ }
+ foreach ($charsets as $charset) {
+ $locale_prefs[] = $locale . '.' . $charset;
+ }
+ $locale_prefs[] = 'en_US';
+ $php_locale = setlocale(LC_ALL, $locale_prefs);
+ }
+ if (is_string($php_locale) && substr($php_locale, 0, 2) == 'tr') {
// Make PHP 5 work with Turkish (the localization results are mixed though).
// Hack for http://bugs.php.net/18556
setlocale(LC_CTYPE, 'C');
@@ -117,9 +131,6 @@ class Gallery_I18n_Core {
$count = isset($options['count']) ? $options['count'] : null;
$values = $options;
unset($values['locale']);
- if ($message instanceof SafeString) {
- $message = (string) $message;
- }
$this->log($message, $options);
$entry = $this->lookup($locale, $message);
diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php
index b486acb7..f1714119 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(t($group->name)) ?> </th>
+ <th> <?= html::clean($group->name) ?> </th>
<? endforeach ?>
</tr>
diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php
index 55731440..c7a96cb5 100644
--- a/modules/gallery/views/upgrader.html.php
+++ b/modules/gallery/views/upgrader.html.php
@@ -112,7 +112,7 @@
<? else: // can_upgrade ?>
<h1> <?= t("Who are you?") ?> </h1>
<p>
- <?= t("You're not logged in as an administrator, so we have to verify you to make sure it's ok for you to do an upgrade. To prove you can run an upgrade, create a file called <b>%name</b> in your <b>%tmp_dir_path</b> directory.",
+ <?= t("You're not logged in as an administrator, so we have to verify you to make sure it's ok for you to do an upgrade. To prove you can run an upgrade, create a file called <b> %name </b> in your <b>%tmp_dir_path</b> directory.",
array("name" => "$upgrade_token",
"tmp_dir_path" => "gallery3/var/tmp")) ?>
</p>
diff --git a/modules/gallery/views/user_profile.html.php b/modules/gallery/views/user_profile.html.php
index 1c346c26..53e8dc1e 100644
--- a/modules/gallery/views/user_profile.html.php
+++ b/modules/gallery/views/user_profile.html.php
@@ -1,27 +1,4 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<style>
- #g-user-profile div {
- margin-top: 1em;
- }
-
- #g-user-profile fieldset {
- border: 1px solid #CCCCCC;
- padding: 0 1em 0.8em;
- }
-
- #g-user-profile fieldset label {
- font-weight: bold;
- }
-
- #g-user-profile fieldset div {
- padding-left: 1em;
- }
-
- #g-user-profile td {
- border: none;
- padding: 0;
- }
-</style>
<script type="text/javascript">
$(document).ready(function() {
$("#g-profile-return").click(function(event) {
@@ -31,45 +8,40 @@
});
</script>
<div id="g-user-profile">
- <h1>
- <a href="#">
- <img src="<?= $user->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
- alt="<?= html::clean_attribute($user->display_name()) ?>"
- class="g-avatar" width="40" height="40" />
- </a>
- <?= t("%name Profile", array("name" => $user->display_name())) ?>
- </h1>
- <? foreach ($info_parts as $info): ?>
- <div>
- <fieldset>
- <label><?= html::purify($info->title) ?></label>
- <div>
- <?= $info->view ?>
- </div>
- </fieldset>
- </div>
- <? endforeach ?>
- <div id="g-profile-buttons" class="ui-helper-clearfix g-right">
- <? if (!$user->guest && $not_current && !empty($user->email)): ?>
- <a class="g-button ui-icon-right ui-state-default ui-corner-all g-dialog-link"
- href="<?= url::site("user_profile/contact/{$user->id}") ?>">
- <?= t("Contact") ?>
+ <div class="ui-helper-clearfix">
+ <a id="g-profile-return" class="g-button g-right ui-state-default ui-corner-all" href="#">
+ <?= t("Return") ?>
</a>
- <? endif ?>
- <? if ($editable): ?>
- <a class="g-button ui-icon-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("form/edit/users/{$user->id}") ?>">
- <?= t("Edit") ?>
+ <a class="g-button g-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("users/form_change_email/{$user->id}") ?>">
+ <?= t("Change email") ?>
</a>
- <a class="g-button ui-icon-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("users/form_change_password/{$user->id}") ?>">
+ <a class="g-button g-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("users/form_change_password/{$user->id}") ?>">
<?= t("Change password") ?>
</a>
- <a class="g-button ui-icon-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("users/form_change_email/{$user->id}") ?>">
- <?= t("Change email") ?>
+ <? if ($editable): ?>
+ <a class="g-button g-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("form/edit/users/{$user->id}") ?>">
+ <?= t("Edit") ?>
</a>
<? endif ?>
-
- <a id="g-profile-return" class="g-button ui-icon-right ui-state-default ui-corner-all" href="#">
- <?= t("Return") ?>
+ <? if (!$user->guest && $not_current && !empty($user->email)): ?>
+ <a class="g-button g-right ui-state-default ui-corner-all g-dialog-link"
+ href="<?= url::site("user_profile/contact/{$user->id}") ?>">
+ <?= t("Contact") ?>
</a>
+ <? endif ?>
</div>
+ <h1>
+ <img src="<?= $user->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
+ alt="<?= html::clean_attribute($user->display_name()) ?>"
+ class="g-avatar g-left" width="40" height="40" />
+ <?= t("User profile: %name", array("name" => $user->display_name())) ?>
+ </h1>
+ <? foreach ($info_parts as $info): ?>
+ <div class="g-block">
+ <h2><?= html::purify($info->title) ?></h2>
+ <div class="g-block-content">
+ <?= $info->view ?>
+ </div>
+ </div>
+ <? endforeach ?>
</div>
diff --git a/modules/gallery/views/user_profile_info.html.php b/modules/gallery/views/user_profile_info.html.php
index 58e134bb..e559abda 100644
--- a/modules/gallery/views/user_profile_info.html.php
+++ b/modules/gallery/views/user_profile_info.html.php
@@ -2,7 +2,7 @@
<table>
<? foreach ($user_profile_data as $label => $value): ?>
<tr>
- <td><?= html::clean($label) ?></td>
+ <th><?= html::clean($label) ?></th>
<td><?= html::purify($value) ?></td>
</tr>
<? endforeach ?>
diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php
index 33d7b4c9..044b6858 100644
--- a/modules/organize/views/organize_tree.html.php
+++ b/modules/organize/views/organize_tree.html.php
@@ -3,24 +3,27 @@
ref="<?= $album->id ?>">
<span class="ui-icon ui-icon-minus g-left">
</span>
- <span class="g-organize-album-text g-left <?= $selected && $album->id == $selected->id ? "ui-state-focus" : "" ?>"
+ <span class="g-organize-album-text <?= $selected && $album->id == $selected->id ? "ui-state-focus" : "" ?>"
ref="<?= $album->id ?>">
<?= html::clean($album->title) ?>
</span>
- <ul class="g-left">
- <? foreach ($album->children(null, null, array(array("type", "=", "album"))) as $child): ?>
+ <? $child_albums = $album->viewable()->children(null, null, array(array("type", "=", "album"))); ?>
+ <? if (!empty($child_albums)): ?>
+ <ul>
+ <? foreach ($child_albums as $child): ?>
<? if ($selected && $child->contains($selected)): ?>
<?= View::factory("organize_tree.html", array("selected" => $selected, "album" => $child)); ?>
<? else: ?>
<li class="g-organize-album ui-icon-left <?= access::can("edit", $child) ? "" : "g-view-only" ?>"
ref="<?= $child->id ?>">
<span class="ui-icon ui-icon-plus g-left"></span>
- <span class="g-organize-album-text g-left <?= $selected && $child->id == $selected->id ? "ui-state-focus" : "" ?>" ref="<?= $child->id ?>">
+ <span class="g-organize-album-text <?= $selected && $child->id == $selected->id ? "ui-state-focus" : "" ?>" ref="<?= $child->id ?>">
<?= html::clean($child->title) ?>
</span>
</li>
<? endif ?>
<? endforeach ?>
</ul>
+ <? endif ?>
</li>
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php
index 9e757ecd..729f087a 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 = (string) t("Everybody", array("locale" => "root"));
+ $everybody->name = "Everybody";
$everybody->special = true;
$everybody->save();
$registered = ORM::factory("group");
- $registered->name = (string) t("Registered Users", array("locale" => "root"));
+ $registered->name = "Registered Users";
$registered->special = true;
$registered->save();
$guest = ORM::factory("user");
$guest->name = "guest";
- $guest->full_name = (string) t("Guest User", array("locale" => "root"));
+ $guest->full_name = "Guest User";
$guest->password = "";
$guest->guest = true;
$guest->save();
$admin = ORM::factory("user");
$admin->name = "admin";
- $admin->full_name = (string) t("Gallery Administrator", array("locale" => "root"));
+ $admin->full_name = "Gallery Administrator";
$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 aa752203..4404ee63 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 : t($this->full_name);
+ return empty($this->full_name) ? $this->name : $this->full_name;
}
/**
diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php
index 69d97547..270a7207 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>
- <?= t(html::clean($user->full_name)) ?>
+ <?= 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 8317d393..6c6c341e 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>
- <?= t(html::clean($group->name)) ?>
+ <?= 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" => t(html::clean($group->name))))->for_html_attr() ?>"
+ title="<?= t("Delete the %name group", array("name" => $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" => t(html::clean($group->name))))->for_html_attr() ?>">
+ array("user" => $user->name, "group" => $group->name))->for_html_attr() ?>">
<span class="ui-icon ui-icon-closethick"><?= t("Remove") ?></span>
</a>
<? endif ?>