From 605a8c206e4714e81f8ade8ae7492faa01fdeca7 Mon Sep 17 00:00:00 2001 From: shish Date: Fri, 27 Apr 2007 18:52:55 +0000 Subject: [PATCH] removed disabled, unstable bits from the stable branch git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.0@22 7f39781d-f577-437e-ae19-be835c7a54ca --- ext/autocomplete.ext.php.disabled | 73 ----------------- ext/notes.ext.php.disabled | 52 ------------ ext/rating.ext.php.disabled | 130 ------------------------------ 3 files changed, 255 deletions(-) delete mode 100644 ext/autocomplete.ext.php.disabled delete mode 100644 ext/notes.ext.php.disabled delete mode 100644 ext/rating.ext.php.disabled diff --git a/ext/autocomplete.ext.php.disabled b/ext/autocomplete.ext.php.disabled deleted file mode 100644 index c758828b..00000000 --- a/ext/autocomplete.ext.php.disabled +++ /dev/null @@ -1,73 +0,0 @@ -page == "index" || $event->page == "view")) { - global $page; - $page->add_side_block(new Block(null, $this->build_autocomplete_script())); - } - if(is_a($event, 'PageRequestEvent') && ($event->page == "autocomplete")) { - global $page; - $page->set_mode("data"); - $page->set_type("text/plain"); - $page->set_data($this->get_completions($event->get_arg(0))); - } - } -// }}} -// do things {{{ - private function get_completions($start) { - global $database; - $tags = $database->db->GetCol("SELECT tag,count(image_id) AS count FROM tags WHERE tag LIKE ? GROUP BY tag ORDER BY count DESC", array($start.'%')); - return implode("\n", $tags); - } -// }}} -// html {{{ - private function build_autocomplete_script() { - global $database; - $ac_url = html_escape(make_link("autocomplete")); - - return << -//completion_cache = new array(); - -input = byId("search_input"); -output = byId("search_completions"); - -function get_cached_completions(start) { -// if(completion_cache[start]) { -// return completion_cache[start]; -// } -// else { - return null; -// } -} -function get_completions(start) { - cached = get_cached_completions(start); - if(cached) { - output.innerHTML = cached; - } - else { - ajaxRequest("$ac_url/"+start, function(data) {set_completions(start, data);}); - } -} -function set_completions(start, data) { -// completion_cache[start] = data; - output.innerHTML = data; -} - -input.onkeyup = function() { - if(input.value.length < 3) { - output.innerHTML = ""; - } - else { - get_completions(input.value); - } -}; - -EOD; - } -// }}} -} -add_event_listener(new AutoComplete()); -?> diff --git a/ext/notes.ext.php.disabled b/ext/notes.ext.php.disabled deleted file mode 100644 index 195fb5b1..00000000 --- a/ext/notes.ext.php.disabled +++ /dev/null @@ -1,52 +0,0 @@ -get_int("ext_notes_version") < 1) { - $this->install(); - } - } - - if(is_a($event, 'DisplayingImageEvent')) { - global $page; - $page->add_main_block(new Block(null, $this->make_notes($event->image->id))); - } - } - - protected function install() { - global $database; - global $config; - $database->db->Execute("CREATE TABLE `image_notes` ( - `id` int(11) NOT NULL auto_increment, - `image_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `owner_ip` char(15) NOT NULL, - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - `version` int(11) DEFAULT 1 NOT NULL, - `is_active` enum('Y', 'N') DEFAULT 'Y' NOT NULL, - `x` int(11) NOT NULL, - `y` int(11) NOT NULL, - `w` int(11) NOT NULL, - `h` int(11) NOT NULL, - `body` text NOT NULL, - PRIMARY KEY (`id`) - )"); - $config->set_int("ext_notes_version", 1); - } - - private function make_notes($image_id) { - global $database; - $notes = $database->db->GetAll("SELECT * FROM image_notes WHERE image_id = ?", array($image_id)); - - return << -img = byId("main_image"); - -EOD; - } -} -add_event_listener(new Notes()); -?> diff --git a/ext/rating.ext.php.disabled b/ext/rating.ext.php.disabled deleted file mode 100644 index 963dbf6f..00000000 --- a/ext/rating.ext.php.disabled +++ /dev/null @@ -1,130 +0,0 @@ -get_int("ext_ratings_version") < 1) { - $this->install(); - } - } - -/* - if(is_a($event, 'ImageDeletionEvent')) { - $this->delete_comments($event->image->id); - } - if(is_a($event, 'CommentDeletionEvent')) { - $this->delete_comment($event->comment_id); - } - - if(is_a($event, 'SetupBuildingEvent')) { - $sb = new SetupBlock("Comment Options"); - $sb->add_label("Allow anonymous comments "); - $sb->add_bool_option("comment_anon"); - $sb->add_label("
Limit to "); - $sb->add_int_option("comment_limit", 1, 60); - $sb->add_label(" comments per "); - $sb->add_int_option("comment_window", 1, 60); - $sb->add_label(" minutes"); - $sb->add_label("
Show "); - $sb->add_int_option("comment_count", 0, 100); - $sb->add_label(" recent comments on the index"); - $event->panel->add_main_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']); - } -*/ - } - - private function can_comment() { - global $config, $user; - return $config->get_bool("rate_anon") || ($user->id != $config->get_int("anon_id")); - } -// }}} -// installer {{{ - protected function install() { - global $database; - global $config; - $database->db->Execute("CREATE TABLE `image_voters` ( - `image_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `vote` tinyint(4) NOT NULL, - `voted` datetime NOT NULL, - PRIMARY KEY (`image_id`,`user_id`) - )"); - $config->set_int("ext_ratings_version", 1); - } -// }}} -// page building {{{ - - private function build_image_rating($image_id) { - global $config; - $i_image_id = int_escape($image_id); - return $this->query_to_html(" - SELECT - users.id as user_id, users.name as user_name, - comments.comment as comment, comments.id as comment_id, - comments.image_id as image_id, comments.owner_ip as poster_ip - FROM comments - LEFT JOIN users ON comments.owner_id=users.id - WHERE comments.image_id=? - ORDER BY comments.id ASC - LIMIT ? - ", array($i_image_id, $config->get_int('recent_count'))); - } - - private function build_rater($image_id) { - if($this->can_comment()) { - $i_image_id = int_escape($image_id); - return " -
- - -
-
- - -
- "; - } - else { - return "You need to create an account before you can rate"; - } - } -// }}} -// add / remove / edit comments {{{ - private function add_rating($image_id, $rating) { - global $user; - global $database; - global $config; - global $page; - - $page->set_title("Error"); - $page->set_heading("Error"); - if(!$config->get_bool('rating_anon') && $user->is_anonymous()) { - $page->add_main_block(new Block("Permission Denied", "Anonymous rating has been disabled")); - } - else { - $i_rating = int_escape($rating); - $database->db->Execute( - "INSERT INTO image_ratings(image_id, user_id, rating, rated) ". - "VALUES(?, ?, ?, now())", - array($image_id, $user->id, $i_rating)); - $page->set_mode("redirect"); - $page->set_redirect(make_link("post/view/".int_escape($image_id))); - } - } - - private function delete_ratings($image_id) { - global $database; - $database->db->Execute("DELETE FROM image_voters WHERE image_id=?", array($image_id)); - } -// }}} -} -add_event_listener(new Ratings()); -?>