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 @@

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 @@
  • 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")))) ?>
  • @@ -47,8 +47,8 @@
  • 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")))) ?>
  • 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 @@
    • 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")))) ?>
    • 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")))) ?>
    • 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 @@

    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 @@ $user->full_name ? $user->full_name : $user->name)) ?>

    - %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)) ?> + %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)) ?>

    diff --git a/system/helpers/request.php b/system/helpers/request.php index 15b8edfa..4203d0e5 100644 --- a/system/helpers/request.php +++ b/system/helpers/request.php @@ -30,7 +30,7 @@ class request_Core { // Set referrer $ref = $_SERVER['HTTP_REFERER']; - if (strpos($ref, (string) url::base(FALSE)) === 0) + if (strpos($ref, url::base(FALSE)) === 0) { // Remove the base URL from the referrer $ref = substr($ref, strlen(url::base(FALSE))); -- cgit v1.2.3 From 4bc7165dab267311407294b11a77e6c2689ad4a1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 29 Aug 2009 16:42:33 -0700 Subject: Delete obsolete comment and tighten the code in site_menu(). --- modules/server_add/helpers/server_add_event.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'modules/server_add/helpers') diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php index 6b21ec2e..b9dd8c28 100644 --- a/modules/server_add/helpers/server_add_event.php +++ b/modules/server_add/helpers/server_add_event.php @@ -31,15 +31,11 @@ class server_add_event_Core { $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. - $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"))); + $menu->get("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 effccfd41d2618cfd41ce6db0834c2298fdb42d8 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sun, 30 Aug 2009 07:00:56 -0700 Subject: Change all instances of SafeString::of_safe_html() to html::mark_safe() in views. --- 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 | 4 ++-- modules/gallery/controllers/admin_languages.php | 2 +- modules/gallery/helpers/graphics.php | 2 +- 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/login.html.php | 2 +- modules/user/views/reset_password.html.php | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) (limited to 'modules/server_add/helpers') diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php index abca78d2..7cd598cd 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" => SafeString::of_safe_html(url::site("admin/akismet")))), + array("url" => html::mark_safe(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 5f27a3fd..c4956591 100644 --- a/modules/digibug/views/admin_digibug.html.php +++ b/modules/digibug/views/admin_digibug.html.php @@ -16,7 +16,7 @@

    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" => SafeString::of_safe_html(url::site("admin/advanced_settings")))) ?> + "advanced_settings_url" => html::mark_safe(url::site("admin/advanced_settings")))) ?>

    diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php index d4e60338..9a4dbeec 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" => SafeString::of_safe_html(url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__")))), + array("url" => html::mark_safe(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 f53510f6..fde3464b 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -39,7 +39,7 @@ Using the same value will speed up your import.", array("g2_pixels" => $g2_sizes["thumb"]["size"], "g3_pixels" => $thumb_size, - "url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?> + "url" => html::mark_safe(url::site("admin/theme_options")))) ?> @@ -48,7 +48,7 @@ Using the same value will speed up your import.", array("g2_pixels" => $g2_sizes["resize"]["size"], "g3_pixels" => $resize_size, - "url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?> + "url" => html::mark_safe(url::site("admin/theme_options")))) ?> diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index 68be709e..b1bc4cff 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -111,7 +111,7 @@ class Admin_Languages_Controller extends Admin_Controller { $group->input("api_key") ->label(empty($api_key) ? t("This is a unique key that will allow you to send translations to the remote server. To get your API key go to %server-link.", - array("server-link" => SafeString::of_safe_html(html::anchor($server_link)))) + array("server-link" => html::mark_safe(html::anchor($server_link)))) : t("API Key")) ->value($api_key) ->error_messages("invalid", t("The API key you provided is invalid.")); diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index fbb85bec..cc37a193 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" => SafeString::of_safe_html(url::site("admin/graphics")))), + array("url" => html::mark_safe(url::site("admin/graphics")))), "missing_graphics_toolkit"); } } diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php index c6ccdbf3..71ef4368 100644 --- a/modules/gallery/views/admin_block_welcome.html.php +++ b/modules/gallery/views/admin_block_welcome.html.php @@ -5,16 +5,16 @@
    • graphics and language settings.", - array("graphics_url" => SafeString::of_safe_html(url::site("admin/graphics")), - "language_url" => SafeString::of_safe_html(url::site("admin/languages")))) ?> + array("graphics_url" => html::mark_safe(url::site("admin/graphics")), + "language_url" => html::mark_safe(url::site("admin/languages")))) ?>
    • choose a theme, or customize the way it looks.", - array("theme_url" => SafeString::of_safe_html(url::site("admin/themes")), - "theme_options_url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?> + array("theme_url" => html::mark_safe(url::site("admin/themes")), + "theme_options_url" => html::mark_safe(url::site("admin/theme_options")))) ?>
    • install modules to add cool features!", - array("modules_url" => SafeString::of_safe_html(url::site("admin/modules")))) ?> + array("modules_url" => html::mark_safe(url::site("admin/modules")))) ?>
    diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php index ccc86da8..de6ce0e7 100644 --- a/modules/gallery/views/upgrader.html.php +++ b/modules/gallery/views/upgrader.html.php @@ -18,7 +18,7 @@

    Gallery is up to date.", - array("url" => SafeString::of_safe_html(url::site("albums/1")))) ?> + array("url" => html::mark_safe(url::site("albums/1")))) ?>

    diff --git a/modules/recaptcha/helpers/recaptcha.php b/modules/recaptcha/helpers/recaptcha.php index 35d9febd..5ac65661 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" => SafeString::of_safe_html(url::site("admin/recaptcha")))), + array("url" => html::mark_safe(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 4be04039..5e23a04b 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" => SafeString::of_safe_html(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))), + array("url" => html::mark_safe(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 57afac12..a84e1afd 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" => SafeString::of_safe_html(url::site("admin/server_add")))), + array("url" => html::mark_safe(url::site("admin/server_add")))), "server_add_configuration"); } else { site_status::clear("server_add_configuration"); diff --git a/modules/user/views/login.html.php b/modules/user/views/login.html.php index 85f673ce..dfd09661 100644 --- a/modules/user/views/login.html.php +++ b/modules/user/views/login.html.php @@ -8,7 +8,7 @@
  • - SafeString::of_safe_html( + html::mark_safe( 'id}") . '" title="' . t("Edit Your Profile")->for_html_attr() . '" id="gUserProfileLink" class="gDialogLink">' . diff --git a/modules/user/views/reset_password.html.php b/modules/user/views/reset_password.html.php index 6fa92d54..4097bb82 100644 --- a/modules/user/views/reset_password.html.php +++ b/modules/user/views/reset_password.html.php @@ -10,7 +10,7 @@

    %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")), + array("site_url" => html::mark_safe(url::base(false, "http")), "confirm_url" => $confirm_url)) ?>

    -- cgit v1.2.3 From df38a890a64dd33eafe3aed51ce8fde732cf8b8b Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sun, 30 Aug 2009 18:07:13 -0700 Subject: Tabs to spaces cleanup --- modules/gallery/controllers/admin_languages.php | 32 +- modules/gallery/controllers/l10n_client.php | 8 +- modules/gallery/helpers/gallery.php | 6 +- modules/gallery/libraries/SafeString.php | 4 +- modules/gallery/tests/Html_Helper_Test.php | 10 +- modules/gallery/tests/SafeString_Test.php | 14 +- modules/gallery/tests/Xss_Security_Test.php | 380 ++++++++++++------------ modules/server_add/helpers/server_add_event.php | 2 +- 8 files changed, 228 insertions(+), 228 deletions(-) (limited to 'modules/server_add/helpers') diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index b1bc4cff..d85c47f9 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -21,10 +21,10 @@ class Admin_Languages_Controller extends Admin_Controller { public function index($share_translations_form=null) { $v = new Admin_View("admin.html"); $v->content = new View("admin_languages.html"); - $v->content->available_locales = locales::available(); + $v->content->available_locales = locales::available(); $v->content->installed_locales = locales::installed(); $v->content->default_locale = module::get_var("gallery", "default_locale"); - + if (empty($share_translations_form)) { $share_translations_form = $this->_share_translations_form(); } @@ -35,21 +35,21 @@ class Admin_Languages_Controller extends Admin_Controller { public function save() { access::verify_csrf(); - - locales::update_installed($this->input->post("installed_locales")); - - $installed_locales = array_keys(locales::installed()); + + locales::update_installed($this->input->post("installed_locales")); + + $installed_locales = array_keys(locales::installed()); $new_default_locale = $this->input->post("default_locale"); - if (!in_array($new_default_locale, $installed_locales)) { - if (!empty($installed_locales)) { - $new_default_locale = $installed_locales[0]; - } else { - $new_default_locale = "en_US"; - } - } - module::set_var("gallery", "default_locale", $new_default_locale); - - print json_encode(array("result" => "success")); + if (!in_array($new_default_locale, $installed_locales)) { + if (!empty($installed_locales)) { + $new_default_locale = $installed_locales[0]; + } else { + $new_default_locale = "en_US"; + } + } + module::set_var("gallery", "default_locale", $new_default_locale); + + print json_encode(array("result" => "success")); } public function share() { diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php index 0775791e..16d39024 100644 --- a/modules/gallery/controllers/l10n_client.php +++ b/modules/gallery/controllers/l10n_client.php @@ -90,13 +90,13 @@ class L10n_Client_Controller extends Controller { } $session = Session::instance(); - $l10n_mode = $session->get("l10n_mode", false); + $l10n_mode = $session->get("l10n_mode", false); $session->set("l10n_mode", !$l10n_mode); $redirect_url = "admin/languages"; - if (!$l10n_mode) { - $redirect_url .= "#l10n-client"; - } + if (!$l10n_mode) { + $redirect_url .= "#l10n-client"; + } url::redirect($redirect_url); } diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 122227fc..035ed1da 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -92,7 +92,7 @@ class gallery_Core { $can_add = $item && access::can("add", $item); if ($can_add) { - $menu->append($add_menu = Menu::factory("submenu") + $menu->append($add_menu = Menu::factory("submenu") ->id("add_menu") ->label(t("Add"))); $add_menu->append(Menu::factory("dialog") @@ -100,11 +100,11 @@ class gallery_Core { ->label(t("Add photos")) ->url(url::site("simple_uploader/app/$item->id"))); if ($item->is_album()) { - $add_menu->append(Menu::factory("dialog") + $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") diff --git a/modules/gallery/libraries/SafeString.php b/modules/gallery/libraries/SafeString.php index 0767a665..cc542e01 100644 --- a/modules/gallery/libraries/SafeString.php +++ b/modules/gallery/libraries/SafeString.php @@ -120,8 +120,8 @@ class SafeString_Core { function for_html_attr() { $string = (string) $this->for_html(); return strtr($string, - array("'"=>"'", - '"'=>'"')); + array("'"=>"'", + '"'=>'"')); } /** diff --git a/modules/gallery/tests/Html_Helper_Test.php b/modules/gallery/tests/Html_Helper_Test.php index f5ce7fa4..3623705e 100644 --- a/modules/gallery/tests/Html_Helper_Test.php +++ b/modules/gallery/tests/Html_Helper_Test.php @@ -21,14 +21,14 @@ class Html_Helper_Test extends Unit_Test_Case { public function clean_test() { $safe_string = html::clean("hello

    world

    "); $this->assert_equal("hello <p >world</p>", - $safe_string); + $safe_string); $this->assert_true($safe_string instanceof SafeString); } public function purify_test() { $safe_string = html::purify("hello

    world

    "); $this->assert_equal("hello

    world

    ", - $safe_string); + $safe_string); $this->assert_true($safe_string instanceof SafeString); } @@ -37,19 +37,19 @@ class Html_Helper_Test extends Unit_Test_Case { $this->assert_true($safe_string instanceof SafeString); $safe_string_2 = html::clean($safe_string); $this->assert_equal("hello

    world

    ", - $safe_string_2); + $safe_string_2); } public function js_string_test() { $string = html::js_string("hello's

    world

    "); $this->assert_equal('"hello\'s

    world<\\/p>"', - $string); + $string); } public function clean_attribute_test() { $safe_string = SafeString::of_safe_html("hello's

    world

    "); $safe_string = html::clean_attribute($safe_string); $this->assert_equal("hello's

    world

    ", - $safe_string); + $safe_string); } } \ No newline at end of file diff --git a/modules/gallery/tests/SafeString_Test.php b/modules/gallery/tests/SafeString_Test.php index ede55240..0895b7dd 100644 --- a/modules/gallery/tests/SafeString_Test.php +++ b/modules/gallery/tests/SafeString_Test.php @@ -21,19 +21,19 @@ class SafeString_Test extends Unit_Test_Case { public function toString_escapes_for_html_test() { $safe_string = new SafeString("hello

    world

    "); $this->assert_equal("hello <p>world</p>", - $safe_string); + $safe_string); } public function toString_for_safe_string_test() { $safe_string = SafeString::of_safe_html("hello

    world

    "); $this->assert_equal("hello

    world

    ", - $safe_string); + $safe_string); } public function for_html_test() { $safe_string = new SafeString("hello

    world

    "); $this->assert_equal("hello <p>world</p>", - $safe_string->for_html()); + $safe_string->for_html()); } public function safestring_of_safestring_test() { @@ -50,27 +50,27 @@ class SafeString_Test extends Unit_Test_Case { $safe_string = new SafeString('"Foo\'s bar"'); $js_string = $safe_string->for_js(); $this->assert_equal('"\\"Foo<\\/em>\'s bar\\""', - $js_string); + $js_string); } public function for_html_attr_test() { $safe_string = new SafeString('"Foo\'s bar"'); $attr_string = $safe_string->for_html_attr(); $this->assert_equal('"<em>Foo</em>'s bar"', - $attr_string); + $attr_string); } public function for_html_attr_with_safe_html_test() { $safe_string = SafeString::of_safe_html('"Foo\'s bar"'); $attr_string = $safe_string->for_html_attr(); $this->assert_equal('"Foo's bar"', - $attr_string); + $attr_string); } public function string_safestring_equality_test() { $safe_string = new SafeString("hello

    world

    "); $this->assert_equal("hello

    world

    ", - $safe_string->unescaped()); + $safe_string->unescaped()); $escaped_string = "hello <p>world</p>"; $this->assert_equal($escaped_string, $safe_string); diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php index 3a22afc1..6c141c52 100644 --- a/modules/gallery/tests/Xss_Security_Test.php +++ b/modules/gallery/tests/Xss_Security_Test.php @@ -24,9 +24,9 @@ class Xss_Security_Test extends Unit_Test_Case { // List of all tokens without whitespace, simplifying parsing. $tokens = array(); foreach (token_get_all(file_get_contents($view)) as $token) { - if (!is_array($token) || ($token[0] != T_WHITESPACE)) { - $tokens[] = $token; - } + if (!is_array($token) || ($token[0] != T_WHITESPACE)) { + $tokens[] = $token; + } } $frame = null; @@ -34,199 +34,199 @@ class Xss_Security_Test extends Unit_Test_Case { $in_script_block = false; for ($token_number = 0; $token_number < count($tokens); $token_number++) { - $token = $tokens[$token_number]; - - // Are we in a block? - if (is_array($token) && $token[0] == T_INLINE_HTML) { - $inline_html = $token[1]; - // T_INLINE_HTML blocks can be split. Need to handle the case - // where one token has "expr_append($inline_html); - } - - // Note: This approach won't catch }i', $inline_html, $matches, PREG_OFFSET_CAPTURE)) { - $last_match = array_pop($matches[0]); - if (is_array($last_match)) { - $closing_script_pos = $last_match[1]; - } else { - $closing_script_pos = $last_match; - } - } - if (preg_match('{]*>}i', $inline_html, $matches, PREG_OFFSET_CAPTURE)) { - $last_match = array_pop($matches[0]); - if (is_array($last_match)) { - $opening_script_pos = $last_match[1]; - } else { - $opening_script_pos = $last_match; - } - } - if ($opening_script_pos != $closing_script_pos) { - $in_script_block = $opening_script_pos > $closing_script_pos; - } - } - - // Look and report each instance of < ? = ... ? > - if (!is_array($token)) { - // A single char token, e.g: ; ( ) - if ($frame) { - $frame->expr_append($token); - } - } else if ($token[0] == T_OPEN_TAG_WITH_ECHO) { - // No need for a stack here - assume < ? = cannot be nested. - $frame = self::_create_frame($token, $in_script_block); + $token = $tokens[$token_number]; + + // Are we in a block? + if (is_array($token) && $token[0] == T_INLINE_HTML) { + $inline_html = $token[1]; + // T_INLINE_HTML blocks can be split. Need to handle the case + // where one token has "expr_append($inline_html); + } + + // Note: This approach won't catch }i', $inline_html, $matches, PREG_OFFSET_CAPTURE)) { + $last_match = array_pop($matches[0]); + if (is_array($last_match)) { + $closing_script_pos = $last_match[1]; + } else { + $closing_script_pos = $last_match; + } + } + if (preg_match('{]*>}i', $inline_html, $matches, PREG_OFFSET_CAPTURE)) { + $last_match = array_pop($matches[0]); + if (is_array($last_match)) { + $opening_script_pos = $last_match[1]; + } else { + $opening_script_pos = $last_match; + } + } + if ($opening_script_pos != $closing_script_pos) { + $in_script_block = $opening_script_pos > $closing_script_pos; + } + } + + // Look and report each instance of < ? = ... ? > + if (!is_array($token)) { + // A single char token, e.g: ; ( ) + if ($frame) { + $frame->expr_append($token); + } + } else if ($token[0] == T_OPEN_TAG_WITH_ECHO) { + // No need for a stack here - assume < ? = cannot be nested. + $frame = self::_create_frame($token, $in_script_block); } else if ($frame && $token[0] == T_CLOSE_TAG) { - // Store the < ? = ... ? > block that just ended here. - $found[$view][] = $frame; - $frame = null; + // Store the < ? = ... ? > block that just ended here. + $found[$view][] = $frame; + $frame = null; } else if ($frame && $token[0] == T_VARIABLE) { - $frame->expr_append($token[1]); + $frame->expr_append($token[1]); if ($token[1] == '$theme') { - if (self::_token_matches(array(T_OBJECT_OPERATOR, "->"), $tokens, $token_number + 1) && - self::_token_matches(array(T_STRING), $tokens, $token_number + 2) && - in_array($tokens[$token_number + 2][1], - array("thumb_proportion", "site_menu", "album_menu", "tag_menu", "photo_menu", + if (self::_token_matches(array(T_OBJECT_OPERATOR, "->"), $tokens, $token_number + 1) && + self::_token_matches(array(T_STRING), $tokens, $token_number + 2) && + in_array($tokens[$token_number + 2][1], + array("thumb_proportion", "site_menu", "album_menu", "tag_menu", "photo_menu", "context_menu", "pager", "site_status", "messages", "album_blocks", "album_bottom", "album_top", "body_attributes", "credits", "dynamic_bottom", "dynamic_top", "footer", "head", "header_bottom", "header_top", "page_bottom", "page_top", "photo_blocks", "photo_bottom", "photo_top", "resize_bottom", "resize_top", "sidebar_blocks", "sidebar_bottom", "sidebar_top", "thumb_bottom", "thumb_info", "thumb_top")) && - self::_token_matches("(", $tokens, $token_number + 3)) { + self::_token_matches("(", $tokens, $token_number + 3)) { - $method = $tokens[$token_number + 2][1]; - $frame->expr_append("->$method("); + $method = $tokens[$token_number + 2][1]; + $frame->expr_append("->$method("); - $token_number += 3; - $token = $tokens[$token_number]; + $token_number += 3; + $token = $tokens[$token_number]; $frame->is_safe_html(true); - } else if (self::_token_matches(array(T_OBJECT_OPERATOR, "->"), $tokens, $token_number + 1) && - self::_token_matches(array(T_STRING), $tokens, $token_number + 2) && - in_array($tokens[$token_number + 2][1], - array("css", "script", "url")) && - self::_token_matches("(", $tokens, $token_number + 3) && - // Only allow constant strings here - self::_token_matches(array(T_CONSTANT_ENCAPSED_STRING), $tokens, $token_number + 4)) { + } else if (self::_token_matches(array(T_OBJECT_OPERATOR, "->"), $tokens, $token_number + 1) && + self::_token_matches(array(T_STRING), $tokens, $token_number + 2) && + in_array($tokens[$token_number + 2][1], + array("css", "script", "url")) && + self::_token_matches("(", $tokens, $token_number + 3) && + // Only allow constant strings here + self::_token_matches(array(T_CONSTANT_ENCAPSED_STRING), $tokens, $token_number + 4)) { - $method = $tokens[$token_number + 2][1]; - $frame->expr_append("->$method("); + $method = $tokens[$token_number + 2][1]; + $frame->expr_append("->$method("); - $token_number += 4; - $token = $tokens[$token_number]; + $token_number += 4; + $token = $tokens[$token_number]; $frame->is_safe_html(true); - } + } } - } else if ($frame && $token[0] == T_STRING) { - $frame->expr_append($token[1]); - // t() and t2() are special in that they're guaranteed to return a SafeString(). - if (in_array($token[1], array("t", "t2"))) { - if (self::_token_matches("(", $tokens, $token_number + 1)) { - $frame->is_safe_html(true); - $frame->expr_append("("); - - $token_number++; - $token = $tokens[$token_number]; - } - } else if ($token[1] == "SafeString") { - // Looking for SafeString::of(... - 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("of", "purify")) && - self::_token_matches("(", $tokens, $token_number + 3)) { + } else if ($frame && $token[0] == T_STRING) { + $frame->expr_append($token[1]); + // t() and t2() are special in that they're guaranteed to return a SafeString(). + if (in_array($token[1], array("t", "t2"))) { + if (self::_token_matches("(", $tokens, $token_number + 1)) { + $frame->is_safe_html(true); + $frame->expr_append("("); + + $token_number++; + $token = $tokens[$token_number]; + } + } else if ($token[1] == "SafeString") { + // Looking for SafeString::of(... + 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("of", "purify")) && + self::_token_matches("(", $tokens, $token_number + 3)) { // Not checking for of_safe_html(). We want such calls to be marked dirty (thus reviewed). - $frame->is_safe_html(true); - - $method = $tokens[$token_number + 2][1]; - $frame->expr_append("::$method("); - - $token_number += 3; - $token = $tokens[$token_number]; - } - } else if ($token[1] == "json_encode") { - if (self::_token_matches("(", $tokens, $token_number + 1)) { - $frame->is_safe_js(true); - $frame->expr_append("("); - - $token_number++; - $token = $tokens[$token_number]; - } - } else if ($token[1] == "url") { - // 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_safe_html(true); - - $method = $tokens[$token_number + 2][1]; - $frame->expr_append("::$method("); - - $token_number += 3; - $token = $tokens[$token_number]; - } - } else if ($token[1] == "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("clean", "purify", "js_string", "clean_attribute")) && - self::_token_matches("(", $tokens, $token_number + 3)) { + $frame->is_safe_html(true); + + $method = $tokens[$token_number + 2][1]; + $frame->expr_append("::$method("); + + $token_number += 3; + $token = $tokens[$token_number]; + } + } else if ($token[1] == "json_encode") { + if (self::_token_matches("(", $tokens, $token_number + 1)) { + $frame->is_safe_js(true); + $frame->expr_append("("); + + $token_number++; + $token = $tokens[$token_number]; + } + } else if ($token[1] == "url") { + // 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_safe_html(true); + + $method = $tokens[$token_number + 2][1]; + $frame->expr_append("::$method("); + + $token_number += 3; + $token = $tokens[$token_number]; + } + } else if ($token[1] == "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("clean", "purify", "js_string", "clean_attribute")) && + self::_token_matches("(", $tokens, $token_number + 3)) { // Not checking for mark_safe(). We want such calls to be marked dirty (thus reviewed). - $method = $tokens[$token_number + 2][1]; - $frame->expr_append("::$method("); + $method = $tokens[$token_number + 2][1]; + $frame->expr_append("::$method("); - $token_number += 3; - $token = $tokens[$token_number]; + $token_number += 3; + $token = $tokens[$token_number]; if ("js_string" == $method) { $frame->is_safe_js(true); } else { $frame->is_safe_html(true); } - } - } - } else if ($frame && $token[0] == T_OBJECT_OPERATOR) { - $frame->expr_append($token[1]); - - if (self::_token_matches(array(T_STRING), $tokens, $token_number + 1) && - in_array($tokens[$token_number + 1][1], - array("for_js", "for_html", "purified_html", "for_html_attr")) && - self::_token_matches("(", $tokens, $token_number + 2)) { - $method = $tokens[$token_number + 1][1]; - $frame->expr_append("$method("); - - $token_number += 2; - $token = $tokens[$token_number]; - - if ("for_js" == $method) { - $frame->is_safe_js(true); - } else { - $frame->is_safe_html(true); - } - } + } + } + } else if ($frame && $token[0] == T_OBJECT_OPERATOR) { + $frame->expr_append($token[1]); + + if (self::_token_matches(array(T_STRING), $tokens, $token_number + 1) && + in_array($tokens[$token_number + 1][1], + array("for_js", "for_html", "purified_html", "for_html_attr")) && + self::_token_matches("(", $tokens, $token_number + 2)) { + $method = $tokens[$token_number + 1][1]; + $frame->expr_append("$method("); + + $token_number += 2; + $token = $tokens[$token_number]; + + if ("for_js" == $method) { + $frame->is_safe_js(true); + } else { + $frame->is_safe_html(true); + } + } } else if ($frame) { - $frame->expr_append($token[1]); - } + $frame->expr_append($token[1]); + } } } @@ -252,26 +252,26 @@ class Xss_Security_Test extends Unit_Test_Case { ksort($found); foreach ($found as $view => $frames) { foreach ($frames as $frame) { - $state = "DIRTY"; - if ($frame->in_script_block()) { - $state = "DIRTY_JS"; - if ($frame->is_safe_js()) { - $state = "CLEAN"; - } - } else { - if ($frame->is_safe_html()) { - $state = "CLEAN"; - } - } - - if ("CLEAN" == $state) { - // Don't print CLEAN instances - No need to update the golden - // file when adding / moving clean instances. - continue; - } - - fprintf($fd, "%-60s %-3s %-8s %s\n", - $view, $frame->line(), $state, $frame->expr()); + $state = "DIRTY"; + if ($frame->in_script_block()) { + $state = "DIRTY_JS"; + if ($frame->is_safe_js()) { + $state = "CLEAN"; + } + } else { + if ($frame->is_safe_html()) { + $state = "CLEAN"; + } + } + + if ("CLEAN" == $state) { + // Don't print CLEAN instances - No need to update the golden + // file when adding / moving clean instances. + continue; + } + + fprintf($fd, "%-60s %-3s %-8s %s\n", + $view, $frame->line(), $state, $frame->expr()); } } fclose($fd); @@ -280,7 +280,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) { @@ -296,9 +296,9 @@ class Xss_Security_Test extends Unit_Test_Case { if (is_array($expected_token)) { for ($i = 0; $i < count($expected_token); $i++) { - if ($expected_token[$i] != $token[$i]) { - return false; - } + if ($expected_token[$i] != $token[$i]) { + return false; + } } return true; } else { diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php index 6b21ec2e..b2d55153 100644 --- a/modules/server_add/helpers/server_add_event.php +++ b/modules/server_add/helpers/server_add_event.php @@ -35,7 +35,7 @@ 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. - $add_menu = $menu->get("add_menu"); + $add_menu = $menu->get("add_menu"); $add_menu->append(Menu::factory("dialog") ->id("server_add") ->label(t("Server add")) -- cgit v1.2.3 From ddb84c84e16766c6b79bd7fea61532257e83ef8b Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Mon, 31 Aug 2009 00:42:18 -0700 Subject: Rename mark_safe() to mark_clean() --- 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 | 4 ++-- modules/gallery/controllers/admin_languages.php | 2 +- modules/gallery/helpers/MY_html.php | 6 +++--- modules/gallery/helpers/graphics.php | 2 +- modules/gallery/tests/Html_Helper_Test.php | 4 ++-- modules/gallery/tests/Xss_Security_Test.php | 2 +- modules/gallery/views/admin_block_welcome.html.php | 10 +++++----- modules/gallery/views/permissions_browse.html.php | 2 +- 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/login.html.php | 2 +- modules/user/views/reset_password.html.php | 2 +- 17 files changed, 25 insertions(+), 25 deletions(-) (limited to 'modules/server_add/helpers') diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php index 7cd598cd..acd5cb3e 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" => html::mark_safe(url::site("admin/akismet")))), + array("url" => html::mark_clean(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 c4956591..9a1838f7 100644 --- a/modules/digibug/views/admin_digibug.html.php +++ b/modules/digibug/views/admin_digibug.html.php @@ -16,7 +16,7 @@

    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" => html::mark_safe(url::site("admin/advanced_settings")))) ?> + "advanced_settings_url" => html::mark_clean(url::site("admin/advanced_settings")))) ?>

    diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php index 9a4dbeec..83540622 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" => html::mark_safe(url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__")))), + array("url" => html::mark_clean(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 fde3464b..23ff27a8 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -39,7 +39,7 @@ Using the same value will speed up your import.", array("g2_pixels" => $g2_sizes["thumb"]["size"], "g3_pixels" => $thumb_size, - "url" => html::mark_safe(url::site("admin/theme_options")))) ?> + "url" => html::mark_clean(url::site("admin/theme_options")))) ?>
  • @@ -48,7 +48,7 @@ Using the same value will speed up your import.", array("g2_pixels" => $g2_sizes["resize"]["size"], "g3_pixels" => $resize_size, - "url" => html::mark_safe(url::site("admin/theme_options")))) ?> + "url" => html::mark_clean(url::site("admin/theme_options")))) ?> diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index d85c47f9..894daedb 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -111,7 +111,7 @@ class Admin_Languages_Controller extends Admin_Controller { $group->input("api_key") ->label(empty($api_key) ? t("This is a unique key that will allow you to send translations to the remote server. To get your API key go to %server-link.", - array("server-link" => html::mark_safe(html::anchor($server_link)))) + 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.")); diff --git a/modules/gallery/helpers/MY_html.php b/modules/gallery/helpers/MY_html.php index 4522d01c..b29f287f 100644 --- a/modules/gallery/helpers/MY_html.php +++ b/modules/gallery/helpers/MY_html.php @@ -51,12 +51,12 @@ class html extends html_Core { * * Example:
        *   // Parameters to t() are automatically escaped by default.
    -   *   // If the parameter is marked as safe, it won't get escaped.
    +   *   // If the parameter is marked as clean, it won't get escaped.
        *   t('Go there',
    -   *     array("url" => html::mark_safe(url::current())))
    +   *     array("url" => html::mark_clean(url::current())))
        * 
    */ - static function mark_safe($html) { + static function mark_clean($html) { return SafeString::of_safe_html($html); } diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 787f8dc3..acbcb9b2 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -443,7 +443,7 @@ class graphics_Core { if (!module::get_var("gallery", "graphics_toolkit")) { site_status::warning( t("Graphics toolkit missing! Please choose a toolkit", - array("url" => html::mark_safe(url::site("admin/graphics")))), + array("url" => html::mark_clean(url::site("admin/graphics")))), "missing_graphics_toolkit"); } } diff --git a/modules/gallery/tests/Html_Helper_Test.php b/modules/gallery/tests/Html_Helper_Test.php index 3623705e..bfce6dcf 100644 --- a/modules/gallery/tests/Html_Helper_Test.php +++ b/modules/gallery/tests/Html_Helper_Test.php @@ -32,8 +32,8 @@ class Html_Helper_Test extends Unit_Test_Case { $this->assert_true($safe_string instanceof SafeString); } - public function mark_safe_test() { - $safe_string = html::mark_safe("hello

    world

    "); + public function mark_clean_test() { + $safe_string = html::mark_clean("hello

    world

    "); $this->assert_true($safe_string instanceof SafeString); $safe_string_2 = html::clean($safe_string); $this->assert_equal("hello

    world

    ", diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php index ef36f6b7..0ba5a587 100644 --- a/modules/gallery/tests/Xss_Security_Test.php +++ b/modules/gallery/tests/Xss_Security_Test.php @@ -195,7 +195,7 @@ class Xss_Security_Test extends Unit_Test_Case { in_array($tokens[$token_number + 2][1], array("clean", "purify", "js_string", "clean_attribute")) && self::_token_matches("(", $tokens, $token_number + 3)) { - // Not checking for mark_safe(). We want such calls to be marked dirty (thus reviewed). + // Not checking for mark_clean(). We want such calls to be marked dirty (thus reviewed). $method = $tokens[$token_number + 2][1]; $frame->expr_append("::$method("); diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php index 71ef4368..d8c96187 100644 --- a/modules/gallery/views/admin_block_welcome.html.php +++ b/modules/gallery/views/admin_block_welcome.html.php @@ -5,16 +5,16 @@
    • graphics and language settings.", - array("graphics_url" => html::mark_safe(url::site("admin/graphics")), - "language_url" => html::mark_safe(url::site("admin/languages")))) ?> + array("graphics_url" => html::mark_clean(url::site("admin/graphics")), + "language_url" => html::mark_clean(url::site("admin/languages")))) ?>
    • choose a theme, or customize the way it looks.", - array("theme_url" => html::mark_safe(url::site("admin/themes")), - "theme_options_url" => html::mark_safe(url::site("admin/theme_options")))) ?> + array("theme_url" => html::mark_clean(url::site("admin/themes")), + "theme_options_url" => html::mark_clean(url::site("admin/theme_options")))) ?>
    • install modules to add cool features!", - array("modules_url" => html::mark_safe(url::site("admin/modules")))) ?> + array("modules_url" => html::mark_clean(url::site("admin/modules")))) ?>
    diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php index 231daa04..b9af9117 100644 --- a/modules/gallery/views/permissions_browse.html.php +++ b/modules/gallery/views/permissions_browse.html.php @@ -29,7 +29,7 @@
    • mod_rewrite and set AllowOverride FileInfo Options to fix this.", - array("mod_rewrite_attrs" => html::mark_safe("href=\"http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html\" target=\"_blank\"", "apache_attrs" => "href=\"http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride\" target=\"_blank\""))) ?> + array("mod_rewrite_attrs" => html::mark_clean("href=\"http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html\" target=\"_blank\"", "apache_attrs" => "href=\"http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride\" target=\"_blank\""))) ?>
    diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php index de6ce0e7..04200920 100644 --- a/modules/gallery/views/upgrader.html.php +++ b/modules/gallery/views/upgrader.html.php @@ -18,7 +18,7 @@

    Gallery is up to date.", - array("url" => html::mark_safe(url::site("albums/1")))) ?> + array("url" => html::mark_clean(url::site("albums/1")))) ?>

    diff --git a/modules/recaptcha/helpers/recaptcha.php b/modules/recaptcha/helpers/recaptcha.php index 5ac65661..bead6156 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" => html::mark_safe(url::site("admin/recaptcha")))), + array("url" => html::mark_clean(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 5e23a04b..0080b4ce 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" => html::mark_safe(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))), + array("url" => html::mark_clean(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 a84e1afd..27794855 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" => html::mark_safe(url::site("admin/server_add")))), + array("url" => html::mark_clean(url::site("admin/server_add")))), "server_add_configuration"); } else { site_status::clear("server_add_configuration"); diff --git a/modules/user/views/login.html.php b/modules/user/views/login.html.php index dfd09661..27431ce8 100644 --- a/modules/user/views/login.html.php +++ b/modules/user/views/login.html.php @@ -8,7 +8,7 @@
  • - html::mark_safe( + html::mark_clean( 'id}") . '" title="' . t("Edit Your Profile")->for_html_attr() . '" id="gUserProfileLink" class="gDialogLink">' . diff --git a/modules/user/views/reset_password.html.php b/modules/user/views/reset_password.html.php index 4097bb82..92ca4917 100644 --- a/modules/user/views/reset_password.html.php +++ b/modules/user/views/reset_password.html.php @@ -10,7 +10,7 @@

    %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" => html::mark_safe(url::base(false, "http")), + array("site_url" => html::mark_clean(url::base(false, "http")), "confirm_url" => $confirm_url)) ?>

    -- cgit v1.2.3