summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMarc <dkm@kataplop.net>2009-06-10 09:53:00 +0200
committerMarc <dkm@kataplop.net>2009-06-10 09:53:00 +0200
commit9b4c7ba73cc86dca8fb6cf81a37fbf806e643483 (patch)
tree0c4d3a99471c21103a34ad5e2fb748199fe4f8f2 /modules
parent657e17361db19ac1878b2a6d93595a763aef8b15 (diff)
parentfc64a55f2e6d2e3f16e0806e6672f7d8c8de42a7 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r--modules/akismet/module.info2
-rw-r--r--modules/g2_import/helpers/g2_import.php38
-rw-r--r--modules/gallery/controllers/albums.php6
-rw-r--r--modules/gallery/controllers/quick.php5
-rw-r--r--modules/gallery/controllers/upgrader.php56
-rw-r--r--modules/gallery/helpers/MY_url.php21
-rw-r--r--modules/gallery/helpers/graphics.php7
-rw-r--r--modules/gallery/helpers/l10n_client.php7
-rw-r--r--modules/gallery/helpers/module.php36
-rw-r--r--modules/gallery/helpers/movie.php8
-rw-r--r--modules/gallery/helpers/photo.php4
-rw-r--r--modules/gallery/js/l10n_client.js20
-rw-r--r--modules/gallery/libraries/MY_View.php2
-rw-r--r--modules/gallery/tests/xss_data.txt13
-rw-r--r--modules/gallery/views/admin_advanced_settings.html.php6
-rw-r--r--modules/gallery/views/admin_block_welcome.html.php2
-rw-r--r--modules/gallery/views/admin_dashboard.html.php8
-rw-r--r--modules/gallery/views/simple_uploader.html.php2
-rw-r--r--modules/gallery/views/upgrader.html.php173
-rw-r--r--modules/recaptcha/module.info2
-rw-r--r--modules/server_add/controllers/server_add.php15
-rw-r--r--modules/user/controllers/logout.php7
22 files changed, 365 insertions, 75 deletions
diff --git a/modules/akismet/module.info b/modules/akismet/module.info
index 8655927d..d45d8a7b 100644
--- a/modules/akismet/module.info
+++ b/modules/akismet/module.info
@@ -1,3 +1,3 @@
name = Akismet
-description = "Filter comments through the <a href='http://akismet.com'>Akismet web service</a> to detect and eliminate spam. You'll need a <a href='http://wordpress.com/api-keys/'>WordPress.com API</a> key to use it."
+description = "Filter comments through the Akismet web service to detect and eliminate spam (http://akismet.com). You'll need a WordPress.com API key to use it."
version = 1
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 1ff63e36..648f3809 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -414,13 +414,19 @@ class g2_import_Core {
Kohana::log("alert", "$g2_path unsupported image type; using a placeholder gif");
$corrupt = 1;
}
- $item = photo::create(
- $parent,
- $g2_path,
- $g2_item->getPathComponent(),
- $g2_item->getTitle(),
- self::extract_description($g2_item),
- self::map($g2_item->getOwnerId()));
+ try {
+ $item = photo::create(
+ $parent,
+ $g2_path,
+ $g2_item->getPathComponent(),
+ $g2_item->getTitle(),
+ self::extract_description($g2_item),
+ self::map($g2_item->getOwnerId()));
+ } catch (Exception $e) {
+ Kohana::log("alert", "Corrupt image $g2_path\n" .
+ $e->getMessage() . "\n" . $e->getTraceAsString());
+ $corrupt = 1;
+ }
break;
case "GalleryMovieItem":
@@ -456,12 +462,18 @@ class g2_import_Core {
// Why oh why did I ever approve the session id placeholder idea in G2?
$g2_item_url =
str_replace('&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT', '', $g2_item_url);
- $warning =
- t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed; " .
- "(imported as <a href=\"%g3_url\">%title</a>)",
- array("g2_url" => $g2_item_url,
- "g3_url" => $item->url(),
- "title" => $g2_item->getTitle()));
+ if (!empty($item)) {
+ $warning =
+ t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed; " .
+ "(imported as <a href=\"%g3_url\">%title</a>)",
+ array("g2_url" => $g2_item_url,
+ "g3_url" => $item->url(),
+ "title" => $g2_item->getTitle()));
+ } else {
+ $warning =
+ t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed",
+ array("g2_url" => $g2_item_url, "title" => $g2_item->getTitle()));
+ }
message::warning($warning);
log::warning("g2_import", $warning);
Kohana::log("alert", $warning);
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index efde4f09..34fee917 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -23,16 +23,18 @@ class Albums_Controller extends Items_Controller {
* @see REST_Controller::_show($resource)
*/
public function _show($album) {
+ $page_size = module::get_var("gallery", "page_size", 9);
if (!access::can("view", $album)) {
if ($album->id == 1) {
- print new Theme_View("login_page.html", "album");
+ $view = new Theme_View("page.html", "page");
+ $view->content = user::get_login_form("login/auth_html");
+ print $view;
return;
} else {
access::forbidden();
}
}
- $page_size = module::get_var("gallery", "page_size", 9);
$show = $this->input->get("show");
if ($show) {
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index 6efcb9de..d6f5213f 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -87,9 +87,12 @@ class Quick_Controller extends Controller {
access::required("view", $item->parent());
access::required("edit", $item->parent());
+ $msg = t("Made <b>%title</b> this album's cover", array("title" => $item->title));
+
item::make_album_cover($item);
+ message::success($msg);
- print json_encode(array("result" => "success"));
+ print json_encode(array("result" => "success", "reload" => 1));
}
public function delete($id) {
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php
new file mode 100644
index 00000000..0d5bb4f6
--- /dev/null
+++ b/modules/gallery/controllers/upgrader.php
@@ -0,0 +1,56 @@
+<?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 Upgrader_Controller extends Controller {
+ public function index() {
+ // Todo: give the admin a chance to log in here
+ if (!user::active()->admin) {
+ access::forbidden();
+ }
+
+ $view = new View("upgrader.html");
+ $view->available = module::available();
+ $view->done = Input::instance()->get("done");
+ print $view;
+ }
+
+ public function upgrade() {
+ // Todo: give the admin a chance to log in here
+ if (!user::active()->admin) {
+ access::forbidden();
+ }
+
+ // Upgrade gallery and user first
+ module::install("gallery");
+ module::install("user");
+
+ // Then upgrade the rest
+ foreach (module::available() as $id => $module) {
+ if ($id == "gallery") {
+ continue;
+ }
+
+ if ($module->active && $module->code_version != $module->version) {
+ module::install($id);
+ }
+ }
+
+ url::redirect("upgrader?done=1");
+ }
+}
diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php
index c8645c4d..7bee70ca 100644
--- a/modules/gallery/helpers/MY_url.php
+++ b/modules/gallery/helpers/MY_url.php
@@ -46,7 +46,19 @@ class url extends url_Core {
return;
}
- $current_uri = html_entity_decode(Router::$current_uri, ENT_QUOTES);
+ $item = self::get_item_from_uri(Router::$current_uri);
+ if ($item && $item->loaded) {
+ Router::$controller = "{$item->type}s";
+ Router::$controller_path = MODPATH . "gallery/controllers/{$item->type}s.php";
+ Router::$method = $item->id;
+ }
+ }
+
+ /**
+ * Return the item that the uri is referencing
+ */
+ static function get_item_from_uri($uri) {
+ $current_uri = html_entity_decode($uri);
$item = ORM::factory("item")->where("relative_path_cache", $current_uri)->find();
if (!$item->loaded) {
// It's possible that the relative path cache for the item we're looking for is out of date,
@@ -61,12 +73,7 @@ class url extends url_Core {
}
}
}
-
- if ($item && $item->loaded) {
- Router::$controller = "{$item->type}s";
- Router::$controller_path = MODPATH . "gallery/controllers/{$item->type}s.php";
- Router::$method = $item->id;
- }
+ return $item;
}
/**
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 4846fa8a..25eb0891 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -166,12 +166,11 @@ class graphics_Core {
$item->resize_dirty = 0;
}
$item->save();
- } catch (Kohana_Exception $e) {
+ } catch (Exception $e) {
// Something went wrong rebuilding the image. Leave it dirty and move on.
// @todo we should handle this better.
Kohana::log("error", "Caught exception rebuilding image: {$item->title}\n" .
- $e->getMessage() . "\n" .
- $e->getTraceAsString());
+ $e->getMessage() . "\n" . $e->getTraceAsString());
return false;
}
@@ -192,7 +191,7 @@ class graphics_Core {
}
if (filesize($input_file) == 0) {
- throw new Exception("@todo MALFORMED_INPUT_FILE");
+ throw new Exception("@todo EMPTY_INPUT_FILE");
}
$dims = getimagesize($input_file);
diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php
index 33f23857..20f81ecc 100644
--- a/modules/gallery/helpers/l10n_client.php
+++ b/modules/gallery/helpers/l10n_client.php
@@ -123,7 +123,12 @@ class l10n_client_Core {
$key = $message_data->key;
$locale = $message_data->locale;
$revision = $message_data->rev;
- $translation = serialize(json_decode($message_data->translation));
+ $translation = json_decode($message_data->translation);
+ if (!is_string($translation)) {
+ // Normalize stdclass to array
+ $translation = (array) $translation;
+ }
+ $translation = serialize($translation);
// @todo Should we normalize the incoming_translations table into messages(id, key, message)
// and incoming_translations(id, translation, locale, revision)? Or just allow
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index 2fd5be6c..dea8e22c 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -27,6 +27,7 @@ class module_Core {
public static $active = array();
public static $modules = array();
public static $var_cache = null;
+ public static $available = array();
/**
* Set the version of the corresponding Module_Model
@@ -39,7 +40,7 @@ class module_Core {
$module->name = $module_name;
$module->active = $module_name == "gallery"; // only gallery is active by default
}
- $module->version = 1;
+ $module->version = $version;
$module->save();
Kohana::log("debug", "$module_name: version is now $version");
}
@@ -74,22 +75,27 @@ class module_Core {
* Return the list of available modules, including uninstalled modules.
*/
static function available() {
- $modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
- foreach (glob(MODPATH . "*/module.info") as $file) {
- $module_name = basename(dirname($file));
- $modules->$module_name = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
- $modules->$module_name->installed = self::is_installed($module_name);
- $modules->$module_name->active = self::is_active($module_name);
- $modules->$module_name->version = self::get_version($module_name);
- $modules->$module_name->locked = false;
- }
+ if (empty(self::$available)) {
+ $modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
+ foreach (glob(MODPATH . "*/module.info") as $file) {
+ $module_name = basename(dirname($file));
+ $modules->$module_name = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
+ $m =& $modules->$module_name;
+ $m->installed = self::is_installed($module_name);
+ $m->active = self::is_active($module_name);
+ $m->code_version = $m->version;
+ $m->version = self::get_version($module_name);
+ $m->locked = false;
+ }
- // Lock certain modules
- $modules->gallery->locked = true;
- $modules->user->locked = true;
- $modules->ksort();
+ // Lock certain modules
+ $modules->gallery->locked = true;
+ $modules->user->locked = true;
+ $modules->ksort();
+ self::$available = $modules;
+ }
- return $modules;
+ return self::$available;
}
/**
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 3aa40dc9..986d5f62 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -142,10 +142,12 @@ class movie_Core {
if (!$ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) {
if (function_exists("exec")) {
$ffmpeg_path = exec("which ffmpeg");
- if ($ffmpeg_path) {
- module::set_var("gallery", "ffmpeg_path", $ffmpeg_path);
- }
}
+
+ if (empty($ffmpeg) && @file_exists("/usr/local/bin/ffmpeg")) {
+ $ffmpeg_path = "/usr/local/bin/ffmpeg";
+ }
+ module::set_var("gallery", "ffmpeg_path", $ffmpeg_path);
}
return $ffmpeg_path;
}
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php
index c1c005f5..a4bc853b 100644
--- a/modules/gallery/helpers/photo.php
+++ b/modules/gallery/helpers/photo.php
@@ -53,6 +53,10 @@ class photo_Core {
throw new Exception("@todo NAME_CANNOT_END_IN_PERIOD");
}
+ if (filesize($filename) == 0) {
+ throw new Exception("@todo EMPTY_INPUT_FILE");
+ }
+
$image_info = getimagesize($filename);
// Force an extension onto the name
diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js
index efd956e2..89c4a57d 100644
--- a/modules/gallery/js/l10n_client.js
+++ b/modules/gallery/js/l10n_client.js
@@ -35,20 +35,20 @@ jQuery.extend(Gallery, {
if(userSelection.length > 0) {
Gallery.l10nClient.filter(userSelection);
Gallery.l10nClient.toggle(1);
- $('#l10n-client #gL10nSearch').focus();
+ $('#l10n-client #gL10nSearch').focus();
} else {
if($('#l10n-client').is('.hidden')) {
Gallery.l10nClient.toggle(1);
if(!$.browser.safari) {
$('#l10n-client #gL10nSearch').focus();
}
- } else {
+ } else {
Gallery.l10nClient.toggle(0);
}
}
break;
case 'clear':
- this.filter(false);
+ this.filter(false);
break;
}
}
@@ -61,7 +61,7 @@ jQuery.extend(Gallery, {
$('#l10n-client .labels .toggle').text('X');
/*
* This CSS clashes with Gallery's CSS, probably due to
- * YUI's grid / floats.
+ * YUI's grid / floats.
if(!$.browser.msie) {
$('body').css('border-bottom', '22em solid #fff');
}
@@ -79,7 +79,7 @@ jQuery.extend(Gallery, {
}
*/
$.cookie('Gallery_l10n_client', '0', {expires: 7, path: '/'});
- break;
+ break;
}
}
// Get a string from the DOM tree
@@ -124,7 +124,7 @@ jQuery.extend(Gallery, {
$('#l10n-edit-translation').removeClass('hidden');
}
}
- // Filter the the string list by a search string
+ // Filter the string list by a search string
this.filter = function(search) {
if(search == false || search == '') {
$('#l10n-client #l10n-search-filter-clear').focus();
@@ -153,7 +153,7 @@ Gallery.behaviors.l10nClient = function(context) {
Gallery.l10nClient.toggle(0);
break;
}
-
+
// If the selection changes, copy string values to the source and target fields.
// Add class to indicate selected string in list widget.
$('#l10n-client-string-select li').click(function() {
@@ -173,7 +173,7 @@ Gallery.behaviors.l10nClient = function(context) {
$('#l10n-client .labels .toggle').click(function() {
if($('#l10n-client').is('.hidden')) {
Gallery.l10nClient.toggle(1);
- } else {
+ } else {
Gallery.l10nClient.toggle(0);
}
});
@@ -184,7 +184,7 @@ Gallery.behaviors.l10nClient = function(context) {
$.hotkeys.add(Gallery.l10nClient.keys['toggle'], function(){Gallery.l10nClient.key('toggle')});
$.hotkeys.add(Gallery.l10nClient.keys['clear'], {target:'#l10n-client #gL10nSearch', type:'keyup'}, function(){Gallery.l10nClient.key('clear')});
}
-
+
// Custom listener for l10n_client livesearch
$('#l10n-client #gL10nSearch').keyup(function(key) {
Gallery.l10nClient.filter($('#l10n-client #gL10nSearch').val());
@@ -222,7 +222,7 @@ Gallery.behaviors.l10nClient = function(context) {
// Clear the translation form fields
Gallery.l10nClient.showSourceMessage('', false);
$('#gL10nClientSaveForm #l10n-edit-translation').val('');
-
+
for (var i = 0; i < num_plural_forms; i++) {
var form = plural_forms[i];
$('#gL10nClientSaveForm #l10n-edit-plural-translation-' + form).val('');
diff --git a/modules/gallery/libraries/MY_View.php b/modules/gallery/libraries/MY_View.php
index bd2794a0..96dcc71b 100644
--- a/modules/gallery/libraries/MY_View.php
+++ b/modules/gallery/libraries/MY_View.php
@@ -44,7 +44,7 @@ class View extends View_Core {
}
}
- public function main_element_attributes() {
+ public function body_attributes() {
if (locale::is_rtl()) {
return 'class="rtl"';
}
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index b71262df..f47ae0dc 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -73,7 +73,7 @@ modules/gallery/views/admin_advanced_settings.html.php 25 DIRTY $var->mod
modules/gallery/views/admin_advanced_settings.html.php 25 $var->name
modules/gallery/views/admin_advanced_settings.html.php 27 $var->name
modules/gallery/views/admin_advanced_settings.html.php 27 DIRTY $var->module_name
-modules/gallery/views/admin_advanced_settings.html.php 28 $var->value
+modules/gallery/views/admin_advanced_settings.html.php 29 $var->value
modules/gallery/views/admin_block_log_entries.html.php 4 DIRTY $entry->severity
modules/gallery/views/admin_block_log_entries.html.php 5 DIRTY $entry->user_id
modules/gallery/views/admin_block_log_entries.html.php 5 $entry->user->name
@@ -278,6 +278,14 @@ modules/gallery/views/simple_uploader.html.php 28 $parent->
modules/gallery/views/simple_uploader.html.php 30 $item->title
modules/gallery/views/simple_uploader.html.php 77 DIRTY $item->id
modules/gallery/views/simple_uploader.html.php 81 DIRTY $csrf
+modules/gallery/views/upgrader.html.php 94 DIRTY $done
+modules/gallery/views/upgrader.html.php 124 DIRTY $module->version
+modules/gallery/views/upgrader.html.php 124 DIRTY $module->code_version
+modules/gallery/views/upgrader.html.php 125 DIRTY $id
+modules/gallery/views/upgrader.html.php 126 DIRTY $module->name
+modules/gallery/views/upgrader.html.php 129 DIRTY $module->version
+modules/gallery/views/upgrader.html.php 132 DIRTY $module->code_version
+modules/gallery/views/upgrader.html.php 155 DIRTY $module->name
modules/image_block/views/image_block_block.html.php 3 DIRTY $item->url()
modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class" => "gThumbnail"))
modules/info/views/info_block.html.php 6 $item->title
@@ -492,6 +500,7 @@ themes/admin_default/views/admin.html.php 20 DIRTY $theme->u
themes/admin_default/views/admin.html.php 29 DIRTY $theme->url("js/jquery.dropshadow.js")
themes/admin_default/views/admin.html.php 30 DIRTY $theme->url("js/ui.init.js")
themes/admin_default/views/admin.html.php 31 DIRTY $theme->admin_head()
+themes/admin_default/views/admin.html.php 34 DIRTY $theme->body_attributes()
themes/admin_default/views/admin.html.php 35 DIRTY $theme->admin_page_top()
themes/admin_default/views/admin.html.php 41 DIRTY $theme->site_status()
themes/admin_default/views/admin.html.php 43 DIRTY $theme->admin_header_top()
@@ -563,7 +572,6 @@ themes/default/views/header.html.php 21 DIRTY $parent->
themes/default/views/header.html.php 21 DIRTY $item->id
themes/default/views/header.html.php 22 $parent->title
themes/default/views/header.html.php 26 $item->title
-themes/default/views/login_page.html.php 10 DIRTY $theme->url("css/screen.css")
themes/default/views/movie.html.php 4 DIRTY $theme->photo_top()
themes/default/views/movie.html.php 7 DIRTY $position
themes/default/views/movie.html.php 7 DIRTY $sibling_count
@@ -590,6 +598,7 @@ themes/default/views/page.html.php 51 DIRTY $theme->u
themes/default/views/page.html.php 52 DIRTY $theme->url("js/jquery.localscroll.js")
themes/default/views/page.html.php 53 DIRTY $theme->url("js/ui.init.js")
themes/default/views/page.html.php 54 DIRTY $theme->head()
+themes/default/views/page.html.php 57 DIRTY $theme->body_attributes()
themes/default/views/page.html.php 58 DIRTY $theme->page_top()
themes/default/views/page.html.php 60 DIRTY $theme->site_status()
themes/default/views/page.html.php 62 DIRTY $theme->display("header.html")
diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php
index 77aff050..b4dedaef 100644
--- a/modules/gallery/views/admin_advanced_settings.html.php
+++ b/modules/gallery/views/admin_advanced_settings.html.php
@@ -6,7 +6,7 @@
</p>
<ul id="gMessage">
<li class="gWarning">
- <b><?= t("Change these values at your own risk!</b>") ?>
+ <b><?= t("Change these values at your own risk!") ?>
</li>
</ul>
@@ -25,7 +25,11 @@
<a href="<?= url::site("admin/advanced_settings/edit/$var->module_name/" . p::clean($var->name)) ?>"
class="gDialogLink"
title="<?= t("Edit %var (%module_name)", array("var" => p::clean($var->name), "module_name" => $var->module_name)) ?>">
+ <? if ($var->value): ?>
<?= p::clean($var->value) ?>
+ <? else: ?>
+ <i> <?= t("empty") ?> </i>
+ <? endif ?>
</a>
</td>
</tr>
diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php
index 488fa908..a453b006 100644
--- a/modules/gallery/views/admin_block_welcome.html.php
+++ b/modules/gallery/views/admin_block_welcome.html.php
@@ -10,7 +10,7 @@
</li>
<li>
<?= t("Appearance - <a href=\"%theme_url\">choose a theme</a>, or <a href=\"%theme_details_url\">customize the way it looks</a>.",
- array("theme_url" => url::site("admin/theme"),
+ array("theme_url" => url::site("admin/themes"),
"theme_details_url" => url::site("admin/theme_details"))) ?>
</li>
<li>
diff --git a/modules/gallery/views/admin_dashboard.html.php b/modules/gallery/views/admin_dashboard.html.php
index c266d7e1..5b8cae2e 100644
--- a/modules/gallery/views/admin_dashboard.html.php
+++ b/modules/gallery/views/admin_dashboard.html.php
@@ -10,23 +10,23 @@
};
$(document).ready(function(){
- $("#gAdminDashboard .gBlock *:first").addClass("gDraggable");
+ $("#gAdminDashboard .gBlock .ui-widget-header").addClass("gDraggable");
$("#gAdminDashboard").sortable({
connectWith: ["#gAdminDashboardSidebar"],
containment: "document",
cursor: "move",
- handle: $("div:first"),
+ handle: $(".ui-widget-header"),
opacity: 0.6,
placeholder: "gDropTarget",
stop: update_blocks
});
- $("#gAdminDashboardSidebar .gBlock *:first").addClass("gDraggable");
+ $("#gAdminDashboardSidebar .gBlock .ui-widget-header").addClass("gDraggable");
$("#gAdminDashboardSidebar").sortable({
connectWith: ["#gAdminDashboard"],
containment: "document",
cursor: "move",
- handle: $("div:first"),
+ handle: $(".ui-widget-header"),
opacity: 0.6,
placeholder: "gDropTarget",
stop: update_blocks
diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php
index 79919d50..f10d764c 100644
--- a/modules/gallery/views/simple_uploader.html.php
+++ b/modules/gallery/views/simple_uploader.html.php
@@ -93,7 +93,7 @@
button_width: "202",
button_height: "45",
button_placeholder_id: "gChooseFilesButtonPlaceholder",
- button_text: '<span class="swfUploadFont">Select photos...</span>',
+ button_text: '<span class="swfUploadFont"><?= t("Select photos...") ?></span>',
button_text_style: ".swfUploadFont { color: #2E6E9E; font-size: 16px; font-family: Lucida Grande,Lucida Sans,Arial,sans-serif; font-weight: bold; }",
button_text_left_padding: 30,
button_text_top_padding: 10,
diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php
new file mode 100644
index 00000000..6b9a0110
--- /dev/null
+++ b/modules/gallery/views/upgrader.html.php
@@ -0,0 +1,173 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<html>
+ <head>
+ <title><?= t("Gallery3 Upgrader") ?></title>
+ </head>
+ <style>
+ body {
+ background: #eee;
+ font-family: Trebuchet MS;
+ font-size: 1.1em;
+ }
+ div#outer {
+ width: 650px;
+ background: white;
+ border: 1px solid #999;
+ margin: 0 auto;
+ padding: -10px;
+ }
+ div#inner {
+ padding: 0 1em 0 1em;
+ margin: 0px;
+ }
+ div#footer {
+ border-top: 1px solid #ccc;
+ margin: 1em;
+ }
+ td.name {
+ text-align: left;
+ padding-left: 30px;
+ }
+ td {
+ text-align: center;
+ border-bottom: 1px solid #eee;
+ }
+ tr.current td {
+ color: #999;
+ font-style: italic;
+ }
+ tr.current td.gallery {
+ color: #00d;
+ }
+ tr.upgradeable td {
+ font-weight: bold;
+ }
+ tr.upgradeable td.gallery {
+ color: #00d;
+ }
+ table {
+ width: 600px;
+ margin-bottom: 10px;
+ }
+ p {
+ font-size: .9em;
+ }
+ ul {
+ font-size: .9em;
+ list-style: none;
+ }
+ li {
+ display: inline;
+ }
+ li:before {
+ content: "\00BB \0020";
+ }
+ div.button {
+ margin: 0 auto;
+ width: 120px;
+ text-align: center;
+ border: 1px solid #999;
+ background: #eee;
+ }
+ div.button a {
+ text-decoration: none;
+ }
+ div.button:hover {
+ background: #ccc;
+ }
+ div#confirmation {
+ position: fixed;
+ top: 400px;
+ left: 325px;
+ background: blue;
+ z-index: 1000;
+ margin: 10px;
+ text-align: center;
+ }
+ div#confirmation div {
+ margin: 2px;
+ padding: 20px;
+ border: 2px solid #999;
+ background: white;
+ }
+ .gray_on_done {
+ opacity: <?= $done ? "0.5" : "1" ?>;
+ }
+ </style>
+ <body>
+ <div id="outer">
+ <img src="<?= url::file("modules/gallery/images/gallery.png") ?>" />
+ <div id="inner">
+ <? if ($done): ?>
+ <div id="confirmation">
+ <div>
+ <h1> <?= t("That's it!") ?> </h1>
+ <p>
+ <?= t("Your <a href=\"%url\">Gallery</a> is up to date.",
+ array("url" => url::site("albums/1"))) ?>
+ </p>
+ </div>
+ </div>
+ <? endif ?>
+ <p class="gray_on_done">
+ <?= t("Welcome to the Gallery upgrader. One click and you're done!") ?>
+ </p>
+ <table>
+ <tr class="gray_on_done">
+ <th> <?= t("Module name") ?> </th>
+ <th> <?= t("Installed version") ?> </th>
+ <th> <?= t("Available version") ?> </th>
+ </tr>
+
+ <? foreach ($available as $id => $module): ?>
+ <? if ($module->active): ?>
+ <tr class="<?= $module->version == $module->code_version ? "current" : "upgradeable" ?>" >
+ <td class="name <?= $id ?>">
+ <?= $module->name ?>
+ </td>
+ <td>
+ <?= $module->version ?>
+ </td>
+ <td>
+ <?= $module->code_version ?>
+ </td>
+ </tr>
+ <? else: ?>
+ <? @$inactive++ ?>
+ <? endif ?>
+ <? endforeach ?>
+ </table>
+
+ <div class="button gray_on_done">
+ <a href="<?= url::site("upgrader/upgrade") ?>">
+ <?= t("Upgrade all") ?>
+ </a>
+ </div>
+
+ <? if (@$inactive): ?>
+ <p class="gray_on_done">
+ <?= t("The following modules are inactive and don't require an upgrade.") ?>
+ </p>
+ <ul class="gray_on_done">
+ <? foreach ($available as $module): ?>
+ <? if (!$module->active): ?>
+ <li>
+ <?= $module->name ?>
+ </li>
+ <? endif ?>
+ <? endforeach ?>
+ </p>
+ <? endif ?>
+ </div>
+ <div id="footer">
+ <p>
+ <i>
+ <?= t("Did something go wrong? Try the <a href=\"%faq_url\">FAQ</a> or ask in the <a href=\"%forums_url\">Gallery forums</a>.</i>",
+ array("faq_url" => "http://codex.gallery2.org/Gallery3:FAQ",
+ "forums_url" => "http://gallery.menalto.com/forum")) ?>
+ </i>
+ </p>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/modules/recaptcha/module.info b/modules/recaptcha/module.info
index 85397580..f2cc50cf 100644
--- a/modules/recaptcha/module.info
+++ b/modules/recaptcha/module.info
@@ -1,3 +1,3 @@
name = Recaptcha
-description = "<a href='http://recaptcha.net'>Recaptcha</a> displays a graphical verification that protects the input form from abuse from 'bots,' or automated programs usually written to generate spam."
+description = "Recaptcha displays a graphical verification that protects the input form from abuse from 'bots,' or automated programs usually written to generate spam (http://recaptcha.net)."
version = 1
diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php
index 2c6eb5e0..c92b4f7e 100644
--- a/modules/server_add/controllers/server_add.php
+++ b/modules/server_add/controllers/server_add.php
@@ -87,17 +87,20 @@ class Server_Add_Controller extends Controller {
foreach (array_keys($paths) as $valid_path) {
$path_length = strlen($valid_path);
foreach ($input_files as $key => $path) {
- if (!empty($path) && $valid_path != $path && strpos($path, $valid_path) === 0) {
- $relative_path = substr(dirname($path), $path_length);
- $name = basename($path);
- $files[$valid_path][] = array("path" => $relative_path,
- "parent_id" => $id, "name" => basename($path),
+ if (!empty($path)) {
+ if ($valid_path != $path && strpos($path, $valid_path) === 0) {
+ $relative_path = substr(dirname($path), $path_length);
+ $name = basename($path);
+ $files[$valid_path][] = array("path" => $relative_path,
+ "parent_id" => $id, "name" => basename($path),
"type" => is_dir($path) ? "album" : "file");
- $total_count++;
+ $total_count++;
+ }
if ($collapsed[$key] === "true") {
$total_count += $this->_select_children($id, $valid_path, $path, $files[$valid_path]);
}
unset($input_files[$key]);
+ unset($collapsed[$key]);
}
}
}
diff --git a/modules/user/controllers/logout.php b/modules/user/controllers/logout.php
index 6ceb7192..a541ed9b 100644
--- a/modules/user/controllers/logout.php
+++ b/modules/user/controllers/logout.php
@@ -26,7 +26,12 @@ class Logout_Controller extends Controller {
log::info("user", t("User %name logged out", array("name" => $user->name)),
html::anchor("user/$user->id", $user->name));
if ($this->input->get("continue")) {
- url::redirect($this->input->get("continue"));
+ $item = url::get_item_from_uri($this->input->get("continue"));
+ if (access::can("view", $item)) {
+ url::redirect($this->input->get("continue"));
+ } else {
+ url::redirect("");
+ }
}
}
} \ No newline at end of file