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 /modules | |
parent | 2eea7b874aa06f08ed58a85197473233b54693aa (diff) | |
parent | e8eb23db42bb929548af358452f1b65e16b61913 (diff) |
Merge branch 'master' of github.com:gallery/gallery3
Diffstat (limited to 'modules')
279 files changed, 868 insertions, 441 deletions
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 |