diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-03-28 21:04:44 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-03-28 21:04:44 -0700 |
commit | ea43c5f06f5c7242f1d5811fe427e55c87497ecc (patch) | |
tree | 7ee253a40c57c8ea8066305e36b633fa2d7500e4 | |
parent | 2eea7b874aa06f08ed58a85197473233b54693aa (diff) | |
parent | e8eb23db42bb929548af358452f1b65e16b61913 (diff) |
Merge branch 'master' of github.com:gallery/gallery3
294 files changed, 1982 insertions, 1599 deletions
diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 95f7b8d2..fbd83ce1 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/application/config/config.php b/application/config/config.php index aecc400c..9a8f4299 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -1,7 +1,7 @@ <?php /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/installer/cli.php b/installer/cli.php index e88293ff..e7c81ac3 100644 --- a/installer/cli.php +++ b/installer/cli.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/installer/index.php b/installer/index.php index a11c0b02..75d6fe5b 100644 --- a/installer/index.php +++ b/installer/index.php @@ -1,7 +1,7 @@ <?php /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/installer/installer.php b/installer/installer.php index 705f1725..bd5fbff1 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/installer/web.php b/installer/web.php index 0a3cdb6e..51f0f8aa 100644 --- a/installer/web.php +++ b/installer/web.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/lib/gallery.common.css b/lib/gallery.common.css index 98b4ee40..31988b67 100644 --- a/lib/gallery.common.css +++ b/lib/gallery.common.css @@ -273,7 +273,7 @@ form li.g-warning { } .g-short-form li.g-error { - padding: .3em 0 .3em 0; + padding: .3em 0; } form.g-error input[type="text"], @@ -294,7 +294,8 @@ li.g-error select { .g-error, .g-denied, -tr.g-error td.g-error { +tr.g-error td.g-error, +#g-add-photos-status .g-error { background: #f6cbca url('images/ico-error.png') no-repeat .4em 50%; color: #f00; } @@ -304,7 +305,8 @@ tr.g-error td.g-error { } .g-success, -.g-allowed { +.g-allowed, +#g-add-photos-status .g-success { background: #d9efc2 url('images/ico-success.png') no-repeat .4em 50%; } @@ -603,60 +605,6 @@ div#g-action-status { margin-left: 0; } -/* Simple uploader ~~~~~~~~~~~~~~~~~~~~~~~ */ - -#g-add-photos-canvas { - border: 1px solid #ccc; - height: 200px; - margin: .5em 0; - overflow: auto; - width: 469px; -} - -#g-add-photos-status { - border: 1px solid #ccc; - height: 125px; - margin: .5em 0; - overflow: auto; - width: 469px; -} - -#g-add-photos button { - float: right; - margin-bottom: .5em; - margin-left: .5em; -} - -#g-add-photos-status li { - text-align: left; - padding-left: 2em; -} - -#g-add-photos-status li.g-success { - background: #d9efc2 url('images/ico-success.png') no-repeat .4em 50%; - width: 429px; -} - -#g-add-photos-status li.g-error { - background: #f6cbca url('images/ico-error.png') no-repeat .4em 50%; - width: 429px; -/* color: #f00;*/ -} - -#g-add-photos-button { - background: #DFEFFC; - border: 1px solid #C5DBEC; - color: #2E6E9E -} - -#g-add-photos p { - margin: 0 -} - -#g-add-photos .g-breadcrumbs li { - padding-top: .5em; -} - /** ******************************************************************* * 7) Right to left language styles **********************************************************************/ @@ -685,7 +633,9 @@ div#g-action-status { .rtl .g-error, .rtl .g-info, .rtl .g-success, -.rtl .g-warning { +.rtl .g-warning, +.rtl #g-add-photos-status .g-success, +.rtl #g-add-photos-status .g-error { background-position: center right; padding-right: 30px !important; } diff --git a/lib/swfupload/swfupload.js b/lib/swfupload/swfupload.js index 969e2008..e65b19cb 100644 --- a/lib/swfupload/swfupload.js +++ b/lib/swfupload/swfupload.js @@ -1,980 +1,980 @@ -/**
- * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
- *
- * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/
- *
- * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- *
- * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- *
- */
-
-
-/* ******************* */
-/* Constructor & Init */
-/* ******************* */
-var SWFUpload;
-
-if (SWFUpload == undefined) {
- SWFUpload = function (settings) {
- this.initSWFUpload(settings);
- };
-}
-
-SWFUpload.prototype.initSWFUpload = function (settings) {
- try {
- this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
- this.settings = settings;
- this.eventQueue = [];
- this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
- this.movieElement = null;
-
-
- // Setup global control tracking
- SWFUpload.instances[this.movieName] = this;
-
- // Load the settings. Load the Flash movie.
- this.initSettings();
- this.loadFlash();
- this.displayDebugInfo();
- } catch (ex) {
- delete SWFUpload.instances[this.movieName];
- throw ex;
- }
-};
-
-/* *************** */
-/* Static Members */
-/* *************** */
-SWFUpload.instances = {};
-SWFUpload.movieCount = 0;
-SWFUpload.version = "2.2.0 2009-03-25";
-SWFUpload.QUEUE_ERROR = {
- QUEUE_LIMIT_EXCEEDED : -100,
- FILE_EXCEEDS_SIZE_LIMIT : -110,
- ZERO_BYTE_FILE : -120,
- INVALID_FILETYPE : -130
-};
-SWFUpload.UPLOAD_ERROR = {
- HTTP_ERROR : -200,
- MISSING_UPLOAD_URL : -210,
- IO_ERROR : -220,
- SECURITY_ERROR : -230,
- UPLOAD_LIMIT_EXCEEDED : -240,
- UPLOAD_FAILED : -250,
- SPECIFIED_FILE_ID_NOT_FOUND : -260,
- FILE_VALIDATION_FAILED : -270,
- FILE_CANCELLED : -280,
- UPLOAD_STOPPED : -290
-};
-SWFUpload.FILE_STATUS = {
- QUEUED : -1,
- IN_PROGRESS : -2,
- ERROR : -3,
- COMPLETE : -4,
- CANCELLED : -5
-};
-SWFUpload.BUTTON_ACTION = {
- SELECT_FILE : -100,
- SELECT_FILES : -110,
- START_UPLOAD : -120
-};
-SWFUpload.CURSOR = {
- ARROW : -1,
- HAND : -2
-};
-SWFUpload.WINDOW_MODE = {
- WINDOW : "window",
- TRANSPARENT : "transparent",
- OPAQUE : "opaque"
-};
-
-// Private: takes a URL, determines if it is relative and converts to an absolute URL
-// using the current site. Only processes the URL if it can, otherwise returns the URL untouched
-SWFUpload.completeURL = function(url) {
- if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) {
- return url;
- }
-
- var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
-
- var indexSlash = window.location.pathname.lastIndexOf("/");
- if (indexSlash <= 0) {
- path = "/";
- } else {
- path = window.location.pathname.substr(0, indexSlash) + "/";
- }
-
- return /*currentURL +*/ path + url;
-
-};
-
-
-/* ******************** */
-/* Instance Members */
-/* ******************** */
-
-// Private: initSettings ensures that all the
-// settings are set, getting a default value if one was not assigned.
-SWFUpload.prototype.initSettings = function () {
- this.ensureDefault = function (settingName, defaultValue) {
- this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
- };
-
- // Upload backend settings
- this.ensureDefault("upload_url", "");
- this.ensureDefault("preserve_relative_urls", false);
- this.ensureDefault("file_post_name", "Filedata");
- this.ensureDefault("post_params", {});
- this.ensureDefault("use_query_string", false);
- this.ensureDefault("requeue_on_error", false);
- this.ensureDefault("http_success", []);
- this.ensureDefault("assume_success_timeout", 0);
-
- // File Settings
- this.ensureDefault("file_types", "*.*");
- this.ensureDefault("file_types_description", "All Files");
- this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited"
- this.ensureDefault("file_upload_limit", 0);
- this.ensureDefault("file_queue_limit", 0);
-
- // Flash Settings
- this.ensureDefault("flash_url", "swfupload.swf");
- this.ensureDefault("prevent_swf_caching", true);
-
- // Button Settings
- this.ensureDefault("button_image_url", "");
- this.ensureDefault("button_width", 1);
- this.ensureDefault("button_height", 1);
- this.ensureDefault("button_text", "");
- this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
- this.ensureDefault("button_text_top_padding", 0);
- this.ensureDefault("button_text_left_padding", 0);
- this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
- this.ensureDefault("button_disabled", false);
- this.ensureDefault("button_placeholder_id", "");
- this.ensureDefault("button_placeholder", null);
- this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
- this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
-
- // Debug Settings
- this.ensureDefault("debug", false);
- this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API
-
- // Event Handlers
- this.settings.return_upload_start_handler = this.returnUploadStart;
- this.ensureDefault("swfupload_loaded_handler", null);
- this.ensureDefault("file_dialog_start_handler", null);
- this.ensureDefault("file_queued_handler", null);
- this.ensureDefault("file_queue_error_handler", null);
- this.ensureDefault("file_dialog_complete_handler", null);
-
- this.ensureDefault("upload_start_handler", null);
- this.ensureDefault("upload_progress_handler", null);
- this.ensureDefault("upload_error_handler", null);
- this.ensureDefault("upload_success_handler", null);
- this.ensureDefault("upload_complete_handler", null);
-
- this.ensureDefault("debug_handler", this.debugMessage);
-
- this.ensureDefault("custom_settings", {});
-
- // Other settings
- this.customSettings = this.settings.custom_settings;
-
- // Update the flash url if needed
- if (!!this.settings.prevent_swf_caching) {
- this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
- }
-
- if (!this.settings.preserve_relative_urls) {
- //this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it
- this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
- this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
- }
-
- delete this.ensureDefault;
-};
-
-// Private: loadFlash replaces the button_placeholder element with the flash movie.
-SWFUpload.prototype.loadFlash = function () {
- var targetElement, tempParent;
-
- // Make sure an element with the ID we are going to use doesn't already exist
- if (document.getElementById(this.movieName) !== null) {
- throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
- }
-
- // Get the element where we will be placing the flash movie
- targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
-
- if (targetElement == undefined) {
- throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
- }
-
- // Append the container and load the flash
- tempParent = document.createElement("div");
- tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
- targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
-
- // Fix IE Flash/Form bug
- if (window[this.movieName] == undefined) {
- window[this.movieName] = this.getMovieElement();
- }
-
-};
-
-// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
-SWFUpload.prototype.getFlashHTML = function () {
- // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
- return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
- '<param name="wmode" value="', this.settings.button_window_mode, '" />',
- '<param name="movie" value="', this.settings.flash_url, '" />',
- '<param name="quality" value="high" />',
- '<param name="menu" value="false" />',
- '<param name="allowScriptAccess" value="always" />',
- '<param name="flashvars" value="' + this.getFlashVars() + '" />',
- '</object>'].join("");
-};
-
-// Private: getFlashVars builds the parameter string that will be passed
-// to flash in the flashvars param.
-SWFUpload.prototype.getFlashVars = function () {
- // Build a string from the post param object
- var paramString = this.buildParamString();
- var httpSuccessString = this.settings.http_success.join(",");
-
- // Build the parameter string
- return ["movieName=", encodeURIComponent(this.movieName),
- "&uploadURL=", encodeURIComponent(this.settings.upload_url),
- "&useQueryString=", encodeURIComponent(this.settings.use_query_string),
- "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
- "&httpSuccess=", encodeURIComponent(httpSuccessString),
- "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
- "&params=", encodeURIComponent(paramString),
- "&filePostName=", encodeURIComponent(this.settings.file_post_name),
- "&fileTypes=", encodeURIComponent(this.settings.file_types),
- "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
- "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
- "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
- "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
- "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
- "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
- "&buttonWidth=", encodeURIComponent(this.settings.button_width),
- "&buttonHeight=", encodeURIComponent(this.settings.button_height),
- "&buttonText=", encodeURIComponent(this.settings.button_text),
- "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
- "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
- "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
- "&buttonAction=", encodeURIComponent(this.settings.button_action),
- "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
- "&buttonCursor=", encodeURIComponent(this.settings.button_cursor)
- ].join("");
-};
-
-// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
-// The element is cached after the first lookup
-SWFUpload.prototype.getMovieElement = function () {
- if (this.movieElement == undefined) {
- this.movieElement = document.getElementById(this.movieName);
- }
-
- if (this.movieElement === null) {
- throw "Could not find Flash element";
- }
-
- return this.movieElement;
-};
-
-// Private: buildParamString takes the name/value pairs in the post_params setting object
-// and joins them up in to a string formatted "name=value&name=value"
-SWFUpload.prototype.buildParamString = function () {
- var postParams = this.settings.post_params;
- var paramStringPairs = [];
-
- if (typeof(postParams) === "object") {
- for (var name in postParams) {
- if (postParams.hasOwnProperty(name)) {
- paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
- }
- }
- }
-
- return paramStringPairs.join("&");
-};
-
-// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
-// all references to the SWF, and other objects so memory is properly freed.
-// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
-// Credits: Major improvements provided by steffen
-SWFUpload.prototype.destroy = function () {
- try {
- // Make sure Flash is done before we try to remove it
- this.cancelUpload(null, false);
-
-
- // Remove the SWFUpload DOM nodes
- var movieElement = null;
- movieElement = this.getMovieElement();
-
- if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
- // Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
- for (var i in movieElement) {
- try {
- if (typeof(movieElement[i]) === "function") {
- movieElement[i] = null;
- }
- } catch (ex1) {}
- }
-
- // Remove the Movie Element from the page
- try {
- movieElement.parentNode.removeChild(movieElement);
- } catch (ex) {}
- }
-
- // Remove IE form fix reference
- window[this.movieName] = null;
-
- // Destroy other references
- SWFUpload.instances[this.movieName] = null;
- delete SWFUpload.instances[this.movieName];
-
- this.movieElement = null;
- this.settings = null;
- this.customSettings = null;
- this.eventQueue = null;
- this.movieName = null;
-
-
- return true;
- } catch (ex2) {
- return false;
- }
-};
-
-
-// Public: displayDebugInfo prints out settings and configuration
-// information about this SWFUpload instance.
-// This function (and any references to it) can be deleted when placing
-// SWFUpload in production.
-SWFUpload.prototype.displayDebugInfo = function () {
- this.debug(
- [
- "---SWFUpload Instance Info---\n",
- "Version: ", SWFUpload.version, "\n",
- "Movie Name: ", this.movieName, "\n",
- "Settings:\n",
- "\t", "upload_url: ", this.settings.upload_url, "\n",
- "\t", "flash_url: ", this.settings.flash_url, "\n",
- "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n",
- "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n",
- "\t", "http_success: ", this.settings.http_success.join(", "), "\n",
- "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n",
- "\t", "file_post_name: ", this.settings.file_post_name, "\n",
- "\t", "post_params: ", this.settings.post_params.toString(), "\n",
- "\t", "file_types: ", this.settings.file_types, "\n",
- "\t", "file_types_description: ", this.settings.file_types_description, "\n",
- "\t", "file_size_limit: ", this.settings.file_size_limit, "\n",
- "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n",
- "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n",
- "\t", "debug: ", this.settings.debug.toString(), "\n",
-
- "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n",
-
- "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n",
- "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
- "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n",
- "\t", "button_width: ", this.settings.button_width.toString(), "\n",
- "\t", "button_height: ", this.settings.button_height.toString(), "\n",
- "\t", "button_text: ", this.settings.button_text.toString(), "\n",
- "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n",
- "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n",
- "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
- "\t", "button_action: ", this.settings.button_action.toString(), "\n",
- "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n",
-
- "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n",
- "Event Handlers:\n",
- "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
- "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
- "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
- "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
- "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
- "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
- "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
- "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
- "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
- "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"
- ].join("")
- );
-};
-
-/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
- the maintain v2 API compatibility
-*/
-// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
-SWFUpload.prototype.addSetting = function (name, value, default_value) {
- if (value == undefined) {
- return (this.settings[name] = default_value);
- } else {
- return (this.settings[name] = value);
- }
-};
-
-// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
-SWFUpload.prototype.getSetting = function (name) {
- if (this.settings[name] != undefined) {
- return this.settings[name];
- }
-
- return "";
-};
-
-
-
-// Private: callFlash handles function calls made to the Flash element.
-// Calls are made with a setTimeout for some functions to work around
-// bugs in the ExternalInterface library.
-SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
- argumentArray = argumentArray || [];
-
- var movieElement = this.getMovieElement();
- var returnValue, returnString;
-
- // Flash's method if calling ExternalInterface methods (code adapted from MooTools).
- try {
- returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
- returnValue = eval(returnString);
- } catch (ex) {
- throw "Call to " + functionName + " failed";
- }
-
- // Unescape file post param values
- if (returnValue != undefined && typeof returnValue.post === "object") {
- returnValue = this.unescapeFilePostParams(returnValue);
- }
-
- return returnValue;
-};
-
-/* *****************************
- -- Flash control methods --
- Your UI should use these
- to operate SWFUpload
- ***************************** */
-
-// WARNING: this function does not work in Flash Player 10
-// Public: selectFile causes a File Selection Dialog window to appear. This
-// dialog only allows 1 file to be selected.
-SWFUpload.prototype.selectFile = function () {
- this.callFlash("SelectFile");
-};
-
-// WARNING: this function does not work in Flash Player 10
-// Public: selectFiles causes a File Selection Dialog window to appear/ This
-// dialog allows the user to select any number of files
-// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
-// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around
-// for this bug.
-SWFUpload.prototype.selectFiles = function () {
- this.callFlash("SelectFiles");
-};
-
-
-// Public: startUpload starts uploading the first file in the queue unless
-// the optional parameter 'fileID' specifies the ID
-SWFUpload.prototype.startUpload = function (fileID) {
- this.callFlash("StartUpload", [fileID]);
-};
-
-// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index.
-// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
-// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
-SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
- if (triggerErrorEvent !== false) {
- triggerErrorEvent = true;
- }
- this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
-};
-
-// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
-// If nothing is currently uploading then nothing happens.
-SWFUpload.prototype.stopUpload = function () {
- this.callFlash("StopUpload");
-};
-
-/* ************************
- * Settings methods
- * These methods change the SWFUpload settings.
- * SWFUpload settings should not be changed directly on the settings object
- * since many of the settings need to be passed to Flash in order to take
- * effect.
- * *********************** */
-
-// Public: getStats gets the file statistics object.
-SWFUpload.prototype.getStats = function () {
- return this.callFlash("GetStats");
-};
-
-// Public: setStats changes the SWFUpload statistics. You shouldn't need to
-// change the statistics but you can. Changing the statistics does not
-// affect SWFUpload accept for the successful_uploads count which is used
-// by the upload_limit setting to determine how many files the user may upload.
-SWFUpload.prototype.setStats = function (statsObject) {
- this.callFlash("SetStats", [statsObject]);
-};
-
-// Public: getFile retrieves a File object by ID or Index. If the file is
-// not found then 'null' is returned.
-SWFUpload.prototype.getFile = function (fileID) {
- if (typeof(fileID) === "number") {
- return this.callFlash("GetFileByIndex", [fileID]);
- } else {
- return this.callFlash("GetFile", [fileID]);
- }
-};
-
-// Public: addFileParam sets a name/value pair that will be posted with the
-// file specified by the Files ID. If the name already exists then the
-// exiting value will be overwritten.
-SWFUpload.prototype.addFileParam = function (fileID, name, value) {
- return this.callFlash("AddFileParam", [fileID, name, value]);
-};
-
-// Public: removeFileParam removes a previously set (by addFileParam) name/value
-// pair from the specified file.
-SWFUpload.prototype.removeFileParam = function (fileID, name) {
- this.callFlash("RemoveFileParam", [fileID, name]);
-};
-
-// Public: setUploadUrl changes the upload_url setting.
-SWFUpload.prototype.setUploadURL = function (url) {
- this.settings.upload_url = url.toString();
- this.callFlash("SetUploadURL", [url]);
-};
-
-// Public: setPostParams changes the post_params setting
-SWFUpload.prototype.setPostParams = function (paramsObject) {
- this.settings.post_params = paramsObject;
- this.callFlash("SetPostParams", [paramsObject]);
-};
-
-// Public: addPostParam adds post name/value pair. Each name can have only one value.
-SWFUpload.prototype.addPostParam = function (name, value) {
- this.settings.post_params[name] = value;
- this.callFlash("SetPostParams", [this.settings.post_params]);
-};
-
-// Public: removePostParam deletes post name/value pair.
-SWFUpload.prototype.removePostParam = function (name) {
- delete this.settings.post_params[name];
- this.callFlash("SetPostParams", [this.settings.post_params]);
-};
-
-// Public: setFileTypes changes the file_types setting and the file_types_description setting
-SWFUpload.prototype.setFileTypes = function (types, description) {
- this.settings.file_types = types;
- this.settings.file_types_description = description;
- this.callFlash("SetFileTypes", [types, description]);
-};
-
-// Public: setFileSizeLimit changes the file_size_limit setting
-SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
- this.settings.file_size_limit = fileSizeLimit;
- this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
-};
-
-// Public: setFileUploadLimit changes the file_upload_limit setting
-SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
- this.settings.file_upload_limit = fileUploadLimit;
- this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
-};
-
-// Public: setFileQueueLimit changes the file_queue_limit setting
-SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
- this.settings.file_queue_limit = fileQueueLimit;
- this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
-};
-
-// Public: setFilePostName changes the file_post_name setting
-SWFUpload.prototype.setFilePostName = function (filePostName) {
- this.settings.file_post_name = filePostName;
- this.callFlash("SetFilePostName", [filePostName]);
-};
-
-// Public: setUseQueryString changes the use_query_string setting
-SWFUpload.prototype.setUseQueryString = function (useQueryString) {
- this.settings.use_query_string = useQueryString;
- this.callFlash("SetUseQueryString", [useQueryString]);
-};
-
-// Public: setRequeueOnError changes the requeue_on_error setting
-SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
- this.settings.requeue_on_error = requeueOnError;
- this.callFlash("SetRequeueOnError", [requeueOnError]);
-};
-
-// Public: setHTTPSuccess changes the http_success setting
-SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
- if (typeof http_status_codes === "string") {
- http_status_codes = http_status_codes.replace(" ", "").split(",");
- }
-
- this.settings.http_success = http_status_codes;
- this.callFlash("SetHTTPSuccess", [http_status_codes]);
-};
-
-// Public: setHTTPSuccess changes the http_success setting
-SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
- this.settings.assume_success_timeout = timeout_seconds;
- this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
-};
-
-// Public: setDebugEnabled changes the debug_enabled setting
-SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
- this.settings.debug_enabled = debugEnabled;
- this.callFlash("SetDebugEnabled", [debugEnabled]);
-};
-
-// Public: setButtonImageURL loads a button image sprite
-SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
- if (buttonImageURL == undefined) {
- buttonImageURL = "";
- }
-
- this.settings.button_image_url = buttonImageURL;
- this.callFlash("SetButtonImageURL", [buttonImageURL]);
-};
-
-// Public: setButtonDimensions resizes the Flash Movie and button
-SWFUpload.prototype.setButtonDimensions = function (width, height) {
- this.settings.button_width = width;
- this.settings.button_height = height;
-
- var movie = this.getMovieElement();
- if (movie != undefined) {
- movie.style.width = width + "px";
- movie.style.height = height + "px";
- }
-
- this.callFlash("SetButtonDimensions", [width, height]);
-};
-// Public: setButtonText Changes the text overlaid on the button
-SWFUpload.prototype.setButtonText = function (html) {
- this.settings.button_text = html;
- this.callFlash("SetButtonText", [html]);
-};
-// Public: setButtonTextPadding changes the top and left padding of the text overlay
-SWFUpload.prototype.setButtonTextPadding = function (left, top) {
- this.settings.button_text_top_padding = top;
- this.settings.button_text_left_padding = left;
- this.callFlash("SetButtonTextPadding", [left, top]);
-};
-
-// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
-SWFUpload.prototype.setButtonTextStyle = function (css) {
- this.settings.button_text_style = css;
- this.callFlash("SetButtonTextStyle", [css]);
-};
-// Public: setButtonDisabled disables/enables the button
-SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
- this.settings.button_disabled = isDisabled;
- this.callFlash("SetButtonDisabled", [isDisabled]);
-};
-// Public: setButtonAction sets the action that occurs when the button is clicked
-SWFUpload.prototype.setButtonAction = function (buttonAction) {
- this.settings.button_action = buttonAction;
- this.callFlash("SetButtonAction", [buttonAction]);
-};
-
-// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
-SWFUpload.prototype.setButtonCursor = function (cursor) {
- this.settings.button_cursor = cursor;
- this.callFlash("SetButtonCursor", [cursor]);
-};
-
-/* *******************************
- Flash Event Interfaces
- These functions are used by Flash to trigger the various
- events.
-
- All these functions a Private.
-
- Because the ExternalInterface library is buggy the event calls
- are added to a queue and the queue then executed by a setTimeout.
- This ensures that events are executed in a determinate order and that
- the ExternalInterface bugs are avoided.
-******************************* */
-
-SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
- // Warning: Don't call this.debug inside here or you'll create an infinite loop
-
- if (argumentArray == undefined) {
- argumentArray = [];
- } else if (!(argumentArray instanceof Array)) {
- argumentArray = [argumentArray];
- }
-
- var self = this;
- if (typeof this.settings[handlerName] === "function") {
- // Queue the event
- this.eventQueue.push(function () {
- this.settings[handlerName].apply(this, argumentArray);
- });
-
- // Execute the next queued event
- setTimeout(function () {
- self.executeNextEvent();
- }, 0);
-
- } else if (this.settings[handlerName] !== null) {
- throw "Event handler " + handlerName + " is unknown or is not a function";
- }
-};
-
-// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout
-// we must queue them in order to garentee that they are executed in order.
-SWFUpload.prototype.executeNextEvent = function () {
- // Warning: Don't call this.debug inside here or you'll create an infinite loop
-
- var f = this.eventQueue ? this.eventQueue.shift() : null;
- if (typeof(f) === "function") {
- f.apply(this);
- }
-};
-
-// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
-// properties that contain characters that are not valid for JavaScript identifiers. To work around this
-// the Flash Component escapes the parameter names and we must unescape again before passing them along.
-SWFUpload.prototype.unescapeFilePostParams = function (file) {
- var reg = /[$]([0-9a-f]{4})/i;
- var unescapedPost = {};
- var uk;
-
- if (file != undefined) {
- for (var k in file.post) {
- if (file.post.hasOwnProperty(k)) {
- uk = k;
- var match;
- while ((match = reg.exec(uk)) !== null) {
- uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
- }
- unescapedPost[uk] = file.post[k];
- }
- }
-
- file.post = unescapedPost;
- }
-
- return file;
-};
-
-// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working)
-SWFUpload.prototype.testExternalInterface = function () {
- try {
- return this.callFlash("TestExternalInterface");
- } catch (ex) {
- return false;
- }
-};
-
-// Private: This event is called by Flash when it has finished loading. Don't modify this.
-// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
-SWFUpload.prototype.flashReady = function () {
- // Check that the movie element is loaded correctly with its ExternalInterface methods defined
- var movieElement = this.getMovieElement();
-
- if (!movieElement) {
- this.debug("Flash called back ready but the flash movie can't be found.");
- return;
- }
-
- this.cleanUp(movieElement);
-
- this.queueEvent("swfupload_loaded_handler");
-};
-
-// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
-// This function is called by Flash each time the ExternalInterface functions are created.
-SWFUpload.prototype.cleanUp = function (movieElement) {
- // Pro-actively unhook all the Flash functions
- try {
- if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
- this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
- for (var key in movieElement) {
- try {
- if (typeof(movieElement[key]) === "function") {
- movieElement[key] = null;
- }
- } catch (ex) {
- }
- }
- }
- } catch (ex1) {
-
- }
-
- // Fix Flashes own cleanup code so if the SWFMovie was removed from the page
- // it doesn't display errors.
- window["__flash__removeCallback"] = function (instance, name) {
- try {
- if (instance) {
- instance[name] = null;
- }
- } catch (flashEx) {
-
- }
- };
-
-};
-
-
-/* This is a chance to do something before the browse window opens */
-SWFUpload.prototype.fileDialogStart = function () {
- this.queueEvent("file_dialog_start_handler");
-};
-
-
-/* Called when a file is successfully added to the queue. */
-SWFUpload.prototype.fileQueued = function (file) {
- file = this.unescapeFilePostParams(file);
- this.queueEvent("file_queued_handler", file);
-};
-
-
-/* Handle errors that occur when an attempt to queue a file fails. */
-SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
- file = this.unescapeFilePostParams(file);
- this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
-};
-
-/* Called after the file dialog has closed and the selected files have been queued.
- You could call startUpload here if you want the queued files to begin uploading immediately. */
-SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
- this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
-};
-
-SWFUpload.prototype.uploadStart = function (file) {
- file = this.unescapeFilePostParams(file);
- this.queueEvent("return_upload_start_handler", file);
-};
-
-SWFUpload.prototype.returnUploadStart = function (file) {
- var returnValue;
- if (typeof this.settings.upload_start_handler === "function") {
- file = this.unescapeFilePostParams(file);
- returnValue = this.settings.upload_start_handler.call(this, file);
- } else if (this.settings.upload_start_handler != undefined) {
- throw "upload_start_handler must be a function";
- }
-
- // Convert undefined to true so if nothing is returned from the upload_start_handler it is
- // interpretted as 'true'.
- if (returnValue === undefined) {
- returnValue = true;
- }
-
- returnValue = !!returnValue;
-
- this.callFlash("ReturnUploadStart", [returnValue]);
-};
-
-
-
-SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
- file = this.unescapeFilePostParams(file);
- this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
-};
-
-SWFUpload.prototype.uploadError = function (file, errorCode, message) {
- file = this.unescapeFilePostParams(file);
- this.queueEvent("upload_error_handler", [file, errorCode, message]);
-};
-
-SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
- file = this.unescapeFilePostParams(file);
- this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
-};
-
-SWFUpload.prototype.uploadComplete = function (file) {
- file = this.unescapeFilePostParams(file);
- this.queueEvent("upload_complete_handler", file);
-};
-
-/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
- internal debug console. You can override this event and have messages written where you want. */
-SWFUpload.prototype.debug = function (message) {
- this.queueEvent("debug_handler", message);
-};
-
-
-/* **********************************
- Debug Console
- The debug console is a self contained, in page location
- for debug message to be sent. The Debug Console adds
- itself to the body if necessary.
-
- The console is automatically scrolled as messages appear.
-
- If you are using your own debug handler or when you deploy to production and
- have debug disabled you can remove these functions to reduce the file size
- and complexity.
-********************************** */
-
-// Private: debugMessage is the default debug_handler. If you want to print debug messages
-// call the debug() function. When overriding the function your own function should
-// check to see if the debug setting is true before outputting debug information.
-SWFUpload.prototype.debugMessage = function (message) {
- if (this.settings.debug) {
- var exceptionMessage, exceptionValues = [];
-
- // Check for an exception object and print it nicely
- if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
- for (var key in message) {
- if (message.hasOwnProperty(key)) {
- exceptionValues.push(key + ": " + message[key]);
- }
- }
- exceptionMessage = exceptionValues.join("\n") || "";
- exceptionValues = exceptionMessage.split("\n");
- exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
- SWFUpload.Console.writeLine(exceptionMessage);
- } else {
- SWFUpload.Console.writeLine(message);
- }
- }
-};
-
-SWFUpload.Console = {};
-SWFUpload.Console.writeLine = function (message) {
- var console, documentForm;
-
- try {
- console = document.getElementById("SWFUpload_Console");
-
- if (!console) {
- documentForm = document.createElement("form");
- document.getElementsByTagName("body")[0].appendChild(documentForm);
-
- console = document.createElement("textarea");
- console.id = "SWFUpload_Console";
- console.style.fontFamily = "monospace";
- console.setAttribute("wrap", "off");
- console.wrap = "off";
- console.style.overflow = "auto";
- console.style.width = "700px";
- console.style.height = "350px";
- console.style.margin = "5px";
- documentForm.appendChild(console);
- }
-
- console.value += message + "\n";
-
- console.scrollTop = console.scrollHeight - console.clientHeight;
- } catch (ex) {
- alert("Exception: " + ex.name + " Message: " + ex.message);
- }
-};
+/** + * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com + * + * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ + * + * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + */ + + +/* ******************* */ +/* Constructor & Init */ +/* ******************* */ +var SWFUpload; + +if (SWFUpload == undefined) { + SWFUpload = function (settings) { + this.initSWFUpload(settings); + }; +} + +SWFUpload.prototype.initSWFUpload = function (settings) { + try { + this.customSettings = {}; // A container where developers can place their own settings associated with this instance. + this.settings = settings; + this.eventQueue = []; + this.movieName = "SWFUpload_" + SWFUpload.movieCount++; + this.movieElement = null; + + + // Setup global control tracking + SWFUpload.instances[this.movieName] = this; + + // Load the settings. Load the Flash movie. + this.initSettings(); + this.loadFlash(); + this.displayDebugInfo(); + } catch (ex) { + delete SWFUpload.instances[this.movieName]; + throw ex; + } +}; + +/* *************** */ +/* Static Members */ +/* *************** */ +SWFUpload.instances = {}; +SWFUpload.movieCount = 0; +SWFUpload.version = "2.2.0 2009-03-25"; +SWFUpload.QUEUE_ERROR = { + QUEUE_LIMIT_EXCEEDED : -100, + FILE_EXCEEDS_SIZE_LIMIT : -110, + ZERO_BYTE_FILE : -120, + INVALID_FILETYPE : -130 +}; +SWFUpload.UPLOAD_ERROR = { + HTTP_ERROR : -200, + MISSING_UPLOAD_URL : -210, + IO_ERROR : -220, + SECURITY_ERROR : -230, + UPLOAD_LIMIT_EXCEEDED : -240, + UPLOAD_FAILED : -250, + SPECIFIED_FILE_ID_NOT_FOUND : -260, + FILE_VALIDATION_FAILED : -270, + FILE_CANCELLED : -280, + UPLOAD_STOPPED : -290 +}; +SWFUpload.FILE_STATUS = { + QUEUED : -1, + IN_PROGRESS : -2, + ERROR : -3, + COMPLETE : -4, + CANCELLED : -5 +}; +SWFUpload.BUTTON_ACTION = { + SELECT_FILE : -100, + SELECT_FILES : -110, + START_UPLOAD : -120 +}; +SWFUpload.CURSOR = { + ARROW : -1, + HAND : -2 +}; +SWFUpload.WINDOW_MODE = { + WINDOW : "window", + TRANSPARENT : "transparent", + OPAQUE : "opaque" +}; + +// Private: takes a URL, determines if it is relative and converts to an absolute URL +// using the current site. Only processes the URL if it can, otherwise returns the URL untouched +SWFUpload.completeURL = function(url) { + if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) { + return url; + } + + var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); + + var indexSlash = window.location.pathname.lastIndexOf("/"); + if (indexSlash <= 0) { + path = "/"; + } else { + path = window.location.pathname.substr(0, indexSlash) + "/"; + } + + return /*currentURL +*/ path + url; + +}; + + +/* ******************** */ +/* Instance Members */ +/* ******************** */ + +// Private: initSettings ensures that all the +// settings are set, getting a default value if one was not assigned. +SWFUpload.prototype.initSettings = function () { + this.ensureDefault = function (settingName, defaultValue) { + this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName]; + }; + + // Upload backend settings + this.ensureDefault("upload_url", ""); + this.ensureDefault("preserve_relative_urls", false); + this.ensureDefault("file_post_name", "Filedata"); + this.ensureDefault("post_params", {}); + this.ensureDefault("use_query_string", false); + this.ensureDefault("requeue_on_error", false); + this.ensureDefault("http_success", []); + this.ensureDefault("assume_success_timeout", 0); + + // File Settings + this.ensureDefault("file_types", "*.*"); + this.ensureDefault("file_types_description", "All Files"); + this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited" + this.ensureDefault("file_upload_limit", 0); + this.ensureDefault("file_queue_limit", 0); + + // Flash Settings + this.ensureDefault("flash_url", "swfupload.swf"); + this.ensureDefault("prevent_swf_caching", true); + + // Button Settings + this.ensureDefault("button_image_url", ""); + this.ensureDefault("button_width", 1); + this.ensureDefault("button_height", 1); + this.ensureDefault("button_text", ""); + this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); + this.ensureDefault("button_text_top_padding", 0); + this.ensureDefault("button_text_left_padding", 0); + this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); + this.ensureDefault("button_disabled", false); + this.ensureDefault("button_placeholder_id", ""); + this.ensureDefault("button_placeholder", null); + this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); + this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); + + // Debug Settings + this.ensureDefault("debug", false); + this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API + + // Event Handlers + this.settings.return_upload_start_handler = this.returnUploadStart; + this.ensureDefault("swfupload_loaded_handler", null); + this.ensureDefault("file_dialog_start_handler", null); + this.ensureDefault("file_queued_handler", null); + this.ensureDefault("file_queue_error_handler", null); + this.ensureDefault("file_dialog_complete_handler", null); + + this.ensureDefault("upload_start_handler", null); + this.ensureDefault("upload_progress_handler", null); + this.ensureDefault("upload_error_handler", null); + this.ensureDefault("upload_success_handler", null); + this.ensureDefault("upload_complete_handler", null); + + this.ensureDefault("debug_handler", this.debugMessage); + + this.ensureDefault("custom_settings", {}); + + // Other settings + this.customSettings = this.settings.custom_settings; + + // Update the flash url if needed + if (!!this.settings.prevent_swf_caching) { + this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); + } + + if (!this.settings.preserve_relative_urls) { + //this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it + this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); + this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); + } + + delete this.ensureDefault; +}; + +// Private: loadFlash replaces the button_placeholder element with the flash movie. +SWFUpload.prototype.loadFlash = function () { + var targetElement, tempParent; + + // Make sure an element with the ID we are going to use doesn't already exist + if (document.getElementById(this.movieName) !== null) { + throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; + } + + // Get the element where we will be placing the flash movie + targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; + + if (targetElement == undefined) { + throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; + } + + // Append the container and load the flash + tempParent = document.createElement("div"); + tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers) + targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement); + + // Fix IE Flash/Form bug + if (window[this.movieName] == undefined) { + window[this.movieName] = this.getMovieElement(); + } + +}; + +// Private: getFlashHTML generates the object tag needed to embed the flash in to the document +SWFUpload.prototype.getFlashHTML = function () { + // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay + return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">', + '<param name="wmode" value="', this.settings.button_window_mode, '" />', + '<param name="movie" value="', this.settings.flash_url, '" />', + '<param name="quality" value="high" />', + '<param name="menu" value="false" />', + '<param name="allowScriptAccess" value="always" />', + '<param name="flashvars" value="' + this.getFlashVars() + '" />', + '</object>'].join(""); +}; + +// Private: getFlashVars builds the parameter string that will be passed +// to flash in the flashvars param. +SWFUpload.prototype.getFlashVars = function () { + // Build a string from the post param object + var paramString = this.buildParamString(); + var httpSuccessString = this.settings.http_success.join(","); + + // Build the parameter string + return ["movieName=", encodeURIComponent(this.movieName), + "&uploadURL=", encodeURIComponent(this.settings.upload_url), + "&useQueryString=", encodeURIComponent(this.settings.use_query_string), + "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), + "&httpSuccess=", encodeURIComponent(httpSuccessString), + "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), + "&params=", encodeURIComponent(paramString), + "&filePostName=", encodeURIComponent(this.settings.file_post_name), + "&fileTypes=", encodeURIComponent(this.settings.file_types), + "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), + "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), + "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), + "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), + "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), + "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), + "&buttonWidth=", encodeURIComponent(this.settings.button_width), + "&buttonHeight=", encodeURIComponent(this.settings.button_height), + "&buttonText=", encodeURIComponent(this.settings.button_text), + "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), + "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), + "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), + "&buttonAction=", encodeURIComponent(this.settings.button_action), + "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), + "&buttonCursor=", encodeURIComponent(this.settings.button_cursor) + ].join(""); +}; + +// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload +// The element is cached after the first lookup +SWFUpload.prototype.getMovieElement = function () { + if (this.movieElement == undefined) { + this.movieElement = document.getElementById(this.movieName); + } + + if (this.movieElement === null) { + throw "Could not find Flash element"; + } + + return this.movieElement; +}; + +// Private: buildParamString takes the name/value pairs in the post_params setting object +// and joins them up in to a string formatted "name=value&name=value" +SWFUpload.prototype.buildParamString = function () { + var postParams = this.settings.post_params; + var paramStringPairs = []; + + if (typeof(postParams) === "object") { + for (var name in postParams) { + if (postParams.hasOwnProperty(name)) { + paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString())); + } + } + } + + return paramStringPairs.join("&"); +}; + +// Public: Used to remove a SWFUpload instance from the page. This method strives to remove +// all references to the SWF, and other objects so memory is properly freed. +// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state. +// Credits: Major improvements provided by steffen +SWFUpload.prototype.destroy = function () { + try { + // Make sure Flash is done before we try to remove it + this.cancelUpload(null, false); + + + // Remove the SWFUpload DOM nodes + var movieElement = null; + movieElement = this.getMovieElement(); + + if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + // Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround) + for (var i in movieElement) { + try { + if (typeof(movieElement[i]) === "function") { + movieElement[i] = null; + } + } catch (ex1) {} + } + + // Remove the Movie Element from the page + try { + movieElement.parentNode.removeChild(movieElement); + } catch (ex) {} + } + + // Remove IE form fix reference + window[this.movieName] = null; + + // Destroy other references + SWFUpload.instances[this.movieName] = null; + delete SWFUpload.instances[this.movieName]; + + this.movieElement = null; + this.settings = null; + this.customSettings = null; + this.eventQueue = null; + this.movieName = null; + + + return true; + } catch (ex2) { + return false; + } +}; + + +// Public: displayDebugInfo prints out settings and configuration +// information about this SWFUpload instance. +// This function (and any references to it) can be deleted when placing +// SWFUpload in production. +SWFUpload.prototype.displayDebugInfo = function () { + this.debug( + [ + "---SWFUpload Instance Info---\n", + "Version: ", SWFUpload.version, "\n", + "Movie Name: ", this.movieName, "\n", + "Settings:\n", + "\t", "upload_url: ", this.settings.upload_url, "\n", + "\t", "flash_url: ", this.settings.flash_url, "\n", + "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", + "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", + "\t", "http_success: ", this.settings.http_success.join(", "), "\n", + "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", + "\t", "file_post_name: ", this.settings.file_post_name, "\n", + "\t", "post_params: ", this.settings.post_params.toString(), "\n", + "\t", "file_types: ", this.settings.file_types, "\n", + "\t", "file_types_description: ", this.settings.file_types_description, "\n", + "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", + "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", + "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", + "\t", "debug: ", this.settings.debug.toString(), "\n", + + "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", + + "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", + "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", + "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", + "\t", "button_width: ", this.settings.button_width.toString(), "\n", + "\t", "button_height: ", this.settings.button_height.toString(), "\n", + "\t", "button_text: ", this.settings.button_text.toString(), "\n", + "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", + "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", + "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", + "\t", "button_action: ", this.settings.button_action.toString(), "\n", + "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", + + "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", + "Event Handlers:\n", + "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", + "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", + "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", + "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", + "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", + "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", + "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", + "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", + "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", + "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n" + ].join("") + ); +}; + +/* Note: addSetting and getSetting are no longer used by SWFUpload but are included + the maintain v2 API compatibility +*/ +// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used. +SWFUpload.prototype.addSetting = function (name, value, default_value) { + if (value == undefined) { + return (this.settings[name] = default_value); + } else { + return (this.settings[name] = value); + } +}; + +// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found. +SWFUpload.prototype.getSetting = function (name) { + if (this.settings[name] != undefined) { + return this.settings[name]; + } + + return ""; +}; + + + +// Private: callFlash handles function calls made to the Flash element. +// Calls are made with a setTimeout for some functions to work around +// bugs in the ExternalInterface library. +SWFUpload.prototype.callFlash = function (functionName, argumentArray) { + argumentArray = argumentArray || []; + + var movieElement = this.getMovieElement(); + var returnValue, returnString; + + // Flash's method if calling ExternalInterface methods (code adapted from MooTools). + try { + returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>'); + returnValue = eval(returnString); + } catch (ex) { + throw "Call to " + functionName + " failed"; + } + + // Unescape file post param values + if (returnValue != undefined && typeof returnValue.post === "object") { + returnValue = this.unescapeFilePostParams(returnValue); + } + + return returnValue; +}; + +/* ***************************** + -- Flash control methods -- + Your UI should use these + to operate SWFUpload + ***************************** */ + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFile causes a File Selection Dialog window to appear. This +// dialog only allows 1 file to be selected. +SWFUpload.prototype.selectFile = function () { + this.callFlash("SelectFile"); +}; + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFiles causes a File Selection Dialog window to appear/ This +// dialog allows the user to select any number of files +// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names. +// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around +// for this bug. +SWFUpload.prototype.selectFiles = function () { + this.callFlash("SelectFiles"); +}; + + +// Public: startUpload starts uploading the first file in the queue unless +// the optional parameter 'fileID' specifies the ID +SWFUpload.prototype.startUpload = function (fileID) { + this.callFlash("StartUpload", [fileID]); +}; + +// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index. +// If you do not specify a fileID the current uploading file or first file in the queue is cancelled. +// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter. +SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) { + if (triggerErrorEvent !== false) { + triggerErrorEvent = true; + } + this.callFlash("CancelUpload", [fileID, triggerErrorEvent]); +}; + +// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue. +// If nothing is currently uploading then nothing happens. +SWFUpload.prototype.stopUpload = function () { + this.callFlash("StopUpload"); +}; + +/* ************************ + * Settings methods + * These methods change the SWFUpload settings. + * SWFUpload settings should not be changed directly on the settings object + * since many of the settings need to be passed to Flash in order to take + * effect. + * *********************** */ + +// Public: getStats gets the file statistics object. +SWFUpload.prototype.getStats = function () { + return this.callFlash("GetStats"); +}; + +// Public: setStats changes the SWFUpload statistics. You shouldn't need to +// change the statistics but you can. Changing the statistics does not +// affect SWFUpload accept for the successful_uploads count which is used +// by the upload_limit setting to determine how many files the user may upload. +SWFUpload.prototype.setStats = function (statsObject) { + this.callFlash("SetStats", [statsObject]); +}; + +// Public: getFile retrieves a File object by ID or Index. If the file is +// not found then 'null' is returned. +SWFUpload.prototype.getFile = function (fileID) { + if (typeof(fileID) === "number") { + return this.callFlash("GetFileByIndex", [fileID]); + } else { + return this.callFlash("GetFile", [fileID]); + } +}; + +// Public: addFileParam sets a name/value pair that will be posted with the +// file specified by the Files ID. If the name already exists then the +// exiting value will be overwritten. +SWFUpload.prototype.addFileParam = function (fileID, name, value) { + return this.callFlash("AddFileParam", [fileID, name, value]); +}; + +// Public: removeFileParam removes a previously set (by addFileParam) name/value +// pair from the specified file. +SWFUpload.prototype.removeFileParam = function (fileID, name) { + this.callFlash("RemoveFileParam", [fileID, name]); +}; + +// Public: setUploadUrl changes the upload_url setting. +SWFUpload.prototype.setUploadURL = function (url) { + this.settings.upload_url = url.toString(); + this.callFlash("SetUploadURL", [url]); +}; + +// Public: setPostParams changes the post_params setting +SWFUpload.prototype.setPostParams = function (paramsObject) { + this.settings.post_params = paramsObject; + this.callFlash("SetPostParams", [paramsObject]); +}; + +// Public: addPostParam adds post name/value pair. Each name can have only one value. +SWFUpload.prototype.addPostParam = function (name, value) { + this.settings.post_params[name] = value; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: removePostParam deletes post name/value pair. +SWFUpload.prototype.removePostParam = function (name) { + delete this.settings.post_params[name]; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: setFileTypes changes the file_types setting and the file_types_description setting +SWFUpload.prototype.setFileTypes = function (types, description) { + this.settings.file_types = types; + this.settings.file_types_description = description; + this.callFlash("SetFileTypes", [types, description]); +}; + +// Public: setFileSizeLimit changes the file_size_limit setting +SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) { + this.settings.file_size_limit = fileSizeLimit; + this.callFlash("SetFileSizeLimit", [fileSizeLimit]); +}; + +// Public: setFileUploadLimit changes the file_upload_limit setting +SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) { + this.settings.file_upload_limit = fileUploadLimit; + this.callFlash("SetFileUploadLimit", [fileUploadLimit]); +}; + +// Public: setFileQueueLimit changes the file_queue_limit setting +SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) { + this.settings.file_queue_limit = fileQueueLimit; + this.callFlash("SetFileQueueLimit", [fileQueueLimit]); +}; + +// Public: setFilePostName changes the file_post_name setting +SWFUpload.prototype.setFilePostName = function (filePostName) { + this.settings.file_post_name = filePostName; + this.callFlash("SetFilePostName", [filePostName]); +}; + +// Public: setUseQueryString changes the use_query_string setting +SWFUpload.prototype.setUseQueryString = function (useQueryString) { + this.settings.use_query_string = useQueryString; + this.callFlash("SetUseQueryString", [useQueryString]); +}; + +// Public: setRequeueOnError changes the requeue_on_error setting +SWFUpload.prototype.setRequeueOnError = function (requeueOnError) { + this.settings.requeue_on_error = requeueOnError; + this.callFlash("SetRequeueOnError", [requeueOnError]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) { + if (typeof http_status_codes === "string") { + http_status_codes = http_status_codes.replace(" ", "").split(","); + } + + this.settings.http_success = http_status_codes; + this.callFlash("SetHTTPSuccess", [http_status_codes]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) { + this.settings.assume_success_timeout = timeout_seconds; + this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]); +}; + +// Public: setDebugEnabled changes the debug_enabled setting +SWFUpload.prototype.setDebugEnabled = function (debugEnabled) { + this.settings.debug_enabled = debugEnabled; + this.callFlash("SetDebugEnabled", [debugEnabled]); +}; + +// Public: setButtonImageURL loads a button image sprite +SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) { + if (buttonImageURL == undefined) { + buttonImageURL = ""; + } + + this.settings.button_image_url = buttonImageURL; + this.callFlash("SetButtonImageURL", [buttonImageURL]); +}; + +// Public: setButtonDimensions resizes the Flash Movie and button +SWFUpload.prototype.setButtonDimensions = function (width, height) { + this.settings.button_width = width; + this.settings.button_height = height; + + var movie = this.getMovieElement(); + if (movie != undefined) { + movie.style.width = width + "px"; + movie.style.height = height + "px"; + } + + this.callFlash("SetButtonDimensions", [width, height]); +}; +// Public: setButtonText Changes the text overlaid on the button +SWFUpload.prototype.setButtonText = function (html) { + this.settings.button_text = html; + this.callFlash("SetButtonText", [html]); +}; +// Public: setButtonTextPadding changes the top and left padding of the text overlay +SWFUpload.prototype.setButtonTextPadding = function (left, top) { + this.settings.button_text_top_padding = top; + this.settings.button_text_left_padding = left; + this.callFlash("SetButtonTextPadding", [left, top]); +}; + +// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button +SWFUpload.prototype.setButtonTextStyle = function (css) { + this.settings.button_text_style = css; + this.callFlash("SetButtonTextStyle", [css]); +}; +// Public: setButtonDisabled disables/enables the button +SWFUpload.prototype.setButtonDisabled = function (isDisabled) { + this.settings.button_disabled = isDisabled; + this.callFlash("SetButtonDisabled", [isDisabled]); +}; +// Public: setButtonAction sets the action that occurs when the button is clicked +SWFUpload.prototype.setButtonAction = function (buttonAction) { + this.settings.button_action = buttonAction; + this.callFlash("SetButtonAction", [buttonAction]); +}; + +// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button +SWFUpload.prototype.setButtonCursor = function (cursor) { + this.settings.button_cursor = cursor; + this.callFlash("SetButtonCursor", [cursor]); +}; + +/* ******************************* + Flash Event Interfaces + These functions are used by Flash to trigger the various + events. + + All these functions a Private. + + Because the ExternalInterface library is buggy the event calls + are added to a queue and the queue then executed by a setTimeout. + This ensures that events are executed in a determinate order and that + the ExternalInterface bugs are avoided. +******************************* */ + +SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + if (argumentArray == undefined) { + argumentArray = []; + } else if (!(argumentArray instanceof Array)) { + argumentArray = [argumentArray]; + } + + var self = this; + if (typeof this.settings[handlerName] === "function") { + // Queue the event + this.eventQueue.push(function () { + this.settings[handlerName].apply(this, argumentArray); + }); + + // Execute the next queued event + setTimeout(function () { + self.executeNextEvent(); + }, 0); + + } else if (this.settings[handlerName] !== null) { + throw "Event handler " + handlerName + " is unknown or is not a function"; + } +}; + +// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout +// we must queue them in order to garentee that they are executed in order. +SWFUpload.prototype.executeNextEvent = function () { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + var f = this.eventQueue ? this.eventQueue.shift() : null; + if (typeof(f) === "function") { + f.apply(this); + } +}; + +// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have +// properties that contain characters that are not valid for JavaScript identifiers. To work around this +// the Flash Component escapes the parameter names and we must unescape again before passing them along. +SWFUpload.prototype.unescapeFilePostParams = function (file) { + var reg = /[$]([0-9a-f]{4})/i; + var unescapedPost = {}; + var uk; + + if (file != undefined) { + for (var k in file.post) { + if (file.post.hasOwnProperty(k)) { + uk = k; + var match; + while ((match = reg.exec(uk)) !== null) { + uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16))); + } + unescapedPost[uk] = file.post[k]; + } + } + + file.post = unescapedPost; + } + + return file; +}; + +// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working) +SWFUpload.prototype.testExternalInterface = function () { + try { + return this.callFlash("TestExternalInterface"); + } catch (ex) { + return false; + } +}; + +// Private: This event is called by Flash when it has finished loading. Don't modify this. +// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded. +SWFUpload.prototype.flashReady = function () { + // Check that the movie element is loaded correctly with its ExternalInterface methods defined + var movieElement = this.getMovieElement(); + + if (!movieElement) { + this.debug("Flash called back ready but the flash movie can't be found."); + return; + } + + this.cleanUp(movieElement); + + this.queueEvent("swfupload_loaded_handler"); +}; + +// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE. +// This function is called by Flash each time the ExternalInterface functions are created. +SWFUpload.prototype.cleanUp = function (movieElement) { + // Pro-actively unhook all the Flash functions + try { + if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); + for (var key in movieElement) { + try { + if (typeof(movieElement[key]) === "function") { + movieElement[key] = null; + } + } catch (ex) { + } + } + } + } catch (ex1) { + + } + + // Fix Flashes own cleanup code so if the SWFMovie was removed from the page + // it doesn't display errors. + window["__flash__removeCallback"] = function (instance, name) { + try { + if (instance) { + instance[name] = null; + } + } catch (flashEx) { + + } + }; + +}; + + +/* This is a chance to do something before the browse window opens */ +SWFUpload.prototype.fileDialogStart = function () { + this.queueEvent("file_dialog_start_handler"); +}; + + +/* Called when a file is successfully added to the queue. */ +SWFUpload.prototype.fileQueued = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queued_handler", file); +}; + + +/* Handle errors that occur when an attempt to queue a file fails. */ +SWFUpload.prototype.fileQueueError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queue_error_handler", [file, errorCode, message]); +}; + +/* Called after the file dialog has closed and the selected files have been queued. + You could call startUpload here if you want the queued files to begin uploading immediately. */ +SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) { + this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]); +}; + +SWFUpload.prototype.uploadStart = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("return_upload_start_handler", file); +}; + +SWFUpload.prototype.returnUploadStart = function (file) { + var returnValue; + if (typeof this.settings.upload_start_handler === "function") { + file = this.unescapeFilePostParams(file); + returnValue = this.settings.upload_start_handler.call(this, file); + } else if (this.settings.upload_start_handler != undefined) { + throw "upload_start_handler must be a function"; + } + + // Convert undefined to true so if nothing is returned from the upload_start_handler it is + // interpretted as 'true'. + if (returnValue === undefined) { + returnValue = true; + } + + returnValue = !!returnValue; + + this.callFlash("ReturnUploadStart", [returnValue]); +}; + + + +SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]); +}; + +SWFUpload.prototype.uploadError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_error_handler", [file, errorCode, message]); +}; + +SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_success_handler", [file, serverData, responseReceived]); +}; + +SWFUpload.prototype.uploadComplete = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_complete_handler", file); +}; + +/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the + internal debug console. You can override this event and have messages written where you want. */ +SWFUpload.prototype.debug = function (message) { + this.queueEvent("debug_handler", message); +}; + + +/* ********************************** + Debug Console + The debug console is a self contained, in page location + for debug message to be sent. The Debug Console adds + itself to the body if necessary. + + The console is automatically scrolled as messages appear. + + If you are using your own debug handler or when you deploy to production and + have debug disabled you can remove these functions to reduce the file size + and complexity. +********************************** */ + +// Private: debugMessage is the default debug_handler. If you want to print debug messages +// call the debug() function. When overriding the function your own function should +// check to see if the debug setting is true before outputting debug information. +SWFUpload.prototype.debugMessage = function (message) { + if (this.settings.debug) { + var exceptionMessage, exceptionValues = []; + + // Check for an exception object and print it nicely + if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") { + for (var key in message) { + if (message.hasOwnProperty(key)) { + exceptionValues.push(key + ": " + message[key]); + } + } + exceptionMessage = exceptionValues.join("\n") || ""; + exceptionValues = exceptionMessage.split("\n"); + exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: "); + SWFUpload.Console.writeLine(exceptionMessage); + } else { + SWFUpload.Console.writeLine(message); + } + } +}; + +SWFUpload.Console = {}; +SWFUpload.Console.writeLine = function (message) { + var console, documentForm; + + try { + console = document.getElementById("SWFUpload_Console"); + + if (!console) { + documentForm = document.createElement("form"); + document.getElementsByTagName("body")[0].appendChild(documentForm); + + console = document.createElement("textarea"); + console.id = "SWFUpload_Console"; + console.style.fontFamily = "monospace"; + console.setAttribute("wrap", "off"); + console.wrap = "off"; + console.style.overflow = "auto"; + console.style.width = "700px"; + console.style.height = "350px"; + console.style.margin = "5px"; + documentForm.appendChild(console); + } + + console.value += message + "\n"; + + console.scrollTop = console.scrollHeight - console.clientHeight; + } catch (ex) { + alert("Exception: " + ex.name + " Message: " + ex.message); + } +}; diff --git a/lib/swfupload/swfupload.queue.js b/lib/swfupload/swfupload.queue.js index 00aef320..69e619da 100644 --- a/lib/swfupload/swfupload.queue.js +++ b/lib/swfupload/swfupload.queue.js @@ -1,98 +1,98 @@ -/*
- Queue Plug-in
-
- Features:
- *Adds a cancelQueue() method for cancelling the entire queue.
- *All queued files are uploaded when startUpload() is called.
- *If false is returned from uploadComplete then the queue upload is stopped.
- If false is not returned (strict comparison) then the queue upload is continued.
- *Adds a QueueComplete event that is fired when all the queued files have finished uploading.
- Set the event handler with the queue_complete_handler setting.
-
- */
-
-var SWFUpload;
-if (typeof(SWFUpload) === "function") {
- SWFUpload.queue = {};
-
- SWFUpload.prototype.initSettings = (function (oldInitSettings) {
- return function () {
- if (typeof(oldInitSettings) === "function") {
- oldInitSettings.call(this);
- }
-
- this.queueSettings = {};
-
- this.queueSettings.queue_cancelled_flag = false;
- this.queueSettings.queue_upload_count = 0;
-
- this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
- this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
- this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
- this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
-
- this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
- };
- })(SWFUpload.prototype.initSettings);
-
- SWFUpload.prototype.startUpload = function (fileID) {
- this.queueSettings.queue_cancelled_flag = false;
- this.callFlash("StartUpload", [fileID]);
- };
-
- SWFUpload.prototype.cancelQueue = function () {
- this.queueSettings.queue_cancelled_flag = true;
- this.stopUpload();
-
- var stats = this.getStats();
- while (stats.files_queued > 0) {
- this.cancelUpload();
- stats = this.getStats();
- }
- };
-
- SWFUpload.queue.uploadStartHandler = function (file) {
- var returnValue;
- if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
- returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
- }
-
- // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
- returnValue = (returnValue === false) ? false : true;
-
- this.queueSettings.queue_cancelled_flag = !returnValue;
-
- return returnValue;
- };
-
- SWFUpload.queue.uploadCompleteHandler = function (file) {
- var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
- var continueUpload;
-
- if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
- this.queueSettings.queue_upload_count++;
- }
-
- if (typeof(user_upload_complete_handler) === "function") {
- continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
- } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
- // If the file was stopped and re-queued don't restart the upload
- continueUpload = false;
- } else {
- continueUpload = true;
- }
-
- if (continueUpload) {
- var stats = this.getStats();
- if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
- this.startUpload();
- } else if (this.queueSettings.queue_cancelled_flag === false) {
- this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
- this.queueSettings.queue_upload_count = 0;
- } else {
- this.queueSettings.queue_cancelled_flag = false;
- this.queueSettings.queue_upload_count = 0;
- }
- }
- };
+/* + Queue Plug-in + + Features: + *Adds a cancelQueue() method for cancelling the entire queue. + *All queued files are uploaded when startUpload() is called. + *If false is returned from uploadComplete then the queue upload is stopped. + If false is not returned (strict comparison) then the queue upload is continued. + *Adds a QueueComplete event that is fired when all the queued files have finished uploading. + Set the event handler with the queue_complete_handler setting. + + */ + +var SWFUpload; +if (typeof(SWFUpload) === "function") { + SWFUpload.queue = {}; + + SWFUpload.prototype.initSettings = (function (oldInitSettings) { + return function () { + if (typeof(oldInitSettings) === "function") { + oldInitSettings.call(this); + } + + this.queueSettings = {}; + + this.queueSettings.queue_cancelled_flag = false; + this.queueSettings.queue_upload_count = 0; + + this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler; + this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler; + this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler; + this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler; + + this.settings.queue_complete_handler = this.settings.queue_complete_handler || null; + }; + })(SWFUpload.prototype.initSettings); + + SWFUpload.prototype.startUpload = function (fileID) { + this.queueSettings.queue_cancelled_flag = false; + this.callFlash("StartUpload", [fileID]); + }; + + SWFUpload.prototype.cancelQueue = function () { + this.queueSettings.queue_cancelled_flag = true; + this.stopUpload(); + + var stats = this.getStats(); + while (stats.files_queued > 0) { + this.cancelUpload(); + stats = this.getStats(); + } + }; + + SWFUpload.queue.uploadStartHandler = function (file) { + var returnValue; + if (typeof(this.queueSettings.user_upload_start_handler) === "function") { + returnValue = this.queueSettings.user_upload_start_handler.call(this, file); + } + + // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value. + returnValue = (returnValue === false) ? false : true; + + this.queueSettings.queue_cancelled_flag = !returnValue; + + return returnValue; + }; + + SWFUpload.queue.uploadCompleteHandler = function (file) { + var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler; + var continueUpload; + + if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) { + this.queueSettings.queue_upload_count++; + } + + if (typeof(user_upload_complete_handler) === "function") { + continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true; + } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) { + // If the file was stopped and re-queued don't restart the upload + continueUpload = false; + } else { + continueUpload = true; + } + + if (continueUpload) { + var stats = this.getStats(); + if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) { + this.startUpload(); + } else if (this.queueSettings.queue_cancelled_flag === false) { + this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]); + this.queueSettings.queue_upload_count = 0; + } else { + this.queueSettings.queue_cancelled_flag = false; + this.queueSettings.queue_upload_count = 0; + } + } + }; }
\ No newline at end of file diff --git a/modules/akismet/controllers/admin_akismet.php b/modules/akismet/controllers/admin_akismet.php index 4847db53..8d292cf4 100644 --- a/modules/akismet/controllers/admin_akismet.php +++ b/modules/akismet/controllers/admin_akismet.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php index b4405de5..3a7fc105 100644 --- a/modules/akismet/helpers/akismet.php +++ b/modules/akismet/helpers/akismet.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/akismet/helpers/akismet_event.php b/modules/akismet/helpers/akismet_event.php index cec6d95d..4bfb0b8b 100644 --- a/modules/akismet/helpers/akismet_event.php +++ b/modules/akismet/helpers/akismet_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/akismet/helpers/akismet_installer.php b/modules/akismet/helpers/akismet_installer.php index b891fc7b..63205d5a 100644 --- a/modules/akismet/helpers/akismet_installer.php +++ b/modules/akismet/helpers/akismet_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/akismet/tests/Akismet_Helper_Test.php b/modules/akismet/tests/Akismet_Helper_Test.php index e185f280..5181fec4 100644 --- a/modules/akismet/tests/Akismet_Helper_Test.php +++ b/modules/akismet/tests/Akismet_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php index 3dd45919..3abfe1de 100644 --- a/modules/comment/controllers/admin_comments.php +++ b/modules/comment/controllers/admin_comments.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php index 6c546321..9e0f86d2 100644 --- a/modules/comment/controllers/comments.php +++ b/modules/comment/controllers/comments.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index f710ad92..e3486e83 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/helpers/comment_block.php b/modules/comment/helpers/comment_block.php index ab86b90a..641395e1 100644 --- a/modules/comment/helpers/comment_block.php +++ b/modules/comment/helpers/comment_block.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php index 12e8d73f..51e663e6 100644 --- a/modules/comment/helpers/comment_event.php +++ b/modules/comment/helpers/comment_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php index 707a98d1..9ca47f1a 100644 --- a/modules/comment/helpers/comment_installer.php +++ b/modules/comment/helpers/comment_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php index 79fa07df..eee6f750 100644 --- a/modules/comment/helpers/comment_rss.php +++ b/modules/comment/helpers/comment_rss.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/helpers/comment_theme.php b/modules/comment/helpers/comment_theme.php index ebcc1c42..b993cdae 100644 --- a/modules/comment/helpers/comment_theme.php +++ b/modules/comment/helpers/comment_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/models/comment.php b/modules/comment/models/comment.php index d9d05995..48084340 100644 --- a/modules/comment/models/comment.php +++ b/modules/comment/models/comment.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/tests/Comment_Event_Test.php b/modules/comment/tests/Comment_Event_Test.php index 08f55b3f..62ffec2f 100644 --- a/modules/comment/tests/Comment_Event_Test.php +++ b/modules/comment/tests/Comment_Event_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/tests/Comment_Helper_Test.php b/modules/comment/tests/Comment_Helper_Test.php index 7ba024c7..313764a8 100644 --- a/modules/comment/tests/Comment_Helper_Test.php +++ b/modules/comment/tests/Comment_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/comment/tests/Comment_Model_Test.php b/modules/comment/tests/Comment_Model_Test.php index f0449c05..f4e944f0 100644 --- a/modules/comment/tests/Comment_Model_Test.php +++ b/modules/comment/tests/Comment_Model_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -18,6 +18,9 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Comment_Model_Test extends Gallery_Unit_Test_Case { + public function teardown() { + identity::set_active_user(identity::admin_user()); + } public function cant_view_comments_for_unviewable_items_test() { $album = test::random_album(); diff --git a/modules/digibug/config/digibug.php b/modules/digibug/config/digibug.php index 6cd165d1..01aa1e00 100644 --- a/modules/digibug/config/digibug.php +++ b/modules/digibug/config/digibug.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/digibug/controllers/admin_digibug.php b/modules/digibug/controllers/admin_digibug.php index 7124338f..76ed2319 100644 --- a/modules/digibug/controllers/admin_digibug.php +++ b/modules/digibug/controllers/admin_digibug.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/digibug/controllers/digibug.php b/modules/digibug/controllers/digibug.php index c98ae20c..3c2bb115 100644 --- a/modules/digibug/controllers/digibug.php +++ b/modules/digibug/controllers/digibug.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php index 37fa57e5..cf7cdf21 100644 --- a/modules/digibug/helpers/digibug_event.php +++ b/modules/digibug/helpers/digibug_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/digibug/helpers/digibug_installer.php b/modules/digibug/helpers/digibug_installer.php index 7e8145d2..a72e9ff3 100644 --- a/modules/digibug/helpers/digibug_installer.php +++ b/modules/digibug/helpers/digibug_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/digibug/helpers/digibug_theme.php b/modules/digibug/helpers/digibug_theme.php index ceda55b5..d146e17d 100644 --- a/modules/digibug/helpers/digibug_theme.php +++ b/modules/digibug/helpers/digibug_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/digibug/models/digibug_proxy.php b/modules/digibug/models/digibug_proxy.php index 10949ed7..0ce21649 100644 --- a/modules/digibug/models/digibug_proxy.php +++ b/modules/digibug/models/digibug_proxy.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/digibug/tests/Digibug_Controller_Test.php b/modules/digibug/tests/Digibug_Controller_Test.php index 561dd3c9..19a3f9da 100644 --- a/modules/digibug/tests/Digibug_Controller_Test.php +++ b/modules/digibug/tests/Digibug_Controller_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/controllers/exif.php b/modules/exif/controllers/exif.php index e19c8ecf..2fe875e3 100644 --- a/modules/exif/controllers/exif.php +++ b/modules/exif/controllers/exif.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php index 3baed177..943feba7 100644 --- a/modules/exif/helpers/exif.php +++ b/modules/exif/helpers/exif.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/helpers/exif_event.php b/modules/exif/helpers/exif_event.php index 6490d11f..e85aa5bd 100644 --- a/modules/exif/helpers/exif_event.php +++ b/modules/exif/helpers/exif_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/helpers/exif_installer.php b/modules/exif/helpers/exif_installer.php index 66226061..6567600e 100644 --- a/modules/exif/helpers/exif_installer.php +++ b/modules/exif/helpers/exif_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/helpers/exif_task.php b/modules/exif/helpers/exif_task.php index 90869630..a754865a 100644 --- a/modules/exif/helpers/exif_task.php +++ b/modules/exif/helpers/exif_task.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/helpers/exif_theme.php b/modules/exif/helpers/exif_theme.php index 23dc95c2..dc891fd3 100644 --- a/modules/exif/helpers/exif_theme.php +++ b/modules/exif/helpers/exif_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/models/exif_key.php b/modules/exif/models/exif_key.php index 1df8ade4..3e9784ac 100644 --- a/modules/exif/models/exif_key.php +++ b/modules/exif/models/exif_key.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/models/exif_record.php b/modules/exif/models/exif_record.php index 3aa0fea5..8f87f6bc 100644 --- a/modules/exif/models/exif_record.php +++ b/modules/exif/models/exif_record.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/exif/tests/Exif_Test.php b/modules/exif/tests/Exif_Test.php index e4835b7f..cf5af851 100644 --- a/modules/exif/tests/Exif_Test.php +++ b/modules/exif/tests/Exif_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index f216091a..bc00378d 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index 1d97653a..2c6ad1b4 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 95ec282d..456c13c4 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -231,6 +231,7 @@ class g2_import_Core { * Import a single group. */ static function import_group(&$queue) { + $messages = array(); $g2_group_id = array_shift($queue); if (self::map($g2_group_id)) { return; @@ -239,33 +240,46 @@ class g2_import_Core { try { $g2_group = g2(GalleryCoreApi::loadEntitiesById($g2_group_id)); } catch (Exception $e) { - return t("Failed to import Gallery 2 group with id: %id\n%exception", - array("id" => $g2_group_id, "exception" => (string)$e)); + throw new G2_Import_Exception( + t("Failed to import Gallery 2 group with id: %id,", + array("id" => $g2_group_id)), + $e); } switch ($g2_group->getGroupType()) { case GROUP_NORMAL: try { $group = identity::create_group($g2_group->getGroupName()); + $messages[] = t("Group '%name' was imported", + array("name" => $g2_group->getGroupname())); } catch (Exception $e) { - // @todo For now we assume this is a "duplicate group" exception - $group = identity::lookup_user_by_name($g2_group->getGroupname()); + // Did it fail because of a duplicate group name? + $group = identity::lookup_group_by_name($g2_group->getGroupname()); + if ($group) { + $messages[] = t("Group '%name' was mapped to the existing group group of the same name.", + array("name" => $g2_group->getGroupname())); + } else { + throw new G2_Import_Exception( + t("Failed to import group '%name'", + array("name" => $g2_group->getGroupname())), + $e); + } } - $message = t("Group '%name' was imported", array("name" => $g2_group->getGroupname())); + break; case GROUP_ALL_USERS: $group = identity::registered_users(); - $message = t("Group 'Registered' was converted to '%name'", array("name" => $group->name)); + $messages[] = t("Group 'Registered' was converted to '%name'", array("name" => $group->name)); break; case GROUP_SITE_ADMINS: - $message = t("Group 'Admin' does not exist in Gallery 3, skipping"); + $messages[] = t("Group 'Admin' does not exist in Gallery 3, skipping"); break; // This is not a group in G3 case GROUP_EVERYBODY: $group = identity::everybody(); - $message = t("Group 'Everybody' was converted to '%name'", array("name" => $group->name)); + $messages[] = t("Group 'Everybody' was converted to '%name'", array("name" => $group->name)); break; } @@ -273,16 +287,18 @@ class g2_import_Core { self::set_map($g2_group->getId(), $group->id, "group"); } - return $message; + return $messages; } /** * Import a single user. */ static function import_user(&$queue) { + $messages = array(); $g2_user_id = array_shift($queue); if (self::map($g2_user_id)) { - return t("User with id: %id already imported, skipping", array("id" => $g2_user_id)); + return t("User with id: %id already imported, skipping", + array("id" => $g2_user_id)); } if (g2(GalleryCoreApi::isAnonymousUser($g2_user_id))) { @@ -295,52 +311,66 @@ class g2_import_Core { try { $g2_user = g2(GalleryCoreApi::loadEntitiesById($g2_user_id)); } catch (Exception $e) { - return t("Failed to import Gallery 2 user with id: %id\n%exception", - array("id" => $g2_user_id, "exception" => (string)$e)); + throw new G2_Import_Exception( + t("Failed to import Gallery 2 user with id: %id\n%exception", + array("id" => $g2_user_id, "exception" => (string)$e)), + $e); } $g2_groups = g2(GalleryCoreApi::fetchGroupsForUser($g2_user->getId())); $user = identity::lookup_user_by_name($g2_user->getUsername()); if ($user) { - $message = t("Loaded existing user: '%name'.", array("name" => $user->name)); + $messages[] = t("Loaded existing user: '%name'.", array("name" => $user->name)); } else { $email = $g2_user->getEmail(); if (empty($email) || !valid::email($email)) { $email = "unknown@unknown.com"; } - $user = identity::create_user($g2_user->getUsername(), $g2_user->getfullname(), - // Note: The API expects a password in cleartext. - // Just use the hashed password as an unpredictable - // value here. The user will have to reset the password. - $g2_user->getHashedPassword(), $email); + try { + $user = identity::create_user($g2_user->getUserName(), $g2_user->getFullName(), + // Note: The API expects a password in cleartext. + // Just use the hashed password as an unpredictable + // value here. The user will have to reset the password. + $g2_user->getHashedPassword(), $email); + } catch (Exception $e) { + throw new G2_Import_Exception( + t("Failed to create user: '%name' (id: %id)", + array("name" => $g2_user->getUserName(), "id" => $g2_user_id)), + $e, $messages); + } if (class_exists("User_Model") && $user instanceof User_Model) { // This will work if G2's password is a PasswordHash password as well. $user->hashed_password = $g2_user->getHashedPassword(); } - $message = t("Created user: '%name'.", array("name" => $user->name)); + $messages[] = t("Created user: '%name'.", array("name" => $user->name)); if ($email == "unknown@unknown.com") { - $message .= t("\n\tFixed invalid email (was '%invalid_email')", - array("invalid_email" => $g2_user->getEmail())); + $messages[] = t("Fixed invalid email (was '%invalid_email')", + array("invalid_email" => $g2_user->getEmail())); } } - $user->hashed_password = $g2_user->getHashedPassword(); $user->locale = $g2_user->getLanguage(); foreach ($g2_groups as $g2_group_id => $g2_group_name) { if ($g2_group_id == $g2_admin_group_id) { $user->admin = true; - $message .= t("\n\tAdded 'admin' flag to user"); + $messages[] = t("Added 'admin' flag to user"); } else { $group = identity::lookup_group(self::map($g2_group_id)); $user->add($group); - $message .= t("\n\tAdded user to group '%group'.", array("group" => $group->name)); + $messages[] = t("Added user to group '%group'.", array("group" => $group->name)); } } - $user->save(); - self::set_map($g2_user->getId(), $user->id, "user"); + try { + $user->save(); + self::set_map($g2_user->getId(), $user->id, "user"); + } catch (Exception $e) { + throw new G2_Import_Exception( + t("Failed to create user: '%name'", array("name" => $user->name)), + $e, $messages); + } - return $message; + return $messages; } /** @@ -367,7 +397,7 @@ class g2_import_Core { // Load the G2 album item, and figure out its parent in G3. $g2_album = g2(GalleryCoreApi::loadEntitiesById($g2_album_id)); } catch (Exception $e) { - return t("Failed to import Gallery 2 album with id: %id\n%exception", + return t("Failed to load Gallery 2 album with id: %id\n%exception", array("id" => $g2_album_id, "exception" => (string)$e)); } @@ -384,7 +414,12 @@ class g2_import_Core { $album->title or $album->title = $album->name; $album->description = self::_decode_html_special_chars(self::extract_description($g2_album)); $album->owner_id = self::map($g2_album->getOwnerId()); - $album->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); + try { + $album->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); + } catch (Exception $e) { + // @todo log + $album->view_count = 0; + } $album->created = $g2_album->getCreationTimestamp(); $order_map = array( @@ -409,7 +444,15 @@ class g2_import_Core { $album->sort_column = $order_map[$g2_order]; $album->sort_order = $direction_map[$g2_order_direction]; } - $album->save(); + + try { + $album->save(); + } catch (Exception $e) { + throw new G2_Import_Exception( + t("Failed to import Gallery 2 album with id %id and name %name.", + array("id" => $g2_album_id, "name" => $album->name)), + $e); + } self::import_keywords_as_tags($g2_album->getKeywords(), $album); } @@ -433,6 +476,7 @@ class g2_import_Core { $queue[$key] = $value; } + $messages = array(); $g3_album_id = self::map($g2_album_id); if (!$g3_album_id) { return t("Album with id: %id not imported", array("id" => $g3_album_id)); @@ -448,12 +492,23 @@ class g2_import_Core { $item_id = self::map($g2_source->getId()); if ($item_id) { $item = ORM::factory("item", $item_id); - $g2_album = ORM::factory("item", $g3_album_id); - $g2_album->album_cover_item_id = $item->id; - $g2_album->thumb_dirty = 1; - $g2_album->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); - $g2_album->save(); - graphics::generate($g2_album); + $g3_album = ORM::factory("item", $g3_album_id); + $g3_album->album_cover_item_id = $item->id; + $g3_album->thumb_dirty = 1; + try { + $g3_album->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); + } catch (Exception $e) { + $g3_album->view_count = 0; + } + try { + $g3_album->save(); + graphics::generate($g2_album); + } catch (Exception $e) { + return (string) new G2_Import_Exception( + t("Failed to generate an album highlight for album '%name'.", + array("name" => $g3_album->name)), + $e); + } } } } @@ -495,13 +550,13 @@ class g2_import_Core { $corrupt = 1; } - $message = array(); + $messages = array(); switch ($g2_type) { case "GalleryPhotoItem": if (!in_array($g2_item->getMimeType(), array("image/jpeg", "image/gif", "image/png"))) { Kohana_Log::add("alert", "$g2_path is an unsupported image type; using a placeholder gif"); - $message[] = t("'%path' is an unsupported image type, using a placeholder", - array("path" => $g2_path)); + $messages[] = t("'%path' is an unsupported image type, using a placeholder", + array("path" => $g2_path)); $g2_path = MODPATH . "g2_import/data/broken-image.gif"; $corrupt = 1; } @@ -517,9 +572,11 @@ class g2_import_Core { $item->owner_id = self::map($g2_item->getOwnerId()); $item->save(); } catch (Exception $e) { - Kohana_Log::add("alert", "Corrupt image $g2_path\n" . (string)$e); - $message[] = t("Corrupt image '%path'", array("path" => $g2_path)); - $message[] = (string)$e; + $exception_info = (string) new G2_Import_Exception( + t("Corrupt image '%path'", array("path" => $g2_path)), + $e, $messages); + Kohana_Log::add("alert", "Corrupt image $g2_path\n" . $exception_info); + $messages[] = $exception_info; $corrupt = 1; $item = null; } @@ -538,16 +595,19 @@ class g2_import_Core { $item->title or $item->title = $item->name; $item->description = self::_decode_html_special_chars(self::extract_description($g2_item)); $item->owner_id = self::map($g2_item->getOwnerId()); + $item->save(); } catch (Exception $e) { - Kohana_Log::add("alert", "Corrupt movie $g2_path\n" . (string)$e); - $message[] = t("Corrupt movie '%path'", array("path" => $g2_path)); - $message[] = (string)$e; + $exception_info = (string) new G2_Import_Exception( + t("Corrupt movie '%path'", array("path" => $g2_path)), + $e, $messages); + Kohana_Log::add("alert", "Corrupt movie $g2_path\n" . $exception_info); + $messages[] = $exception_info; $corrupt = 1; $item = null; } } else { Kohana_Log::add("alert", "$g2_path is an unsupported movie type"); - $message[] = t("'%path' is an unsupported movie type", array("path" => $g2_path)); + $messages[] = t("'%path' is an unsupported movie type", array("path" => $g2_path)); $corrupt = 1; } @@ -564,7 +624,11 @@ class g2_import_Core { $g2_item_url = self::g2_url(array("view" => "core.ShowItem", "itemId" => $g2_item->getId())); if (isset($item)) { - $item->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_item_id)); + try { + $item->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_item_id)); + } catch (Exception $e) { + $view_count = 1; + } $item->save(); self::set_map($g2_item_id, $item->id, "item", $g2_item_url); @@ -591,21 +655,23 @@ class g2_import_Core { if ($corrupt) { if (!empty($item)) { - $message[] = + $title = $g2_item->getTitle(); + $title or $title = $g2_item->getPathComponent(); + $messages[] = 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())); + "title" => $title)); } else { - $message[] = + $messages[] = t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed", array("g2_url" => $g2_item_url, "title" => $g2_item->getTitle())); } } self::$current_g2_item = null; - return $message; + return $messages; } /** @@ -745,7 +811,7 @@ class g2_import_Core { try { $g2_comment = g2(GalleryCoreApi::loadEntitiesById($g2_comment_id)); } catch (Exception $e) { - return t("Failed to import Gallery 2 comment with id: %id\%exception", + return t("Failed to load Gallery 2 comment with id: %id\%exception", array("id" => $g2_comment_id, "exception" => (string)$e)); } @@ -775,7 +841,14 @@ class g2_import_Core { $comment->state = "published"; $comment->server_http_host = $g2_comment->getHost(); $comment->created = $g2_comment->getDate(); - $comment->save(); + try { + $comment->save(); + } catch (Exception $e) { + return (string) new G2_Import_Exception( + t("Failed to import comment with id: %id.", + array("id" => $g2_comment_id)), + $e); + } } /** @@ -888,7 +961,14 @@ class g2_import_Core { } } } - $item->save(); + try { + $item->save(); + } catch (Exception $e) { + return (string) new G2_Import_Exception( + t("Failed to copy thumbnails and resizes for item '%name' (Gallery 2 id: %id)", + array("name" => $item->name, "id" => $g2_item_id)), + $e); + } } /** @@ -1124,3 +1204,22 @@ function g2() { } } +/** + * A wrapper for exceptions to report more details in case + * it's a ORM validation exception. + */ +class G2_Import_Exception extends Exception { + public function __construct($message, Exception $previous=null, $additional_messages=null) { + if ($additional_messages) { + $message .= "\n" . implode("\n", $additional_messages); + } + if ($previous && $previous instanceof ORM_Validation_Exception) { + $message .= "\nORM validation errors: " . print_r($previous->validation->errors(), true); + } + if ($previous) { + $message .= "\n" . (string) $previous; + } + // The $previous parameter is supported in PHP 5.3.0+. + parent::__construct($message); + } +}
\ No newline at end of file diff --git a/modules/g2_import/helpers/g2_import_event.php b/modules/g2_import/helpers/g2_import_event.php index 02a2126d..d3eb001a 100644 --- a/modules/g2_import/helpers/g2_import_event.php +++ b/modules/g2_import/helpers/g2_import_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/g2_import/helpers/g2_import_installer.php b/modules/g2_import/helpers/g2_import_installer.php index 1ec8afa9..8ada4fcb 100644 --- a/modules/g2_import/helpers/g2_import_installer.php +++ b/modules/g2_import/helpers/g2_import_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index b1179e22..f2a13291 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/g2_import/helpers/g2_import_theme.php b/modules/g2_import/helpers/g2_import_theme.php index b1aaac00..788253f9 100644 --- a/modules/g2_import/helpers/g2_import_theme.php +++ b/modules/g2_import/helpers/g2_import_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/g2_import/models/g2_map.php b/modules/g2_import/models/g2_map.php index 12fc1565..a20f48d6 100644 --- a/modules/g2_import/models/g2_map.php +++ b/modules/g2_import/models/g2_map.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/cache.php b/modules/gallery/config/cache.php index d9a27c96..a817a5da 100644 --- a/modules/gallery/config/cache.php +++ b/modules/gallery/config/cache.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/cookie.php b/modules/gallery/config/cookie.php index 692ef548..ded3bdaa 100644 --- a/modules/gallery/config/cookie.php +++ b/modules/gallery/config/cookie.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/database.php b/modules/gallery/config/database.php index c20ccdb0..0defd853 100644 --- a/modules/gallery/config/database.php +++ b/modules/gallery/config/database.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/locale.php b/modules/gallery/config/locale.php index f8241444..2047159d 100644 --- a/modules/gallery/config/locale.php +++ b/modules/gallery/config/locale.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/log_file.php b/modules/gallery/config/log_file.php index 827a5d80..d154d6d4 100644 --- a/modules/gallery/config/log_file.php +++ b/modules/gallery/config/log_file.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/routes.php b/modules/gallery/config/routes.php index 8ccd5a01..55d3cf6c 100644 --- a/modules/gallery/config/routes.php +++ b/modules/gallery/config/routes.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/sendmail.php b/modules/gallery/config/sendmail.php index a4fa76ef..65b1d59b 100644 --- a/modules/gallery/config/sendmail.php +++ b/modules/gallery/config/sendmail.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/session.php b/modules/gallery/config/session.php index 6905e299..a94166d3 100644 --- a/modules/gallery/config/session.php +++ b/modules/gallery/config/session.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/config/upload.php b/modules/gallery/config/upload.php index 69ea7768..e065ab68 100644 --- a/modules/gallery/config/upload.php +++ b/modules/gallery/config/upload.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin.php b/modules/gallery/controllers/admin.php index 838c2b50..787a2138 100644 --- a/modules/gallery/controllers/admin.php +++ b/modules/gallery/controllers/admin.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin_advanced_settings.php b/modules/gallery/controllers/admin_advanced_settings.php index 391d2598..d9a281b5 100644 --- a/modules/gallery/controllers/admin_advanced_settings.php +++ b/modules/gallery/controllers/admin_advanced_settings.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin_dashboard.php b/modules/gallery/controllers/admin_dashboard.php index 42a3c081..adc0df16 100644 --- a/modules/gallery/controllers/admin_dashboard.php +++ b/modules/gallery/controllers/admin_dashboard.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin_graphics.php b/modules/gallery/controllers/admin_graphics.php index c59dd38e..abbd8986 100644 --- a/modules/gallery/controllers/admin_graphics.php +++ b/modules/gallery/controllers/admin_graphics.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index 41523023..1ca777dc 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin_maintenance.php b/modules/gallery/controllers/admin_maintenance.php index c16c5c41..d6a2d191 100644 --- a/modules/gallery/controllers/admin_maintenance.php +++ b/modules/gallery/controllers/admin_maintenance.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -40,6 +40,7 @@ class Admin_Maintenance_Controller extends Admin_Controller { } $view = new Admin_View("admin.html"); + $view->page_title = t("Maintenance tasks"); $view->content = new View("admin_maintenance.html"); $view->content->task_definitions = task::get_definitions(); $view->content->running_tasks = ORM::factory("task") diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php index 081b3f12..30e1ace5 100644 --- a/modules/gallery/controllers/admin_modules.php +++ b/modules/gallery/controllers/admin_modules.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php index 4c55bf89..73f84d2f 100644 --- a/modules/gallery/controllers/admin_sidebar.php +++ b/modules/gallery/controllers/admin_sidebar.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index 6297e4aa..cf4fb77a 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php index 6991acd2..327ea6c8 100644 --- a/modules/gallery/controllers/admin_themes.php +++ b/modules/gallery/controllers/admin_themes.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 036dade0..730db9ae 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php index 7f3a3c7d..4b1a342a 100644 --- a/modules/gallery/controllers/combined.php +++ b/modules/gallery/controllers/combined.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 33952366..fff90ec5 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/items.php b/modules/gallery/controllers/items.php index f261e3a9..f205bf86 100644 --- a/modules/gallery/controllers/items.php +++ b/modules/gallery/controllers/items.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php index be0aaa11..d5b322ef 100644 --- a/modules/gallery/controllers/l10n_client.php +++ b/modules/gallery/controllers/l10n_client.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -38,6 +38,7 @@ class L10n_Client_Controller extends Controller { } $is_plural = Gallery_I18n::is_plural_message(unserialize($root_message->message)); + $is_empty = true; if ($is_plural) { $plural_forms = l10n_client::plural_forms($locale); $translation = array(); @@ -47,9 +48,11 @@ class L10n_Client_Controller extends Controller { throw new Exception("@todo bad request data"); } $translation[$plural_form] = $value; + $is_empty = $is_empty && empty($value); } } else { $translation = $input->post("l10n-edit-translation"); + $is_empty = empty($translation); if (null === $translation || !is_string($translation)) { throw new Exception("@todo bad request data"); } @@ -60,25 +63,31 @@ class L10n_Client_Controller extends Controller { ->where("locale", "=", $locale) ->find(); - if (!$entry->loaded()) { - $entry->key = $key; - $entry->locale = $locale; - $entry->message = $root_message->message; - $entry->base_revision = null; - } + if ($is_empty) { + if ($entry->loaded()) { + $entry->delete(); + } + } else { + if (!$entry->loaded()) { + $entry->key = $key; + $entry->locale = $locale; + $entry->message = $root_message->message; + $entry->base_revision = null; + } - $entry->translation = serialize($translation); + $entry->translation = serialize($translation); - $entry_from_incoming = ORM::factory("incoming_translation") - ->where("key", "=", $key) - ->where("locale", "=", $locale) - ->find(); + $entry_from_incoming = ORM::factory("incoming_translation") + ->where("key", "=", $key) + ->where("locale", "=", $locale) + ->find(); - if (!$entry_from_incoming->loaded()) { - $entry->base_revision = $entry_from_incoming->revision; - } + if (!$entry_from_incoming->loaded()) { + $entry->base_revision = $entry_from_incoming->revision; + } - $entry->save(); + $entry->save(); + } Gallery_I18n::clear_cache($locale); diff --git a/modules/gallery/controllers/login.php b/modules/gallery/controllers/login.php index 093c15da..40125476 100644 --- a/modules/gallery/controllers/login.php +++ b/modules/gallery/controllers/login.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/logout.php b/modules/gallery/controllers/logout.php index bfcf0f9e..967dad49 100644 --- a/modules/gallery/controllers/logout.php +++ b/modules/gallery/controllers/logout.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/maintenance.php b/modules/gallery/controllers/maintenance.php index b5f39bed..27673ff0 100644 --- a/modules/gallery/controllers/maintenance.php +++ b/modules/gallery/controllers/maintenance.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/move.php b/modules/gallery/controllers/move.php index 14513fdc..f8b85b6f 100644 --- a/modules/gallery/controllers/move.php +++ b/modules/gallery/controllers/move.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index 78a56e81..16d22d90 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php index aef032a0..6eafd9df 100644 --- a/modules/gallery/controllers/packager.php +++ b/modules/gallery/controllers/packager.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/permissions.php b/modules/gallery/controllers/permissions.php index e03f41a9..fc06cb44 100644 --- a/modules/gallery/controllers/permissions.php +++ b/modules/gallery/controllers/permissions.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index f2d47eec..f336d07c 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index 04aab8dc..813d1a93 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/reauthenticate.php b/modules/gallery/controllers/reauthenticate.php index dbd1cd21..b2a67f01 100644 --- a/modules/gallery/controllers/reauthenticate.php +++ b/modules/gallery/controllers/reauthenticate.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index 16d1d241..c7e5031b 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index 48769bce..cb940b46 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/user_profile.php b/modules/gallery/controllers/user_profile.php index b89bc358..c064e791 100644 --- a/modules/gallery/controllers/user_profile.php +++ b/modules/gallery/controllers/user_profile.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/controllers/welcome_message.php b/modules/gallery/controllers/welcome_message.php index af0d6997..b20f0a94 100644 --- a/modules/gallery/controllers/welcome_message.php +++ b/modules/gallery/controllers/welcome_message.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index f3e5ec6d..c2fb97e8 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -11,6 +11,70 @@ * 1) End-user **********************************************************************/ +/* Uploader ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +#g-add-photos-canvas, +#g-add-photos-status { + width: 469px; +} + +#g-add-photos-canvas { + border: 1px solid #ccc; + height: 200px; + margin: .5em 0; + padding: 2.8em 0 0 0; + overflow: auto; + position: relative; +} + +#g-add-photos-canvas object, +#g-add-photos-button { + left: 137px; + margin: 0 0 .5em 0; + padding: .4em 1em; + position: absolute; + top: 0; + width: 175px; +} + +#g-add-photos-canvas object { + margin: 0; + z-index: 100; +} + +#g-add-photos-canvas .uploadifyQueueItem { + margin: 0; +} + +#g-add-photos-button { + z-index: 1; +} + +#g-add-photos-status { + border: 1px solid #ccc; + height: 125px; + margin: .4em 0; + overflow: auto; +} + +#g-add-photos-status .g-message-block { + border: none; +} + +#g-add-photos-status #g-action-status li { + margin: 0 0 1px 0; + padding-top: .7em; + width: 433px; +} + +#g-add-photos-form .g-breadcrumbs { + margin: 0; +} + +#g-add-photos-form p { + margin-bottom: 0 +} + /* Permissions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #g-edit-permissions-form { @@ -121,6 +185,10 @@ * 3) Right to left language styles **********************************************************************/ +.rtl #g-add-photos-status #g-action-status li { + width: 407px; +} + .rtl #g-block-admin .g-left { margin-left: 1em; margin-right: 0; diff --git a/modules/gallery/helpers/MY_html.php b/modules/gallery/helpers/MY_html.php index b29f287f..cf130401 100644 --- a/modules/gallery/helpers/MY_html.php +++ b/modules/gallery/helpers/MY_html.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/MY_num.php b/modules/gallery/helpers/MY_num.php index 613b99df..e784b1ac 100644 --- a/modules/gallery/helpers/MY_num.php +++ b/modules/gallery/helpers/MY_num.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/MY_remote.php b/modules/gallery/helpers/MY_remote.php index af2a05d8..3e13ba8d 100644 --- a/modules/gallery/helpers/MY_remote.php +++ b/modules/gallery/helpers/MY_remote.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php index 323cae37..57ce9623 100644 --- a/modules/gallery/helpers/MY_url.php +++ b/modules/gallery/helpers/MY_url.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php index 7e8b079a..87b6b313 100644 --- a/modules/gallery/helpers/access.php +++ b/modules/gallery/helpers/access.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -637,8 +637,22 @@ class access_Core { $dirs[] = dirname($album->thumb_path()); } - $base_url = url::site("?kohana_uri=/file_proxy"); - $base_url = str_replace("/?", "?", $base_url); + $base_url = url::base(true); + $sep = "?"; + if (strpos($base_url, "?") !== false) { + $sep = "&"; + } + $base_url .= $sep . "kohana_uri=/file_proxy"; + // Replace "/index.php/?kohana..." with "/index.php?koahan..." + // Doesn't apply to "/?kohana..." or "/foo/?kohana..." + // Can't check for "index.php" since the file might be renamed, and + // there might be more Apache aliases / rewrites at work. + $url_path = parse_url($base_url, PHP_URL_PATH); + // Does the URL path have a file component? + if (preg_match("#[^/]+\.php#i", $url_path)) { + $base_url = str_replace("/?", "?", $base_url); + } + foreach ($dirs as $dir) { if ($value === self::DENY) { $fp = fopen("$dir/.htaccess", "w+"); diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index 15e0c3ca..521806a0 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/auth.php b/modules/gallery/helpers/auth.php index c3e9e6e9..1a9fe869 100644 --- a/modules/gallery/helpers/auth.php +++ b/modules/gallery/helpers/auth.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/batch.php b/modules/gallery/helpers/batch.php index 0faa3369..72d24400 100644 --- a/modules/gallery/helpers/batch.php +++ b/modules/gallery/helpers/batch.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php index 978ef9ba..4dcd6c32 100644 --- a/modules/gallery/helpers/block_manager.php +++ b/modules/gallery/helpers/block_manager.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/dir.php b/modules/gallery/helpers/dir.php index 1717bdd9..f66f443e 100644 --- a/modules/gallery/helpers/dir.php +++ b/modules/gallery/helpers/dir.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 84f8a7fb..7f7db10b 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class gallery_Core { - const VERSION = "3.0 git (pre-RC1)"; + const VERSION = "3.0 RC1 (Santa Fe)"; /** * If Gallery is in maintenance mode, then force all non-admins to get routed to a "This site is diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index 46742743..08ce21b7 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -93,7 +93,7 @@ class gallery_block_Core { case "language": $locales = locales::installed(); - if (count($locales)) { + if (count($locales) > 1) { foreach ($locales as $locale => $display_name) { $locales[$locale] = SafeString::of_safe_html($display_name); } diff --git a/modules/gallery/helpers/gallery_error.php b/modules/gallery/helpers/gallery_error.php index 551f8c63..f9bbedfc 100644 --- a/modules/gallery/helpers/gallery_error.php +++ b/modules/gallery/helpers/gallery_error.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 36f91142..d723cc1b 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -383,7 +383,7 @@ class gallery_event_Core { ->id("delete") ->label($delete_title) ->css_class("ui-icon-trash") - ->css_id("g-quick-delete") + ->css_class("g-quick-delete") ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&from_id=$theme_item->id&page_type=$page_type"))); } diff --git a/modules/gallery/helpers/gallery_graphics.php b/modules/gallery/helpers/gallery_graphics.php index ce08bbd7..6038a95b 100644 --- a/modules/gallery/helpers/gallery_graphics.php +++ b/modules/gallery/helpers/gallery_graphics.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 6f8a6688..39c35711 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php index c1790d28..9c528c0e 100644 --- a/modules/gallery/helpers/gallery_rss.php +++ b/modules/gallery/helpers/gallery_rss.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php index 617f7f48..fa95c612 100644 --- a/modules/gallery/helpers/gallery_task.php +++ b/modules/gallery/helpers/gallery_task.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index d6944323..62deb831 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -71,6 +71,7 @@ class gallery_theme_Core { static function page_bottom($theme) { $session = Session::instance(); if ($session->get("profiler", false)) { + Profiler::enable(); $profiler = new Profiler(); $profiler->render(); } @@ -87,6 +88,7 @@ class gallery_theme_Core { static function admin_page_bottom($theme) { $session = Session::instance(); if ($session->get("profiler", false)) { + Profiler::enable(); $profiler = new Profiler(); $profiler->render(); } diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index c85c7750..7ff09d13 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/identity.php b/modules/gallery/helpers/identity.php index 6df860d6..5f1664ec 100644 --- a/modules/gallery/helpers/identity.php +++ b/modules/gallery/helpers/identity.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 36193071..43c93225 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index c0fc422a..16abec5a 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php index c4dd4a5f..05ca65cf 100644 --- a/modules/gallery/helpers/items_rest.php +++ b/modules/gallery/helpers/items_rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php index c27e4e5b..f45f502d 100644 --- a/modules/gallery/helpers/l10n_client.php +++ b/modules/gallery/helpers/l10n_client.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/l10n_scanner.php b/modules/gallery/helpers/l10n_scanner.php index bb7cb449..2287a7ba 100644 --- a/modules/gallery/helpers/l10n_scanner.php +++ b/modules/gallery/helpers/l10n_scanner.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php index e72d7ed9..aacb37ca 100644 --- a/modules/gallery/helpers/locales.php +++ b/modules/gallery/helpers/locales.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -81,6 +81,7 @@ class locales_Core { $l["eu_ES"] = "Euskara"; // Basque $l["fa_IR"] = "ÙØ§Ø±Ø³"; // Farsi $l["fi_FI"] = "Suomi"; // Finnish + $l["fo_FO"] = "Føroyskt"; // Faroese $l["fr_FR"] = "Français"; // French $l["ga_IE"] = "Gaeilge"; // Irish $l["he_IL"] = "עברית"; // Hebrew diff --git a/modules/gallery/helpers/log.php b/modules/gallery/helpers/log.php index 184b0b97..26f70480 100644 --- a/modules/gallery/helpers/log.php +++ b/modules/gallery/helpers/log.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/message.php b/modules/gallery/helpers/message.php index 02680655..047eb2c7 100644 --- a/modules/gallery/helpers/message.php +++ b/modules/gallery/helpers/message.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/model_cache.php b/modules/gallery/helpers/model_cache.php index 88756407..b39d599e 100644 --- a/modules/gallery/helpers/model_cache.php +++ b/modules/gallery/helpers/model_cache.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 9523d1d2..18d65ed5 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 3c494e96..6333eaf2 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index bbdf2e3b..f20d37a3 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/site_status.php b/modules/gallery/helpers/site_status.php index 04316fff..759eb382 100644 --- a/modules/gallery/helpers/site_status.php +++ b/modules/gallery/helpers/site_status.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/task.php b/modules/gallery/helpers/task.php index aa0eb94d..4dda568f 100644 --- a/modules/gallery/helpers/task.php +++ b/modules/gallery/helpers/task.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index b836292f..ae5f030c 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/user_profile.php b/modules/gallery/helpers/user_profile.php index 95a994bc..e5ebce84 100644 --- a/modules/gallery/helpers/user_profile.php +++ b/modules/gallery/helpers/user_profile.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/helpers/xml.php b/modules/gallery/helpers/xml.php index e734e90c..2d3a2545 100644 --- a/modules/gallery/helpers/xml.php +++ b/modules/gallery/helpers/xml.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/hooks/init_gallery.php b/modules/gallery/hooks/init_gallery.php index c7355260..10383e9a 100644 --- a/modules/gallery/hooks/init_gallery.php +++ b/modules/gallery/hooks/init_gallery.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js index d0d6f619..a1170e2d 100644 --- a/modules/gallery/js/l10n_client.js +++ b/modules/gallery/js/l10n_client.js @@ -124,7 +124,7 @@ jQuery.extend(Gallery, { if (translation[form] == undefined) { translation[form] = ''; } - $('#l10n-edit-plural-translation-' + form) + $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']") .attr('value', translation[form]); $('#plural-' + form).removeClass('hidden'); } @@ -166,7 +166,7 @@ jQuery.extend(Gallery, { if (form == 'one') { text = source['one']; } - $('#l10n-edit-plural-translation-' + form) + $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']") .attr('value', text); } } else { @@ -260,18 +260,26 @@ Gallery.behaviors.l10nClient = function(context) { // Store translation in local js var translation = {}; + var is_non_empty = false; if (is_plural) { for (var i = 0; i < num_plural_forms; i++) { var form = plural_forms[i]; - translation[form] = $('#g-l10n-client-save-form #l10n-edit-plural-translation-' + form).attr('value'); + translation[form] = $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']").attr('value'); + is_non_empty = is_non_empty || translation[form]; } } else { translation = $('#l10n-edit-translation').attr('value'); + is_non_empty = translation; } Gallery.l10nClient.setString(Gallery.l10nClient.selected, translation); - // Mark message as translated. - $('#l10n-client-string-select li').eq(Gallery.l10nClient.selected).removeClass('untranslated').removeClass('active').addClass('translated'); + // Mark message as translated / untranslated. + var source_element = $('#l10n-client-string-select li').eq(Gallery.l10nClient.selected); + if (is_non_empty) { + source_element.removeClass('untranslated').removeClass('active').addClass('translated'); + } else { + source_element.removeClass('active').removeClass('translated').addClass('untranslated'); + } // Clear the translation form fields Gallery.l10nClient.showSourceMessage('', false); @@ -279,7 +287,7 @@ Gallery.behaviors.l10nClient = function(context) { for (var i = 0; i < num_plural_forms; i++) { var form = plural_forms[i]; - $('#g-l10n-client-save-form #l10n-edit-plural-translation-' + form).val(''); + $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']").val(''); } $("#g-l10n-client-save-form input[name='l10n-message-key']").val(''); }, diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index e3f9dff0..88d86a7d 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -38,6 +38,7 @@ class Admin_View_Core extends Gallery_View { $this->set_global("user", identity::active_user()); $this->set_global("page_type", "admin"); $this->set_global("page_subtype", $name); + $this->set_global("page_title", null); } public function admin_menu() { diff --git a/modules/gallery/libraries/Block.php b/modules/gallery/libraries/Block.php index 6fe679f1..f0a1b9c6 100644 --- a/modules/gallery/libraries/Block.php +++ b/modules/gallery/libraries/Block.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Form_Script.php b/modules/gallery/libraries/Form_Script.php index 1f965767..a2465169 100644 --- a/modules/gallery/libraries/Form_Script.php +++ b/modules/gallery/libraries/Form_Script.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Form_Uploadify.php b/modules/gallery/libraries/Form_Uploadify.php index 9d76153d..e5b6d819 100644 --- a/modules/gallery/libraries/Form_Uploadify.php +++ b/modules/gallery/libraries/Form_Uploadify.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Form_Uploadify_buttons.php b/modules/gallery/libraries/Form_Uploadify_buttons.php index 549010b8..eab0a700 100644 --- a/modules/gallery/libraries/Form_Uploadify_buttons.php +++ b/modules/gallery/libraries/Form_Uploadify_buttons.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Gallery_I18n.php b/modules/gallery/libraries/Gallery_I18n.php index f1e77744..f8068eec 100644 --- a/modules/gallery/libraries/Gallery_I18n.php +++ b/modules/gallery/libraries/Gallery_I18n.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 940c5321..b45bb94a 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php index 01ea9ad7..067a9929 100644 --- a/modules/gallery/libraries/IdentityProvider.php +++ b/modules/gallery/libraries/IdentityProvider.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/InPlaceEdit.php b/modules/gallery/libraries/InPlaceEdit.php index 04a2e9a5..7e631ab9 100644 --- a/modules/gallery/libraries/InPlaceEdit.php +++ b/modules/gallery/libraries/InPlaceEdit.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/MY_Database.php b/modules/gallery/libraries/MY_Database.php index cb70104a..10dd8f3c 100644 --- a/modules/gallery/libraries/MY_Database.php +++ b/modules/gallery/libraries/MY_Database.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/MY_Forge.php b/modules/gallery/libraries/MY_Forge.php index ee2a0bef..0e264335 100644 --- a/modules/gallery/libraries/MY_Forge.php +++ b/modules/gallery/libraries/MY_Forge.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/MY_Input.php b/modules/gallery/libraries/MY_Input.php index dce569fd..703136c7 100644 --- a/modules/gallery/libraries/MY_Input.php +++ b/modules/gallery/libraries/MY_Input.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/MY_Kohana_Exception.php b/modules/gallery/libraries/MY_Kohana_Exception.php index d6f1f467..e7ebdb1f 100644 --- a/modules/gallery/libraries/MY_Kohana_Exception.php +++ b/modules/gallery/libraries/MY_Kohana_Exception.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -92,4 +92,61 @@ class Kohana_Exception extends Kohana_Exception_Core { } print $view; } + + /** + * @see Kohana_Exception::dump() + */ + public static function dump($value, $length=128, $max_level=5) { + return self::safe_dump($value, null, $length, $max_level); + } + + /** + * A safer version of dump(), eliding sensitive information in the dumped + * data, such as session ids and passwords / hashes. + */ + public static function safe_dump($value, $key, $length=128, $max_level=5) { + return parent::dump(self::_sanitize_for_dump($value, $key), $length, $max_level); + } + + /** + * Elides sensitive data which shouldn't be echoed to the client, + * such as passwords, and other secrets. + */ + /* Visible for testing*/ static function _sanitize_for_dump($value, $key=null) { + // Better elide too much than letting something through. + // Note: unanchored match is intended. + $sensitive_info_pattern = + '/(password|pass|email|hash|private_key|session_id|session|g3sid|csrf|secret)/i'; + if (preg_match($sensitive_info_pattern, $key) || + (is_string($value) && preg_match('/[a-f0-9]{20,}/i', $value))) { + return 'removed for display'; + } else if (is_object($value)) { + if ($value instanceof Database) { + // Elide database password, host, name, user, etc. + return get_class($value) . ' object - details omitted for display'; + } else if ($value instanceof User_Model) { + return get_class($value) . ' object for "' . $value->name . '" - details omitted for display'; + } + return self::_sanitize_for_dump((array) $value, $key); + } else if (is_array($value)) { + $result = array(); + foreach ($value as $k => $v) { + $actual_key = $k; + $key_for_display = $k; + if ($k[0] === "\x00") { + // Remove the access level from the variable name + $actual_key = substr($k, strrpos($k, "\x00") + 1); + $access = $k[1] === '*' ? 'protected' : 'private'; + $key_for_display = "$access: $actual_key"; + } + if (is_object($v)) { + $key_for_display .= ' (type: ' . get_class($v) . ')'; + } + $result[$key_for_display] = self::_sanitize_for_dump($v, $actual_key); + } + } else { + $result = $value; + } + return $result; + } }
\ No newline at end of file diff --git a/modules/gallery/libraries/MY_ORM.php b/modules/gallery/libraries/MY_ORM.php index a158d853..4a66cf63 100644 --- a/modules/gallery/libraries/MY_ORM.php +++ b/modules/gallery/libraries/MY_ORM.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/MY_Pagination.php b/modules/gallery/libraries/MY_Pagination.php index d06a974f..4c0df1fb 100644 --- a/modules/gallery/libraries/MY_Pagination.php +++ b/modules/gallery/libraries/MY_Pagination.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/MY_View.php b/modules/gallery/libraries/MY_View.php index 83e0d0be..d76e25ff 100644 --- a/modules/gallery/libraries/MY_View.php +++ b/modules/gallery/libraries/MY_View.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index fef07916..3ad6ebef 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php index 3668d42d..e5b8ecd4 100644 --- a/modules/gallery/libraries/ORM_MPTT.php +++ b/modules/gallery/libraries/ORM_MPTT.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/SafeString.php b/modules/gallery/libraries/SafeString.php index cc63f3a7..81a51f08 100644 --- a/modules/gallery/libraries/SafeString.php +++ b/modules/gallery/libraries/SafeString.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Sendmail.php b/modules/gallery/libraries/Sendmail.php index aa2b51a9..ded7b2ef 100644 --- a/modules/gallery/libraries/Sendmail.php +++ b/modules/gallery/libraries/Sendmail.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Task_Definition.php b/modules/gallery/libraries/Task_Definition.php index 8d9c5922..2a78308e 100644 --- a/modules/gallery/libraries/Task_Definition.php +++ b/modules/gallery/libraries/Task_Definition.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index a6d1806c..8b432fb6 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/libraries/drivers/Cache/Database.php b/modules/gallery/libraries/drivers/Cache/Database.php index 085c5c35..9ada52e1 100644 --- a/modules/gallery/libraries/drivers/Cache/Database.php +++ b/modules/gallery/libraries/drivers/Cache/Database.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -130,7 +130,7 @@ class Cache_Database_Driver extends Cache_Driver { // Make sure the expiration is valid and that the hash matches if ($cache->expiration != 0 && $cache->expiration <= time()) { // Cache is not valid, delete it now - $this->delete($cache->id); + $this->delete(array($cache->id)); } else { // Disable notices for unserializing $ER = error_reporting(~E_NOTICE); diff --git a/modules/gallery/libraries/drivers/IdentityProvider.php b/modules/gallery/libraries/drivers/IdentityProvider.php index 09cdd093..3e85a57b 100644 --- a/modules/gallery/libraries/drivers/IdentityProvider.php +++ b/modules/gallery/libraries/drivers/IdentityProvider.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/access_cache.php b/modules/gallery/models/access_cache.php index 10d05df7..af1b5c6c 100644 --- a/modules/gallery/models/access_cache.php +++ b/modules/gallery/models/access_cache.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/access_intent.php b/modules/gallery/models/access_intent.php index 86cda7b3..e71f8c46 100644 --- a/modules/gallery/models/access_intent.php +++ b/modules/gallery/models/access_intent.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/cache.php b/modules/gallery/models/cache.php index 99e19a6e..4a7e37f6 100644 --- a/modules/gallery/models/cache.php +++ b/modules/gallery/models/cache.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/failed_auth.php b/modules/gallery/models/failed_auth.php index 3c25f9d8..a541f435 100644 --- a/modules/gallery/models/failed_auth.php +++ b/modules/gallery/models/failed_auth.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/graphics_rule.php b/modules/gallery/models/graphics_rule.php index 2b5a8968..49036b9c 100644 --- a/modules/gallery/models/graphics_rule.php +++ b/modules/gallery/models/graphics_rule.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/incoming_translation.php b/modules/gallery/models/incoming_translation.php index 0c9a343f..45340c30 100644 --- a/modules/gallery/models/incoming_translation.php +++ b/modules/gallery/models/incoming_translation.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index d747b84d..6ede5109 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/log.php b/modules/gallery/models/log.php index a2044325..aa1a37ed 100644 --- a/modules/gallery/models/log.php +++ b/modules/gallery/models/log.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/message.php b/modules/gallery/models/message.php index 851ececa..994d0cdb 100644 --- a/modules/gallery/models/message.php +++ b/modules/gallery/models/message.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/module.php b/modules/gallery/models/module.php index 5a9ea5bd..dc181849 100644 --- a/modules/gallery/models/module.php +++ b/modules/gallery/models/module.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/outgoing_translation.php b/modules/gallery/models/outgoing_translation.php index bf617f42..43f56dce 100644 --- a/modules/gallery/models/outgoing_translation.php +++ b/modules/gallery/models/outgoing_translation.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/permission.php b/modules/gallery/models/permission.php index e77fa5bd..b6b544d5 100644 --- a/modules/gallery/models/permission.php +++ b/modules/gallery/models/permission.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/task.php b/modules/gallery/models/task.php index 24d909cb..4888a734 100644 --- a/modules/gallery/models/task.php +++ b/modules/gallery/models/task.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/theme.php b/modules/gallery/models/theme.php index f479fd5a..523542f9 100644 --- a/modules/gallery/models/theme.php +++ b/modules/gallery/models/theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/models/var.php b/modules/gallery/models/var.php index 434370e9..a79d0048 100644 --- a/modules/gallery/models/var.php +++ b/modules/gallery/models/var.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Access_Helper_Test.php b/modules/gallery/tests/Access_Helper_Test.php index 5331117d..c092e3fd 100644 --- a/modules/gallery/tests/Access_Helper_Test.php +++ b/modules/gallery/tests/Access_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -20,6 +20,10 @@ class Access_Helper_Test extends Gallery_Unit_Test_Case { private $_group; + public function setup() { + identity::set_active_user(identity::guest()); + } + public function teardown() { try { $group = identity::lookup_group_by_name("access_test"); @@ -41,10 +45,7 @@ class Access_Helper_Test extends Gallery_Unit_Test_Case { // Reset some permissions that we mangle below access::allow(identity::everybody(), "view", item::root()); - } - - public function setup() { - identity::set_active_user(identity::guest()); + identity::set_active_user(identity::admin_user()); } public function groups_and_permissions_are_bound_to_columns_test() { diff --git a/modules/gallery/tests/Albums_Controller_Test.php b/modules/gallery/tests/Albums_Controller_Test.php index 76c9a628..6c64394d 100644 --- a/modules/gallery/tests/Albums_Controller_Test.php +++ b/modules/gallery/tests/Albums_Controller_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Cache_Test.php b/modules/gallery/tests/Cache_Test.php index 1023568b..4c65698a 100644 --- a/modules/gallery/tests/Cache_Test.php +++ b/modules/gallery/tests/Cache_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -118,7 +118,7 @@ class Cache_Test extends Gallery_Unit_Test_Case { $value3 = array("field5" => "value5", "field6" => "value6"); $this->_driver->set(array($id3 => $value3), array("tag3", "tag4"), 84600); - $this->_driver->delete($id1); + $this->_driver->delete(array($id1)); $this->assert_false($this->_driver->exists($id1), "$id1 should have been deleted"); $this->assert_true($this->_driver->exists($id2), "$id2 should not have been deleted"); @@ -138,7 +138,7 @@ class Cache_Test extends Gallery_Unit_Test_Case { $value3 = array("field5" => "value5", "field6" => "value6"); $this->_driver->set(array($id3 => $value3), array("tag3", "tag4"), 84600); - $data = $this->_driver->delete("tag3", true); + $data = $this->_driver->delete_tag(array("tag3")); $this->assert_true($this->_driver->exists($id1), "$id1 should not have been deleted"); $this->assert_false($this->_driver->exists($id2), "$id2 should have been deleted"); diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php index c27196da..e83f9a29 100644 --- a/modules/gallery/tests/Controller_Auth_Test.php +++ b/modules/gallery/tests/Controller_Auth_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Database_Test.php b/modules/gallery/tests/Database_Test.php index 730785e2..f1a83d9c 100644 --- a/modules/gallery/tests/Database_Test.php +++ b/modules/gallery/tests/Database_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Dir_Helper_Test.php b/modules/gallery/tests/Dir_Helper_Test.php index 69241447..597963d7 100644 --- a/modules/gallery/tests/Dir_Helper_Test.php +++ b/modules/gallery/tests/Dir_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/DrawForm_Test.php b/modules/gallery/tests/DrawForm_Test.php index f7b727c0..4cbc7cb7 100644 --- a/modules/gallery/tests/DrawForm_Test.php +++ b/modules/gallery/tests/DrawForm_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php index 9b2b1480..39df9f06 100644 --- a/modules/gallery/tests/File_Structure_Test.php +++ b/modules/gallery/tests/File_Structure_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -125,7 +125,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");", "/**", " * Gallery - a web based photo album viewer and editor", - " * Copyright (C) 2000-2009 Bharat Mediratta", + " * Copyright (C) 2000-2010 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", diff --git a/modules/gallery/tests/Gallery_Filters.php b/modules/gallery/tests/Gallery_Filters.php index d1bc2cfa..4e32553b 100644 --- a/modules/gallery/tests/Gallery_Filters.php +++ b/modules/gallery/tests/Gallery_Filters.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Gallery_I18n_Test.php b/modules/gallery/tests/Gallery_I18n_Test.php index f6e50d71..3643e2ed 100644 --- a/modules/gallery/tests/Gallery_I18n_Test.php +++ b/modules/gallery/tests/Gallery_I18n_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Gallery_Installer_Test.php b/modules/gallery/tests/Gallery_Installer_Test.php index 3db434bc..67e712de 100644 --- a/modules/gallery/tests/Gallery_Installer_Test.php +++ b/modules/gallery/tests/Gallery_Installer_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Html_Helper_Test.php b/modules/gallery/tests/Html_Helper_Test.php index be318632..520f9b01 100644 --- a/modules/gallery/tests/Html_Helper_Test.php +++ b/modules/gallery/tests/Html_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Item_Helper_Test.php b/modules/gallery/tests/Item_Helper_Test.php index 50587702..295871a5 100644 --- a/modules/gallery/tests/Item_Helper_Test.php +++ b/modules/gallery/tests/Item_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -18,8 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Item_Helper_Test extends Gallery_Unit_Test_Case { - - public function setup() { + public function teardown() { identity::set_active_user(identity::admin_user()); } diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index 9f632fb5..d0676292 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Item_Rest_Helper_Test.php b/modules/gallery/tests/Item_Rest_Helper_Test.php index 6d1dd864..bef95668 100644 --- a/modules/gallery/tests/Item_Rest_Helper_Test.php +++ b/modules/gallery/tests/Item_Rest_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case { + public function teardown() { + identity::set_active_user(identity::admin_user()); + } + public function resolve_test() { $album = test::random_album(); $resolved = rest::resolve(rest::url("item", $album)); diff --git a/modules/gallery/tests/Kohana_Exception_Test.php b/modules/gallery/tests/Kohana_Exception_Test.php new file mode 100644 index 00000000..48bc5184 --- /dev/null +++ b/modules/gallery/tests/Kohana_Exception_Test.php @@ -0,0 +1,170 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2010 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 Kohana_Exception_Test extends Gallery_Unit_Test_Case { + + public function dump_test() { + // Verify the override. + $this->assert_equal('<small>string</small><span>(19)</span> "removed for display"', + Kohana_Exception::dump("1a62761b836138c6198313911")); + $this->assert_equal('<small>string</small><span>(14)</span> "original value"', + Kohana_Exception::dump("original value")); + } + + public function safe_dump_test() { + // Verify the delegation. + $this->assert_equal('<small>string</small><span>(19)</span> "removed for display"', + Kohana_Exception::safe_dump("original value", "password")); + $this->assert_equal('<small>string</small><span>(14)</span> "original value"', + Kohana_Exception::safe_dump("original value", "meow")); + } + + public function sanitize_for_dump_match_key_test() { + $this->assert_equal("removed for display", + Kohana_Exception::_sanitize_for_dump("original value", "password")); + $this->assert_equal("original value", + Kohana_Exception::_sanitize_for_dump("original value", "meow")); + } + + public function sanitize_for_dump_match_key_loosely_test() { + $this->assert_equal("removed for display", + Kohana_Exception::_sanitize_for_dump("original value", "this secret key")); + } + + public function sanitize_for_dump_match_value_test() { + // Looks like a hash / secret value. + $this->assert_equal("removed for display", + Kohana_Exception::_sanitize_for_dump("p$2a178b841c6391d6368f131", "meow")); + $this->assert_equal("original value", + Kohana_Exception::_sanitize_for_dump("original value", "meow")); + } + + public function sanitize_for_dump_array_test() { + $var = array("safe" => "original value 1", + "some hash" => "original value 2", + "three" => "2a3728788982938293b9292"); + $expected = array("safe" => "original value 1", + "some hash" => "removed for display", + "three" => "removed for display"); + + $this->assert_equal($expected, + Kohana_Exception::_sanitize_for_dump($var, "ignored")); + } + + public function sanitize_for_dump_nested_array_test() { + $var = array("safe" => "original value 1", + "safe 2" => array("some hash" => "original value 2")); + $expected = array("safe" => "original value 1", + "safe 2" => array("some hash" => "removed for display")); + $this->assert_equal($expected, + Kohana_Exception::_sanitize_for_dump($var, "ignored")); + } + + public function sanitize_for_dump_user_test() { + $user = new User_Model(); + $user->name = "john"; + $user->hash = "value 1"; + $user->email = "value 2"; + $user->full_name = "value 3"; + $this->assert_equal('User_Model object for "john" - details omitted for display', + Kohana_Exception::_sanitize_for_dump($user, "ignored")); + } + + public function sanitize_for_dump_database_test() { + $db = new Kohana_Exception_Test_Database( + array("connection" => array("user" => "john", "name" => "gallery_3"), + "cache" => array())); + $this->assert_equal("Kohana_Exception_Test_Database object - details omitted for display", + Kohana_Exception::_sanitize_for_dump($db, "ignored")); + } + + public function sanitize_for_dump_nested_database_test() { + $db = new Kohana_Exception_Test_Database( + array("connection" => array("user" => "john", "name" => "gallery_3"), + "cache" => array())); + $var = array("some" => "foo", + "bar" => $db); + $this->assert_equal( + array("some" => "foo", + "bar (type: Kohana_Exception_Test_Database)" => + "Kohana_Exception_Test_Database object - details omitted for display"), + Kohana_Exception::_sanitize_for_dump($var, "ignored")); + } + + public function sanitize_for_dump_object_test() { + $obj = new Kohana_Exception_Test_Class(); + $obj->password = "original value"; + $expected = array("var_1" => "val 1", + "protected: var_2" => "val 2", + "private: var_3" => "val 3", + "protected: hash" => "removed for display", + "private: email_address" => "removed for display", + "password" => "removed for display"); + $this->assert_equal($expected, + Kohana_Exception::_sanitize_for_dump($obj, "ignored")); + } + + public function sanitize_for_dump_nested_object_test() { + $user = new User_Model(); + $user->name = "john"; + $obj = new Kohana_Exception_Test_Class(); + $obj->meow = new Kohana_Exception_Test_Class(); + $obj->woof = "original value"; + $obj->foo = array("bar" => $user); + $expected = array("var_1" => "val 1", + "protected: var_2" => "val 2", + "private: var_3" => "val 3", + "protected: hash" => "removed for display", + "private: email_address" => "removed for display", + "meow (type: Kohana_Exception_Test_Class)" => + array("var_1" => "val 1", + "protected: var_2" => "val 2", + "private: var_3" => "val 3", + "protected: hash" => "removed for display", + "private: email_address" => "removed for display"), + "woof" => "original value", + "foo" => array("bar (type: User_Model)" => + 'User_Model object for "john" - details omitted for display')); + $this->assert_equal($expected, + Kohana_Exception::_sanitize_for_dump($obj, "ignored")); + } +} + +class Kohana_Exception_Test_Database extends Database { + function __construct($config) { parent::__construct($config); } + public function connect() {} + public function disconnect() {} + public function set_charset($charset) {} + public function query_execute($sql) {} + public function escape($value) {} + public function list_constraints($table) {} + public function list_fields($table) {} + public function list_tables() {} +} + +class Kohana_Exception_Test_Class { + public $var_1 = "val 1"; + protected $var_2 = "val 2"; + private $var_3 = "val 3"; + protected $hash = "val 4"; + private $email_address = "val 5"; + function __set($name, $val) { + $this->$name = $val; + } +}
\ No newline at end of file diff --git a/modules/gallery/tests/Locales_Helper_Test.php b/modules/gallery/tests/Locales_Helper_Test.php index a2680928..a0ffd91c 100644 --- a/modules/gallery/tests/Locales_Helper_Test.php +++ b/modules/gallery/tests/Locales_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Menu_Test.php b/modules/gallery/tests/Menu_Test.php index 643aa727..58e37d5b 100644 --- a/modules/gallery/tests/Menu_Test.php +++ b/modules/gallery/tests/Menu_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/ORM_MPTT_Test.php b/modules/gallery/tests/ORM_MPTT_Test.php index 5e741537..71f553d5 100644 --- a/modules/gallery/tests/ORM_MPTT_Test.php +++ b/modules/gallery/tests/ORM_MPTT_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Photos_Controller_Test.php b/modules/gallery/tests/Photos_Controller_Test.php index 50d49fcc..dc50db94 100644 --- a/modules/gallery/tests/Photos_Controller_Test.php +++ b/modules/gallery/tests/Photos_Controller_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/SafeString_Test.php b/modules/gallery/tests/SafeString_Test.php index 7002a874..64772c12 100644 --- a/modules/gallery/tests/SafeString_Test.php +++ b/modules/gallery/tests/SafeString_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Sendmail_Test.php b/modules/gallery/tests/Sendmail_Test.php index bc57e434..b20543d1 100644 --- a/modules/gallery/tests/Sendmail_Test.php +++ b/modules/gallery/tests/Sendmail_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Url_Security_Test.php b/modules/gallery/tests/Url_Security_Test.php index 255b3909..dd395f78 100644 --- a/modules/gallery/tests/Url_Security_Test.php +++ b/modules/gallery/tests/Url_Security_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Var_Test.php b/modules/gallery/tests/Var_Test.php index fb19da7a..b3492c71 100644 --- a/modules/gallery/tests/Var_Test.php +++ b/modules/gallery/tests/Var_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php index a39a069d..f7806c07 100644 --- a/modules/gallery/tests/Xss_Security_Test.php +++ b/modules/gallery/tests/Xss_Security_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 44233459..a3ca31f4 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -218,8 +218,8 @@ modules/gallery/views/upgrader.html.php 77 DIRTY $modul modules/gallery/views/upgrader.html.php 99 DIRTY_ATTR $done?"muted":"" modules/gallery/views/upgrader.html.php 102 DIRTY_ATTR $done?"muted":"" modules/gallery/views/user_languages_block.html.php 2 DIRTY form::dropdown("g-select-session-locale",$installed_locales,$selected) -modules/gallery/views/user_profile.html.php 36 DIRTY_ATTR $user->avatar_url(40,$theme->url(,true)) -modules/gallery/views/user_profile.html.php 47 DIRTY $info->view +modules/gallery/views/user_profile.html.php 34 DIRTY_ATTR $user->avatar_url(40,$theme->url(,true)) +modules/gallery/views/user_profile.html.php 43 DIRTY $info->view modules/image_block/views/image_block_block.html.php 3 DIRTY_JS $item->url() modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class"=>"g-thumbnail")) modules/info/views/info_block.html.php 22 DIRTY date("M j, Y H:i:s",$item->captured) @@ -250,11 +250,11 @@ modules/organize/views/organize_tree.html.php 2 DIRTY_ATTR acce modules/organize/views/organize_tree.html.php 3 DIRTY_ATTR $album->id modules/organize/views/organize_tree.html.php 6 DIRTY_ATTR $selected&&$album->id==$selected->id?"ui-state-focus":"" modules/organize/views/organize_tree.html.php 7 DIRTY_ATTR $album->id -modules/organize/views/organize_tree.html.php 13 DIRTY View::factory("organize_tree.html",array("selected"=>$selected,"album"=>$child)); -modules/organize/views/organize_tree.html.php 15 DIRTY_ATTR access::can("edit",$child)?"":"g-view-only" -modules/organize/views/organize_tree.html.php 16 DIRTY_ATTR $child->id -modules/organize/views/organize_tree.html.php 18 DIRTY_ATTR $selected&&$child->id==$selected->id?"ui-state-focus":"" +modules/organize/views/organize_tree.html.php 15 DIRTY View::factory("organize_tree.html",array("selected"=>$selected,"album"=>$child)); +modules/organize/views/organize_tree.html.php 17 DIRTY_ATTR access::can("edit",$child)?"":"g-view-only" modules/organize/views/organize_tree.html.php 18 DIRTY_ATTR $child->id +modules/organize/views/organize_tree.html.php 20 DIRTY_ATTR $selected&&$child->id==$selected->id?"ui-state-focus":"" +modules/organize/views/organize_tree.html.php 20 DIRTY_ATTR $child->id 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 @@ -274,21 +274,16 @@ modules/rss/views/feed.mrss.php 42 DIRTY_ATTR $chi modules/rss/views/feed.mrss.php 48 DIRTY_ATTR $child->thumb_url(true) modules/rss/views/feed.mrss.php 49 DIRTY_ATTR $child->thumb_height modules/rss/views/feed.mrss.php 50 DIRTY_ATTR $child->thumb_width -modules/rss/views/feed.mrss.php 54 DIRTY_ATTR $child->resize_url(true) -modules/rss/views/feed.mrss.php 55 DIRTY_ATTR @filesize($child->resize_path()) -modules/rss/views/feed.mrss.php 56 DIRTY_ATTR $child->mime_type -modules/rss/views/feed.mrss.php 57 DIRTY_ATTR $child->resize_height -modules/rss/views/feed.mrss.php 58 DIRTY_ATTR $child->resize_width -modules/rss/views/feed.mrss.php 61 DIRTY_ATTR $child->file_url(true) -modules/rss/views/feed.mrss.php 62 DIRTY_ATTR @filesize($child->file_path()) -modules/rss/views/feed.mrss.php 63 DIRTY_ATTR $child->mime_type -modules/rss/views/feed.mrss.php 64 DIRTY_ATTR $child->height -modules/rss/views/feed.mrss.php 65 DIRTY_ATTR $child->width -modules/rss/views/feed.mrss.php 70 DIRTY_ATTR $child->file_url(true) -modules/rss/views/feed.mrss.php 71 DIRTY_ATTR @filesize($child->file_path()) -modules/rss/views/feed.mrss.php 72 DIRTY_ATTR $child->height -modules/rss/views/feed.mrss.php 73 DIRTY_ATTR $child->width -modules/rss/views/feed.mrss.php 74 DIRTY_ATTR $child->mime_type +modules/rss/views/feed.mrss.php 57 DIRTY_ATTR $child->resize_url(true) +modules/rss/views/feed.mrss.php 58 DIRTY_ATTR @filesize($child->resize_path()) +modules/rss/views/feed.mrss.php 59 DIRTY_ATTR $child->mime_type +modules/rss/views/feed.mrss.php 60 DIRTY_ATTR $child->resize_height +modules/rss/views/feed.mrss.php 61 DIRTY_ATTR $child->resize_width +modules/rss/views/feed.mrss.php 65 DIRTY_ATTR $child->file_url(true) +modules/rss/views/feed.mrss.php 66 DIRTY_ATTR @filesize($child->file_path()) +modules/rss/views/feed.mrss.php 67 DIRTY_ATTR $child->mime_type +modules/rss/views/feed.mrss.php 68 DIRTY_ATTR $child->height +modules/rss/views/feed.mrss.php 69 DIRTY_ATTR $child->width modules/rss/views/rss_block.html.php 6 DIRTY_JS rss::url($url) modules/search/views/search.html.php 27 DIRTY_ATTR $item_class modules/search/views/search.html.php 28 DIRTY_JS $item->url() @@ -320,8 +315,8 @@ modules/user/views/admin_users.html.php 87 DIRTY ($user modules/user/views/admin_users.html.php 123 DIRTY_ATTR $group->id modules/user/views/admin_users.html.php 123 DIRTY_ATTR ($group->special?"g-default-group":"") modules/user/views/admin_users.html.php 125 DIRTY $v -modules/user/views/admin_users_group.html.php 22 DIRTY_JS $user->id -modules/user/views/admin_users_group.html.php 22 DIRTY_JS $group->id +modules/user/views/admin_users_group.html.php 24 DIRTY_JS $user->id +modules/user/views/admin_users_group.html.php 24 DIRTY_JS $group->id modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $width modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $height modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $url diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index 07134475..d4b7b0c1 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -49,13 +49,14 @@ </tr> <? $i = 0 ?> <? foreach ($available_locales as $code => $display_name): ?> - <? if ($i == (count($available_locales)/2)): ?> - <table> - <tr> - <th> <?= t("Installed") ?> </th> - <th> <?= t("Language") ?> </th> - <th> <?= t("Default language") ?> </th> - </tr> + <? if ($i == (int) (count($available_locales)/2)): ?> + </table> + <table> + <tr> + <th> <?= t("Installed") ?> </th> + <th> <?= t("Language") ?> </th> + <th> <?= t("Default language") ?> </th> + </tr> <? endif ?> <tr class="<?= (isset($installed_locales[$code])) ? "g-available" : "" ?><?= ($default_locale == $code) ? " g-selected" : "" ?>"> <td> <?= form::checkbox("installed_locales[]", $code, isset($installed_locales[$code])) ?> </td> diff --git a/modules/gallery/views/form_uploadify.html.php b/modules/gallery/views/form_uploadify.html.php index 137cb353..d811f913 100644 --- a/modules/gallery/views/form_uploadify.html.php +++ b/modules/gallery/views/form_uploadify.html.php @@ -1,25 +1,4 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<style> -#g-add-photos-canvas object { - height: 33px; - left: -80px; - position: relative; - z-index: 100; -} -#g-add-photos-canvas span { - height: 33px; - width: 150px; -} -#g-add-photos-button { - float: left; - left: 155px; - padding-bottom: .5em; - padding-top: .5em; - position: relative; - width: 150px; - z-index: 1; -} -</style> <script type="text/javascript" src="<?= url::file("lib/swfobject.js") ?>"></script> <script type="text/javascript" src="<?= url::file("lib/uploadify/jquery.uploadify.min.js") ?>"></script> <script type="text/javascript"> @@ -113,7 +92,7 @@ <p> <?= t("Photos will be uploaded to album: ") ?> </p> - <ul class="g-breadcrumbs"> + <ul class="g-breadcrumbs ui-helper-clearfix"> <? foreach ($album->parents() as $i => $parent): ?> <li<? if ($i == 0) print " class=\"g-first\"" ?>> <?= html::clean($parent->title) ?> </li> <? endforeach ?> @@ -121,11 +100,11 @@ </ul> </div> -<div id="g-add-photos-canvas" style="text-align: center;clear: both"> - <a id="g-add-photos-button" class="ui-corner-all" href="#"><?= t("Select photos...") ?></a> +<div id="g-add-photos-canvas"> + <button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos...") ?></button> <span id="g-uploadify"></span> </div> -<div id="g-add-photos-status" style="text-align: center;"> - <ul> +<div id="g-add-photos-status"> + <ul id="g-action-status" class="g-message-block"> </ul> </div> diff --git a/modules/gallery/views/kohana/error.php b/modules/gallery/views/kohana/error.php index 26628cf2..d55105a0 100644 --- a/modules/gallery/views/kohana/error.php +++ b/modules/gallery/views/kohana/error.php @@ -204,7 +204,7 @@ <pre><?= $name?></pre> </td> <td class="value"> - <pre><?= Kohana_Exception::dump($arg) ?></pre> + <pre><?= Kohana_Exception::safe_dump($arg, $name) ?></pre> </td> </tr> <? endforeach?> @@ -265,7 +265,7 @@ </code> </td> <td class="value"> - <pre><?= Kohana_Exception::dump($value) ?></pre> + <pre><?= Kohana_Exception::safe_dump($value, $key) ?></pre> </td> </tr> <? endforeach?> diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index 2690ad24..80ee16d9 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery_unit_test/helpers/MY_request.php b/modules/gallery_unit_test/helpers/MY_request.php index 452fb0cc..c169be05 100644 --- a/modules/gallery_unit_test/helpers/MY_request.php +++ b/modules/gallery_unit_test/helpers/MY_request.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery_unit_test/helpers/test.php b/modules/gallery_unit_test/helpers/test.php index 91bd1be5..1be82a74 100644 --- a/modules/gallery_unit_test/helpers/test.php +++ b/modules/gallery_unit_test/helpers/test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php b/modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php index 545af0fe..fa04667d 100644 --- a/modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php +++ b/modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/image_block/helpers/image_block_block.php b/modules/image_block/helpers/image_block_block.php index 82c92f19..51ccc4a0 100644 --- a/modules/image_block/helpers/image_block_block.php +++ b/modules/image_block/helpers/image_block_block.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index a86bbec9..3cbbb12b 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/info/helpers/info_theme.php b/modules/info/helpers/info_theme.php index 8b8602a1..05a19cf5 100644 --- a/modules/info/helpers/info_theme.php +++ b/modules/info/helpers/info_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/kohana23_compat/config/pagination.php b/modules/kohana23_compat/config/pagination.php index d2fcd2b1..91ecc308 100644 --- a/modules/kohana23_compat/config/pagination.php +++ b/modules/kohana23_compat/config/pagination.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/kohana23_compat/libraries/MY_Database_Builder.php b/modules/kohana23_compat/libraries/MY_Database_Builder.php index b2a5c92a..014efe0e 100644 --- a/modules/kohana23_compat/libraries/MY_Database_Builder.php +++ b/modules/kohana23_compat/libraries/MY_Database_Builder.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/kohana23_compat/libraries/Pagination.php b/modules/kohana23_compat/libraries/Pagination.php index 2b06f359..ee268051 100644 --- a/modules/kohana23_compat/libraries/Pagination.php +++ b/modules/kohana23_compat/libraries/Pagination.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/notification/controllers/notification.php b/modules/notification/controllers/notification.php index d502b9fe..6458c2fb 100644 --- a/modules/notification/controllers/notification.php +++ b/modules/notification/controllers/notification.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/notification/helpers/notification.php b/modules/notification/helpers/notification.php index 3e4854d7..0cf536bc 100644 --- a/modules/notification/helpers/notification.php +++ b/modules/notification/helpers/notification.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index 19e8dedb..df9dbe48 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/notification/helpers/notification_installer.php b/modules/notification/helpers/notification_installer.php index aa2e09f7..d082d80f 100644 --- a/modules/notification/helpers/notification_installer.php +++ b/modules/notification/helpers/notification_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/notification/models/pending_notification.php b/modules/notification/models/pending_notification.php index 15710fba..c447620e 100644 --- a/modules/notification/models/pending_notification.php +++ b/modules/notification/models/pending_notification.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/notification/models/subscription.php b/modules/notification/models/subscription.php index c246ced5..043de45c 100644 --- a/modules/notification/models/subscription.php +++ b/modules/notification/models/subscription.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index c92d711f..8dc8692c 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/organize/helpers/organize_event.php b/modules/organize/helpers/organize_event.php index 6aa6da81..a9d64637 100644 --- a/modules/organize/helpers/organize_event.php +++ b/modules/organize/helpers/organize_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -26,7 +26,7 @@ class organize_event_Core { ->append(Menu::factory("dialog") ->id("organize") ->label(t("Organize album")) - ->css_id("g-organize-link") + ->css_id("g-menu-organize-link") ->url(url::site("organize/dialog/{$item->id}"))); } } @@ -37,8 +37,7 @@ class organize_event_Core { ->append(Menu::factory("dialog") ->id("organize") ->label(t("Organize album")) - ->css_id("g-organize-link") - ->css_class("ui-icon-folder-open") + ->css_class("ui-icon-folder-open g-organize-link") ->url(url::site("organize/dialog/{$item->id}"))); } } diff --git a/modules/organize/helpers/organize_theme.php b/modules/organize/helpers/organize_theme.php index c2914675..da4a1b41 100644 --- a/modules/organize/helpers/organize_theme.php +++ b/modules/organize/helpers/organize_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/recaptcha/controllers/admin_recaptcha.php b/modules/recaptcha/controllers/admin_recaptcha.php index 0ddb98c1..3f2959a5 100644 --- a/modules/recaptcha/controllers/admin_recaptcha.php +++ b/modules/recaptcha/controllers/admin_recaptcha.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/recaptcha/helpers/recaptcha.php b/modules/recaptcha/helpers/recaptcha.php index 5df22cbc..68905bd8 100644 --- a/modules/recaptcha/helpers/recaptcha.php +++ b/modules/recaptcha/helpers/recaptcha.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php index a7f64bdd..fda998e1 100644 --- a/modules/recaptcha/helpers/recaptcha_event.php +++ b/modules/recaptcha/helpers/recaptcha_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/recaptcha/helpers/recaptcha_installer.php b/modules/recaptcha/helpers/recaptcha_installer.php index e04822ea..b970d0ab 100644 --- a/modules/recaptcha/helpers/recaptcha_installer.php +++ b/modules/recaptcha/helpers/recaptcha_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/recaptcha/helpers/recaptcha_theme.php b/modules/recaptcha/helpers/recaptcha_theme.php index fd1f563c..ee880986 100644 --- a/modules/recaptcha/helpers/recaptcha_theme.php +++ b/modules/recaptcha/helpers/recaptcha_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/recaptcha/libraries/Form_Recaptcha.php b/modules/recaptcha/libraries/Form_Recaptcha.php index f4e9d4ac..736e0d95 100644 --- a/modules/recaptcha/libraries/Form_Recaptcha.php +++ b/modules/recaptcha/libraries/Form_Recaptcha.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/rest/controllers/rest.php b/modules/rest/controllers/rest.php index 7cdd97c9..9f9b9aff 100644 --- a/modules/rest/controllers/rest.php +++ b/modules/rest/controllers/rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -36,7 +36,7 @@ class Rest_Controller extends Controller { $key = rest::get_access_token($user->id); rest::reply($key->access_key); - } + } public function __call($function, $args) { $input = Input::instance(); @@ -68,7 +68,7 @@ class Rest_Controller extends Controller { } try { - print rest::reply(call_user_func(array($handler_class, $handler_method), $request)); + rest::reply(call_user_func(array($handler_class, $handler_method), $request)); } catch (ORM_Validation_Exception $e) { foreach ($e->validation->errors() as $key => $value) { $msgs[] = "$key: $value"; diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php index 1ee72aed..7440350f 100644 --- a/modules/rest/helpers/rest.php +++ b/modules/rest/helpers/rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -39,8 +39,7 @@ class rest_Core { static function set_active_user($access_token) { if (empty($access_token)) { - identity::set_active_user(identity::guest()); - return; + throw new Rest_Exception("Forbidden", 403); } $key = ORM::factory("user_access_token") diff --git a/modules/rest/helpers/rest_event.php b/modules/rest/helpers/rest_event.php index c46e65c4..91affe7a 100644 --- a/modules/rest/helpers/rest_event.php +++ b/modules/rest/helpers/rest_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/rest/helpers/rest_installer.php b/modules/rest/helpers/rest_installer.php index 9fbc5b2e..f69f62d1 100644 --- a/modules/rest/helpers/rest_installer.php +++ b/modules/rest/helpers/rest_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/rest/libraries/Rest_Exception.php b/modules/rest/libraries/Rest_Exception.php index c3548b7e..505c2e7a 100644 --- a/modules/rest/libraries/Rest_Exception.php +++ b/modules/rest/libraries/Rest_Exception.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/rest/models/user_access_token.php b/modules/rest/models/user_access_token.php index 5669d8d1..44330768 100644 --- a/modules/rest/models/user_access_token.php +++ b/modules/rest/models/user_access_token.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/rest/tests/Rest_Controller_Test.php b/modules/rest/tests/Rest_Controller_Test.php index 9f73bed9..21be8300 100644 --- a/modules/rest/tests/Rest_Controller_Test.php +++ b/modules/rest/tests/Rest_Controller_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -20,6 +20,9 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case { public function setup() { $this->_save = array($_GET, $_POST, $_SERVER); + + $key = rest::get_access_token(1); // admin user + $_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = $key->access_key; } public function teardown() { @@ -60,24 +63,26 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case { } public function get_test() { + unset($_SERVER["HTTP_X_GALLERY_REQUEST_KEY"]); + $_SERVER["REQUEST_METHOD"] = "GET"; $_GET["key"] = "value"; - $this->assert_array_equal_to_json( - array("params" => array("key" => "value"), - "method" => "get", - "access_token" => null, - "url" => "http://./index.php/gallery_unit_test"), - test::call_and_capture(array(new Rest_Controller(), "mock"))); + try { + test::call_and_capture(array(new Rest_Controller(), "mock")); + } catch (Rest_Exception $e) { + $this->assert_same(403, $e->getCode()); + return; + } + + $this->assert_true(false, "Should be forbidden"); } public function get_with_access_key_test() { - $key = rest::get_access_token(1); // admin user - $_SERVER["REQUEST_METHOD"] = "GET"; - $_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = $key->access_key; $_GET["key"] = "value"; + $key = rest::get_access_token(1); // admin user $this->assert_array_equal_to_json( array("params" => array("key" => "value"), "method" => "get", @@ -90,10 +95,11 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case { $_SERVER["REQUEST_METHOD"] = "POST"; $_POST["key"] = "value"; + $key = rest::get_access_token(1); // admin user $this->assert_array_equal_to_json( array("params" => array("key" => "value"), "method" => "post", - "access_token" => null, + "access_token" => $key->access_key, "url" => "http://./index.php/gallery_unit_test"), test::call_and_capture(array(new Rest_Controller(), "mock"))); } @@ -103,10 +109,11 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case { $_SERVER["HTTP_X_GALLERY_REQUEST_METHOD"] = "put"; $_POST["key"] = "value"; + $key = rest::get_access_token(1); // admin user $this->assert_array_equal_to_json( array("params" => array("key" => "value"), "method" => "put", - "access_token" => null, + "access_token" => $key->access_key, "url" => "http://./index.php/gallery_unit_test"), test::call_and_capture(array(new Rest_Controller(), "mock"))); } @@ -116,10 +123,11 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case { $_SERVER["HTTP_X_GALLERY_REQUEST_METHOD"] = "delete"; $_POST["key"] = "value"; + $key = rest::get_access_token(1); // admin user $this->assert_array_equal_to_json( array("params" => array("key" => "value"), "method" => "delete", - "access_token" => null, + "access_token" => $key->access_key, "url" => "http://./index.php/gallery_unit_test"), test::call_and_capture(array(new Rest_Controller(), "mock"))); } diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php index 3066ba16..407220da 100644 --- a/modules/rss/controllers/rss.php +++ b/modules/rss/controllers/rss.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php index 4260206c..684dad08 100644 --- a/modules/rss/helpers/rss.php +++ b/modules/rss/helpers/rss.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/rss/helpers/rss_block.php b/modules/rss/helpers/rss_block.php index 8da45e98..5e53e492 100644 --- a/modules/rss/helpers/rss_block.php +++ b/modules/rss/helpers/rss_block.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index ea870847..e5894f30 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php index 9018ffa2..22f83218 100644 --- a/modules/search/helpers/search.php +++ b/modules/search/helpers/search.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/search/helpers/search_event.php b/modules/search/helpers/search_event.php index 97041f8c..45f7da4c 100644 --- a/modules/search/helpers/search_event.php +++ b/modules/search/helpers/search_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php index f3225b4e..929cc1a8 100644 --- a/modules/search/helpers/search_installer.php +++ b/modules/search/helpers/search_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/search/helpers/search_task.php b/modules/search/helpers/search_task.php index e039e493..08f75d66 100644 --- a/modules/search/helpers/search_task.php +++ b/modules/search/helpers/search_task.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/search/helpers/search_theme.php b/modules/search/helpers/search_theme.php index 1bb6121c..07066caa 100644 --- a/modules/search/helpers/search_theme.php +++ b/modules/search/helpers/search_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/search/models/search_record.php b/modules/search/models/search_record.php index 9f3bb1ec..fe9b758f 100644 --- a/modules/search/models/search_record.php +++ b/modules/search/models/search_record.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index 17c3f68b..7ffba361 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 4cdaa275..3e460f20 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/server_add/helpers/server_add.php b/modules/server_add/helpers/server_add.php index 27794855..03869f2d 100644 --- a/modules/server_add/helpers/server_add.php +++ b/modules/server_add/helpers/server_add.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php index e1295bd4..631af02f 100644 --- a/modules/server_add/helpers/server_add_event.php +++ b/modules/server_add/helpers/server_add_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/server_add/helpers/server_add_installer.php b/modules/server_add/helpers/server_add_installer.php index c3c1572d..676bc3cf 100644 --- a/modules/server_add/helpers/server_add_installer.php +++ b/modules/server_add/helpers/server_add_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/server_add/helpers/server_add_theme.php b/modules/server_add/helpers/server_add_theme.php index 84f28df2..53f78772 100644 --- a/modules/server_add/helpers/server_add_theme.php +++ b/modules/server_add/helpers/server_add_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/server_add/models/server_add_file.php b/modules/server_add/models/server_add_file.php index 8b1ed924..83bde344 100644 --- a/modules/server_add/models/server_add_file.php +++ b/modules/server_add/models/server_add_file.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/server_add/views/admin_server_add.html.php b/modules/server_add/views/admin_server_add.html.php index 6dbb8637..933ab7f8 100644 --- a/modules/server_add/views/admin_server_add.html.php +++ b/modules/server_add/views/admin_server_add.html.php @@ -1,6 +1,6 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <div class="g-block"> - <h1> <?= t("Add from server admininstration") ?> </h1> + <h1> <?= t("Add from server administration") ?> </h1> <div class="g-block-content"> <?= $form ?> <h2><?= t("Authorized paths") ?></h2> diff --git a/modules/slideshow/helpers/slideshow_event.php b/modules/slideshow/helpers/slideshow_event.php index 137ec313..6cb5d019 100644 --- a/modules/slideshow/helpers/slideshow_event.php +++ b/modules/slideshow/helpers/slideshow_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/slideshow/helpers/slideshow_installer.php b/modules/slideshow/helpers/slideshow_installer.php index 8d612f3e..cabbf7a8 100644 --- a/modules/slideshow/helpers/slideshow_installer.php +++ b/modules/slideshow/helpers/slideshow_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/slideshow/helpers/slideshow_theme.php b/modules/slideshow/helpers/slideshow_theme.php index 6aaf371c..c23326cf 100644 --- a/modules/slideshow/helpers/slideshow_theme.php +++ b/modules/slideshow/helpers/slideshow_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index 9092ec68..03a14814 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 04400d73..f9a56ccf 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/item_tags_rest.php b/modules/tag/helpers/item_tags_rest.php index 43e2cef0..8a1b1e8b 100644 --- a/modules/tag/helpers/item_tags_rest.php +++ b/modules/tag/helpers/item_tags_rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index a500be58..8df4210d 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php index f0b56175..0473e4b2 100644 --- a/modules/tag/helpers/tag_block.php +++ b/modules/tag/helpers/tag_block.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 10075c02..a790b930 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php index bcb830e4..6ccaf835 100644 --- a/modules/tag/helpers/tag_installer.php +++ b/modules/tag/helpers/tag_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag_item_rest.php b/modules/tag/helpers/tag_item_rest.php index fe07fefb..bce00a9f 100644 --- a/modules/tag/helpers/tag_item_rest.php +++ b/modules/tag/helpers/tag_item_rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag_items_rest.php b/modules/tag/helpers/tag_items_rest.php index 18973ebb..003c7c95 100644 --- a/modules/tag/helpers/tag_items_rest.php +++ b/modules/tag/helpers/tag_items_rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag_rest.php b/modules/tag/helpers/tag_rest.php index 4879cf63..f30706bd 100644 --- a/modules/tag/helpers/tag_rest.php +++ b/modules/tag/helpers/tag_rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag_rss.php b/modules/tag/helpers/tag_rss.php index 5d42caab..7d52814b 100644 --- a/modules/tag/helpers/tag_rss.php +++ b/modules/tag/helpers/tag_rss.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php index e966821a..f731dbb7 100644 --- a/modules/tag/helpers/tag_theme.php +++ b/modules/tag/helpers/tag_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/helpers/tags_rest.php b/modules/tag/helpers/tags_rest.php index f28be7b5..82826d8e 100644 --- a/modules/tag/helpers/tags_rest.php +++ b/modules/tag/helpers/tags_rest.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index 38a8ed69..e8bd69c5 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/tests/Tag_Item_Rest_Helper_Test.php b/modules/tag/tests/Tag_Item_Rest_Helper_Test.php index cb368790..e5acab93 100644 --- a/modules/tag/tests/Tag_Item_Rest_Helper_Test.php +++ b/modules/tag/tests/Tag_Item_Rest_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/tests/Tag_Rest_Helper_Test.php b/modules/tag/tests/Tag_Rest_Helper_Test.php index 838de975..f4d5a14a 100644 --- a/modules/tag/tests/Tag_Rest_Helper_Test.php +++ b/modules/tag/tests/Tag_Rest_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/tests/Tag_Test.php b/modules/tag/tests/Tag_Test.php index defc4e89..38c32e47 100644 --- a/modules/tag/tests/Tag_Test.php +++ b/modules/tag/tests/Tag_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/tag/tests/Tags_Rest_Helper_Test.php b/modules/tag/tests/Tags_Rest_Helper_Test.php index cdf7bfdf..a0ebc8c3 100644 --- a/modules/tag/tests/Tags_Rest_Helper_Test.php +++ b/modules/tag/tests/Tags_Rest_Helper_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -26,6 +26,10 @@ class Tags_Rest_Helper_Test extends Gallery_Unit_Test_Case { } } + public function teardown() { + identity::set_active_user(identity::admin_user()); + } + public function get_test() { $t1 = tag::add(item::root(), "t1"); $t2 = tag::add(item::root(), "t2"); diff --git a/modules/user/config/identity.php b/modules/user/config/identity.php index f9f013aa..36ebc038 100644 --- a/modules/user/config/identity.php +++ b/modules/user/config/identity.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php index df3d96c9..3e36fd67 100644 --- a/modules/user/controllers/admin_users.php +++ b/modules/user/controllers/admin_users.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/controllers/password.php b/modules/user/controllers/password.php index f5190974..522b6b35 100644 --- a/modules/user/controllers/password.php +++ b/modules/user/controllers/password.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -52,7 +52,7 @@ class Password_Controller extends Controller { $user_name = $form->reset->inputs["name"]->value; $user = user::lookup_by_name($user_name); if ($user && !empty($user->email)) { - $user->hash = md5(rand()); + $user->hash = md5(uniqid(mt_rand(), true)); $user->save(); $message = new View("reset_password.html"); $message->confirm_url = url::abs_site("password/do_reset?key=$user->hash"); diff --git a/modules/user/controllers/users.php b/modules/user/controllers/users.php index cd7d271f..e1f1fa2b 100644 --- a/modules/user/controllers/users.php +++ b/modules/user/controllers/users.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 @@ -30,7 +30,8 @@ class Users_Controller extends Controller { $user->full_name = $form->edit_user->full_name->value; $user->url = $form->edit_user->url->value; - if ($user->locale != $form->edit_user->locale->value) { + if (count(locales::installed()) > 1 && + $user->locale != $form->edit_user->locale->value) { $user->locale = $form->edit_user->locale->value; $flush_locale_cookie = true; } @@ -221,6 +222,10 @@ class Users_Controller extends Controller { /** @todo combine with Admin_Users_Controller::_add_locale_dropdown */ private function _add_locale_dropdown(&$form, $user=null) { $locales = locales::installed(); + if (count($locales) <= 1) { + return; + } + foreach ($locales as $locale => $display_name) { $locales[$locale] = SafeString::of_safe_html($display_name); } diff --git a/modules/user/helpers/group.php b/modules/user/helpers/group.php index 38124b0d..c84910f1 100644 --- a/modules/user/helpers/group.php +++ b/modules/user/helpers/group.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php index 7ceca6a5..650dcf6a 100644 --- a/modules/user/helpers/user.php +++ b/modules/user/helpers/user.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/helpers/user_event.php b/modules/user/helpers/user_event.php index cf91812e..3b6ddc66 100644 --- a/modules/user/helpers/user_event.php +++ b/modules/user/helpers/user_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php index 729f087a..afa0bd16 100644 --- a/modules/user/helpers/user_installer.php +++ b/modules/user/helpers/user_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/helpers/user_theme.php b/modules/user/helpers/user_theme.php index 31e2e8c0..5a7161ed 100644 --- a/modules/user/helpers/user_theme.php +++ b/modules/user/helpers/user_theme.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/libraries/drivers/IdentityProvider/Gallery.php b/modules/user/libraries/drivers/IdentityProvider/Gallery.php index 666f185f..1ed7dd4f 100644 --- a/modules/user/libraries/drivers/IdentityProvider/Gallery.php +++ b/modules/user/libraries/drivers/IdentityProvider/Gallery.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/models/group.php b/modules/user/models/group.php index 82843ad1..57b12963 100644 --- a/modules/user/models/group.php +++ b/modules/user/models/group.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/models/user.php b/modules/user/models/user.php index 4404ee63..78d74aa3 100644 --- a/modules/user/models/user.php +++ b/modules/user/models/user.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/tests/No_Direct_ORM_Access_Test.php b/modules/user/tests/No_Direct_ORM_Access_Test.php index eb7f09b0..0e5aa263 100644 --- a/modules/user/tests/No_Direct_ORM_Access_Test.php +++ b/modules/user/tests/No_Direct_ORM_Access_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/tests/User_Groups_Test.php b/modules/user/tests/User_Groups_Test.php index d0026d89..c3e90718 100644 --- a/modules/user/tests/User_Groups_Test.php +++ b/modules/user/tests/User_Groups_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/user/tests/User_Installer_Test.php b/modules/user/tests/User_Installer_Test.php index b3c5960a..98e5edff 100644 --- a/modules/user/tests/User_Installer_Test.php +++ b/modules/user/tests/User_Installer_Test.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php index f535ad08..aa5be8db 100644 --- a/modules/watermark/controllers/admin_watermarks.php +++ b/modules/watermark/controllers/admin_watermarks.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/watermark/helpers/watermark.php b/modules/watermark/helpers/watermark.php index 60d5cb5d..557d31be 100644 --- a/modules/watermark/helpers/watermark.php +++ b/modules/watermark/helpers/watermark.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/watermark/helpers/watermark_event.php b/modules/watermark/helpers/watermark_event.php index 45b410f9..8254e6ff 100644 --- a/modules/watermark/helpers/watermark_event.php +++ b/modules/watermark/helpers/watermark_event.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/modules/watermark/helpers/watermark_installer.php b/modules/watermark/helpers/watermark_installer.php index e45ef746..23d1c3ee 100644 --- a/modules/watermark/helpers/watermark_installer.php +++ b/modules/watermark/helpers/watermark_installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta + * Copyright (C) 2000-2010 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 diff --git a/system/core/Kohana.php b/system/core/Kohana.php index ae056d0e..f7f6b326 100644 --- a/system/core/Kohana.php +++ b/system/core/Kohana.php @@ -32,6 +32,7 @@ abstract class Kohana_Core { // Include paths protected static $include_paths; + protected static $include_paths_hash = ''; // Cache lifetime protected static $cache_lifetime; @@ -365,14 +366,7 @@ abstract class Kohana_Core { // Add SYSPATH as the last path Kohana::$include_paths[] = SYSPATH; - // Clear cached include paths - self::$internal_cache['find_file_paths'] = array(); - if ( ! isset(self::$write_cache['find_file_paths'])) - { - // Write cache at shutdown - self::$write_cache['find_file_paths'] = TRUE; - } - + Kohana::$include_paths_hash = md5(serialize(Kohana::$include_paths)); } return Kohana::$include_paths; @@ -766,8 +760,8 @@ abstract class Kohana_Core { // Search path $search = $directory.'/'.$filename.$ext; - if (isset(Kohana::$internal_cache['find_file_paths'][$search])) - return Kohana::$internal_cache['find_file_paths'][$search]; + if (isset(Kohana::$internal_cache['find_file_paths'][Kohana::$include_paths_hash][$search])) + return Kohana::$internal_cache['find_file_paths'][Kohana::$include_paths_hash][$search]; // Load include paths $paths = Kohana::$include_paths; @@ -824,7 +818,7 @@ abstract class Kohana_Core { Kohana::$write_cache['find_file_paths'] = TRUE; } - return Kohana::$internal_cache['find_file_paths'][$search] = $found; + return Kohana::$internal_cache['find_file_paths'][Kohana::$include_paths_hash][$search] = $found; } /** diff --git a/themes/admin_wind/views/admin.html.php b/themes/admin_wind/views/admin.html.php index fa79119a..2f64c847 100644 --- a/themes/admin_wind/views/admin.html.php +++ b/themes/admin_wind/views/admin.html.php @@ -4,7 +4,13 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <title><?= t("Admin dashboard") ?></title> + <title> + <? if ($page_title): ?> + <?= $page_title ?> + <? else: ?> + <?= t("Admin dashboard") ?> + <? endif ?> + </title> <link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" /> <?= $theme->css("yui/reset-fonts-grids.css") ?> diff --git a/themes/wind/css/screen.css b/themes/wind/css/screen.css index e96b259d..f8e26073 100644 --- a/themes/wind/css/screen.css +++ b/themes/wind/css/screen.css @@ -213,10 +213,16 @@ td { padding-left: 0; } +/* Sidebar ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + #g-sidebar .g-block-content { padding-left: 1em; } +#g-sidebar #g-image-block { + overflow: hidden; +} + /* Album content ~~~~~~~~~~~~~~~~~~~~~~~~~ */ #g-content #g-album-grid { diff --git a/themes/wind/views/no_sidebar.html.php b/themes/wind/views/no_sidebar.html.php index 83686318..a9eb0e3e 100644 --- a/themes/wind/views/no_sidebar.html.php +++ b/themes/wind/views/no_sidebar.html.php @@ -1,6 +1,6 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <ul class="g-message-block"> - <li class="g-warning"><?= t("No active sidebar blocks." ?> + <li class="g-warning"><?= t("No active sidebar blocks.") ?> <br/><a href="<?= url::site("admin/sidebar") ?>"><?= t("Add blocks") ?></a> </li> </ul> diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php index 61e34145..ebfbf700 100644 --- a/themes/wind/views/page.html.php +++ b/themes/wind/views/page.html.php @@ -35,10 +35,10 @@ <![endif]--> <? if ($theme->page_type == "collection"): ?> <? if ($thumb_proportion != 1): ?> - <? $new_width = $thumb_proportion * 213 ?> - <? $new_height = $thumb_proportion * 240 ?> + <? $new_width = round($thumb_proportion * 213) ?> + <? $new_height = round($thumb_proportion * 240) ?> <style type="text/css"> - #g-content #g-album-grid .g-item { + .g-view #g-content #g-album-grid .g-item { width: <?= $new_width ?>px; height: <?= $new_height ?>px; /* <?= $thumb_proportion ?> */ |