summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/albums.php22
-rw-r--r--modules/gallery/controllers/movies.php20
-rw-r--r--modules/gallery/controllers/packager.php2
-rw-r--r--modules/gallery/controllers/photos.php20
4 files changed, 31 insertions, 33 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index b0887195..25df0da7 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -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/movies.php b/modules/gallery/controllers/movies.php
index 717eb8aa..bf50abd5 100644
--- a/modules/gallery/controllers/movies.php
+++ b/modules/gallery/controllers/movies.php
@@ -38,19 +38,19 @@ class Movies_Controller extends Items_Controller {
}
$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..9da34f9c 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -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/photos.php b/modules/gallery/controllers/photos.php
index b22ac8e5..d500a92e 100644
--- a/modules/gallery/controllers/photos.php
+++ b/modules/gallery/controllers/photos.php
@@ -38,19 +38,19 @@ class Photos_Controller extends Items_Controller {
}
$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;
}