summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/controllers/albums.php1
-rw-r--r--modules/gallery/controllers/movies.php4
-rw-r--r--modules/gallery/helpers/album.php5
-rw-r--r--modules/gallery/helpers/gallery.php19
-rw-r--r--modules/gallery/helpers/movie.php30
-rw-r--r--modules/gallery/helpers/photo.php5
-rw-r--r--modules/gallery/tests/Xss_Security_Test.php4
-rw-r--r--modules/gallery/views/admin_maintenance_show_log.html.php4
8 files changed, 58 insertions, 14 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index 694cc4ff..9733d1cd 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -28,7 +28,6 @@ class Albums_Controller extends Items_Controller {
if ($album->id == 1) {
$view = new Theme_View("page.html", "login");
$view->page_title = t("Log in to Gallery");
- //$view->content = user::get_login_form("login/auth_html");
$view->content = new View("login_ajax.html");
$view->content->form = user::get_login_form("login/auth_html");
print $view;
diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php
index fa07668e..2a917c58 100644
--- a/modules/gallery/controllers/movies.php
+++ b/modules/gallery/controllers/movies.php
@@ -60,7 +60,7 @@ class Movies_Controller extends Items_Controller {
access::required("view", $movie);
access::required("edit", $movie);
- $form = photo::get_edit_form($movie);
+ $form = movie::get_edit_form($movie);
if ($valid = $form->validate()) {
if ($form->edit_item->filename->value != $movie->name ||
$form->edit_item->slug->value != $movie->slug) {
@@ -114,6 +114,6 @@ class Movies_Controller extends Items_Controller {
public function _form_edit($movie) {
access::required("view", $movie);
access::required("edit", $movie);
- print photo::get_edit_form($movie);
+ print movie::get_edit_form($movie);
}
}
diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php
index 9cd746d7..65868cf2 100644
--- a/modules/gallery/helpers/album.php
+++ b/modules/gallery/helpers/album.php
@@ -123,14 +123,15 @@ class album_Core {
if ($parent->id != 1) {
$group->input("dirname")->label(t("Directory Name"))->value($parent->name)
->rules("required")
- ->error_messages("name_conflict", t("There is already a photo or album with this name"))
+ ->error_messages(
+ "name_conflict", t("There is already a movie, photo or album with this name"))
->callback("item::validate_no_slashes")
->error_messages("no_slashes", t("The directory name can't contain a \"/\""))
->callback("item::validate_no_trailing_period")
->error_messages("no_trailing_period", t("The directory name can't end in \".\""));
$group->input("slug")->label(t("Internet Address"))->value($parent->slug)
->error_messages(
- "slug_conflict", t("There is already a photo or album with this internet address"))
+ "slug_conflict", t("There is already a movie, photo or album with this internet address"))
->callback("item::validate_url_safe")
->error_messages(
"not_url_safe",
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 80ae65bd..91dd2073 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -114,19 +114,32 @@ class gallery_Core {
}
}
+ switch ($item->type) {
+ case "album":
+ $option_text = t("Album options");
+ $edit_text = t("Edit album");
+ break;
+ case "movie":
+ $option_text = t("Movie options");
+ $edit_text = t("Edit movie");
+ break;
+ default:
+ $option_text = t("Photo options");
+ $edit_text = t("Edit photo");
+ }
+
$menu->append($options_menu = Menu::factory("submenu")
->id("options_menu")
- ->label(t("Photo options")));
+ ->label($option_text));
if ($item && ($can_edit || $can_add)) {
if ($can_edit) {
$options_menu->append(Menu::factory("dialog")
->id("edit_item")
- ->label($item->is_album() ? t("Edit album") : t("Edit photo"))
+ ->label($edit_text)
->url(url::site("form/edit/{$item->type}s/$item->id")));
}
if ($item->is_album()) {
- $options_menu->label(t("Album options"));
if ($can_edit) {
$options_menu->append(Menu::factory("dialog")
->id("edit_permissions")
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 59bf5c19..6c8c6c88 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -128,6 +128,36 @@ class movie_Core {
return $movie;
}
+ static function get_edit_form($movie) {
+ $form = new Forge("movies/$movie->id", "", "post", array("id" => "gEditMovieForm"));
+ $form->hidden("_method")->value("put");
+ $group = $form->group("edit_item")->label(t("Edit Movie"));
+ $group->input("title")->label(t("Title"))->value($movie->title);
+ $group->textarea("description")->label(t("Description"))->value($movie->description);
+ $group->input("filename")->label(t("Filename"))->value($movie->name)
+ ->error_messages(
+ "name_conflict", t("There is already a movie, photo or album with this name"))
+ ->callback("item::validate_no_slashes")
+ ->error_messages("no_slashes", t("The movie name can't contain a \"/\""))
+ ->callback("item::validate_no_trailing_period")
+ ->error_messages("no_trailing_period", t("The movie name can't end in \".\""));
+ $group->input("slug")->label(t("Internet Address"))->value($movie->slug)
+ ->callback("item::validate_url_safe")
+ ->error_messages(
+ "slug_conflict", t("There is already a movie, photo or album with this internet address"))
+ ->error_messages(
+ "not_url_safe",
+ t("The internet address should contain only letters, numbers, hyphens and underscores"));
+
+ module::event("item_edit_form", $movie, $form);
+
+ $group = $form->group("buttons")->label("");
+ $group->submit("")->value(t("Modify"));
+ $form->add_rules_from(ORM::factory("item"));
+ return $form;
+ }
+
+
static function getmoviesize($filename) {
$ffmpeg = self::find_ffmpeg();
if (empty($ffmpeg)) {
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php
index 3d9fbe69..065d2d31 100644
--- a/modules/gallery/helpers/photo.php
+++ b/modules/gallery/helpers/photo.php
@@ -163,7 +163,8 @@ class photo_Core {
$group->input("title")->label(t("Title"))->value($photo->title);
$group->textarea("description")->label(t("Description"))->value($photo->description);
$group->input("filename")->label(t("Filename"))->value($photo->name)
- ->error_messages("name_conflict", t("There is already a photo or album with this name"))
+ ->error_messages(
+ "name_conflict", t("There is already a movie, photo or album with this name"))
->callback("item::validate_no_slashes")
->error_messages("no_slashes", t("The photo name can't contain a \"/\""))
->callback("item::validate_no_trailing_period")
@@ -171,7 +172,7 @@ class photo_Core {
$group->input("slug")->label(t("Internet Address"))->value($photo->slug)
->callback("item::validate_url_safe")
->error_messages(
- "slug_conflict", t("There is already a photo or album with this internet address"))
+ "slug_conflict", t("There is already a movie, photo or album with this internet address"))
->error_messages(
"not_url_safe",
t("The internet address should contain only letters, numbers, hyphens and underscores"));
diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php
index 16541017..b296d97c 100644
--- a/modules/gallery/tests/Xss_Security_Test.php
+++ b/modules/gallery/tests/Xss_Security_Test.php
@@ -248,7 +248,7 @@ class Xss_Security_Test extends Unit_Test_Case {
$frame->is_safe_attr(true);
}
}
- }
+ }
} else if ($frame && $token[0] == T_OBJECT_OPERATOR) {
$frame->expr_append($token[1]);
@@ -349,7 +349,7 @@ class Xss_Security_Test extends Unit_Test_Case {
$canonical = MODPATH . "gallery/tests/xss_data.txt";
exec("diff $canonical $new", $output, $return_value);
$this->assert_false(
- $return_value, "XSS golden file mismatch. Output:\n" . implode("\n", $output) );
+ $return_value, "XSS golden file mismatch. Output:\n" . implode("\n", $output) );
}
private static function _create_frame($token, $in_script_block,
diff --git a/modules/gallery/views/admin_maintenance_show_log.html.php b/modules/gallery/views/admin_maintenance_show_log.html.php
index 8ea1beb6..2dfef90f 100644
--- a/modules/gallery/views/admin_maintenance_show_log.html.php
+++ b/modules/gallery/views/admin_maintenance_show_log.html.php
@@ -2,8 +2,8 @@
<script type="text/javascript">
dismiss = function() {
window.location.reload();
- }
- download = function(){
+ };
+ download = function() {
// send request
$('<form action="<?= url::site("admin/maintenance/save_log/$task->id?csrf=$csrf") ?>" method="post"></form>').
appendTo('body').submit().remove();