summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/admin.php2
-rw-r--r--modules/gallery/controllers/admin_advanced_settings.php2
-rw-r--r--modules/gallery/controllers/admin_dashboard.php2
-rw-r--r--modules/gallery/controllers/admin_graphics.php2
-rw-r--r--modules/gallery/controllers/admin_languages.php14
-rw-r--r--modules/gallery/controllers/admin_maintenance.php4
-rw-r--r--modules/gallery/controllers/admin_modules.php2
-rw-r--r--modules/gallery/controllers/admin_sidebar.php2
-rw-r--r--modules/gallery/controllers/admin_theme_options.php2
-rw-r--r--modules/gallery/controllers/admin_themes.php2
-rw-r--r--modules/gallery/controllers/admin_upgrade_checker.php57
-rw-r--r--modules/gallery/controllers/albums.php26
-rw-r--r--modules/gallery/controllers/combined.php5
-rw-r--r--modules/gallery/controllers/file_proxy.php41
-rw-r--r--modules/gallery/controllers/items.php2
-rw-r--r--modules/gallery/controllers/l10n_client.php2
-rw-r--r--modules/gallery/controllers/login.php4
-rw-r--r--modules/gallery/controllers/logout.php2
-rw-r--r--modules/gallery/controllers/movies.php26
-rw-r--r--modules/gallery/controllers/packager.php4
-rw-r--r--modules/gallery/controllers/permissions.php2
-rw-r--r--modules/gallery/controllers/photos.php26
-rw-r--r--modules/gallery/controllers/quick.php2
-rw-r--r--modules/gallery/controllers/reauthenticate.php2
-rw-r--r--modules/gallery/controllers/upgrader.php7
-rw-r--r--modules/gallery/controllers/uploader.php2
-rw-r--r--modules/gallery/controllers/user_profile.php2
-rw-r--r--modules/gallery/controllers/welcome_message.php2
28 files changed, 152 insertions, 96 deletions
diff --git a/modules/gallery/controllers/admin.php b/modules/gallery/controllers/admin.php
index 8fc5432d..b70f9634 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 cf197743..fd652988 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 76c42612..8dfb6615 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 de98035d..a2d19d4a 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 573ededf..2e2651fc 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -74,9 +74,11 @@ class Admin_Languages_Controller extends Admin_Controller {
private function _save_api_key($form) {
$new_key = $form->sharing->api_key->value;
- if ($new_key && !l10n_client::validate_api_key($new_key)) {
- $form->sharing->api_key->add_error("invalid", 1);
- $valid = false;
+ if ($new_key) {
+ list($connected, $valid) = l10n_client::validate_api_key($new_key);
+ if (!$valid) {
+ $form->sharing->api_key->add_error($connected ? "invalid" : "no_connection", 1);
+ }
} else {
$valid = true;
}
@@ -119,7 +121,9 @@ class Admin_Languages_Controller extends Admin_Controller {
array("server-link" => html::mark_clean(html::anchor($server_link))))
: t("API key"))
->value($api_key)
- ->error_messages("invalid", t("The API key you provided is invalid."));
+ ->error_messages("invalid", t("The API key you provided is invalid."))
+ ->error_messages(
+ "no_connection", t("Could not connect to remote server to validate the API key."));
$group->submit("save")->value(t("Save settings"));
if ($api_key && $this->_outgoing_translations_count()) {
// TODO: UI improvement: hide API key / save button when API key is set.
diff --git a/modules/gallery/controllers/admin_maintenance.php b/modules/gallery/controllers/admin_maintenance.php
index 7729d797..ce828a75 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
->set("state", "stalled")
->where("done", "=", 0)
->where("state", "<>", "stalled")
- ->where(new Database_Expression("UNIX_TIMESTAMP(NOW()) - `updated` > 15"))
+ ->where(db::expr("UNIX_TIMESTAMP(NOW()) - `updated` > 15"))
->execute();
$stalled_count = $query->count();
if ($stalled_count) {
diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php
index 650b7e9e..787785ea 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 2e49097a..42c4bb18 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 57f32f96..055e063c 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 a88e1e89..cd8a5530 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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_upgrade_checker.php b/modules/gallery/controllers/admin_upgrade_checker.php
new file mode 100644
index 00000000..a5cfcfc8
--- /dev/null
+++ b/modules/gallery/controllers/admin_upgrade_checker.php
@@ -0,0 +1,57 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2011 Bharat Mediratta
+ *
+ * This 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 Admin_Upgrade_Checker_Controller extends Admin_Controller {
+ function check_now() {
+ access::verify_csrf();
+ upgrade_checker::fetch_version_info();
+ $message = upgrade_checker::get_upgrade_message();
+ if ($message) {
+ $message .= t(
+ " <a href=\"%hide-url\"><i>(remind me later)</i></a>",
+ array("url" => url::site("admin/upgrade_checker/remind_me_later?csrf=__CSRF__")));
+ site_status::info($message, "upgrade_checker");
+ } else {
+ site_status::clear("upgrade_checker");
+ }
+ url::redirect("admin/dashboard");
+ }
+
+ function remind_me_later() {
+ access::verify_csrf();
+ site_status::clear("upgrade_checker");
+ if ($referer = Input::instance()->server("HTTP_REFERER")) {
+ url::redirect($referer);
+ } else {
+ url::redirect(item::root()->abs_url());
+ }
+ }
+
+ function set_auto($val) {
+ access::verify_csrf();
+ module::set_var("gallery", "upgrade_checker_auto_enabled", (bool)$val);
+
+ if ((bool)$val) {
+ message::success(t("Automatic upgrade checking is enabled."));
+ } else {
+ message::success(t("Automatic upgrade checking is disabled."));
+ }
+ url::redirect("admin/dashboard");
+ }
+}
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index b0887195..ccf6c1cb 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ class Albums_Controller extends Items_Controller {
if ($show) {
$child = ORM::factory("item", $show);
- $index = $album->get_position($child);
+ $index = item::get_position($child);
if ($index) {
$page = ceil($index / $page_size);
if ($page == 1) {
@@ -61,20 +61,18 @@ class Albums_Controller extends Items_Controller {
}
$template = new Theme_View("page.html", "collection", "album");
- $template->set_global("page", $page);
- $template->set_global("page_title", null);
- $template->set_global("max_pages", $max_pages);
- $template->set_global("page_size", $page_size);
- $template->set_global("item", $album);
- $template->set_global("children", $album->viewable()->children($page_size, $offset));
- $template->set_global("children_count", $children_count);
- $template->set_global("parents", $album->parents()->as_array()); // view calls empty() on this
+ $template->set_global(
+ array("page" => $page,
+ "page_title" => null,
+ "max_pages" => $max_pages,
+ "page_size" => $page_size,
+ "item" => $album,
+ "children" => $album->viewable()->children($page_size, $offset),
+ "parents" => $album->parents()->as_array(), // view calls empty() on this
+ "children_count" => $children_count));
$template->content = new View("album.html");
- // We can't use math in ORM or the query builder, so do this by hand. It's important
- // that we do this with math, otherwise concurrent accesses will damage accuracy.
- db::query("UPDATE {items} SET `view_count` = `view_count` + 1 WHERE `id` = $album->id")
- ->execute();
+ $album->increment_view_count();
print $template;
}
diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php
index 4b1a342a..ef640bd9 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This 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 Combined_Controller extends Controller {
+ const ALLOW_MAINTENANCE_MODE = true;
+ const ALLOW_PRIVATE_GALLERY = true;
+
/**
* Return the combined Javascript bundle associated with the given key.
*/
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php
index b17310c4..d1e42106 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,10 +27,13 @@
* input is sanitized against the database before we perform any file I/O.
*/
class File_Proxy_Controller extends Controller {
+ const ALLOW_PRIVATE_GALLERY = true;
public function __call($function, $args) {
- // request_uri: gallery3/var/trunk/albums/foo/bar.jpg
+ // request_uri: gallery3/var/albums/foo/bar.jpg?m=1234
$request_uri = rawurldecode(Input::instance()->server("REQUEST_URI"));
+ // get rid of query parameters
+ // request_uri: gallery3/var/albums/foo/bar.jpg
$request_uri = preg_replace("/\?.*/", "", $request_uri);
// var_uri: gallery3/var/
@@ -42,13 +45,11 @@ class File_Proxy_Controller extends Controller {
throw new Kohana_404_Exception();
}
+ // file_uri: albums/foo/bar.jpg
$file_uri = substr($request_uri, strlen($var_uri));
- // Make sure that we don't leave the var dir
- if (strpos($file_uri, "..") !== false) {
- throw new Kohana_404_Exception();
- }
-
+ // type: albums
+ // path: foo/bar.jpg
list ($type, $path) = explode("/", $file_uri, 2);
if ($type != "resizes" && $type != "albums" && $type != "thumbs") {
throw new Kohana_404_Exception();
@@ -56,28 +57,16 @@ class File_Proxy_Controller extends Controller {
// If the last element is .album.jpg, pop that off since it's not a real item
$path = preg_replace("|/.album.jpg$|", "", $path);
- $encoded_path = array();
- foreach (explode("/", $path) as $path_part) {
- $encoded_path[] = rawurlencode($path_part);
- }
- $encoded_path = implode("/", $encoded_path);
- // We now have the relative path to the item. Search for it in the path cache
- // The patch cache is urlencoded so re-encode the path. (it was decoded earlier to
- // insure that the paths are normalized.
- $item = ORM::factory("item")
- ->where("relative_path_cache", "=", $encoded_path)->find();
- if (!$item->loaded()) {
- // We didn't turn it up. It's possible that the relative_path_cache is out of date here.
- // There was fallback code, but bharat deleted it in 8f1bca74. If it turns out to be
- // necessary, it's easily resurrected.
- // If we're looking for a .jpg then it's it's possible that we're requesting the thumbnail
- // for a movie. In that case, the .flv, .mp4 or .m4v file would have been converted to a
- // .jpg. So try some alternate types:
+ $item = item::find_by_path($path);
+ if (!$item->loaded()) {
+ // We didn't turn it up. If we're looking for a .jpg then it's it's possible that we're
+ // requesting the thumbnail for a movie. In that case, the .flv, .mp4 or .m4v file would
+ // have been converted to a .jpg. So try some alternate types:
if (preg_match('/.jpg$/', $path)) {
foreach (array("flv", "mp4", "m4v") as $ext) {
- $movie_path = preg_replace('/.jpg$/', ".$ext", $encoded_path);
- $item = ORM::factory("item")->where("relative_path_cache", "=", $movie_path)->find();
+ $movie_path = preg_replace('/.jpg$/', ".$ext", $path);
+ $item = item::find_by_path($movie_path);
if ($item->loaded()) {
break;
}
diff --git a/modules/gallery/controllers/items.php b/modules/gallery/controllers/items.php
index 39b0f638..9dd49547 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 6833a9ae..05b88829 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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/login.php b/modules/gallery/controllers/login.php
index 62d33345..b203b7d3 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This 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,8 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Login_Controller extends Controller {
+ const ALLOW_MAINTENANCE_MODE = true;
+ const ALLOW_PRIVATE_GALLERY = true;
public function ajax() {
$view = new View("login_ajax.html");
diff --git a/modules/gallery/controllers/logout.php b/modules/gallery/controllers/logout.php
index 20fa8074..dd0f7ddc 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 717eb8aa..8e81c594 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,29 +28,29 @@ class Movies_Controller extends Items_Controller {
access::required("view", $movie);
$where = array(array("type", "!=", "album"));
- $position = $movie->parent()->get_position($movie, $where);
+ $position = item::get_position($movie, $where);
if ($position > 1) {
list ($previous_item, $ignore, $next_item) =
- $movie->parent()->children(3, $position - 2, $where);
+ $movie->parent()->viewable()->children(3, $position - 2, $where);
} else {
$previous_item = null;
list ($next_item) = $movie->parent()->viewable()->children(1, $position, $where);
}
$template = new Theme_View("page.html", "item", "movie");
- $template->set_global("item", $movie);
- $template->set_global("children", array());
- $template->set_global("children_count", 0);
- $template->set_global("parents", $movie->parents()->as_array());
- $template->set_global("next_item", $next_item);
- $template->set_global("previous_item", $previous_item);
- $template->set_global("sibling_count", $movie->parent()->viewable()->children_count($where));
- $template->set_global("position", $position);
+ $template->set_global(
+ array("item" => $movie,
+ "children" => array(),
+ "children_count" => 0,
+ "parents" => $movie->parents()->as_array(),
+ "next_item" => $next_item,
+ "previous_item" => $previous_item,
+ "sibling_count" => $movie->parent()->viewable()->children_count($where),
+ "position" => $position));
$template->content = new View("movie.html");
- $movie->view_count++;
- $movie->save();
+ $movie->increment_view_count();
print $template;
}
diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php
index bd51b93c..c5335c72 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ class Packager_Controller extends Controller {
// numbers, keeping our install.sql file more stable.
srand(0);
- foreach (array("gallery", "user", "comment", "organize", "info", "rest",
+ foreach (array("gallery", "user", "comment", "organize", "info",
"rss", "search", "slideshow", "tag") as $module_name) {
module::install($module_name);
module::activate($module_name);
diff --git a/modules/gallery/controllers/permissions.php b/modules/gallery/controllers/permissions.php
index fc06cb44..023610c1 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 b22ac8e5..054300a1 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,29 +28,29 @@ class Photos_Controller extends Items_Controller {
access::required("view", $photo);
$where = array(array("type", "!=", "album"));
- $position = $photo->parent()->get_position($photo, $where);
+ $position = item::get_position($photo, $where);
if ($position > 1) {
list ($previous_item, $ignore, $next_item) =
- $photo->parent()->children(3, $position - 2, $where);
+ $photo->parent()->viewable()->children(3, $position - 2, $where);
} else {
$previous_item = null;
list ($next_item) = $photo->parent()->viewable()->children(1, $position, $where);
}
$template = new Theme_View("page.html", "item", "photo");
- $template->set_global("item", $photo);
- $template->set_global("children", array());
- $template->set_global("children_count", 0);
- $template->set_global("parents", $photo->parents()->as_array());
- $template->set_global("next_item", $next_item);
- $template->set_global("previous_item", $previous_item);
- $template->set_global("sibling_count", $photo->parent()->viewable()->children_count($where));
- $template->set_global("position", $position);
+ $template->set_global(
+ array("item" => $photo,
+ "children" => array(),
+ "children_count" => 0,
+ "parents" => $photo->parents()->as_array(),
+ "next_item" => $next_item,
+ "previous_item" => $previous_item,
+ "sibling_count" => $photo->parent()->viewable()->children_count($where),
+ "position" => $position));
$template->content = new View("photo.html");
- $photo->view_count++;
- $photo->save();
+ $photo->increment_view_count();
print $template;
}
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index 3db4f5df..17abc39f 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 53a96374..ef0e4632 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 b2646874..365ba28e 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ class Upgrader_Controller extends Controller {
// Make sure we have an upgrade token
if (!($upgrade_token = $session->get("upgrade_token", null))) {
- $session->set("upgrade_token", $upgrade_token = md5(rand()));
+ $session->set("upgrade_token", $upgrade_token = random::hash());
}
// If the upgrade token exists, then bless this session
@@ -94,6 +94,9 @@ class Upgrader_Controller extends Controller {
// If the upgrade failed, this will get recreated
site_status::clear("upgrade_now");
+ // Clear any upgrade check strings, we are probably up to date.
+ site_status::clear("upgrade_checker");
+
if (php_sapi_name() == "cli") {
if ($failed) {
print "Upgrade completed ** WITH FAILURES **\n";
diff --git a/modules/gallery/controllers/uploader.php b/modules/gallery/controllers/uploader.php
index 168e8b2d..6b1455e4 100644
--- a/modules/gallery/controllers/uploader.php
+++ b/modules/gallery/controllers/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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 4922416c..f30fe78a 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you 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 b20f0a94..f2a5aeb1 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-2010 Bharat Mediratta
+ * Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by