summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/albums.php6
-rw-r--r--modules/gallery/controllers/file_proxy.php7
-rw-r--r--modules/gallery/controllers/packager.php9
-rw-r--r--modules/gallery/controllers/upgrader.php6
-rw-r--r--modules/gallery/controllers/uploader.php6
5 files changed, 25 insertions, 9 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index e14fe347..0fb033a8 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -93,10 +93,16 @@ class Albums_Controller extends Items_Controller {
"previous_item" => $previous_item,
"next_item" => $next_item,
"sibling_count" => $item->parent()->viewable()->children_count($where),
+ "siblings_callback" => array("Albums_Controller::get_siblings", array($item)),
"parents" => $item->parents()->as_array(),
"breadcrumbs" => Breadcrumb::array_from_item_parents($item));
}
+ static function get_siblings($item, $limit=null, $offset=null) {
+ // @todo consider creating Item_Model::siblings() if we use this more broadly.
+ return $item->parent()->viewable()->children($limit, $offset);
+ }
+
public function create($parent_id) {
access::verify_csrf();
$album = ORM::factory("item", $parent_id);
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php
index a9e98ce1..7e5d0038 100644
--- a/modules/gallery/controllers/file_proxy.php
+++ b/modules/gallery/controllers/file_proxy.php
@@ -129,6 +129,13 @@ class File_Proxy_Controller extends Controller {
throw $e;
}
+ if (gallery::show_profiler()) {
+ Profiler::enable();
+ $profiler = new Profiler();
+ $profiler->render();
+ exit;
+ }
+
header("Content-Length: " . filesize($file));
header("Pragma:");
diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php
index c48965b5..d7e3cf41 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -88,14 +88,17 @@ class Packager_Controller extends Controller {
$dbconfig = Kohana::config('database.default');
$conn = $dbconfig["connection"];
- $pass = $conn["pass"] ? "-p{$conn['pass']}" : "";
$sql_file = DOCROOT . "installer/install.sql";
if (!is_writable($sql_file)) {
print "$sql_file is not writeable";
return;
}
- $command = "mysqldump --compact --skip-extended-insert --add-drop-table -h{$conn['host']} " .
- "-u{$conn['user']} $pass {$conn['database']} > $sql_file";
+ $command = sprintf(
+ "mysqldump --compact --skip-extended-insert --add-drop-table %s %s %s %s > $sql_file",
+ escapeshellarg("-h{$conn['host']}"),
+ escapeshellarg("-u{$conn['user']}"),
+ $conn['pass'] ? escapeshellarg("-p{$conn['pass']}") : "",
+ escapeshellarg($conn['database']));
exec($command, $output, $status);
if ($status) {
print "<pre>";
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php
index e60385d9..d3c6e2ec 100644
--- a/modules/gallery/controllers/upgrader.php
+++ b/modules/gallery/controllers/upgrader.php
@@ -107,7 +107,11 @@ class Upgrader_Controller extends Controller {
print "Upgrade complete\n";
}
} else {
- url::redirect("upgrader?failed=" . join(",", $failed));
+ if ($failed) {
+ url::redirect("upgrader?failed=" . join(",", $failed));
+ } else {
+ url::redirect("upgrader");
+ }
}
}
}
diff --git a/modules/gallery/controllers/uploader.php b/modules/gallery/controllers/uploader.php
index b2ec5b55..78437071 100644
--- a/modules/gallery/controllers/uploader.php
+++ b/modules/gallery/controllers/uploader.php
@@ -63,13 +63,9 @@ class Uploader_Controller extends Controller {
$item->parent_id = $album->id;
$item->set_data_file($temp_filename);
- // Remove double extensions from the filename - they'll be disallowed in the model but if
- // we don't do it here then it'll result in a failed upload.
- $item->name = legal_file::smash_extensions($item->name);
-
$path_info = @pathinfo($temp_filename);
if (array_key_exists("extension", $path_info) &&
- in_array(strtolower($path_info["extension"]), legal_file::get_movie_extensions())) {
+ legal_file::get_movie_extensions($path_info["extension"])) {
$item->type = "movie";
$item->save();
log::success("content", t("Added a movie"),