From dbeadc1407293d0c7af36723db6fe5699890b845 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 22 Jul 2009 14:27:57 -0700
Subject: Use the Kohana cascading filesystem to locate resources loaded by the
theme. Because the theme comes first, this means that themes can override
any module resources, at the cost that we no longer have namespacing for JS
and CSS files.
The only file getting used outside of this model is
themes/default/screen.css which is used in the admin theme. I fixed
that by copying screen.css into admin_default and renaming its
screen.css to admin_screen.css. I also copied over all the images
that it was referencing.
Fixes tickets #48 and #539.
Theme API changes:
- theme_script(), theme_url() and theme_css() are no longer needed
- script(), url() and css() now refer to the first matching asset in
the module load path, where gallery3/lib is at the end of the path
---
modules/server_add/helpers/server_add_theme.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'modules/server_add/helpers')
diff --git a/modules/server_add/helpers/server_add_theme.php b/modules/server_add/helpers/server_add_theme.php
index 02f99690..2ba2e167 100644
--- a/modules/server_add/helpers/server_add_theme.php
+++ b/modules/server_add/helpers/server_add_theme.php
@@ -20,20 +20,20 @@
class server_add_theme_Core {
static function head($theme) {
if (user::active()->admin) {
- $theme->script("modules/server_add/js/server_add.js");
+ $theme->script("server_add.js");
}
}
static function admin_head($theme) {
$head = array();
if (strpos(Router::$current_uri, "admin/server_add") !== false) {
- $theme->css("lib/jquery.autocomplete.css");
+ $theme->css("jquery.autocomplete.css");
$base = url::site("__ARGS__");
$csrf = access::csrf_token();
$head[] = "";
- $theme->script("lib/jquery.autocomplete.js");
- $theme->script("modules/server_add/js/admin.js");
+ $theme->script("jquery.autocomplete.js");
+ $theme->script("admin.js");
}
return implode("\n", $head);
--
cgit v1.2.3
From 1e90e40d3a9fe2cb826b56686f23a33879418048 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Tue, 28 Jul 2009 13:47:22 -0700
Subject: Use events to generate menus, instead of having xxx_menu helpers.
This is the first step towards having a simple, lightweight and unified API
for module interaction.
---
modules/akismet/helpers/akismet_event.php | 16 ++
modules/akismet/helpers/akismet_menu.php | 36 -----
modules/comment/helpers/comment_event.php | 17 +++
modules/comment/helpers/comment_menu.php | 37 -----
modules/digibug/helpers/digibug_event.php | 50 +++++++
modules/digibug/helpers/digibug_menu.php | 50 -------
modules/g2_import/helpers/g2_import_event.php | 9 ++
modules/g2_import/helpers/g2_import_menu.php | 29 ----
modules/gallery/helpers/gallery_menu.php | 164 ---------------------
modules/gallery/libraries/Admin_View.php | 70 +++++++--
modules/gallery/libraries/Theme_View.php | 105 +++++++++----
.../notification/helpers/notification_event.php | 19 +++
modules/notification/helpers/notification_menu.php | 39 -----
modules/organize/helpers/organize_event.php | 33 +++++
modules/organize/helpers/organize_menu.php | 33 -----
modules/recaptcha/helpers/recaptcha_event.php | 8 +
modules/recaptcha/helpers/recaptcha_menu.php | 28 ----
modules/server_add/helpers/server_add_event.php | 64 ++++++++
modules/server_add/helpers/server_add_menu.php | 64 --------
modules/slideshow/helpers/slideshow_event.php | 30 ++++
modules/slideshow/helpers/slideshow_menu.php | 51 -------
modules/tag/helpers/tag_event.php | 8 +
modules/tag/helpers/tag_menu.php | 28 ----
modules/user/helpers/user_event.php | 8 +
modules/user/helpers/user_menu.php | 28 ----
modules/watermark/helpers/watermark_event.php | 29 ++++
modules/watermark/helpers/watermark_menu.php | 29 ----
27 files changed, 426 insertions(+), 656 deletions(-)
delete mode 100644 modules/akismet/helpers/akismet_menu.php
delete mode 100644 modules/comment/helpers/comment_menu.php
create mode 100644 modules/digibug/helpers/digibug_event.php
delete mode 100644 modules/digibug/helpers/digibug_menu.php
delete mode 100644 modules/g2_import/helpers/g2_import_menu.php
delete mode 100644 modules/gallery/helpers/gallery_menu.php
delete mode 100644 modules/notification/helpers/notification_menu.php
create mode 100644 modules/organize/helpers/organize_event.php
delete mode 100644 modules/organize/helpers/organize_menu.php
delete mode 100644 modules/recaptcha/helpers/recaptcha_menu.php
create mode 100644 modules/server_add/helpers/server_add_event.php
delete mode 100644 modules/server_add/helpers/server_add_menu.php
delete mode 100644 modules/slideshow/helpers/slideshow_menu.php
delete mode 100644 modules/tag/helpers/tag_menu.php
delete mode 100644 modules/user/helpers/user_menu.php
create mode 100644 modules/watermark/helpers/watermark_event.php
delete mode 100644 modules/watermark/helpers/watermark_menu.php
(limited to 'modules/server_add/helpers')
diff --git a/modules/akismet/helpers/akismet_event.php b/modules/akismet/helpers/akismet_event.php
index bffc0fd7..d6cde222 100644
--- a/modules/akismet/helpers/akismet_event.php
+++ b/modules/akismet/helpers/akismet_event.php
@@ -51,4 +51,20 @@ class akismet_event_Core {
akismet::submit_ham($new);
}
}
+
+ static function admin_menu($menu, $theme) {
+ $menu->get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("akismet")
+ ->label(t("Akismet"))
+ ->url(url::site("admin/akismet")));
+
+ if (module::get_var("akismet", "api_key")) {
+ $menu->get("statistics_menu")
+ ->append(Menu::factory("link")
+ ->id("akismet")
+ ->label(t("Akismet"))
+ ->url(url::site("admin/akismet/stats")));
+ }
+ }
}
diff --git a/modules/akismet/helpers/akismet_menu.php b/modules/akismet/helpers/akismet_menu.php
deleted file mode 100644
index ebd948d6..00000000
--- a/modules/akismet/helpers/akismet_menu.php
+++ /dev/null
@@ -1,36 +0,0 @@
-get("settings_menu")
- ->append(Menu::factory("link")
- ->id("akismet")
- ->label(t("Akismet"))
- ->url(url::site("admin/akismet")));
-
- if (module::get_var("akismet", "api_key")) {
- $menu->get("statistics_menu")
- ->append(Menu::factory("link")
- ->id("akismet")
- ->label(t("Akismet"))
- ->url(url::site("admin/akismet/stats")));
- }
- }
-}
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php
index 3850a001..614c7c65 100644
--- a/modules/comment/helpers/comment_event.php
+++ b/modules/comment/helpers/comment_event.php
@@ -21,4 +21,21 @@ class comment_event_Core {
static function item_deleted($item) {
Database::instance()->delete("comments", array("item_id" => $item->id));
}
+
+ static function admin_menu($menu, $theme) {
+ $menu->get("content_menu")
+ ->append(Menu::factory("link")
+ ->id("comments")
+ ->label(t("Comments"))
+ ->url(url::site("admin/comments")));
+ }
+
+ static function photo_menu($menu, $theme) {
+ $menu
+ ->append(Menu::factory("link")
+ ->id("comments")
+ ->label(t("View comments on this item"))
+ ->url("#comments")
+ ->css_id("gCommentsLink"));
+ }
}
diff --git a/modules/comment/helpers/comment_menu.php b/modules/comment/helpers/comment_menu.php
deleted file mode 100644
index 01881921..00000000
--- a/modules/comment/helpers/comment_menu.php
+++ /dev/null
@@ -1,37 +0,0 @@
-get("content_menu")
- ->append(Menu::factory("link")
- ->id("comments")
- ->label(t("Comments"))
- ->url(url::site("admin/comments")));
- }
-
- static function photo($menu, $theme) {
- $menu
- ->append(Menu::factory("link")
- ->id("comments")
- ->label(t("View comments on this item"))
- ->url("#comments")
- ->css_id("gCommentsLink"));
- }
-}
diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php
new file mode 100644
index 00000000..c4f9e560
--- /dev/null
+++ b/modules/digibug/helpers/digibug_event.php
@@ -0,0 +1,50 @@
+get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("digibug_menu")
+ ->label(t("Digibug"))
+ ->url(url::site("admin/digibug")));
+ }
+
+ static function photo_menu($menu, $theme) {
+ $item = $theme->item();
+ $menu->append(
+ Menu::factory("link")
+ ->id("digibug")
+ ->label(t("Print with Digibug"))
+ ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf"))
+ ->css_id("gDigibugLink"));
+ }
+
+ static function thumb_menu($menu, $theme, $item) {
+ if ($item->type == "photo") {
+ $menu->get("options_menu")
+ ->append(
+ Menu::factory("link")
+ ->id("digibug")
+ ->label(t("Print with Digibug"))
+ ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf"))
+ ->css_id("gDigibugLink"));
+ }
+ }
+}
diff --git a/modules/digibug/helpers/digibug_menu.php b/modules/digibug/helpers/digibug_menu.php
deleted file mode 100644
index 3f70fa24..00000000
--- a/modules/digibug/helpers/digibug_menu.php
+++ /dev/null
@@ -1,50 +0,0 @@
-get("settings_menu")
- ->append(Menu::factory("link")
- ->id("digibug_menu")
- ->label(t("Digibug"))
- ->url(url::site("admin/digibug")));
- }
-
- static function photo($menu, $theme) {
- $item = $theme->item();
- $menu->append(
- Menu::factory("link")
- ->id("digibug")
- ->label(t("Print with Digibug"))
- ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf"))
- ->css_id("gDigibugLink"));
- }
-
- static function thumb($menu, $theme, $item) {
- if ($item->type == "photo") {
- $menu->get("options_menu")
- ->append(
- Menu::factory("link")
- ->id("digibug")
- ->label(t("Print with Digibug"))
- ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf"))
- ->css_id("gDigibugLink"));
- }
- }
-}
diff --git a/modules/g2_import/helpers/g2_import_event.php b/modules/g2_import/helpers/g2_import_event.php
index 77b489a7..609e1a45 100644
--- a/modules/g2_import/helpers/g2_import_event.php
+++ b/modules/g2_import/helpers/g2_import_event.php
@@ -25,4 +25,13 @@ class g2_import_event_Core {
static function item_created($item) {
g2_import::copy_matching_thumbnails_and_resizes($item);
}
+
+ static function admin_menu($menu, $theme) {
+ $menu
+ ->get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("g2_import")
+ ->label(t("Gallery 2 Import"))
+ ->url(url::site("admin/g2_import")));
+ }
}
diff --git a/modules/g2_import/helpers/g2_import_menu.php b/modules/g2_import/helpers/g2_import_menu.php
deleted file mode 100644
index 68d75cb4..00000000
--- a/modules/g2_import/helpers/g2_import_menu.php
+++ /dev/null
@@ -1,29 +0,0 @@
-get("settings_menu")
- ->append(Menu::factory("link")
- ->id("g2_import")
- ->label(t("Gallery 2 Import"))
- ->url(url::site("admin/g2_import")));
- }
-}
diff --git a/modules/gallery/helpers/gallery_menu.php b/modules/gallery/helpers/gallery_menu.php
deleted file mode 100644
index 040b19e1..00000000
--- a/modules/gallery/helpers/gallery_menu.php
+++ /dev/null
@@ -1,164 +0,0 @@
-append(Menu::factory("link")
- ->id("home")
- ->label(t("Home"))
- ->url(url::site("albums/1")));
-
- $item = $theme->item();
-
- $can_edit = $item && access::can("edit", $item);
- $can_add = $item && access::can("add", $item);
-
- if ($can_add) {
- $menu->append(Menu::factory("dialog")
- ->id("add_photos_item")
- ->label(t("Add photos"))
- ->url(url::site("simple_uploader/app/$item->id")));
- }
-
- $menu->append($options_menu = Menu::factory("submenu")
- ->id("options_menu")
- ->label(t("Options")));
- 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"))
- ->url(url::site("form/edit/{$item->type}s/$item->id")));
- }
-
- // @todo Move album options menu to the album quick edit pane
- if ($item->is_album()) {
- if ($can_add) {
- $options_menu
- ->append(Menu::factory("dialog")
- ->id("add_album")
- ->label(t("Add an album"))
- ->url(url::site("form/add/albums/$item->id?type=album")));
- }
-
- if ($can_edit) {
- $options_menu
- ->append(Menu::factory("dialog")
- ->id("edit_permissions")
- ->label(t("Edit permissions"))
- ->url(url::site("permissions/browse/$item->id")));
- }
- }
- }
-
- if (user::active()->admin) {
- $menu->append($admin_menu = Menu::factory("submenu")
- ->id("admin_menu")
- ->label(t("Admin")));
- self::admin($admin_menu, $theme);
- foreach (module::active() as $module) {
- if ($module->name == "gallery") {
- continue;
- }
- $class = "{$module->name}_menu";
- if (method_exists($class, "admin")) {
- call_user_func_array(array($class, "admin"), array(&$admin_menu, $theme));
- }
- }
- }
- }
-
- static function album($menu, $theme) {
- }
-
- static function tag($menu, $theme) {
- }
-
- static function thumb($menu, $theme, $item) {
- $menu->append(Menu::factory("submenu")
- ->id("options_menu")
- ->label(t("Options"))
- ->css_class("gThumbMenu"));
- }
-
- static function photo($menu, $theme) {
- if (access::can("view_full", $theme->item())) {
- $menu->append(Menu::factory("link")
- ->id("fullsize")
- ->label(t("View full size"))
- ->url($theme->item()->file_url())
- ->css_class("gFullSizeLink"));
- }
- }
-
- static function admin($menu, $theme) {
- $menu
- ->append(Menu::factory("link")
- ->id("dashboard")
- ->label(t("Dashboard"))
- ->url(url::site("admin")))
- ->append(Menu::factory("submenu")
- ->id("settings_menu")
- ->label(t("Settings"))
- ->append(Menu::factory("link")
- ->id("graphics_toolkits")
- ->label(t("Graphics"))
- ->url(url::site("admin/graphics")))
- ->append(Menu::factory("link")
- ->id("languages")
- ->label(t("Languages"))
- ->url(url::site("admin/languages")))
- ->append(Menu::factory("link")
- ->id("l10n_mode")
- ->label(Session::instance()->get("l10n_mode", false)
- ? t("Stop translating") : t("Start translating"))
- ->url(url::site("l10n_client/toggle_l10n_mode?csrf=" .
- access::csrf_token())))
- ->append(Menu::factory("link")
- ->id("advanced")
- ->label(t("Advanced"))
- ->url(url::site("admin/advanced_settings"))))
- ->append(Menu::factory("link")
- ->id("modules")
- ->label(t("Modules"))
- ->url(url::site("admin/modules")))
- ->append(Menu::factory("submenu")
- ->id("content_menu")
- ->label(t("Content")))
- ->append(Menu::factory("submenu")
- ->id("appearance_menu")
- ->label(t("Appearance"))
- ->append(Menu::factory("link")
- ->id("themes")
- ->label(t("Theme Choice"))
- ->url(url::site("admin/themes")))
- ->append(Menu::factory("link")
- ->id("theme_options")
- ->label(t("Theme Options"))
- ->url(url::site("admin/theme_options"))))
- ->append(Menu::factory("submenu")
- ->id("statistics_menu")
- ->label(t("Statistics")))
- ->append(Menu::factory("link")
- ->id("maintenance")
- ->label(t("Maintenance"))
- ->url(url::site("admin/maintenance")));
- }
-}
diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php
index 47770a90..2a48d1e3 100644
--- a/modules/gallery/libraries/Admin_View.php
+++ b/modules/gallery/libraries/Admin_View.php
@@ -44,22 +44,66 @@ class Admin_View_Core extends Gallery_View {
$this->set_global("user", user::active());
}
- public function admin_menu() {
- $menu = Menu::factory("root");
- gallery_menu::admin($menu, $this);
-
- foreach (module::active() as $module) {
- if ($module->name == "gallery") {
- continue;
- }
- $class = "{$module->name}_menu";
- if (method_exists($class, "admin")) {
- call_user_func_array(array($class, "admin"), array(&$menu, $this));
- }
+ public function admin_menu($menu=null) {
+ if (!$menu) {
+ $menu = Menu::factory("root");
}
+ $menu
+ ->append(Menu::factory("link")
+ ->id("dashboard")
+ ->label(t("Dashboard"))
+ ->url(url::site("admin")))
+ ->append(Menu::factory("submenu")
+ ->id("settings_menu")
+ ->label(t("Settings"))
+ ->append(Menu::factory("link")
+ ->id("graphics_toolkits")
+ ->label(t("Graphics"))
+ ->url(url::site("admin/graphics")))
+ ->append(Menu::factory("link")
+ ->id("languages")
+ ->label(t("Languages"))
+ ->url(url::site("admin/languages")))
+ ->append(Menu::factory("link")
+ ->id("l10n_mode")
+ ->label(Session::instance()->get("l10n_mode", false)
+ ? t("Stop translating") : t("Start translating"))
+ ->url(url::site("l10n_client/toggle_l10n_mode?csrf=" .
+ access::csrf_token())))
+ ->append(Menu::factory("link")
+ ->id("advanced")
+ ->label(t("Advanced"))
+ ->url(url::site("admin/advanced_settings"))))
+ ->append(Menu::factory("link")
+ ->id("modules")
+ ->label(t("Modules"))
+ ->url(url::site("admin/modules")))
+ ->append(Menu::factory("submenu")
+ ->id("content_menu")
+ ->label(t("Content")))
+ ->append(Menu::factory("submenu")
+ ->id("appearance_menu")
+ ->label(t("Appearance"))
+ ->append(Menu::factory("link")
+ ->id("themes")
+ ->label(t("Theme Choice"))
+ ->url(url::site("admin/themes")))
+ ->append(Menu::factory("link")
+ ->id("theme_options")
+ ->label(t("Theme Options"))
+ ->url(url::site("admin/theme_options"))))
+ ->append(Menu::factory("submenu")
+ ->id("statistics_menu")
+ ->label(t("Statistics")))
+ ->append(Menu::factory("link")
+ ->id("maintenance")
+ ->label(t("Maintenance"))
+ ->url(url::site("admin/maintenance")));
+
+ module::event("admin_menu", $menu, $this);
$menu->compact();
- print $menu;
+ return $menu;
}
/**
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index fa45ec89..60471f75 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -81,52 +81,103 @@ class Theme_View_Core extends Gallery_View {
public function site_menu() {
$menu = Menu::factory("root");
if ($this->page_type != "login") {
- gallery_menu::site($menu, $this);
+ $menu->append(Menu::factory("link")
+ ->id("home")
+ ->label(t("Home"))
+ ->url(url::site("albums/1")));
- foreach (module::active() as $module) {
- if ($module->name == "gallery") {
- continue;
+ $item = $this->item();
+
+ $can_edit = $item && access::can("edit", $item);
+ $can_add = $item && access::can("add", $item);
+
+ if ($can_add) {
+ $menu->append(Menu::factory("dialog")
+ ->id("add_photos_item")
+ ->label(t("Add photos"))
+ ->url(url::site("simple_uploader/app/$item->id")));
+ }
+
+ $menu->append($options_menu = Menu::factory("submenu")
+ ->id("options_menu")
+ ->label(t("Options")));
+ 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"))
+ ->url(url::site("form/edit/{$item->type}s/$item->id")));
}
- $class = "{$module->name}_menu";
- if (method_exists($class, "site")) {
- call_user_func_array(array($class, "site"), array(&$menu, $this));
+
+ // @todo Move album options menu to the album quick edit pane
+ if ($item->is_album()) {
+ if ($can_add) {
+ $options_menu
+ ->append(Menu::factory("dialog")
+ ->id("add_album")
+ ->label(t("Add an album"))
+ ->url(url::site("form/add/albums/$item->id?type=album")));
+ }
+
+ if ($can_edit) {
+ $options_menu
+ ->append(Menu::factory("dialog")
+ ->id("edit_permissions")
+ ->label(t("Edit permissions"))
+ ->url(url::site("permissions/browse/$item->id")));
+ }
}
}
+
+ if (user::active()->admin) {
+ $menu->append($admin_menu = Menu::factory("submenu")
+ ->id("admin_menu")
+ ->label(t("Admin")));
+ Admin_View::admin_menu($admin_menu, $this);
+ module::event("admin_menu", $admin_menu, $this);
+ }
+
+ module::event("site_menu", $menu, $this);
}
- $menu->compact();
- print $menu;
+ return $menu->compact();
}
public function album_menu() {
- print $this->_menu("album");
+ $menu = Menu::factory("root");
+ module::event("album_menu", $menu, $this);
+ return $menu->compact();
}
public function tag_menu() {
- print $this->_menu("tag");
+ $menu = Menu::factory("root");
+ module::event("tag_menu", $menu, $this);
+ return $menu->compact();
}
public function photo_menu() {
- print $this->_menu("photo");
- }
+ $menu = Menu::factory("root");
+ if (access::can("view_full", $this->item())) {
+ $menu->append(Menu::factory("link")
+ ->id("fullsize")
+ ->label(t("View full size"))
+ ->url($this->item()->file_url())
+ ->css_class("gFullSizeLink"));
+ }
- public function thumb_menu($item) {
- print $this->_menu("thumb", $item)->css_class("gThumbMenu");
+ module::event("photo_menu", $menu, $this);
+ return $menu->compact();
}
- private function _menu($type, $item=null) {
- $menu = Menu::factory("root");
- call_user_func_array(array("gallery_menu", $type), array(&$menu, $this, $item));
- foreach (module::active() as $module) {
- if ($module->name == "gallery") {
- continue;
- }
- $class = "{$module->name}_menu";
- if (method_exists($class, $type)) {
- call_user_func_array(array($class, $type), array(&$menu, $this, $item));
- }
- }
+ public function thumb_menu($item) {
+ $menu = Menu::factory("root")
+ ->append(Menu::factory("submenu")
+ ->id("options_menu")
+ ->label(t("Options"))
+ ->css_class("gThumbMenu"));
+ module::event("thumb_menu", $menu, $this, $item);
return $menu->compact();
}
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php
index 536557c6..c6e770a7 100644
--- a/modules/notification/helpers/notification_event.php
+++ b/modules/notification/helpers/notification_event.php
@@ -55,4 +55,23 @@ class notification_event_Core {
static function batch_complete() {
notification::send_pending_notifications();
}
+
+ static function site_menu($menu, $theme) {
+ if (!user::active()->guest) {
+ $item = $theme->item();
+
+ if ($item && $item->is_album() && access::can("view", $item)) {
+ $watching = notification::is_watching($item);
+
+ $label = $watching ? t("Remove notifications") : t("Enable notifications");
+
+ $menu->get("options_menu")
+ ->append(Menu::factory("link")
+ ->id("watch")
+ ->label($label)
+ ->css_id("gNotifyLink")
+ ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token())));
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/notification/helpers/notification_menu.php b/modules/notification/helpers/notification_menu.php
deleted file mode 100644
index 73d1dd03..00000000
--- a/modules/notification/helpers/notification_menu.php
+++ /dev/null
@@ -1,39 +0,0 @@
-guest) {
- $item = $theme->item();
-
- if ($item && $item->is_album() && access::can("view", $item)) {
- $watching = notification::is_watching($item);
-
- $label = $watching ? t("Remove notifications") : t("Enable notifications");
-
- $menu->get("options_menu")
- ->append(Menu::factory("link")
- ->id("watch")
- ->label($label)
- ->css_id("gNotifyLink")
- ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token())));
- }
- }
- }
-}
diff --git a/modules/organize/helpers/organize_event.php b/modules/organize/helpers/organize_event.php
new file mode 100644
index 00000000..99a28673
--- /dev/null
+++ b/modules/organize/helpers/organize_event.php
@@ -0,0 +1,33 @@
+item();
+
+ if ($item && access::can("edit", $item) && $item->is_album()) {
+ $menu->get("options_menu")
+ ->append(Menu::factory("link")
+ ->id("organize")
+ ->label(t("Organize Album"))
+ ->css_id("gOrganizeLink")
+ ->url(url::site("organize/index/{$item->id}")));
+ }
+ }
+}
diff --git a/modules/organize/helpers/organize_menu.php b/modules/organize/helpers/organize_menu.php
deleted file mode 100644
index 850c1eab..00000000
--- a/modules/organize/helpers/organize_menu.php
+++ /dev/null
@@ -1,33 +0,0 @@
-item();
-
- if ($item && access::can("edit", $item) && $item->is_album()) {
- $menu->get("options_menu")
- ->append(Menu::factory("link")
- ->id("organize")
- ->label(t("Organize Album"))
- ->css_id("gOrganizeLink")
- ->url(url::site("organize/index/{$item->id}")));
- }
- }
-}
diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php
index 932ddee6..d23a0c74 100644
--- a/modules/recaptcha/helpers/recaptcha_event.php
+++ b/modules/recaptcha/helpers/recaptcha_event.php
@@ -23,4 +23,12 @@ class recaptcha_event_Core {
$form->add_comment->recaptcha("recaptcha")->label("")->id("gRecaptcha");
}
}
+
+ static function admin_menu($menu, $theme) {
+ $menu->get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("recaptcha")
+ ->label(t("reCAPTCHA"))
+ ->url(url::site("admin/recaptcha")));
+ }
}
diff --git a/modules/recaptcha/helpers/recaptcha_menu.php b/modules/recaptcha/helpers/recaptcha_menu.php
deleted file mode 100644
index 047abf8f..00000000
--- a/modules/recaptcha/helpers/recaptcha_menu.php
+++ /dev/null
@@ -1,28 +0,0 @@
-get("settings_menu")
- ->append(Menu::factory("link")
- ->id("recaptcha")
- ->label(t("reCAPTCHA"))
- ->url(url::site("admin/recaptcha")));
- }
-}
diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php
new file mode 100644
index 00000000..b53e72d1
--- /dev/null
+++ b/modules/server_add/helpers/server_add_event.php
@@ -0,0 +1,64 @@
+get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("server_add")
+ ->label(t("Server Add"))
+ ->url(url::site("admin/server_add")));
+ }
+
+ static function site_menu($menu, $theme) {
+ $item = $theme->item();
+ $paths = unserialize(module::get_var("server_add", "authorized_paths"));
+
+ if ($item && user::active()->admin && $item->is_album() && !empty($paths)) {
+ // This is a little tricky. Normally there's an "Add Photo" menu option, but we want to
+ // turn that into a dropdown if there are two different ways to add things. Do that in a
+ // portable way for now. If we find ourselves duplicating this pattern, we should make an
+ // API method for this.
+ $server_add = Menu::factory("dialog")
+ ->id("server_add")
+ ->label(t("Add from server"))
+ ->url(url::site("server_add/browse/$item->id"));
+ $add_photos_item = $menu->get("add_photos_item");
+ $add_photos_menu = $menu->get("add_photos_menu");
+
+ if ($add_photos_item && !$add_photos_menu) {
+ // Assuming that $add_menu is unset, create add_menu and add our item
+ $menu->add_after(
+ "add_photos_item",
+ Menu::factory("submenu")
+ ->id("add_photos_menu")
+ ->label($add_photos_item->label)
+ ->append(Menu::factory("dialog")
+ ->id("add_photos_submenu_item")
+ ->label(t("Simple Uploader"))
+ ->url($add_photos_item->url))
+ ->append($server_add));
+ $menu->remove("add_photos_item");
+ } else if ($add_photos_menu) {
+ // Append to the existing sub-menu
+ $add_photos_menu->append($server_add);
+ }
+ }
+ }
+}
diff --git a/modules/server_add/helpers/server_add_menu.php b/modules/server_add/helpers/server_add_menu.php
deleted file mode 100644
index 0f01eb64..00000000
--- a/modules/server_add/helpers/server_add_menu.php
+++ /dev/null
@@ -1,64 +0,0 @@
-get("settings_menu")
- ->append(Menu::factory("link")
- ->id("server_add")
- ->label(t("Server Add"))
- ->url(url::site("admin/server_add")));
- }
-
- static function site($menu, $theme) {
- $item = $theme->item();
- $paths = unserialize(module::get_var("server_add", "authorized_paths"));
-
- if ($item && user::active()->admin && $item->is_album() && !empty($paths)) {
- // This is a little tricky. Normally there's an "Add Photo" menu option, but we want to
- // turn that into a dropdown if there are two different ways to add things. Do that in a
- // portable way for now. If we find ourselves duplicating this pattern, we should make an
- // API method for this.
- $server_add = Menu::factory("dialog")
- ->id("server_add")
- ->label(t("Add from server"))
- ->url(url::site("server_add/browse/$item->id"));
- $add_photos_item = $menu->get("add_photos_item");
- $add_photos_menu = $menu->get("add_photos_menu");
-
- if ($add_photos_item && !$add_photos_menu) {
- // Assuming that $add_menu is unset, create add_menu and add our item
- $menu->add_after(
- "add_photos_item",
- Menu::factory("submenu")
- ->id("add_photos_menu")
- ->label($add_photos_item->label)
- ->append(Menu::factory("dialog")
- ->id("add_photos_submenu_item")
- ->label(t("Simple Uploader"))
- ->url($add_photos_item->url))
- ->append($server_add));
- $menu->remove("add_photos_item");
- } else if ($add_photos_menu) {
- // Append to the existing sub-menu
- $add_photos_menu->append($server_add);
- }
- }
- }
-}
diff --git a/modules/slideshow/helpers/slideshow_event.php b/modules/slideshow/helpers/slideshow_event.php
index c6cd7dc7..cf79f71a 100644
--- a/modules/slideshow/helpers/slideshow_event.php
+++ b/modules/slideshow/helpers/slideshow_event.php
@@ -29,4 +29,34 @@ class slideshow_event_Core {
site_status::clear("slideshow_needs_rss");
}
}
+
+ static function album_menu($menu, $theme) {
+ $menu
+ ->append(Menu::factory("link")
+ ->id("slideshow")
+ ->label(t("View slideshow"))
+ ->url("javascript:PicLensLite.start(" .
+ "{maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})")
+ ->css_id("gSlideshowLink"));
+ }
+
+ static function photo_menu($menu, $theme) {
+ $menu
+ ->append(Menu::factory("link")
+ ->id("slideshow")
+ ->label(t("View slideshow"))
+ ->url("javascript:PicLensLite.start(" .
+ "{maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})")
+ ->css_id("gSlideshowLink"));
+ }
+
+ static function tag_menu($menu, $theme) {
+ $menu
+ ->append(Menu::factory("link")
+ ->id("slideshow")
+ ->label(t("View slideshow"))
+ ->url("javascript:PicLensLite.start(" .
+ "{maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})")
+ ->css_id("gSlideshowLink"));
+ }
}
diff --git a/modules/slideshow/helpers/slideshow_menu.php b/modules/slideshow/helpers/slideshow_menu.php
deleted file mode 100644
index ee975d88..00000000
--- a/modules/slideshow/helpers/slideshow_menu.php
+++ /dev/null
@@ -1,51 +0,0 @@
-append(Menu::factory("link")
- ->id("slideshow")
- ->label(t("View slideshow"))
- ->url("javascript:PicLensLite.start(" .
- "{maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})")
- ->css_id("gSlideshowLink"));
- }
-
- static function photo($menu, $theme) {
- $menu
- ->append(Menu::factory("link")
- ->id("slideshow")
- ->label(t("View slideshow"))
- ->url("javascript:PicLensLite.start(" .
- "{maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})")
- ->css_id("gSlideshowLink"));
- }
-
- static function tag($menu, $theme) {
- $menu
- ->append(Menu::factory("link")
- ->id("slideshow")
- ->label(t("View slideshow"))
- ->url("javascript:PicLensLite.start(" .
- "{maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})")
- ->css_id("gSlideshowLink"));
- }
-
-}
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index 0fe8a393..f5fa6d4c 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -85,4 +85,12 @@ class tag_event_Core {
}
tag::compact();
}
+
+ static function admin_menu($menu, $theme) {
+ $menu->get("content_menu")
+ ->append(Menu::factory("link")
+ ->id("tags")
+ ->label(t("Tags"))
+ ->url(url::site("admin/tags")));
+ }
}
diff --git a/modules/tag/helpers/tag_menu.php b/modules/tag/helpers/tag_menu.php
deleted file mode 100644
index e1b61a93..00000000
--- a/modules/tag/helpers/tag_menu.php
+++ /dev/null
@@ -1,28 +0,0 @@
-get("content_menu")
- ->append(Menu::factory("link")
- ->id("tags")
- ->label(t("Tags"))
- ->url(url::site("admin/tags")));
- }
-}
diff --git a/modules/user/helpers/user_event.php b/modules/user/helpers/user_event.php
index 6515fbfb..4bde224b 100644
--- a/modules/user/helpers/user_event.php
+++ b/modules/user/helpers/user_event.php
@@ -30,4 +30,12 @@ class user_event_Core {
I18n::instance()->locale($locale);
}
}
+
+ static function admin_menu($menu, $theme) {
+ $menu->add_after("appearance_menu",
+ Menu::factory("link")
+ ->id("users_groups")
+ ->label(t("Users/Groups"))
+ ->url(url::site("admin/users")));
+ }
}
diff --git a/modules/user/helpers/user_menu.php b/modules/user/helpers/user_menu.php
deleted file mode 100644
index 05e401f9..00000000
--- a/modules/user/helpers/user_menu.php
+++ /dev/null
@@ -1,28 +0,0 @@
-add_after("appearance_menu",
- Menu::factory("link")
- ->id("users_groups")
- ->label(t("Users/Groups"))
- ->url(url::site("admin/users")));
- }
-}
diff --git a/modules/watermark/helpers/watermark_event.php b/modules/watermark/helpers/watermark_event.php
new file mode 100644
index 00000000..45b410f9
--- /dev/null
+++ b/modules/watermark/helpers/watermark_event.php
@@ -0,0 +1,29 @@
+get("content_menu")
+ ->append(
+ Menu::factory("link")
+ ->id("watermarks")
+ ->label(t("Watermarks"))
+ ->url(url::site("admin/watermarks")));
+ }
+}
diff --git a/modules/watermark/helpers/watermark_menu.php b/modules/watermark/helpers/watermark_menu.php
deleted file mode 100644
index bc3a4fed..00000000
--- a/modules/watermark/helpers/watermark_menu.php
+++ /dev/null
@@ -1,29 +0,0 @@
-get("content_menu")
- ->append(
- Menu::factory("link")
- ->id("watermarks")
- ->label(t("Watermarks"))
- ->url(url::site("admin/watermarks")));
- }
-}
--
cgit v1.2.3
From 4828db003f3ee505eb9e6d056cdb142da34b78ff Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Thu, 27 Aug 2009 15:47:54 -0700
Subject: Remove 'ENGINE=InnoDB' specification from tables that we create. Use
the system's default table specification. Fixes ticket #597.
---
installer/install.sql | 44 +++++++++++-----------
modules/comment/helpers/comment_installer.php | 2 +-
modules/digibug/helpers/digibug_installer.php | 2 +-
modules/exif/helpers/exif_installer.php | 2 +-
modules/g2_import/helpers/g2_import_installer.php | 2 +-
modules/gallery/controllers/packager.php | 4 ++
modules/gallery/helpers/gallery_installer.php | 32 ++++++++--------
.../helpers/notification_installer.php | 4 +-
modules/search/helpers/search_installer.php | 2 +-
.../server_add/helpers/server_add_installer.php | 4 +-
modules/tag/helpers/tag_installer.php | 4 +-
modules/user/helpers/user_installer.php | 6 +--
modules/watermark/helpers/watermark_installer.php | 2 +-
13 files changed, 57 insertions(+), 53 deletions(-)
(limited to 'modules/server_add/helpers')
diff --git a/installer/install.sql b/installer/install.sql
index 48b504ba..21464379 100755
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -11,7 +11,7 @@ CREATE TABLE {access_caches} (
`edit_2` binary(1) NOT NULL default '0',
`add_2` binary(1) NOT NULL default '0',
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {access_caches} VALUES (1,1,'1','0','0','1','0','0');
DROP TABLE IF EXISTS {access_intents};
@@ -29,7 +29,7 @@ CREATE TABLE {access_intents} (
`edit_2` binary(1) default NULL,
`add_2` binary(1) default NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {access_intents} VALUES (1,1,'1','1','0','0','1','1','0','0');
DROP TABLE IF EXISTS {caches};
@@ -43,7 +43,7 @@ CREATE TABLE {caches} (
`cache` longblob,
PRIMARY KEY (`id`),
KEY `tags` (`tags`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {comments};
SET @saved_cs_client = @@character_set_client;
@@ -72,7 +72,7 @@ CREATE TABLE {comments} (
`text` text,
`updated` int(9) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {graphics_rules};
SET @saved_cs_client = @@character_set_client;
@@ -86,7 +86,7 @@ CREATE TABLE {graphics_rules} (
`priority` int(9) NOT NULL,
`target` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','resize',100,'thumb');
INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:480;s:6:\"master\";i:2;}','gallery','resize',100,'resize');
@@ -99,7 +99,7 @@ CREATE TABLE {groups} (
`special` tinyint(1) default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {groups} VALUES (1,'Everybody',1);
INSERT INTO {groups} VALUES (2,'Registered Users',1);
@@ -111,7 +111,7 @@ CREATE TABLE {groups_users} (
`user_id` int(9) NOT NULL,
PRIMARY KEY (`group_id`,`user_id`),
UNIQUE KEY `user_id` (`user_id`,`group_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {groups_users} VALUES (1,1);
INSERT INTO {groups_users} VALUES (1,2);
@@ -129,7 +129,7 @@ CREATE TABLE {incoming_translations} (
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`,`locale`),
KEY `locale_key` (`locale`,`key`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {items};
SET @saved_cs_client = @@character_set_client;
@@ -171,7 +171,7 @@ CREATE TABLE {items} (
KEY `type` (`type`),
KEY `random` (`rand_key`),
KEY `weight` (`weight`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,NULL,0,NULL,'',1,NULL,NULL,2,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1');
DROP TABLE IF EXISTS {items_tags};
@@ -184,7 +184,7 @@ CREATE TABLE {items_tags} (
PRIMARY KEY (`id`),
KEY `tag_id` (`tag_id`,`id`),
KEY `item_id` (`item_id`,`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {logs};
SET @saved_cs_client = @@character_set_client;
@@ -200,7 +200,7 @@ CREATE TABLE {logs} (
`url` varchar(255) default NULL,
`user_id` int(9) default '0',
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {messages};
SET @saved_cs_client = @@character_set_client;
@@ -212,7 +212,7 @@ CREATE TABLE {messages} (
`value` varchar(255) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {modules};
SET @saved_cs_client = @@character_set_client;
@@ -224,7 +224,7 @@ CREATE TABLE {modules} (
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {modules} VALUES (1,1,'gallery',10);
INSERT INTO {modules} VALUES (2,1,'user',1);
@@ -248,7 +248,7 @@ CREATE TABLE {outgoing_translations} (
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`,`locale`),
KEY `locale_key` (`locale`,`key`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {permissions};
SET @saved_cs_client = @@character_set_client;
@@ -259,7 +259,7 @@ CREATE TABLE {permissions} (
`name` varchar(64) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {permissions} VALUES (1,'View','view');
INSERT INTO {permissions} VALUES (2,'View Full Size','view_full');
@@ -276,7 +276,7 @@ CREATE TABLE {search_records} (
PRIMARY KEY (`id`),
KEY `item_id` (`item_id`),
FULLTEXT KEY `data` (`data`)
-) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {search_records} VALUES (1,1,0,' Gallery');
DROP TABLE IF EXISTS {sessions};
@@ -287,7 +287,7 @@ CREATE TABLE {sessions} (
`data` text NOT NULL,
`last_activity` int(10) unsigned NOT NULL,
PRIMARY KEY (`session_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {tags};
SET @saved_cs_client = @@character_set_client;
@@ -298,7 +298,7 @@ CREATE TABLE {tags} (
`count` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {tasks};
SET @saved_cs_client = @@character_set_client;
@@ -316,7 +316,7 @@ CREATE TABLE {tasks} (
`updated` int(9) default NULL,
PRIMARY KEY (`id`),
KEY `owner_id` (`owner_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {themes};
SET @saved_cs_client = @@character_set_client;
@@ -327,7 +327,7 @@ CREATE TABLE {themes} (
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {themes} VALUES (1,'default',1);
INSERT INTO {themes} VALUES (2,'admin_default',1);
@@ -350,7 +350,7 @@ CREATE TABLE {users} (
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `hash` (`hash`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {users} VALUES (1,'guest','Guest User','',0,0,NULL,0,1,NULL,NULL,NULL);
INSERT INTO {users} VALUES (2,'admin','Gallery Administrator','',0,0,NULL,1,0,NULL,NULL,NULL);
@@ -364,7 +364,7 @@ CREATE TABLE {vars} (
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY `module_name` (`module_name`,`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {vars} VALUES (1,'gallery','active_site_theme','default');
INSERT INTO {vars} VALUES (2,'gallery','active_admin_theme','admin_default');
diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php
index edf2427c..80594c16 100644
--- a/modules/comment/helpers/comment_installer.php
+++ b/modules/comment/helpers/comment_installer.php
@@ -44,7 +44,7 @@ class comment_installer {
`text` text,
`updated` int(9) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
block_manager::add("dashboard_center", "comment", "recent_comments");
module::set_var("comment", "spam_caught", 0);
diff --git a/modules/digibug/helpers/digibug_installer.php b/modules/digibug/helpers/digibug_installer.php
index 1cd78b44..7e8145d2 100644
--- a/modules/digibug/helpers/digibug_installer.php
+++ b/modules/digibug/helpers/digibug_installer.php
@@ -26,7 +26,7 @@ class digibug_installer {
`request_date` TIMESTAMP NOT NULL DEFAULT current_timestamp,
`item_id` int(9) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_var("digibug", "company_id", "3153");
module::set_var("digibug", "event_id", "8491");
diff --git a/modules/exif/helpers/exif_installer.php b/modules/exif/helpers/exif_installer.php
index 0233f2bb..66226061 100644
--- a/modules/exif/helpers/exif_installer.php
+++ b/modules/exif/helpers/exif_installer.php
@@ -28,7 +28,7 @@ class exif_installer {
`dirty` BOOLEAN default 1,
PRIMARY KEY (`id`),
KEY(`item_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("exif", 1);
}
diff --git a/modules/g2_import/helpers/g2_import_installer.php b/modules/g2_import/helpers/g2_import_installer.php
index 0f87da6c..feacb518 100644
--- a/modules/g2_import/helpers/g2_import_installer.php
+++ b/modules/g2_import/helpers/g2_import_installer.php
@@ -26,7 +26,7 @@ class g2_import_installer {
`g3_id` int(9) NOT NULL,
PRIMARY KEY (`id`),
KEY (`g2_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("g2_import", 1);
mkdir(VARPATH . "modules/g2_import");
diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php
index 7b4d68f6..fbb1d07d 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -123,6 +123,10 @@ class Packager_Controller extends Controller {
// Normalize dates
$line = preg_replace("/,$root_created_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
$line = preg_replace("/,$root_updated_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
+
+ // Remove ENGINE= specifications
+ $line = preg_replace("/ENGINE=\S+ /", "", $line);
+
$buf .= $line;
}
$fd = fopen($sql_file, "wb");
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index d12dad70..a212ef85 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -24,13 +24,13 @@ class gallery_installer {
`id` int(9) NOT NULL auto_increment,
`item_id` int(9),
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {access_intents} (
`id` int(9) NOT NULL auto_increment,
`item_id` int(9),
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {caches} (
`id` int(9) NOT NULL auto_increment,
@@ -40,7 +40,7 @@ class gallery_installer {
`cache` longblob,
PRIMARY KEY (`id`),
KEY (`tags`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {graphics_rules} (
`id` int(9) NOT NULL auto_increment,
@@ -51,7 +51,7 @@ class gallery_installer {
`priority` int(9) NOT NULL,
`target` varchar(32) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {incoming_translations} (
`id` int(9) NOT NULL auto_increment,
@@ -63,7 +63,7 @@ class gallery_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`key`, `locale`),
KEY `locale_key` (`locale`, `key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {items} (
`id` int(9) NOT NULL auto_increment,
@@ -100,7 +100,7 @@ class gallery_installer {
KEY `type` (`type`),
KEY `random` (`rand_key`),
KEY `weight` (`weight` DESC))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {logs} (
`id` int(9) NOT NULL auto_increment,
@@ -113,7 +113,7 @@ class gallery_installer {
`url` varchar(255) default NULL,
`user_id` int(9) default 0,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {messages} (
`id` int(9) NOT NULL auto_increment,
@@ -122,7 +122,7 @@ class gallery_installer {
`value` varchar(255) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {modules} (
`id` int(9) NOT NULL auto_increment,
@@ -131,7 +131,7 @@ class gallery_installer {
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {outgoing_translations} (
`id` int(9) NOT NULL auto_increment,
@@ -143,7 +143,7 @@ class gallery_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`key`, `locale`),
KEY `locale_key` (`locale`, `key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {permissions} (
`id` int(9) NOT NULL auto_increment,
@@ -151,14 +151,14 @@ class gallery_installer {
`name` varchar(64) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {sessions} (
`session_id` varchar(127) NOT NULL,
`data` text NOT NULL,
`last_activity` int(10) UNSIGNED NOT NULL,
PRIMARY KEY (`session_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {tasks} (
`id` int(9) NOT NULL auto_increment,
@@ -173,7 +173,7 @@ class gallery_installer {
`updated` int(9) default NULL,
PRIMARY KEY (`id`),
KEY (`owner_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {themes} (
`id` int(9) NOT NULL auto_increment,
@@ -181,7 +181,7 @@ class gallery_installer {
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {vars} (
`id` int(9) NOT NULL auto_increment,
@@ -190,7 +190,7 @@ class gallery_installer {
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY(`module_name`, `name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) {
@mkdir(VARPATH . $dir);
@@ -284,7 +284,7 @@ class gallery_installer {
`cache` text,
PRIMARY KEY (`id`),
KEY (`tags`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
diff --git a/modules/notification/helpers/notification_installer.php b/modules/notification/helpers/notification_installer.php
index 3d450258..aa2e09f7 100644
--- a/modules/notification/helpers/notification_installer.php
+++ b/modules/notification/helpers/notification_installer.php
@@ -27,14 +27,14 @@ class notification_installer {
PRIMARY KEY (`id`),
UNIQUE KEY (`item_id`, `user_id`),
UNIQUE KEY (`user_id`, `item_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {pending_notifications} (
`id` int(9) NOT NULL auto_increment,
`email` varchar(128) NOT NULL,
`subject` varchar(255) NOT NULL,
`text` text,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("notification", 1);
}
diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php
index cd253be4..10d8211f 100644
--- a/modules/search/helpers/search_installer.php
+++ b/modules/search/helpers/search_installer.php
@@ -28,7 +28,7 @@ class search_installer {
PRIMARY KEY (`id`),
KEY(`item_id`),
FULLTEXT INDEX (`data`))
- ENGINE=MyISAM DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("search", 1);
}
diff --git a/modules/server_add/helpers/server_add_installer.php b/modules/server_add/helpers/server_add_installer.php
index cd278eb7..c3c1572d 100644
--- a/modules/server_add/helpers/server_add_installer.php
+++ b/modules/server_add/helpers/server_add_installer.php
@@ -27,7 +27,7 @@ class server_add_installer {
`parent_id` int(9),
`task_id` int(9) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("server_add", 3);
server_add::check_config();
}
@@ -40,7 +40,7 @@ class server_add_installer {
`task_id` int(9) NOT NULL,
`file` varchar(255) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("server_add", $version = 2);
}
diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php
index 3c16e3f3..bcb830e4 100644
--- a/modules/tag/helpers/tag_installer.php
+++ b/modules/tag/helpers/tag_installer.php
@@ -26,7 +26,7 @@ class tag_installer {
`count` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {items_tags} (
`id` int(9) NOT NULL auto_increment,
@@ -35,7 +35,7 @@ class tag_installer {
PRIMARY KEY (`id`),
KEY(`tag_id`, `id`),
KEY(`item_id`, `id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("tag", 1);
}
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php
index 1959d038..8ef4f13d 100644
--- a/modules/user/helpers/user_installer.php
+++ b/modules/user/helpers/user_installer.php
@@ -36,7 +36,7 @@ class user_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`hash`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {groups} (
`id` int(9) NOT NULL auto_increment,
@@ -44,14 +44,14 @@ class user_installer {
`special` BOOLEAN default 0,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {groups_users} (
`group_id` int(9) NOT NULL,
`user_id` int(9) NOT NULL,
PRIMARY KEY (`group_id`, `user_id`),
UNIQUE KEY(`user_id`, `group_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$everybody = group::create("Everybody");
$everybody->special = true;
diff --git a/modules/watermark/helpers/watermark_installer.php b/modules/watermark/helpers/watermark_installer.php
index 705b89d4..b3e91044 100644
--- a/modules/watermark/helpers/watermark_installer.php
+++ b/modules/watermark/helpers/watermark_installer.php
@@ -30,7 +30,7 @@ class watermark_installer {
`mime_type` varchar(64) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
@mkdir(VARPATH . "modules/watermark");
module::set_version("watermark", 1);
--
cgit v1.2.3
From 746609b967532a6570a229d5b1e2997527316305 Mon Sep 17 00:00:00 2001
From: jhilden
Date: Sat, 29 Aug 2009 14:27:08 -0400
Subject: * created new generic "Add" dropdown in the site menu. this should
take care of ticket #537
* removed start/stop translation menu items from the admin, since they are on the languags admin page now
---
modules/gallery/helpers/gallery.php | 65 +++++++++++--------------
modules/server_add/helpers/server_add_event.php | 29 ++---------
2 files changed, 34 insertions(+), 60 deletions(-)
(limited to 'modules/server_add/helpers')
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index c81af842..122227fc 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -82,9 +82,9 @@ class gallery_Core {
static function site_menu($menu, $theme) {
if ($theme->page_type != "login") {
$menu->append(Menu::factory("link")
- ->id("home")
- ->label(t("Home"))
- ->url(url::site("albums/1")));
+ ->id("home")
+ ->label(t("Home"))
+ ->url(url::site("albums/1")));
$item = $theme->item();
@@ -92,48 +92,47 @@ class gallery_Core {
$can_add = $item && access::can("add", $item);
if ($can_add) {
- $menu->append(Menu::factory("dialog")
- ->id("add_photos_item")
- ->label(t("Add photos"))
- ->url(url::site("simple_uploader/app/$item->id")));
+ $menu->append($add_menu = Menu::factory("submenu")
+ ->id("add_menu")
+ ->label(t("Add")));
+ $add_menu->append(Menu::factory("dialog")
+ ->id("add_photos_item")
+ ->label(t("Add photos"))
+ ->url(url::site("simple_uploader/app/$item->id")));
+ if ($item->is_album()) {
+ $add_menu->append(Menu::factory("dialog")
+ ->id("add_album_item")
+ ->label(t("Add an album"))
+ ->url(url::site("form/add/albums/$item->id?type=album")));
+ }
}
$menu->append($options_menu = Menu::factory("submenu")
- ->id("options_menu")
- ->label(t("Options")));
+ ->id("options_menu")
+ ->label(t("Photo options")));
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"))
- ->url(url::site("form/edit/{$item->type}s/$item->id")));
+ $options_menu->append(Menu::factory("dialog")
+ ->id("edit_item")
+ ->label($item->is_album() ? t("Edit album") : t("Edit photo"))
+ ->url(url::site("form/edit/{$item->type}s/$item->id")));
}
- // @todo Move album options menu to the album quick edit pane
if ($item->is_album()) {
- if ($can_add) {
- $options_menu
- ->append(Menu::factory("dialog")
- ->id("add_album")
- ->label(t("Add an album"))
- ->url(url::site("form/add/albums/$item->id?type=album")));
- }
-
+ $options_menu->label(t("Album options"));
if ($can_edit) {
- $options_menu
- ->append(Menu::factory("dialog")
- ->id("edit_permissions")
- ->label(t("Edit permissions"))
- ->url(url::site("permissions/browse/$item->id")));
+ $options_menu->append(Menu::factory("dialog")
+ ->id("edit_permissions")
+ ->label(t("Edit permissions"))
+ ->url(url::site("permissions/browse/$item->id")));
}
}
}
if (user::active()->admin) {
$menu->append($admin_menu = Menu::factory("submenu")
- ->id("admin_menu")
- ->label(t("Admin")));
+ ->id("admin_menu")
+ ->label(t("Admin")));
gallery::admin_menu($admin_menu, $theme);
module::event("admin_menu", $admin_menu, $theme);
}
@@ -159,12 +158,6 @@ class gallery_Core {
->id("languages")
->label(t("Languages"))
->url(url::site("admin/languages")))
- ->append(Menu::factory("link")
- ->id("l10n_mode")
- ->label(Session::instance()->get("l10n_mode", false)
- ? t("Stop translating") : t("Start translating"))
- ->url(url::site("l10n_client/toggle_l10n_mode?csrf=" .
- access::csrf_token())))
->append(Menu::factory("link")
->id("advanced")
->label(t("Advanced"))
diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php
index b53e72d1..6b21ec2e 100644
--- a/modules/server_add/helpers/server_add_event.php
+++ b/modules/server_add/helpers/server_add_event.php
@@ -35,30 +35,11 @@ class server_add_event_Core {
// turn that into a dropdown if there are two different ways to add things. Do that in a
// portable way for now. If we find ourselves duplicating this pattern, we should make an
// API method for this.
- $server_add = Menu::factory("dialog")
- ->id("server_add")
- ->label(t("Add from server"))
- ->url(url::site("server_add/browse/$item->id"));
- $add_photos_item = $menu->get("add_photos_item");
- $add_photos_menu = $menu->get("add_photos_menu");
-
- if ($add_photos_item && !$add_photos_menu) {
- // Assuming that $add_menu is unset, create add_menu and add our item
- $menu->add_after(
- "add_photos_item",
- Menu::factory("submenu")
- ->id("add_photos_menu")
- ->label($add_photos_item->label)
- ->append(Menu::factory("dialog")
- ->id("add_photos_submenu_item")
- ->label(t("Simple Uploader"))
- ->url($add_photos_item->url))
- ->append($server_add));
- $menu->remove("add_photos_item");
- } else if ($add_photos_menu) {
- // Append to the existing sub-menu
- $add_photos_menu->append($server_add);
- }
+ $add_menu = $menu->get("add_menu");
+ $add_menu->append(Menu::factory("dialog")
+ ->id("server_add")
+ ->label(t("Server add"))
+ ->url(url::site("server_add/browse/$item->id")));
}
}
}
--
cgit v1.2.3
From b4b638be44375c93f5222c7b48ed547845d6d7e5 Mon Sep 17 00:00:00 2001
From: Andy Staudacher
Date: Sat, 29 Aug 2009 16:28:30 -0700
Subject: Undo url helper changes - url methods no longer return a SafeString.
Adding SafeString::of_safe_html() calls where urls are passed as parameters to t() and t2().
---
modules/akismet/helpers/akismet.php | 2 +-
modules/digibug/views/admin_digibug.html.php | 2 +-
modules/exif/helpers/exif.php | 2 +-
modules/g2_import/views/admin_g2_import.html.php | 10 ++++-----
modules/gallery/helpers/MY_url.php | 24 +---------------------
modules/gallery/helpers/graphics.php | 2 +-
modules/gallery/tests/Xss_Security_Test.php | 15 +++++++++++---
modules/gallery/views/admin_block_welcome.html.php | 10 ++++-----
modules/gallery/views/upgrader.html.php | 2 +-
modules/recaptcha/helpers/recaptcha.php | 2 +-
modules/search/helpers/search.php | 2 +-
modules/server_add/helpers/server_add.php | 2 +-
modules/user/views/reset_password.html.php | 4 +++-
system/helpers/request.php | 2 +-
14 files changed, 35 insertions(+), 46 deletions(-)
(limited to 'modules/server_add/helpers')
diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php
index db45a6ab..abca78d2 100644
--- a/modules/akismet/helpers/akismet.php
+++ b/modules/akismet/helpers/akismet.php
@@ -94,7 +94,7 @@ class akismet_Core {
if (empty($api_key)) {
site_status::warning(
t("Akismet is not quite ready! Please provide an API Key",
- array("url" => url::site("admin/akismet"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/akismet")))),
"akismet_config");
} else {
site_status::clear("akismet_config");
diff --git a/modules/digibug/views/admin_digibug.html.php b/modules/digibug/views/admin_digibug.html.php
index 7e4436ff..5f27a3fd 100644
--- a/modules/digibug/views/admin_digibug.html.php
+++ b/modules/digibug/views/admin_digibug.html.php
@@ -16,7 +16,7 @@
= t("You don't need an account with Digibug, but if you register with Digibug and enter your Digibug id in the Advanced Settings page you can make money off of your photos!",
array("signup_url" => "http://www.digibug.com/signup.php",
- "advanced_settings_url" => url::site("admin/advanced_settings"))) ?>
+ "advanced_settings_url" => SafeString::of_safe_html(url::site("admin/advanced_settings")))) ?>
diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php
index 20ecd0cb..d4e60338 100644
--- a/modules/exif/helpers/exif.php
+++ b/modules/exif/helpers/exif.php
@@ -164,7 +164,7 @@ class exif_Core {
if ($remaining) {
site_status::warning(
t('Your Exif index needs to be updated. Fix this now',
- array("url" => url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__")))),
"exif_index_out_of_date");
}
}
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index da2bb5d1..f53510f6 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -37,9 +37,9 @@
if ($g2_sizes["thumb"]["size"] && $thumb_size != $g2_sizes["thumb"]["size"]): ?>
= t("Your most common thumbnail size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. Using the same value will speed up your import.",
- array("g2_pixels" => $g2_sizes["thumb"]["size"],
- "g3_pixels" => $thumb_size,
- "url" => url::site("admin/theme_options"))) ?>
+ array("g2_pixels" => $g2_sizes["thumb"]["size"],
+ "g3_pixels" => $thumb_size,
+ "url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?>
endif ?>
@@ -47,8 +47,8 @@
= t("Your most common intermediate size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. Using the same value will speed up your import.",
array("g2_pixels" => $g2_sizes["resize"]["size"],
- "g3_pixels" => $resize_size,
- "url" => url::site("admin/theme_options"))) ?>
+ "g3_pixels" => $resize_size,
+ "url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?>
endif ?>
diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php
index 6092a9d8..c4967c52 100644
--- a/modules/gallery/helpers/MY_url.php
+++ b/modules/gallery/helpers/MY_url.php
@@ -30,8 +30,7 @@ class url extends url_Core {
if ($parts[0] == "albums" || $parts[0] == "photos") {
$uri = model_cache::get("item", $parts[1])->relative_path();
}
- $url = parent::site($uri . $query, $protocol);
- return SafeString::of_safe_html($url);
+ return parent::site($uri . $query, $protocol);
}
static function parse_url() {
@@ -100,25 +99,4 @@ class url extends url_Core {
static function abs_current($qs=false) {
return self::abs_site(url::current($qs));
}
-
- public static function base($index=false, $protocol=false) {
- $url = parent::base($index, $protocol);
- return SafeString::of_safe_html($url);
- }
-
- public static function current($qs=false) {
- $url = parent::current($qs);
- return SafeString::of_safe_html($url);
- }
-
- public static function file($file, $index=false) {
- $url = parent::file($file, $index);
- return SafeString::of_safe_html($url);
- }
-
- public static function merge(array $arguments) {
- $url = parent::merge($arguments);
- return SafeString::of_safe_html($url);
- }
-
}
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 7dc46eeb..fbb85bec 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -442,7 +442,7 @@ class graphics_Core {
if (!module::get_var("gallery", "graphics_toolkit")) {
site_status::warning(
t("Graphics toolkit missing! Please choose a toolkit",
- array("url" => url::site("admin/graphics"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/graphics")))),
"missing_graphics_toolkit");
}
}
diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php
index 690dc760..a2d3d59b 100644
--- a/modules/gallery/tests/Xss_Security_Test.php
+++ b/modules/gallery/tests/Xss_Security_Test.php
@@ -130,14 +130,14 @@ class Xss_Security_Test extends Unit_Test_Case {
$token = $tokens[$token_number];
}
} else if ($token[1] == "url") {
- // url methods return a SafeString
+ // url methods return safe HTML
if (self::_token_matches(array(T_DOUBLE_COLON, "::"), $tokens, $token_number + 1) &&
self::_token_matches(array(T_STRING), $tokens, $token_number + 2) &&
in_array($tokens[$token_number + 2][1],
array("site", "current", "base", "file", "abs_site", "abs_current",
"abs_file", "merge")) &&
self::_token_matches("(", $tokens, $token_number + 3)) {
- $frame->is_safestring(true);
+ $frame->is_safe_html(true);
$method = $tokens[$token_number + 2][1];
$frame->expr_append("::$method(");
@@ -203,7 +203,8 @@ class Xss_Security_Test extends Unit_Test_Case {
$state = "CLEAN";
}
} else {
- if ($frame->is_safestring() || $frame->purified_html_called() || $frame->for_html_called()) {
+ if ($frame->is_safe_html() || $frame->is_safestring() ||
+ $frame->purified_html_called() || $frame->for_html_called()) {
$state = "CLEAN";
}
}
@@ -259,6 +260,7 @@ class Xss_Security_Test_Frame {
private $_for_html_called = false;
private $_purified_html_called = false;
private $_json_encode_called = false;
+ private $_is_safe_html = false;
private $_line;
function __construct($line_number, $in_script_block) {
@@ -288,6 +290,13 @@ class Xss_Security_Test_Frame {
return $this->_is_safestring;
}
+ function is_safe_html($new_val=NULL) {
+ if ($new_val !== NULL) {
+ $this->_is_safe_html = (bool) $new_val;
+ }
+ return $this->_is_safe_html;
+ }
+
function json_encode_called($new_val=NULL) {
if ($new_val !== NULL) {
$this->_json_encode_called = (bool) $new_val;
diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php
index 38d2bd56..c6ccdbf3 100644
--- a/modules/gallery/views/admin_block_welcome.html.php
+++ b/modules/gallery/views/admin_block_welcome.html.php
@@ -5,16 +5,16 @@
-
= t("General Settings - choose your graphics and language settings.",
- array("graphics_url" => url::site("admin/graphics"),
- "language_url" => url::site("admin/languages"))) ?>
+ array("graphics_url" => SafeString::of_safe_html(url::site("admin/graphics")),
+ "language_url" => SafeString::of_safe_html(url::site("admin/languages")))) ?>
-
= t("Appearance - choose a theme, or customize the way it looks.",
- array("theme_url" => url::site("admin/themes"),
- "theme_options_url" => url::site("admin/theme_options"))) ?>
+ array("theme_url" => SafeString::of_safe_html(url::site("admin/themes")),
+ "theme_options_url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?>
-
= t("Customize - install modules to add cool features!",
- array("modules_url" => url::site("admin/modules"))) ?>
+ array("modules_url" => SafeString::of_safe_html(url::site("admin/modules")))) ?>
diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php
index 37578855..ccc86da8 100644
--- a/modules/gallery/views/upgrader.html.php
+++ b/modules/gallery/views/upgrader.html.php
@@ -18,7 +18,7 @@
= t("That's it!") ?>
= t("Your Gallery is up to date.",
- array("url" => url::site("albums/1"))) ?>
+ array("url" => SafeString::of_safe_html(url::site("albums/1")))) ?>
diff --git a/modules/recaptcha/helpers/recaptcha.php b/modules/recaptcha/helpers/recaptcha.php
index 501dd972..35d9febd 100644
--- a/modules/recaptcha/helpers/recaptcha.php
+++ b/modules/recaptcha/helpers/recaptcha.php
@@ -43,7 +43,7 @@ class recaptcha_Core {
if (empty($public_key) || empty($private_key)) {
site_status::warning(
t("reCAPTCHA is not quite ready! Please configure the reCAPTCHA Keys",
- array("url" => url::site("admin/recaptcha"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/recaptcha")))),
"recaptcha_config");
} else {
site_status::clear("recaptcha_config");
diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php
index 355c4493..4be04039 100644
--- a/modules/search/helpers/search.php
+++ b/modules/search/helpers/search.php
@@ -58,7 +58,7 @@ class search_Core {
if ($remaining) {
site_status::warning(
t('Your search index needs to be updated. Fix this now',
- array("url" => url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))),
"search_index_out_of_date");
}
}
diff --git a/modules/server_add/helpers/server_add.php b/modules/server_add/helpers/server_add.php
index 74f51ad9..57afac12 100644
--- a/modules/server_add/helpers/server_add.php
+++ b/modules/server_add/helpers/server_add.php
@@ -25,7 +25,7 @@ class server_add_Core {
if (empty($paths)) {
site_status::warning(
t("Server Add needs configuration. Configure it now!",
- array("url" => url::site("admin/server_add"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/server_add")))),
"server_add_configuration");
} else {
site_status::clear("server_add_configuration");
diff --git a/modules/user/views/reset_password.html.php b/modules/user/views/reset_password.html.php
index 3dc7aebf..6fa92d54 100644
--- a/modules/user/views/reset_password.html.php
+++ b/modules/user/views/reset_password.html.php
@@ -9,7 +9,9 @@
= t("Hello, %name,", array("name" => $user->full_name ? $user->full_name : $user->name)) ?>
- = t("We received a request to reset your password for %site_url. If you made this request, you can confirm it by clicking this link. If you didn't request this password reset, it's ok to ignore this mail.", array("site_url" => url::base(false, "http"), "confirm_url" => $confirm_url)) ?>
+ = t("We received a request to reset your password for %site_url. If you made this request, you can confirm it by clicking this link. If you didn't request this password reset, it's ok to ignore this mail.",
+ array("site_url" => SafeString::of_safe_html(url::base(false, "http")),
+ "confirm_url" => $confirm_url)) ?>