From 5a4d6f72779b7baff810d40d7f01deecd31eab2d Mon Sep 17 00:00:00 2001 From: shish Date: Thu, 12 Jul 2007 08:14:37 +0000 Subject: [PATCH] remove ConfigSaveEvent handlers git-svn-id: file:///home/shish/svn/shimmie2/trunk@265 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/home/main.php | 5 ---- contrib/link_image/main.php | 3 --- contrib/rating/main.php | 6 ----- contrib/site_description/main.php | 3 --- contrib/tag_history/main.php | 3 --- contrib/wiki/main.php | 4 --- contrib/word_filter/main.php | 3 --- ext/comment/main.php | 7 ----- ext/downtime/main.php | 4 --- ext/image/main.php | 7 ----- ext/index/main.php | 5 ---- ext/news/main.php | 3 --- ext/setup/main.php | 45 ++++++++++++++++++------------- ext/tag_edit/main.php | 3 --- ext/tag_list/main.php | 7 ----- ext/upload/main.php | 5 ---- ext/user/main.php | 4 --- ext/view/main.php | 5 ---- ext/zoom/main.php | 3 --- 19 files changed, 27 insertions(+), 98 deletions(-) diff --git a/contrib/home/main.php b/contrib/home/main.php index f44a1681..3aca1443 100644 --- a/contrib/home/main.php +++ b/contrib/home/main.php @@ -33,11 +33,6 @@ class Home extends Extension { $sb->add_label("
Note: page accessed via /home"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) - { - $event->config->set_string_from_post("home_links"); - $event->config->set_string_from_post("home_counter"); - } } private function get_body() diff --git a/contrib/link_image/main.php b/contrib/link_image/main.php index c15f5bc1..90695b2d 100644 --- a/contrib/link_image/main.php +++ b/contrib/link_image/main.php @@ -17,9 +17,6 @@ class LinkImage extends Extension { $sb->add_text_option("ext_link-img_text-link_format","Text Link Format:"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_string_from_post("ext_link-img_text-link_format"); - } if(is_a($event, 'InitExtEvent')) { global $config; //just set default if empty. diff --git a/contrib/rating/main.php b/contrib/rating/main.php index a031f75e..f73882b5 100644 --- a/contrib/rating/main.php +++ b/contrib/rating/main.php @@ -39,12 +39,6 @@ class Ratings extends Extension { $sb->add_label(" recent comments on the index"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_bool("comment_anon", $_POST['comment_anon']); - $event->config->set_int("comment_limit", $_POST['comment_limit']); - $event->config->set_int("comment_window", $_POST['comment_window']); - $event->config->set_int("comment_count", $_POST['comment_count']); - } */ } diff --git a/contrib/site_description/main.php b/contrib/site_description/main.php index d150e4cd..257fe67d 100644 --- a/contrib/site_description/main.php +++ b/contrib/site_description/main.php @@ -23,9 +23,6 @@ class SiteDescription extends Extension { $sb->add_longtext_option("site_description"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_string_from_post("site_description"); - } } } add_event_listener(new SiteDescription()); diff --git a/contrib/tag_history/main.php b/contrib/tag_history/main.php index 6ecd9adb..206ab13d 100644 --- a/contrib/tag_history/main.php +++ b/contrib/tag_history/main.php @@ -50,9 +50,6 @@ class Tag_History extends Extension { $sb->add_label(" entires per image"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_int_from_post("history_limit"); - } if(is_a($event, 'TagSetEvent')) { $this->add_tag_history($event->image_id); } diff --git a/contrib/wiki/main.php b/contrib/wiki/main.php index 6a9252ae..19aea167 100644 --- a/contrib/wiki/main.php +++ b/contrib/wiki/main.php @@ -139,10 +139,6 @@ class Wiki extends Extension { $sb->add_bool_option("wiki_edit_user", "
Allow user edits: "); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_bool_from_post("wiki_edit_anon"); - $event->config->set_bool_from_post("wiki_edit_user"); - } } // }}} // misc {{{ diff --git a/contrib/word_filter/main.php b/contrib/word_filter/main.php index 14939578..41dabe18 100644 --- a/contrib/word_filter/main.php +++ b/contrib/word_filter/main.php @@ -19,9 +19,6 @@ class WordFilter extends Extension { $sb->add_label("
(each line should be search term and replace term, separated by a comma)"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_string_from_post("word_filter"); - } } private function filter($text) { diff --git a/ext/comment/main.php b/ext/comment/main.php index 9621441e..b92e37b7 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -127,13 +127,6 @@ class CommentList extends Extension { $sb->add_text_option("comment_wordpress_key", "
Akismet Key "); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_bool_from_post("comment_anon"); - $event->config->set_int_from_post("comment_limit"); - $event->config->set_int_from_post("comment_window"); - $event->config->set_int_from_post("comment_count"); - $event->config->set_string_from_post("comment_wordpress_key"); - } } // }}} // installer {{{ diff --git a/ext/downtime/main.php b/ext/downtime/main.php index 5a49dd7e..1cd8cc8a 100644 --- a/ext/downtime/main.php +++ b/ext/downtime/main.php @@ -14,10 +14,6 @@ class Downtime extends Extension { $sb->add_longtext_option("downtime_message", "
"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_bool_from_post("downtime"); - $event->config->set_string_from_post("downtime_message"); - } if(is_a($event, 'PageRequestEvent')) { global $config; if($config->get_bool("downtime")) { diff --git a/ext/image/main.php b/ext/image/main.php index 88abedc8..e339fae6 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -49,13 +49,6 @@ class ImageIO extends Extension { $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_string_from_post("thumb_engine"); - $event->config->set_int_from_post("thumb_width"); - $event->config->set_int_from_post("thumb_height"); - $event->config->set_int_from_post("thumb_quality"); - $event->config->set_int_from_post("thumb_mem_limit"); - } } // }}} // add image {{{ diff --git a/ext/index/main.php b/ext/index/main.php index 7a752d0d..595d9973 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -44,11 +44,6 @@ class Index extends Extension { $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_int_from_post("index_width"); - $event->config->set_int_from_post("index_height"); - $event->config->set_string_from_post("image_tip"); - } } } add_event_listener(new Index()); diff --git a/ext/news/main.php b/ext/news/main.php index 5ee8c134..a45e03fd 100644 --- a/ext/news/main.php +++ b/ext/news/main.php @@ -17,9 +17,6 @@ class News extends Extension { $sb->add_longtext_option("news_text"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_string_from_post("news_text"); - } } } add_event_listener(new News()); diff --git a/ext/setup/main.php b/ext/setup/main.php index 1eca938f..18699005 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -50,7 +50,8 @@ class SetupBlock extends Block { if(!is_null($label)) { $this->body .= ""; } - $this->body .= "\n"; + $this->body .= "\n"; + $this->body .= "\n"; } public function add_longtext_option($name, $label=null) { @@ -59,8 +60,9 @@ class SetupBlock extends Block { if(!is_null($label)) { $this->body .= ""; } - $this->body .= "\n"; + $this->body .= "\n"; $this->body .= "\n"; // setup page auto-layout counts
tags + $this->body .= "\n"; } public function add_bool_option($name, $label=null) { @@ -69,14 +71,15 @@ class SetupBlock extends Block { if(!is_null($label)) { $this->body .= ""; } - $this->body .= "\n"; + $this->body .= "\n"; + $this->body .= "\n"; } - public function add_hidden_option($name, $label=null) { - global $config; - $val = $config->get_string($name); - $this->body .= ""; - } +// public function add_hidden_option($name, $label=null) { +// global $config; +// $val = $config->get_string($name); +// $this->body .= ""; +// } public function add_int_option($name, $label=null) { global $config; @@ -84,7 +87,8 @@ class SetupBlock extends Block { if(!is_null($label)) { $this->body .= ""; } - $this->body .= "\n"; + $this->body .= "\n"; + $this->body .= "\n"; } public function add_shorthand_int_option($name, $label=null) { @@ -93,7 +97,8 @@ class SetupBlock extends Block { if(!is_null($label)) { $this->body .= ""; } - $this->body .= "\n"; + $this->body .= "\n"; + $this->body .= "\n"; } public function add_choice_option($name, $options, $label=null) { @@ -103,13 +108,14 @@ class SetupBlock extends Block { if(!is_null($label)) { $this->body .= ""; } - $html = ""; foreach($options as $optname => $optval) { if($optval == $current) $selected=" selected"; else $selected=""; $html .= "\n"; } $html .= ""; + $this->body .= "\n"; $this->body .= $html; } @@ -166,13 +172,16 @@ class Setup extends Extension { $event->panel->add_block($sb); } if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_string_from_post("title"); - $event->config->set_string_from_post("front_page"); - $event->config->set_string_from_post("base_href"); - $event->config->set_string_from_post("data_href"); - $event->config->set_string_from_post("contact_link"); - $event->config->set_string_from_post("theme"); - $event->config->set_int_from_post("anon_id"); + foreach($_POST as $name => $value) { + if(substr($name, 0, 8) == "_config_") { + $name = substr($name, 8); + switch($_POST["_type_$name"]) { + case "string": $event->config->set_string($name, $value); break; + case "int": $event->config->set_int($name, $value); break; + case "bool": $event->config->set_bool($name, $value); break; + } + } + } } if(is_a($event, 'UserBlockBuildingEvent')) { diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 3fccfd72..77e3cff8 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -61,9 +61,6 @@ class TagEdit extends Extension { $sb->add_bool_option("tag_edit_anon", "Allow anonymous editing: "); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_bool_from_post("tag_edit_anon"); - } } // }}} // do things {{{ diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 584fa074..48c4ef8b 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -59,13 +59,6 @@ class TagList extends Extension { $sb->add_bool_option("tag_list_numbers", "
Show tag counts: "); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_int_from_post("tags_min"); - - $event->config->set_int_from_post("tag_list_length"); - $event->config->set_string_from_post("info_link"); - $event->config->set_bool_from_post("tag_list_numbers"); - } } // }}} // misc {{{ diff --git a/ext/upload/main.php b/ext/upload/main.php index 426a9d25..1ba5367c 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -38,11 +38,6 @@ class Upload extends Extension { $sb->add_bool_option("upload_anon", "
Allow anonymous uploads: "); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_int_from_post("upload_count"); - $event->config->set_int_from_post("upload_size"); - $event->config->set_bool_from_post("upload_anon"); - } } // }}} // do things {{{ diff --git a/ext/user/main.php b/ext/user/main.php index 7bb68603..50d1832e 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -74,10 +74,6 @@ class UserPage extends Extension { $sb->add_longtext_option("login_tac", "
Terms & Conditions:
"); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_bool_from_post("login_signup_enabled"); - $event->config->set_string_from_post("login_tac"); - } if(is_a($event, 'UserBlockBuildingEvent')) { $event->add_link("User Config", make_link("user")); diff --git a/ext/view/main.php b/ext/view/main.php index 68283119..82803597 100644 --- a/ext/view/main.php +++ b/ext/view/main.php @@ -41,11 +41,6 @@ class ViewImage extends Extension { $sb->add_text_option("image_tlink", "
Thumbnail link "); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_string_from_post("image_ilink"); - $event->config->set_string_from_post("image_slink"); - $event->config->set_string_from_post("image_tlink"); - } } // }}} // HTML {{{ diff --git a/ext/zoom/main.php b/ext/zoom/main.php index 1f92bdc3..f795cc6b 100644 --- a/ext/zoom/main.php +++ b/ext/zoom/main.php @@ -16,9 +16,6 @@ class Zoom extends Extension { $sb->add_bool_option("image_zoom", "Zoom by default: "); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { - $event->config->set_bool_from_post("image_zoom"); - } } }